17 L
"Mem", L
"I/O", L
"Bus"
20 L
"I/O", L
"Mem", L
"PMem", L
"Mem64", L
"PMem64", L
"Bus"
25VOID *mIoMmuRegistration;
38 IN PCI_RESOURCE_TYPE ResourceType
41 switch (ResourceType) {
43 return RootBridge->Io.Translation;
45 return RootBridge->Mem.Translation;
47 return RootBridge->PMem.Translation;
49 return RootBridge->MemAbove4G.Translation;
51 return RootBridge->PMemAbove4G.Translation;
53 return RootBridge->Bus.Translation;
100 UINT64 IntersectionBase;
101 UINT64 IntersectionEnd;
108 IntersectionBase =
MAX (Base, Descriptor->BaseAddress);
109 IntersectionEnd =
MIN (
111 Descriptor->BaseAddress + Descriptor->Length
113 if (IntersectionBase >= IntersectionEnd) {
121 Status =
gDS->AddIoSpace (
124 IntersectionEnd - IntersectionBase
128 EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
129 "%a: %a: add [%Lx, %Lx): %r\n",
141 "%a: %a: desc [%Lx, %Lx) type %u conflicts with "
142 "aperture [%Lx, %Lx)\n",
145 Descriptor->BaseAddress,
146 Descriptor->BaseAddress + Descriptor->Length,
147 (UINT32)Descriptor->GcdIoType,
151 return EFI_INVALID_PARAMETER;
172 UINTN NumberOfDescriptors;
175 Status =
gDS->GetIoSpaceMap (&NumberOfDescriptors, &IoSpaceMap);
176 if (EFI_ERROR (Status)) {
179 "%a: %a: GetIoSpaceMap(): %r\n",
187 for (Index = 0; Index < NumberOfDescriptors; Index++) {
189 if (EFI_ERROR (Status)) {
204 for (CheckBase = Base;
205 CheckBase < Base + Length;
208 CheckStatus =
gDS->GetIoSpaceDescriptor (CheckBase, &Descriptor);
264 IN UINT64 Capabilities,
268 UINT64 IntersectionBase;
269 UINT64 IntersectionEnd;
273 ((Descriptor->Capabilities & Capabilities) == Capabilities))
278 IntersectionBase =
MAX (Base, Descriptor->BaseAddress);
279 IntersectionEnd =
MIN (
281 Descriptor->BaseAddress + Descriptor->Length
283 if (IntersectionBase >= IntersectionEnd) {
291 Status =
gDS->AddMemorySpace (
294 IntersectionEnd - IntersectionBase,
299 EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE,
300 "%a: %a: add [%Lx, %Lx): %r\n",
312 "%a: %a: desc [%Lx, %Lx) type %u cap %Lx conflicts "
313 "with aperture [%Lx, %Lx) cap %Lx\n",
316 Descriptor->BaseAddress,
317 Descriptor->BaseAddress + Descriptor->Length,
318 (UINT32)Descriptor->GcdMemoryType,
319 Descriptor->Capabilities,
324 return EFI_INVALID_PARAMETER;
342 IN UINT64 Capabilities
347 UINTN NumberOfDescriptors;
350 Status =
gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);
351 if (EFI_ERROR (Status)) {
354 "%a: %a: GetMemorySpaceMap(): %r\n",
362 for (Index = 0; Index < NumberOfDescriptors; Index++) {
367 &MemorySpaceMap[Index]
369 if (EFI_ERROR (Status)) {
370 goto FreeMemorySpaceMap;
384 for (CheckBase = Base;
385 CheckBase < Base + Length;
388 CheckStatus =
gDS->GetMemorySpaceDescriptor (CheckBase, &Descriptor);
391 ASSERT ((Descriptor.
Capabilities & Capabilities) == Capabilities);
419 if (!EFI_ERROR (Status)) {
420 gBS->CloseEvent (mIoMmuEvent);
446 UINTN RootBridgeCount;
449 UINTN MemApertureIndex;
450 BOOLEAN ResourceAssigned;
455 if ((RootBridges ==
NULL) || (RootBridgeCount == 0)) {
456 return EFI_UNSUPPORTED;
459 Status =
gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid,
NULL, (VOID **)&mCpuIo);
466 ASSERT (HostBridge !=
NULL);
468 HostBridge->Signature = PCI_HOST_BRIDGE_SIGNATURE;
469 HostBridge->CanRestarted =
TRUE;
471 ResourceAssigned =
FALSE;
476 for (Index = 0; Index < RootBridgeCount; Index++) {
481 ASSERT (RootBridge !=
NULL);
482 if (RootBridge ==
NULL) {
492 ASSERT (ResourceAssigned == RootBridges[Index].ResourceAssigned);
495 if (RootBridges[Index].Io.Base <= RootBridges[Index].
Io.Limit) {
500 HostAddress = TO_HOST_ADDRESS (
501 RootBridges[Index].Io.Base,
502 RootBridges[Index].
Io.Translation
507 RootBridges[Index].Io.Limit - RootBridges[Index].
Io.Base + 1
510 if (ResourceAssigned) {
511 Status =
gDS->AllocateIoSpace (
515 RootBridges[Index].Io.Limit - RootBridges[Index].
Io.Base + 1,
530 MemApertures[0] = &RootBridges[Index].
Mem;
531 MemApertures[1] = &RootBridges[Index].
MemAbove4G;
532 MemApertures[2] = &RootBridges[Index].
PMem;
535 for (MemApertureIndex = 0; MemApertureIndex <
ARRAY_SIZE (MemApertures); MemApertureIndex++) {
536 if (MemApertures[MemApertureIndex]->Base <= MemApertures[MemApertureIndex]->Limit) {
541 HostAddress = TO_HOST_ADDRESS (
542 MemApertures[MemApertureIndex]->Base,
543 MemApertures[MemApertureIndex]->Translation
547 MemApertures[MemApertureIndex]->Limit - MemApertures[MemApertureIndex]->Base + 1,
551 Status =
gDS->SetMemorySpaceAttributes (
553 MemApertures[MemApertureIndex]->Limit - MemApertures[MemApertureIndex]->Base + 1,
556 if (EFI_ERROR (Status)) {
557 DEBUG ((DEBUG_WARN,
"PciHostBridge driver failed to set EFI_MEMORY_UC to MMIO aperture - %r.\n", Status));
560 if (ResourceAssigned) {
561 Status =
gDS->AllocateMemorySpace (
565 MemApertures[MemApertureIndex]->Limit - MemApertures[MemApertureIndex]->Base + 1,
585 if (!ResourceAssigned) {
595 Status =
gBS->InstallMultipleProtocolInterfaces (
597 &gEfiPciHostBridgeResourceAllocationProtocolGuid,
598 &HostBridge->ResAlloc,
605 ; !
IsNull (&HostBridge->RootBridges, Link)
606 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
609 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
610 RootBridge->RootBridgeIo.
ParentHandle = HostBridge->Handle;
612 Status =
gBS->InstallMultipleProtocolInterfaces (
614 &gEfiDevicePathProtocolGuid,
615 RootBridge->DevicePath,
616 &gEfiPciRootBridgeIoProtocolGuid,
617 &RootBridge->RootBridgeIo,
625 if (!EFI_ERROR (Status)) {
653 UINTN RootBridgeCount;
654 PCI_RESOURCE_TYPE Index;
659 ; !
IsNull (&HostBridge->RootBridges, Link)
660 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
670 ASSERT (Resources !=
NULL);
672 for (Link =
GetFirstNode (&HostBridge->RootBridges), Descriptor = Resources
673 ; !
IsNull (&HostBridge->RootBridges, Link)
674 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
677 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
678 for (Index = TypeIo; Index < TypeMax; Index++) {
679 ResAllocNode = &RootBridge->ResAllocNode[Index];
681 Descriptor->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
683 Descriptor->AddrRangeMin = ResAllocNode->Base;
684 Descriptor->AddrRangeMax = ResAllocNode->Alignment;
685 Descriptor->AddrLen = ResAllocNode->Length;
686 Descriptor->SpecificFlag = 0;
687 switch (ResAllocNode->Type) {
689 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;
693 Descriptor->SpecificFlag = EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE;
695 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
696 Descriptor->AddrSpaceGranularity = 32;
700 Descriptor->SpecificFlag = EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE;
702 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
703 Descriptor->AddrSpaceGranularity = 64;
707 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_BUS;
721 End->Desc = ACPI_END_TAG_DESCRIPTOR;
731 End->Desc = ACPI_END_TAG_DESCRIPTOR;
734 DEBUG ((DEBUG_ERROR,
"Call PciHostBridgeResourceConflict().\n"));
756 UINTN BitsOfAlignment,
763 if (BaseAddress < Limit) {
774 while (BaseAddress + Length <= Limit + 1) {
776 Status =
gDS->AllocateMemorySpace (
786 Status =
gDS->AllocateIoSpace (
797 if (!EFI_ERROR (Status)) {
801 BaseAddress +=
LShiftU64 (1, BitsOfAlignment);
831 UINTN BitsOfAlignment;
835 PCI_RESOURCE_TYPE Index;
836 PCI_RESOURCE_TYPE Index1;
837 PCI_RESOURCE_TYPE Index2;
838 BOOLEAN ResNodeHandled[TypeMax];
842 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
846 if (!HostBridge->CanRestarted) {
847 return EFI_NOT_READY;
854 ; !
IsNull (&HostBridge->RootBridges, Link)
855 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
858 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
859 for (Index = TypeIo; Index < TypeMax; Index++) {
860 RootBridge->ResAllocNode[Index].Type = Index;
861 RootBridge->ResAllocNode[Index].Base = 0;
862 RootBridge->ResAllocNode[Index].Length = 0;
863 RootBridge->ResAllocNode[Index].Status = ResNone;
865 RootBridge->ResourceSubmitted =
FALSE;
869 HostBridge->CanRestarted =
TRUE;
876 HostBridge->CanRestarted =
FALSE;
898 ; !
IsNull (&HostBridge->RootBridges, Link)
899 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
902 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
903 if (!RootBridge->ResourceSubmitted) {
904 return EFI_NOT_READY;
908 DEBUG ((DEBUG_INFO,
"PciHostBridge: NotifyPhase (AllocateResources)\n"));
910 ; !
IsNull (&HostBridge->RootBridges, Link)
911 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
914 for (Index = TypeIo; Index < TypeBus; Index++) {
915 ResNodeHandled[Index] =
FALSE;
918 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
919 DEBUG ((DEBUG_INFO,
" RootBridge: %s\n", RootBridge->DevicePathStr));
921 for (Index1 = TypeIo; Index1 < TypeBus; Index1++) {
922 if (RootBridge->ResAllocNode[Index1].Status == ResNone) {
923 ResNodeHandled[Index1] =
TRUE;
930 for (Index2 = TypeIo; Index2 < TypeBus; Index2++) {
931 if (ResNodeHandled[Index2]) {
935 if (MaxAlignment <= RootBridge->ResAllocNode[Index2].Alignment) {
936 MaxAlignment = RootBridge->ResAllocNode[Index2].Alignment;
941 ASSERT (Index < TypeMax);
942 ResNodeHandled[Index] =
TRUE;
943 Alignment = RootBridge->ResAllocNode[Index].Alignment;
945 BaseAddress = MAX_UINT64;
954 if ((Translation & Alignment) != 0) {
957 "[%a:%d] Translation %lx is not aligned to %lx!\n",
963 ASSERT ((Translation & Alignment) == 0);
970 ReturnStatus = EFI_OUT_OF_RESOURCES;
983 RootBridge->ResAllocNode[Index].Length,
984 MIN (15, BitsOfAlignment),
987 RootBridge->Io.Translation
990 RootBridge->Io.Limit,
991 RootBridge->Io.Translation
999 RootBridge->ResAllocNode[Index].Length,
1000 MIN (63, BitsOfAlignment),
1002 ALIGN_VALUE (RootBridge->MemAbove4G.Base, Alignment + 1),
1003 RootBridge->MemAbove4G.Translation
1006 RootBridge->MemAbove4G.Limit,
1007 RootBridge->MemAbove4G.Translation
1010 if (BaseAddress != MAX_UINT64) {
1021 RootBridge->ResAllocNode[Index].Length,
1022 MIN (31, BitsOfAlignment),
1024 ALIGN_VALUE (RootBridge->Mem.Base, Alignment + 1),
1025 RootBridge->Mem.Translation
1028 RootBridge->Mem.Limit,
1029 RootBridge->Mem.Translation
1037 RootBridge->ResAllocNode[Index].Length,
1038 MIN (63, BitsOfAlignment),
1040 ALIGN_VALUE (RootBridge->PMemAbove4G.Base, Alignment + 1),
1041 RootBridge->PMemAbove4G.Translation
1044 RootBridge->PMemAbove4G.Limit,
1045 RootBridge->PMemAbove4G.Translation
1048 if (BaseAddress != MAX_UINT64) {
1058 RootBridge->ResAllocNode[Index].Length,
1059 MIN (31, BitsOfAlignment),
1061 ALIGN_VALUE (RootBridge->PMem.Base, Alignment + 1),
1062 RootBridge->PMem.Translation
1065 RootBridge->PMem.Limit,
1066 RootBridge->PMem.Translation
1078 " %s: Base/Length/Alignment = %lx/%lx/%lx - ",
1079 mPciResourceTypeStr[Index],
1081 RootBridge->ResAllocNode[Index].Length,
1084 if (BaseAddress != MAX_UINT64) {
1085 RootBridge->ResAllocNode[Index].Base = BaseAddress;
1086 RootBridge->ResAllocNode[Index].Status = ResAllocated;
1087 DEBUG ((DEBUG_INFO,
"Success\n"));
1089 ReturnStatus = EFI_OUT_OF_RESOURCES;
1090 DEBUG ((DEBUG_ERROR,
"Out Of Resource!\n"));
1096 if (ReturnStatus == EFI_OUT_OF_RESOURCES) {
1104 ; !
IsNull (&HostBridge->RootBridges, Link)
1105 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1108 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1109 for (Index = TypeIo; Index < TypeBus; Index++) {
1110 if (RootBridge->ResAllocNode[Index].Status != ResAllocated) {
1111 RootBridge->ResAllocNode[Index].Length = 0;
1116 return ReturnStatus;
1130 ; !
IsNull (&HostBridge->RootBridges, Link)
1131 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1134 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1135 for (Index = TypeIo; Index < TypeBus; Index++) {
1136 if (RootBridge->ResAllocNode[Index].Status == ResAllocated) {
1139 Status =
gDS->FreeIoSpace (RootBridge->ResAllocNode[Index].Base, RootBridge->ResAllocNode[Index].Length);
1140 if (EFI_ERROR (Status)) {
1141 ReturnStatus = Status;
1150 Status =
gDS->FreeMemorySpace (RootBridge->ResAllocNode[Index].Base, RootBridge->ResAllocNode[Index].Length);
1151 if (EFI_ERROR (Status)) {
1152 ReturnStatus = Status;
1162 RootBridge->ResAllocNode[Index].Type = Index;
1163 RootBridge->ResAllocNode[Index].Base = 0;
1164 RootBridge->ResAllocNode[Index].Length = 0;
1165 RootBridge->ResAllocNode[Index].Status = ResNone;
1169 RootBridge->ResourceSubmitted =
FALSE;
1172 HostBridge->CanRestarted =
TRUE;
1173 return ReturnStatus;
1190 return EFI_INVALID_PARAMETER;
1224 if (RootBridgeHandle ==
NULL) {
1225 return EFI_INVALID_PARAMETER;
1228 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1229 ReturnNext = (BOOLEAN)(*RootBridgeHandle ==
NULL);
1232 ; !
IsNull (&HostBridge->RootBridges, Link)
1233 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1236 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1238 *RootBridgeHandle = RootBridge->Handle;
1242 ReturnNext = (BOOLEAN)(*RootBridgeHandle == RootBridge->Handle);
1246 ASSERT (
IsNull (&HostBridge->RootBridges, Link));
1247 return EFI_NOT_FOUND;
1249 return EFI_INVALID_PARAMETER;
1274 OUT UINT64 *Attributes
1281 if (Attributes ==
NULL) {
1282 return EFI_INVALID_PARAMETER;
1285 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1287 ; !
IsNull (&HostBridge->RootBridges, Link)
1288 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1291 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1292 if (RootBridgeHandle == RootBridge->Handle) {
1293 *Attributes = RootBridge->AllocationAttributes;
1298 return EFI_INVALID_PARAMETER;
1320 OUT VOID **Configuration
1329 if (Configuration ==
NULL) {
1330 return EFI_INVALID_PARAMETER;
1333 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1335 ; !
IsNull (&HostBridge->RootBridges, Link)
1336 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1339 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1340 if (RootBridgeHandle == RootBridge->Handle) {
1342 if (*Configuration ==
NULL) {
1343 return EFI_OUT_OF_RESOURCES;
1347 Descriptor->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
1349 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_BUS;
1350 Descriptor->GenFlag = 0;
1351 Descriptor->SpecificFlag = 0;
1352 Descriptor->AddrSpaceGranularity = 0;
1353 Descriptor->AddrRangeMin = RootBridge->Bus.Base;
1354 Descriptor->AddrRangeMax = 0;
1355 Descriptor->AddrTranslationOffset = 0;
1356 Descriptor->AddrLen = RootBridge->Bus.Limit - RootBridge->Bus.Base + 1;
1359 End->Desc = ACPI_END_TAG_DESCRIPTOR;
1360 End->Checksum = 0x0;
1366 return EFI_INVALID_PARAMETER;
1387 IN VOID *Configuration
1396 if (Configuration ==
NULL) {
1397 return EFI_INVALID_PARAMETER;
1406 if ((Descriptor->Desc != ACPI_ADDRESS_SPACE_DESCRIPTOR) ||
1407 (Descriptor->ResType != ACPI_ADDRESS_SPACE_TYPE_BUS) ||
1408 (End->Desc != ACPI_END_TAG_DESCRIPTOR)
1411 return EFI_INVALID_PARAMETER;
1414 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1416 ; !
IsNull (&HostBridge->RootBridges, Link)
1417 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1420 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1421 if (RootBridgeHandle == RootBridge->Handle) {
1422 if (Descriptor->AddrLen == 0) {
1423 return EFI_INVALID_PARAMETER;
1426 if ((Descriptor->AddrRangeMin < RootBridge->Bus.Base) ||
1427 (Descriptor->AddrRangeMin + Descriptor->AddrLen - 1 > RootBridge->Bus.Limit)
1430 return EFI_INVALID_PARAMETER;
1436 RootBridge->ResAllocNode[TypeBus].Base = Descriptor->AddrRangeMin;
1437 RootBridge->ResAllocNode[TypeBus].Length = Descriptor->AddrLen;
1438 RootBridge->ResAllocNode[TypeBus].Status = ResAllocated;
1443 return EFI_INVALID_PARAMETER;
1463 IN VOID *Configuration
1470 PCI_RESOURCE_TYPE Type;
1475 if (Configuration ==
NULL) {
1476 return EFI_INVALID_PARAMETER;
1479 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1481 ; !
IsNull (&HostBridge->RootBridges, Link)
1482 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1485 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1486 if (RootBridgeHandle == RootBridge->Handle) {
1487 DEBUG ((DEBUG_INFO,
"PciHostBridge: SubmitResources for %s\n", RootBridge->DevicePathStr));
1494 if (Descriptor->ResType > ACPI_ADDRESS_SPACE_TYPE_BUS) {
1495 return EFI_INVALID_PARAMETER;
1500 " %s: Granularity/SpecificFlag = %ld / %02x%s\n",
1501 mAcpiAddressSpaceTypeStr[Descriptor->ResType],
1502 Descriptor->AddrSpaceGranularity,
1503 Descriptor->SpecificFlag,
1504 (Descriptor->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) != 0 ? L
" (Prefetchable)" : L
""
1506 DEBUG ((DEBUG_INFO,
" Length/Alignment = 0x%lx / 0x%lx\n", Descriptor->AddrLen, Descriptor->AddrRangeMax));
1507 switch (Descriptor->ResType) {
1508 case ACPI_ADDRESS_SPACE_TYPE_MEM:
1509 if ((Descriptor->AddrSpaceGranularity != 32) && (Descriptor->AddrSpaceGranularity != 64)) {
1510 return EFI_INVALID_PARAMETER;
1513 if ((Descriptor->AddrSpaceGranularity == 32) && (Descriptor->AddrLen >= SIZE_4GB)) {
1514 return EFI_INVALID_PARAMETER;
1523 ((Descriptor->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) != 0)
1526 return EFI_INVALID_PARAMETER;
1529 case ACPI_ADDRESS_SPACE_TYPE_IO:
1533 if (
GetPowerOfTwo64 (Descriptor->AddrRangeMax + 1) != (Descriptor->AddrRangeMax + 1)) {
1534 return EFI_INVALID_PARAMETER;
1544 if (Descriptor->Desc != ACPI_END_TAG_DESCRIPTOR) {
1545 return EFI_INVALID_PARAMETER;
1549 if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {
1550 if (Descriptor->AddrSpaceGranularity == 32) {
1551 if ((Descriptor->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) != 0) {
1557 ASSERT (Descriptor->AddrSpaceGranularity == 64);
1558 if ((Descriptor->SpecificFlag & EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE) != 0) {
1565 ASSERT (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_IO);
1569 RootBridge->ResAllocNode[Type].Length = Descriptor->AddrLen;
1570 RootBridge->ResAllocNode[Type].Alignment = Descriptor->AddrRangeMax;
1571 RootBridge->ResAllocNode[Type].Status = ResSubmitted;
1574 RootBridge->ResourceSubmitted =
TRUE;
1579 return EFI_INVALID_PARAMETER;
1602 OUT VOID **Configuration
1615 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1617 ; !
IsNull (&HostBridge->RootBridges, Link)
1618 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1621 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1622 if (RootBridgeHandle == RootBridge->Handle) {
1623 for (Index = 0, Number = 0; Index < TypeBus; Index++) {
1624 if (RootBridge->ResAllocNode[Index].Status != ResNone) {
1630 if (Buffer ==
NULL) {
1631 return EFI_OUT_OF_RESOURCES;
1635 for (Index = 0; Index < TypeBus; Index++) {
1636 ResStatus = RootBridge->ResAllocNode[Index].Status;
1637 if (ResStatus != ResNone) {
1638 Descriptor->Desc = ACPI_ADDRESS_SPACE_DESCRIPTOR;
1640 Descriptor->GenFlag = 0;
1647 Descriptor->AddrRangeMin = TO_DEVICE_ADDRESS (
1648 RootBridge->ResAllocNode[Index].Base,
1651 Descriptor->AddrRangeMax = 0;
1652 Descriptor->AddrTranslationOffset = (ResStatus == ResAllocated) ?
EFI_RESOURCE_SATISFIED : PCI_RESOURCE_LESS;
1653 Descriptor->AddrLen = RootBridge->ResAllocNode[Index].Length;
1657 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;
1661 Descriptor->SpecificFlag = EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE;
1663 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
1664 Descriptor->AddrSpaceGranularity = 32;
1668 Descriptor->SpecificFlag = EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE;
1670 Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;
1671 Descriptor->AddrSpaceGranularity = 64;
1680 End->Desc = ACPI_END_TAG_DESCRIPTOR;
1683 *Configuration = Buffer;
1689 return EFI_INVALID_PARAMETER;
1720 return EFI_INVALID_PARAMETER;
1723 HostBridge = PCI_HOST_BRIDGE_FROM_THIS (This);
1725 ; !
IsNull (&HostBridge->RootBridges, Link)
1726 ; Link =
GetNextNode (&HostBridge->RootBridges, Link)
1729 RootBridge = ROOT_BRIDGE_FROM_LINK (Link);
1730 if (RootBridgeHandle == RootBridge->Handle) {
1735 return EFI_INVALID_PARAMETER;
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
UINT64 EFIAPI GetPowerOfTwo64(IN UINT64 Operand)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
INTN EFIAPI LowBitSet64(IN UINT64 Operand)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ALIGN_VALUE(Value, Alignment)
#define ARRAY_SIZE(Array)
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG_CODE_BEGIN()
#define DEBUG(Expression)
PCI_IO_DEVICE * CreateRootBridge(IN EFI_HANDLE RootBridgeHandle)
EFI_STATUS EFIAPI GetNextRootBridge(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN OUT EFI_HANDLE *RootBridgeHandle)
EFI_STATUS EFIAPI NotifyPhase(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase)
EFI_STATUS EFIAPI PreprocessController(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_HANDLE RootBridgeHandle, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress, IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase)
EFI_STATUS EFIAPI StartBusEnumeration(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_HANDLE RootBridgeHandle, OUT VOID **Configuration)
EFI_STATUS EFIAPI InitializePciHostBridge(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS IntersectIoDescriptor(IN UINT64 Base, IN UINT64 Length, IN CONST EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor)
UINT64 AllocateResource(BOOLEAN Mmio, UINT64 Length, UINTN BitsOfAlignment, UINT64 BaseAddress, UINT64 Limit)
EFI_STATUS EFIAPI GetAttributes(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_HANDLE RootBridgeHandle, OUT UINT64 *Attributes)
EFI_STATUS EFIAPI SetBusNumbers(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_HANDLE RootBridgeHandle, IN VOID *Configuration)
VOID ResourceConflict(IN PCI_HOST_BRIDGE_INSTANCE *HostBridge)
VOID EFIAPI IoMmuProtocolCallback(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS AddIoSpace(IN UINT64 Base, IN UINT64 Length)
UINT64 GetTranslationByResourceType(IN PCI_ROOT_BRIDGE_INSTANCE *RootBridge, IN PCI_RESOURCE_TYPE ResourceType)
EFI_STATUS EFIAPI GetProposedResources(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_HANDLE RootBridgeHandle, OUT VOID **Configuration)
EFI_STATUS EFIAPI SubmitResources(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This, IN EFI_HANDLE RootBridgeHandle, IN VOID *Configuration)
EFI_STATUS AddMemoryMappedIoSpace(IN UINT64 Base, IN UINT64 Length, IN UINT64 Capabilities)
EFI_STATUS IntersectMemoryDescriptor(IN UINT64 Base, IN UINT64 Length, IN UINT64 Capabilities, IN CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor)
PCI_ROOT_BRIDGE *EFIAPI PciHostBridgeGetRootBridges(UINTN *Count)
VOID EFIAPI PciHostBridgeFreeRootBridges(PCI_ROOT_BRIDGE *Bridges, UINTN Count)
VOID EFIAPI PciHostBridgeResourceConflict(EFI_HANDLE HostBridgeHandle, VOID *Configuration)
#define EFI_RESOURCE_SATISFIED
#define EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE
@ EfiPciHostBridgeEndEnumeration
@ EfiPciHostBridgeBeginEnumeration
@ EfiPciHostBridgeBeginResourceAllocation
@ EfiPciHostBridgeSetResources
@ EfiPciHostBridgeAllocateResources
@ EfiPciHostBridgeBeginBusAllocation
@ EfiPciHostBridgeFreeResources
@ EfiPciHostBridgeEndResourceAllocation
@ EfiPciHostBridgeEndBusAllocation
EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE
@ EfiPciBeforeResourceCollection
@ EfiGcdMemoryTypeNonExistent
@ EfiGcdMemoryTypeMemoryMappedIo
@ EfiGcdIoTypeNonExistent
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_GUID gEdkiiIoMmuProtocolGuid
UINT64 EFI_PHYSICAL_ADDRESS
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SUBMIT_RESOURCES SubmitResources
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_START_BUS_ENUMERATION StartBusEnumeration
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_ATTRIBUTES GetAllocAttributes
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SET_BUS_NUMBERS SetBusNumbers
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_NOTIFY_PHASE NotifyPhase
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_PREPROCESS_CONTROLLER PreprocessController
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_PROPOSED_RESOURCES GetProposedResources
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_NEXT_ROOT_BRIDGE GetNextRootBridge
EFI_PHYSICAL_ADDRESS BaseAddress
EFI_GCD_IO_TYPE GcdIoType
EFI_GCD_MEMORY_TYPE GcdMemoryType
EFI_PHYSICAL_ADDRESS BaseAddress
PCI_ROOT_BRIDGE_APERTURE Io
IO aperture which can be used by the root bridge.
PCI_ROOT_BRIDGE_APERTURE PMem
Prefetchable MMIO aperture below 4GB which can be used by the root bridge.
PCI_ROOT_BRIDGE_APERTURE Mem
MMIO aperture below 4GB which can be used by the root bridge.
PCI_ROOT_BRIDGE_APERTURE PMemAbove4G
Prefetchable MMIO aperture above 4GB which can be used by the root bridge.
PCI_ROOT_BRIDGE_APERTURE MemAbove4G
MMIO aperture above 4GB which can be used by the root bridge.