mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PvScsiDxe: Probe PCI devices and look for PvScsi
PvScsiControllerSupported() is called on handles passed in by the ConnectController() boot service and if the handle is the PVSCSI controller, the function would return success. A success return value will attach our driver to the device. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567 Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Liran Alon <liran.alon@oracle.com> Message-Id: <20200328200100.60786-5-liran.alon@oracle.com> Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
This commit is contained in:
parent
419b30d642
commit
a9f9d5cf56
|
@ -0,0 +1,21 @@
|
|||
/** @file
|
||||
|
||||
VMware PVSCSI Device specific type and macro definitions.
|
||||
|
||||
Copyright (C) 2020, Oracle and/or its affiliates.
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __PVSCSI_H_
|
||||
#define __PVSCSI_H_
|
||||
|
||||
//
|
||||
// Device offsets and constants
|
||||
//
|
||||
|
||||
#define PCI_VENDOR_ID_VMWARE (0x15ad)
|
||||
#define PCI_DEVICE_ID_VMWARE_PVSCSI (0x07c0)
|
||||
|
||||
#endif // __PVSCSI_H_
|
|
@ -9,7 +9,11 @@
|
|||
|
||||
**/
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
#include <IndustryStandard/PvScsi.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Uefi/UefiSpec.h>
|
||||
|
||||
//
|
||||
|
@ -31,7 +35,50 @@ PvScsiDriverBindingSupported (
|
|||
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 != PCI_VENDOR_ID_VMWARE) ||
|
||||
(Pci.Hdr.DeviceId != PCI_DEVICE_ID_VMWARE_PVSCSI)) {
|
||||
Status = EFI_UNSUPPORTED;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
gBS->CloseProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiPciIoProtocolGuid,
|
||||
This->DriverBindingHandle,
|
||||
ControllerHandle
|
||||
);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
|
|
|
@ -22,7 +22,12 @@
|
|||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
OvmfPkg/OvmfPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiBootServicesTableLib
|
||||
UefiDriverEntryPoint
|
||||
UefiLib
|
||||
|
||||
[Protocols]
|
||||
gEfiPciIoProtocolGuid ## TO_START
|
||||
|
|
Loading…
Reference in New Issue