summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/LsiScsiDxe
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2020-07-17 14:11:23 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-07-17 20:51:55 +0000
commit79f802a50ee942e297c86138e6c19cab77a3a2eb (patch)
tree22bd951490f86f5eae7712bc3681a74a242ad105 /OvmfPkg/LsiScsiDxe
parent386ca8abf74cd98ca9c0ef64b4427acd4e2e2431 (diff)
downloadedk2-79f802a50ee942e297c86138e6c19cab77a3a2eb.tar.gz
edk2-79f802a50ee942e297c86138e6c19cab77a3a2eb.tar.bz2
edk2-79f802a50ee942e297c86138e6c19cab77a3a2eb.zip
OvmfPkg/LsiScsiDxe: Probe PCI devices and look for LsiScsi
Implement LsiScsiControllerSupported() to probe the PCI ID and look for LSI 53C895A. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200717061130.8881-5-glin@suse.com>
Diffstat (limited to 'OvmfPkg/LsiScsiDxe')
-rw-r--r--OvmfPkg/LsiScsiDxe/LsiScsi.c48
-rw-r--r--OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf6
2 files changed, 53 insertions, 1 deletions
diff --git a/OvmfPkg/LsiScsiDxe/LsiScsi.c b/OvmfPkg/LsiScsiDxe/LsiScsi.c
index 62daa3ab99..5bca85bd75 100644
--- a/OvmfPkg/LsiScsiDxe/LsiScsi.c
+++ b/OvmfPkg/LsiScsiDxe/LsiScsi.c
@@ -9,7 +9,12 @@
**/
+#include <IndustryStandard/LsiScsi.h>
+#include <IndustryStandard/Pci.h>
+#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
+#include <Protocol/PciIo.h>
+#include <Protocol/PciRootBridgeIo.h>
#include <Uefi/UefiSpec.h>
#include "LsiScsi.h"
@@ -31,7 +36,48 @@ LsiScsiControllerSupported (
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
- return EFI_UNSUPPORTED;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ PCI_TYPE00 Pci;
+
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiPciIoProtocolGuid,
+ (VOID **)&PciIo,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_BY_DRIVER
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = PciIo->Pci.Read (
+ PciIo,
+ EfiPciIoWidthUint32,
+ 0,
+ sizeof (Pci) / sizeof (UINT32),
+ &Pci
+ );
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
+
+ if (Pci.Hdr.VendorId == LSI_LOGIC_PCI_VENDOR_ID &&
+ Pci.Hdr.DeviceId == LSI_53C895A_PCI_DEVICE_ID) {
+ Status = EFI_SUCCESS;
+ } else {
+ Status = EFI_UNSUPPORTED;
+ }
+
+Done:
+ gBS->CloseProtocol (
+ ControllerHandle,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ ControllerHandle
+ );
+ return Status;
}
EFI_STATUS
diff --git a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf b/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf
index 5cb15c4565..7ce11fcc6a 100644
--- a/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf
+++ b/OvmfPkg/LsiScsiDxe/LsiScsiDxe.inf
@@ -22,7 +22,13 @@
[Packages]
MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
[LibraryClasses]
+ BaseLib
+ UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
+
+[Protocols]
+ gEfiPciIoProtocolGuid ## TO_START