13#define MAX_NON_DISCOVERABLE_PCI_DEVICE_ID (32 * 256)
23SupportedNonDiscoverableDevices[] = {
24 &gEdkiiNonDiscoverableAhciDeviceGuid,
25 &gEdkiiNonDiscoverableEhciDeviceGuid,
26 &gEdkiiNonDiscoverableNvmeDeviceGuid,
27 &gEdkiiNonDiscoverableOhciDeviceGuid,
28 &gEdkiiNonDiscoverableSdhciDeviceGuid,
29 &gEdkiiNonDiscoverableUfsDeviceGuid,
30 &gEdkiiNonDiscoverableUhciDeviceGuid,
31 &gEdkiiNonDiscoverableXhciDeviceGuid,
76 Status =
gBS->OpenProtocol (
78 &gEdkiiNonDiscoverableDeviceProtocolGuid,
80 This->DriverBindingHandle,
82 EFI_OPEN_PROTOCOL_BY_DRIVER
84 if (EFI_ERROR (Status)) {
88 Status = EFI_UNSUPPORTED;
89 for (Idx = 0; Idx <
ARRAY_SIZE (SupportedNonDiscoverableDevices); Idx++) {
90 if (
CompareGuid (Device->Type, SupportedNonDiscoverableDevices[Idx])) {
96 if (EFI_ERROR (Status)) {
104 for (Desc = Device->Resources; Desc->Desc != ACPI_END_TAG_DESCRIPTOR;
105 Desc = (VOID *)((UINT8 *)Desc + Desc->Len + 3))
107 if ((Desc->Desc != ACPI_ADDRESS_SPACE_DESCRIPTOR) ||
108 (Desc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM))
110 Status = EFI_UNSUPPORTED;
118 &gEdkiiNonDiscoverableDeviceProtocolGuid,
119 This->DriverBindingHandle,
151 ASSERT (mUniqueIdCounter < MAX_NON_DISCOVERABLE_PCI_DEVICE_ID);
152 if (mUniqueIdCounter >= MAX_NON_DISCOVERABLE_PCI_DEVICE_ID) {
153 return EFI_OUT_OF_RESOURCES;
158 return EFI_OUT_OF_RESOURCES;
161 Status =
gBS->OpenProtocol (
163 &gEdkiiNonDiscoverableDeviceProtocolGuid,
164 (VOID **)&Dev->Device,
165 This->DriverBindingHandle,
167 EFI_OPEN_PROTOCOL_BY_DRIVER
169 if (EFI_ERROR (Status)) {
179 Dev->Signature = NON_DISCOVERABLE_PCI_DEVICE_SIG;
180 Status =
gBS->InstallProtocolInterface (
182 &gEfiPciIoProtocolGuid,
186 if (EFI_ERROR (Status)) {
190 Dev->UniqueId = mUniqueIdCounter++;
197 &gEdkiiNonDiscoverableDeviceProtocolGuid,
198 This->DriverBindingHandle,
234 Status =
gBS->OpenProtocol (
236 &gEfiPciIoProtocolGuid,
238 This->DriverBindingHandle,
240 EFI_OPEN_PROTOCOL_GET_PROTOCOL
242 if (EFI_ERROR (Status)) {
246 Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO (PciIo);
251 Status =
gBS->UninstallProtocolInterface (
253 &gEfiPciIoProtocolGuid,
256 if (EFI_ERROR (Status)) {
262 &gEdkiiNonDiscoverableDeviceProtocolGuid,
263 This->DriverBindingHandle,
305 Status =
gBS->LocateProtocol (&gEfiCpuArchProtocolGuid,
NULL, (VOID **)&mCpu);
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ARRAY_SIZE(Array)
#define ASSERT_EFI_ERROR(StatusParameter)
STATIC EFI_STATUS EFIAPI NonDiscoverablePciDeviceStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE DeviceHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
STATIC EFI_STATUS EFIAPI NonDiscoverablePciDeviceStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE DeviceHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI NonDiscoverablePciDeviceDxeEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC EFI_STATUS EFIAPI NonDiscoverablePciDeviceSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE DeviceHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
VOID InitializePciIoProtocol(NON_DISCOVERABLE_PCI_DEVICE *Dev)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)