OvmfPkg/MptScsiDxe: Probe PCI devices and look for MptScsi
The MptScsiControllerSupported function is called on handles passed in by the ConnectController() boot service and if the handle is the lsi53c1030 controller the function would return success. A successful return value will attach our driver to the device. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2390 Signed-off-by: Nikita Leshenko <nikita.leshchenko@oracle.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liran Alon <liran.alon@oracle.com> Message-Id: <20200504210607.144434-5-nikita.leshchenko@oracle.com>
This commit is contained in:
committed by
mergify[bot]
parent
be7fcaa1c9
commit
f47074425d
@@ -9,7 +9,11 @@
|
||||
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/FusionMptScsi.h>
|
||||
#include <IndustryStandard/Pci.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Uefi/UefiSpec.h>
|
||||
|
||||
//
|
||||
@@ -31,7 +35,50 @@ MptScsiControllerSupported (
|
||||
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_53C1030_PCI_DEVICE_ID ||
|
||||
Pci.Hdr.DeviceId == LSI_SAS1068_PCI_DEVICE_ID ||
|
||||
Pci.Hdr.DeviceId == LSI_SAS1068E_PCI_DEVICE_ID)) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Done:
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
|
Reference in New Issue
Block a user