33 IN NON_DISCOVERABLE_DEVICE_TYPE Type
37 case NonDiscoverableDeviceTypeAhci:
38 return &gEdkiiNonDiscoverableAhciDeviceGuid;
40 case NonDiscoverableDeviceTypeAmba:
41 return &gEdkiiNonDiscoverableAmbaDeviceGuid;
43 case NonDiscoverableDeviceTypeEhci:
44 return &gEdkiiNonDiscoverableEhciDeviceGuid;
46 case NonDiscoverableDeviceTypeNvme:
47 return &gEdkiiNonDiscoverableNvmeDeviceGuid;
49 case NonDiscoverableDeviceTypeOhci:
50 return &gEdkiiNonDiscoverableOhciDeviceGuid;
52 case NonDiscoverableDeviceTypeSdhci:
53 return &gEdkiiNonDiscoverableSdhciDeviceGuid;
55 case NonDiscoverableDeviceTypeUfs:
56 return &gEdkiiNonDiscoverableUfsDeviceGuid;
58 case NonDiscoverableDeviceTypeUhci:
59 return &gEdkiiNonDiscoverableUhciDeviceGuid;
61 case NonDiscoverableDeviceTypeXhci:
62 return &gEdkiiNonDiscoverableXhciDeviceGuid;
103 IN NON_DISCOVERABLE_DEVICE_TYPE Type,
104 IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType,
122 if ((Type >= NonDiscoverableDeviceTypeMax) ||
123 (DmaType >= NonDiscoverableDeviceDmaTypeMax) ||
124 (NumMmioResources == 0))
126 return EFI_INVALID_PARAMETER;
129 if (Handle ==
NULL) {
130 Handle = &LocalHandle;
134 AllocSize =
sizeof *Device +
138 if (Device ==
NULL) {
139 return EFI_OUT_OF_RESOURCES;
143 ASSERT (Device->Type !=
NULL);
145 Device->DmaType = DmaType;
146 Device->Initialize = InitFunc;
150 for (Index = 0; Index < NumMmioResources; Index++) {
151 Desc = &Device->Resources[Index];
155 Desc->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
156 Desc->Len =
sizeof *Desc - 3;
157 Desc->AddrRangeMin = Base;
158 Desc->AddrLen = Size;
159 Desc->AddrRangeMax = Base + Size - 1;
160 Desc->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
162 Desc->AddrTranslationOffset = 0;
169 End->Desc = ACPI_END_TAG_DESCRIPTOR;
177 if (DevicePath ==
NULL) {
178 Status = EFI_OUT_OF_RESOURCES;
182 CopyGuid (&DevicePath->Vendor.
Guid, &gEdkiiNonDiscoverableDeviceProtocolGuid);
188 DevicePath->BaseAddress = Device->Resources[0].AddrRangeMin;
189 DevicePath->ResourceType = Device->Resources[0].ResType;
193 sizeof (*DevicePath) -
sizeof (DevicePath->End)
197 Status =
gBS->InstallMultipleProtocolInterfaces (
199 &gEdkiiNonDiscoverableDeviceProtocolGuid,
201 &gEfiDevicePathProtocolGuid,
205 if (EFI_ERROR (Status)) {
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
#define HARDWARE_DEVICE_PATH
UINT16 EFIAPI SetDevicePathNodeLength(IN OUT VOID *Node, IN UINTN Length)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI CreateDeviceNode(IN UINT8 NodeType, IN UINT8 NodeSubType, IN UINT16 NodeLength)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define VA_ARG(Marker, TYPE)
#define VA_START(Marker, Parameter)
STATIC CONST EFI_GUID * GetGuidFromType(IN NON_DISCOVERABLE_DEVICE_TYPE Type)
EFI_STATUS EFIAPI RegisterNonDiscoverableMmioDevice(IN NON_DISCOVERABLE_DEVICE_TYPE Type, IN NON_DISCOVERABLE_DEVICE_DMA_TYPE DmaType, IN NON_DISCOVERABLE_DEVICE_INIT InitFunc, IN OUT EFI_HANDLE *Handle OPTIONAL, IN UINTN NumMmioResources,...)
EFI_STATUS(EFIAPI * NON_DISCOVERABLE_DEVICE_INIT)(IN NON_DISCOVERABLE_DEVICE *This)
UINT64 EFI_PHYSICAL_ADDRESS