2 PCI resouces support functions implemntation for PCI Bus module.
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 The function is used to skip VGA range.
20 @param Start Returned start address including VGA range.
21 @param Length The length of VGA range.
35 ASSERT (Start
!= NULL
);
37 // For legacy VGA, bit 10 to bit 15 is not decoded
42 StartOffset
= Original
& Mask
;
43 LimitOffset
= ((*Start
) + Length
- 1) & Mask
;
44 if (LimitOffset
>= VGABASE1
) {
45 *Start
= *Start
- StartOffset
+ VGALIMIT2
+ 1;
50 This function is used to skip ISA aliasing aperture.
52 @param Start Returned start address including ISA aliasing aperture.
53 @param Length The length of ISA aliasing aperture.
57 SkipIsaAliasAperture (
68 ASSERT (Start
!= NULL
);
71 // For legacy ISA, bit 10 to bit 15 is not decoded
76 StartOffset
= Original
& Mask
;
77 LimitOffset
= ((*Start
) + Length
- 1) & Mask
;
79 if (LimitOffset
>= ISABASE
) {
80 *Start
= *Start
- StartOffset
+ ISALIMIT
+ 1;
85 This function inserts a resource node into the resource list.
86 The resource list is sorted in descend order.
88 @param Bridge PCI resource node for bridge.
89 @param ResNode Resource node want to be inserted.
94 IN OUT PCI_RESOURCE_NODE
*Bridge
,
95 IN PCI_RESOURCE_NODE
*ResNode
98 LIST_ENTRY
*CurrentLink
;
99 PCI_RESOURCE_NODE
*Temp
;
100 UINT64 ResNodeAlignRest
;
101 UINT64 TempAlignRest
;
103 ASSERT (Bridge
!= NULL
);
104 ASSERT (ResNode
!= NULL
);
106 InsertHeadList (&Bridge
->ChildList
, &ResNode
->Link
);
108 CurrentLink
= Bridge
->ChildList
.ForwardLink
->ForwardLink
;
109 while (CurrentLink
!= &Bridge
->ChildList
) {
110 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
112 if (ResNode
->Alignment
> Temp
->Alignment
) {
114 } else if (ResNode
->Alignment
== Temp
->Alignment
) {
115 ResNodeAlignRest
= ResNode
->Length
& ResNode
->Alignment
;
116 TempAlignRest
= Temp
->Length
& Temp
->Alignment
;
117 if ((ResNodeAlignRest
== 0) || (ResNodeAlignRest
>= TempAlignRest
)) {
122 SwapListEntries (&ResNode
->Link
, CurrentLink
);
124 CurrentLink
= ResNode
->Link
.ForwardLink
;
129 This routine is used to merge two different resource trees in need of
132 For example, if an upstream PPB doesn't support,
133 prefetchable memory decoding, the PCI bus driver will choose to call this function
134 to merge prefectchable memory resource list into normal memory list.
136 If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource
138 If Dst is NULL or Res is NULL, ASSERT ().
140 @param Dst Point to destination resource tree.
141 @param Res Point to source resource tree.
142 @param TypeMerge If the TypeMerge is TRUE, Res resource type is changed to the type of
143 destination resource type.
148 IN PCI_RESOURCE_NODE
*Dst
,
149 IN PCI_RESOURCE_NODE
*Res
,
154 LIST_ENTRY
*CurrentLink
;
155 PCI_RESOURCE_NODE
*Temp
;
157 ASSERT (Dst
!= NULL
);
158 ASSERT (Res
!= NULL
);
160 while (!IsListEmpty (&Res
->ChildList
)) {
161 CurrentLink
= Res
->ChildList
.ForwardLink
;
163 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
166 Temp
->ResType
= Dst
->ResType
;
169 RemoveEntryList (CurrentLink
);
170 InsertResourceNode (Dst
, Temp
);
175 This function is used to calculate the IO16 aperture
178 @param Bridge PCI resource node for bridge.
182 CalculateApertureIo16 (
183 IN PCI_RESOURCE_NODE
*Bridge
188 LIST_ENTRY
*CurrentLink
;
189 PCI_RESOURCE_NODE
*Node
;
193 EFI_PCI_PLATFORM_POLICY PciPolicy
;
196 // Always assume there is ISA device and VGA device on the platform
197 // will be customized later
203 // Check PciPlatform policy
205 if (gPciPlatformProtocol
!= NULL
) {
206 Status
= gPciPlatformProtocol
->GetPlatformPolicy (
207 gPciPlatformProtocol
,
210 if (!EFI_ERROR (Status
)) {
211 if ((PciPolicy
& EFI_RESERVE_ISA_IO_ALIAS
) != 0) {
214 if ((PciPolicy
& EFI_RESERVE_VGA_IO_ALIAS
) != 0) {
218 } else if (gPciOverrideProtocol
!= NULL
) {
219 Status
= gPciOverrideProtocol
->GetPlatformPolicy (
220 gPciOverrideProtocol
,
223 if (!EFI_ERROR (Status
)) {
224 if ((PciPolicy
& EFI_RESERVE_ISA_IO_ALIAS
) != 0) {
227 if ((PciPolicy
& EFI_RESERVE_VGA_IO_ALIAS
) != 0) {
235 if (Bridge
== NULL
) {
239 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
242 // Assume the bridge is aligned
244 while (CurrentLink
!= &Bridge
->ChildList
) {
246 Node
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
249 // Consider the aperture alignment
251 Offset
= Aperture
& (Node
->Alignment
);
255 Aperture
= Aperture
+ (Node
->Alignment
+ 1) - Offset
;
260 // IsaEnable and VGAEnable can not be implemented now.
261 // If both of them are enabled, then the IO resource would
262 // become too limited to meet the requirement of most of devices.
264 if (IsaEnable
|| VGAEnable
) {
265 if (!IS_PCI_BRIDGE (&(Node
->PciDev
->Pci
)) && !IS_CARDBUS_BRIDGE (&(Node
->PciDev
->Pci
))) {
267 // Check if there is need to support ISA/VGA decoding
268 // If so, we need to avoid isa/vga aliasing range
271 SkipIsaAliasAperture (
275 Offset
= Aperture
& (Node
->Alignment
);
277 Aperture
= Aperture
+ (Node
->Alignment
+ 1) - Offset
;
279 } else if (VGAEnable
) {
284 Offset
= Aperture
& (Node
->Alignment
);
286 Aperture
= Aperture
+ (Node
->Alignment
+ 1) - Offset
;
292 Node
->Offset
= Aperture
;
295 // Increment aperture by the length of node
297 Aperture
+= Node
->Length
;
299 CurrentLink
= CurrentLink
->ForwardLink
;
303 // At last, adjust the aperture with the bridge's
306 Offset
= Aperture
& (Bridge
->Alignment
);
309 Aperture
= Aperture
+ (Bridge
->Alignment
+ 1) - Offset
;
312 Bridge
->Length
= Aperture
;
314 // At last, adjust the bridge's alignment to the first child's alignment
315 // if the bridge has at least one child
317 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
318 if (CurrentLink
!= &Bridge
->ChildList
) {
319 Node
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
320 if (Node
->Alignment
> Bridge
->Alignment
) {
321 Bridge
->Alignment
= Node
->Alignment
;
327 This function is used to calculate the resource aperture
328 for a given bridge device.
330 @param Bridge PCI resouce node for given bridge device.
334 CalculateResourceAperture (
335 IN PCI_RESOURCE_NODE
*Bridge
339 LIST_ENTRY
*CurrentLink
;
340 PCI_RESOURCE_NODE
*Node
;
346 if (Bridge
== NULL
) {
350 if (Bridge
->ResType
== PciBarTypeIo16
) {
352 CalculateApertureIo16 (Bridge
);
356 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
359 // Assume the bridge is aligned
361 while (CurrentLink
!= &Bridge
->ChildList
) {
363 Node
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
366 // Apply padding resource if available
368 Offset
= Aperture
& (Node
->Alignment
);
372 Aperture
= Aperture
+ (Node
->Alignment
+ 1) - Offset
;
377 // Recode current aperture as a offset
378 // this offset will be used in future real allocation
380 Node
->Offset
= Aperture
;
383 // Increment aperture by the length of node
385 Aperture
+= Node
->Length
;
388 // Consider the aperture alignment
390 CurrentLink
= CurrentLink
->ForwardLink
;
394 // At last, adjust the aperture with the bridge's
397 Offset
= Aperture
& (Bridge
->Alignment
);
399 Aperture
= Aperture
+ (Bridge
->Alignment
+ 1) - Offset
;
403 // If the bridge has already padded the resource and the
404 // amount of padded resource is larger, then keep the
407 if (Bridge
->Length
< Aperture
) {
408 Bridge
->Length
= Aperture
;
412 // At last, adjust the bridge's alignment to the first child's alignment
413 // if the bridge has at least one child
415 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
416 if (CurrentLink
!= &Bridge
->ChildList
) {
417 Node
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
418 if (Node
->Alignment
> Bridge
->Alignment
) {
419 Bridge
->Alignment
= Node
->Alignment
;
425 Get IO/Memory resource infor for given PCI device.
427 @param PciDev Pci device instance.
428 @param IoNode Resource info node for IO .
429 @param Mem32Node Resource info node for 32-bit memory.
430 @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
431 @param Mem64Node Resource info node for 64-bit memory.
432 @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
436 GetResourceFromDevice (
437 IN PCI_IO_DEVICE
*PciDev
,
438 IN OUT PCI_RESOURCE_NODE
*IoNode
,
439 IN OUT PCI_RESOURCE_NODE
*Mem32Node
,
440 IN OUT PCI_RESOURCE_NODE
*PMem32Node
,
441 IN OUT PCI_RESOURCE_NODE
*Mem64Node
,
442 IN OUT PCI_RESOURCE_NODE
*PMem64Node
447 PCI_RESOURCE_NODE
*Node
;
448 BOOLEAN ResourceRequested
;
451 ResourceRequested
= FALSE
;
453 for (Index
= 0; Index
< PCI_MAX_BAR
; Index
++) {
455 switch ((PciDev
->PciBar
)[Index
].BarType
) {
457 case PciBarTypeMem32
:
459 Node
= CreateResourceNode (
461 (PciDev
->PciBar
)[Index
].Length
,
462 (PciDev
->PciBar
)[Index
].Alignment
,
473 ResourceRequested
= TRUE
;
476 case PciBarTypeMem64
:
478 Node
= CreateResourceNode (
480 (PciDev
->PciBar
)[Index
].Length
,
481 (PciDev
->PciBar
)[Index
].Alignment
,
492 ResourceRequested
= TRUE
;
495 case PciBarTypePMem64
:
497 Node
= CreateResourceNode (
499 (PciDev
->PciBar
)[Index
].Length
,
500 (PciDev
->PciBar
)[Index
].Alignment
,
511 ResourceRequested
= TRUE
;
514 case PciBarTypePMem32
:
516 Node
= CreateResourceNode (
518 (PciDev
->PciBar
)[Index
].Length
,
519 (PciDev
->PciBar
)[Index
].Alignment
,
529 ResourceRequested
= TRUE
;
535 Node
= CreateResourceNode (
537 (PciDev
->PciBar
)[Index
].Length
,
538 (PciDev
->PciBar
)[Index
].Alignment
,
548 ResourceRequested
= TRUE
;
551 case PciBarTypeUnknown
:
562 for (Index
= 0; Index
< PCI_MAX_BAR
; Index
++) {
564 switch ((PciDev
->VfPciBar
)[Index
].BarType
) {
566 case PciBarTypeMem32
:
568 Node
= CreateVfResourceNode (
570 (PciDev
->VfPciBar
)[Index
].Length
,
571 (PciDev
->VfPciBar
)[Index
].Alignment
,
584 case PciBarTypeMem64
:
586 Node
= CreateVfResourceNode (
588 (PciDev
->VfPciBar
)[Index
].Length
,
589 (PciDev
->VfPciBar
)[Index
].Alignment
,
602 case PciBarTypePMem64
:
604 Node
= CreateVfResourceNode (
606 (PciDev
->VfPciBar
)[Index
].Length
,
607 (PciDev
->VfPciBar
)[Index
].Alignment
,
620 case PciBarTypePMem32
:
622 Node
= CreateVfResourceNode (
624 (PciDev
->VfPciBar
)[Index
].Length
,
625 (PciDev
->VfPciBar
)[Index
].Alignment
,
641 case PciBarTypeUnknown
:
648 // If there is no resource requested from this device,
649 // then we indicate this device has been allocated naturally.
651 if (!ResourceRequested
) {
652 PciDev
->Allocated
= TRUE
;
657 This function is used to create a resource node.
659 @param PciDev Pci device instance.
660 @param Length Length of Io/Memory resource.
661 @param Alignment Alignment of resource.
662 @param Bar Bar index.
663 @param ResType Type of resource: IO/Memory.
664 @param ResUsage Resource usage.
666 @return PCI resource node created for given PCI device.
667 NULL means PCI resource node is not created.
672 IN PCI_IO_DEVICE
*PciDev
,
676 IN PCI_BAR_TYPE ResType
,
677 IN PCI_RESOURCE_USAGE ResUsage
680 PCI_RESOURCE_NODE
*Node
;
684 Node
= AllocateZeroPool (sizeof (PCI_RESOURCE_NODE
));
685 ASSERT (Node
!= NULL
);
690 Node
->Signature
= PCI_RESOURCE_SIGNATURE
;
691 Node
->PciDev
= PciDev
;
692 Node
->Length
= Length
;
693 Node
->Alignment
= Alignment
;
695 Node
->ResType
= ResType
;
696 Node
->Reserved
= FALSE
;
697 Node
->ResourceUsage
= ResUsage
;
698 InitializeListHead (&Node
->ChildList
);
704 This function is used to create a IOV VF resource node.
706 @param PciDev Pci device instance.
707 @param Length Length of Io/Memory resource.
708 @param Alignment Alignment of resource.
709 @param Bar Bar index.
710 @param ResType Type of resource: IO/Memory.
711 @param ResUsage Resource usage.
713 @return PCI resource node created for given VF PCI device.
714 NULL means PCI resource node is not created.
718 CreateVfResourceNode (
719 IN PCI_IO_DEVICE
*PciDev
,
723 IN PCI_BAR_TYPE ResType
,
724 IN PCI_RESOURCE_USAGE ResUsage
727 PCI_RESOURCE_NODE
*Node
;
731 "PCI-IOV B%x.D%x.F%x - VfResource (Bar - 0x%x) (Type - 0x%x) (Length - 0x%x)\n",
732 (UINTN
)PciDev
->BusNumber
,
733 (UINTN
)PciDev
->DeviceNumber
,
734 (UINTN
)PciDev
->FunctionNumber
,
740 Node
= CreateResourceNode (PciDev
, Length
, Alignment
, Bar
, ResType
, ResUsage
);
745 Node
->Virtual
= TRUE
;
751 This function is used to extract resource request from
754 @param Bridge Pci device instance.
755 @param IoNode Resource info node for IO.
756 @param Mem32Node Resource info node for 32-bit memory.
757 @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
758 @param Mem64Node Resource info node for 64-bit memory.
759 @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
764 IN PCI_IO_DEVICE
*Bridge
,
765 IN OUT PCI_RESOURCE_NODE
*IoNode
,
766 IN OUT PCI_RESOURCE_NODE
*Mem32Node
,
767 IN OUT PCI_RESOURCE_NODE
*PMem32Node
,
768 IN OUT PCI_RESOURCE_NODE
*Mem64Node
,
769 IN OUT PCI_RESOURCE_NODE
*PMem64Node
773 PCI_RESOURCE_NODE
*IoBridge
;
774 PCI_RESOURCE_NODE
*Mem32Bridge
;
775 PCI_RESOURCE_NODE
*PMem32Bridge
;
776 PCI_RESOURCE_NODE
*Mem64Bridge
;
777 PCI_RESOURCE_NODE
*PMem64Bridge
;
778 LIST_ENTRY
*CurrentLink
;
780 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
782 while (CurrentLink
!= NULL
&& CurrentLink
!= &Bridge
->ChildList
) {
784 Temp
= PCI_IO_DEVICE_FROM_LINK (CurrentLink
);
787 // Create resource nodes for this device by scanning the
788 // Bar array in the device private data
789 // If the upstream bridge doesn't support this device,
790 // no any resource node will be created for this device
792 GetResourceFromDevice (
801 if (IS_PCI_BRIDGE (&Temp
->Pci
)) {
804 // If the device has children, create a bridge resource node for this PPB
805 // Note: For PPB, memory aperture is aligned with 1MB and IO aperture
806 // is aligned with 4KB
807 // This device is typically a bridge device like PPB and P2C
808 // Note: 0x1000 aligned
810 IoBridge
= CreateResourceNode (
819 Mem32Bridge
= CreateResourceNode (
828 PMem32Bridge
= CreateResourceNode (
837 Mem64Bridge
= CreateResourceNode (
846 PMem64Bridge
= CreateResourceNode (
856 // Recursively create resouce map on this bridge
867 if (ResourceRequestExisted (IoBridge
)) {
878 // If there is node under this resource bridge,
879 // then calculate bridge's aperture of this type
880 // and insert it into the respective resource tree.
881 // If no, delete this resource bridge
883 if (ResourceRequestExisted (Mem32Bridge
)) {
889 FreePool (Mem32Bridge
);
894 // If there is node under this resource bridge,
895 // then calculate bridge's aperture of this type
896 // and insert it into the respective resource tree.
897 // If no, delete this resource bridge
899 if (ResourceRequestExisted (PMem32Bridge
)) {
905 FreePool (PMem32Bridge
);
910 // If there is node under this resource bridge,
911 // then calculate bridge's aperture of this type
912 // and insert it into the respective resource tree.
913 // If no, delete this resource bridge
915 if (ResourceRequestExisted (Mem64Bridge
)) {
921 FreePool (Mem64Bridge
);
926 // If there is node under this resource bridge,
927 // then calculate bridge's aperture of this type
928 // and insert it into the respective resource tree.
929 // If no, delete this resource bridge
931 if (ResourceRequestExisted (PMem64Bridge
)) {
937 FreePool (PMem64Bridge
);
944 // If it is P2C, apply hard coded resource padding
946 if (IS_CARDBUS_BRIDGE (&Temp
->Pci
)) {
947 ResourcePaddingForCardBusBridge (
957 CurrentLink
= CurrentLink
->ForwardLink
;
961 // To do some platform specific resource padding ...
963 ResourcePaddingPolicy (
973 // Degrade resource if necessary
984 // Calculate resource aperture for this bridge device
986 CalculateResourceAperture (Mem32Node
);
987 CalculateResourceAperture (PMem32Node
);
988 CalculateResourceAperture (Mem64Node
);
989 CalculateResourceAperture (PMem64Node
);
990 CalculateResourceAperture (IoNode
);
994 This function is used to do the resource padding for a specific platform.
996 @param PciDev Pci device instance.
997 @param IoNode Resource info node for IO.
998 @param Mem32Node Resource info node for 32-bit memory.
999 @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
1000 @param Mem64Node Resource info node for 64-bit memory.
1001 @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
1005 ResourcePaddingPolicy (
1006 IN PCI_IO_DEVICE
*PciDev
,
1007 IN PCI_RESOURCE_NODE
*IoNode
,
1008 IN PCI_RESOURCE_NODE
*Mem32Node
,
1009 IN PCI_RESOURCE_NODE
*PMem32Node
,
1010 IN PCI_RESOURCE_NODE
*Mem64Node
,
1011 IN PCI_RESOURCE_NODE
*PMem64Node
1015 // Create padding resource node
1017 if (PciDev
->ResourcePaddingDescriptors
!= NULL
) {
1018 ApplyResourcePadding (
1030 This function is used to degrade resource if the upstream bridge
1031 doesn't support certain resource. Degradation path is
1032 PMEM64 -> MEM64 -> MEM32
1033 PMEM64 -> PMEM32 -> MEM32
1036 @param Bridge Pci device instance.
1037 @param Mem32Node Resource info node for 32-bit memory.
1038 @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
1039 @param Mem64Node Resource info node for 64-bit memory.
1040 @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
1045 IN PCI_IO_DEVICE
*Bridge
,
1046 IN PCI_RESOURCE_NODE
*Mem32Node
,
1047 IN PCI_RESOURCE_NODE
*PMem32Node
,
1048 IN PCI_RESOURCE_NODE
*Mem64Node
,
1049 IN PCI_RESOURCE_NODE
*PMem64Node
1053 PCI_IO_DEVICE
*Temp
;
1054 LIST_ENTRY
*CurrentLink
;
1057 // For RootBridge, PPB , P2C, go recursively to traverse all its children
1058 // to find if this bridge and downstream has OptionRom.
1061 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
1062 while (CurrentLink
!= NULL
&& CurrentLink
!= &Bridge
->ChildList
) {
1064 Temp
= PCI_IO_DEVICE_FROM_LINK (CurrentLink
);
1065 if (Temp
->RomSize
!= 0) {
1069 CurrentLink
= CurrentLink
->ForwardLink
;
1073 // If bridge doesn't support Prefetchable
1074 // memory64, degrade it to Prefetchable memory32
1076 if (!BridgeSupportResourceDecode (Bridge
, EFI_BRIDGE_PMEM64_DECODE_SUPPORTED
)) {
1084 // if no PMem32 request and no OptionRom request, still keep PMem64. Otherwise degrade to PMem32
1086 if ((PMem32Node
!= NULL
&& (PMem32Node
->Length
!= 0 && Bridge
->Parent
!= NULL
)) || HasOprom
) {
1088 // Fixed the issue that there is no resource for 64-bit (above 4G)
1100 // If bridge doesn't support Mem64
1101 // degrade it to mem32
1103 if (!BridgeSupportResourceDecode (Bridge
, EFI_BRIDGE_MEM64_DECODE_SUPPORTED
)) {
1112 // If bridge doesn't support Pmem32
1113 // degrade it to mem32
1115 if (!BridgeSupportResourceDecode (Bridge
, EFI_BRIDGE_PMEM32_DECODE_SUPPORTED
)) {
1124 // if bridge supports combined Pmem Mem decoding
1125 // merge these two type of resource
1127 if (BridgeSupportResourceDecode (Bridge
, EFI_BRIDGE_PMEM_MEM_COMBINE_SUPPORTED
)) {
1143 Test whether bridge device support decode resource.
1145 @param Bridge Bridge device instance.
1146 @param Decode Decode type according to resource type.
1148 @return TRUE The bridge device support decode resource.
1149 @return FALSE The bridge device don't support decode resource.
1153 BridgeSupportResourceDecode (
1154 IN PCI_IO_DEVICE
*Bridge
,
1158 if (((Bridge
->Decodes
) & Decode
) != 0) {
1166 This function is used to program the resource allocated
1167 for each resource node under specified bridge.
1169 @param Base Base address of resource to be progammed.
1170 @param Bridge PCI resource node for the bridge device.
1172 @retval EFI_SUCCESS Successfully to program all resouces
1173 on given PCI bridge device.
1174 @retval EFI_OUT_OF_RESOURCES Base is all one.
1180 IN PCI_RESOURCE_NODE
*Bridge
1183 LIST_ENTRY
*CurrentLink
;
1184 PCI_RESOURCE_NODE
*Node
;
1187 if (Base
== gAllOne
) {
1188 return EFI_OUT_OF_RESOURCES
;
1191 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
1193 while (CurrentLink
!= &Bridge
->ChildList
) {
1195 Node
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1197 if (!IS_PCI_BRIDGE (&(Node
->PciDev
->Pci
))) {
1199 if (IS_CARDBUS_BRIDGE (&(Node
->PciDev
->Pci
))) {
1201 // Program the PCI Card Bus device
1203 ProgramP2C (Base
, Node
);
1206 // Program the PCI device BAR
1208 ProgramBar (Base
, Node
);
1212 // Program the PCI devices under this bridge
1214 Status
= ProgramResource (Base
+ Node
->Offset
, Node
);
1215 if (EFI_ERROR (Status
)) {
1219 ProgramPpbApperture (Base
, Node
);
1222 CurrentLink
= CurrentLink
->ForwardLink
;
1229 Program Bar register for PCI device.
1231 @param Base Base address for PCI device resource to be progammed.
1232 @param Node Point to resoure node structure.
1238 IN PCI_RESOURCE_NODE
*Node
1241 EFI_PCI_IO_PROTOCOL
*PciIo
;
1245 ASSERT (Node
->Bar
< PCI_MAX_BAR
);
1250 if (Node
->Virtual
) {
1251 ProgramVfBar (Base
, Node
);
1255 PciIo
= &(Node
->PciDev
->PciIo
);
1257 Address
= Base
+ Node
->Offset
;
1260 // Indicate pci bus driver has allocated
1261 // resource for this device
1262 // It might be a temporary solution here since
1263 // pci device could have multiple bar
1265 Node
->PciDev
->Allocated
= TRUE
;
1267 switch ((Node
->PciDev
->PciBar
[Node
->Bar
]).BarType
) {
1269 case PciBarTypeIo16
:
1270 case PciBarTypeIo32
:
1271 case PciBarTypeMem32
:
1272 case PciBarTypePMem32
:
1276 EfiPciIoWidthUint32
,
1277 (Node
->PciDev
->PciBar
[Node
->Bar
]).Offset
,
1282 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1286 case PciBarTypeMem64
:
1287 case PciBarTypePMem64
:
1289 Address32
= (UINT32
) (Address
& 0x00000000FFFFFFFF);
1293 EfiPciIoWidthUint32
,
1294 (Node
->PciDev
->PciBar
[Node
->Bar
]).Offset
,
1299 Address32
= (UINT32
) RShiftU64 (Address
, 32);
1303 EfiPciIoWidthUint32
,
1304 (UINT8
) ((Node
->PciDev
->PciBar
[Node
->Bar
]).Offset
+ 4),
1309 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1319 Program IOV VF Bar register for PCI device.
1321 @param Base Base address for PCI device resource to be progammed.
1322 @param Node Point to resoure node structure.
1328 IN PCI_RESOURCE_NODE
*Node
1331 EFI_PCI_IO_PROTOCOL
*PciIo
;
1335 ASSERT (Node
->Bar
< PCI_MAX_BAR
);
1336 ASSERT (Node
->Virtual
);
1339 PciIo
= &(Node
->PciDev
->PciIo
);
1341 Address
= Base
+ Node
->Offset
;
1344 // Indicate pci bus driver has allocated
1345 // resource for this device
1346 // It might be a temporary solution here since
1347 // pci device could have multiple bar
1349 Node
->PciDev
->Allocated
= TRUE
;
1351 switch ((Node
->PciDev
->VfPciBar
[Node
->Bar
]).BarType
) {
1353 case PciBarTypeMem32
:
1354 case PciBarTypePMem32
:
1358 EfiPciIoWidthUint32
,
1359 (Node
->PciDev
->VfPciBar
[Node
->Bar
]).Offset
,
1364 Node
->PciDev
->VfPciBar
[Node
->Bar
].BaseAddress
= Address
;
1368 "PCI-IOV B%x.D%x.F%x - VF Bar (Offset - 0x%x) 32Mem (Address - 0x%x)\n",
1369 (UINTN
)Node
->PciDev
->BusNumber
,
1370 (UINTN
)Node
->PciDev
->DeviceNumber
,
1371 (UINTN
)Node
->PciDev
->FunctionNumber
,
1372 (UINTN
)(Node
->PciDev
->VfPciBar
[Node
->Bar
]).Offset
,
1378 case PciBarTypeMem64
:
1379 case PciBarTypePMem64
:
1381 Address32
= (UINT32
) (Address
& 0x00000000FFFFFFFF);
1385 EfiPciIoWidthUint32
,
1386 (Node
->PciDev
->VfPciBar
[Node
->Bar
]).Offset
,
1391 Address32
= (UINT32
) RShiftU64 (Address
, 32);
1395 EfiPciIoWidthUint32
,
1396 ((Node
->PciDev
->VfPciBar
[Node
->Bar
]).Offset
+ 4),
1401 Node
->PciDev
->VfPciBar
[Node
->Bar
].BaseAddress
= Address
;
1405 "PCI-IOV B%x.D%x.F%x - VF Bar (Offset - 0x%x) 64Mem (Address - 0x%lx)\n",
1406 (UINTN
)Node
->PciDev
->BusNumber
,
1407 (UINTN
)Node
->PciDev
->DeviceNumber
,
1408 (UINTN
)Node
->PciDev
->FunctionNumber
,
1409 (UINTN
)(Node
->PciDev
->VfPciBar
[Node
->Bar
]).Offset
,
1415 case PciBarTypeIo16
:
1416 case PciBarTypeIo32
:
1427 Program PCI-PCI bridge apperture.
1429 @param Base Base address for resource.
1430 @param Node Point to resoure node structure.
1434 ProgramPpbApperture (
1436 IN PCI_RESOURCE_NODE
*Node
1439 EFI_PCI_IO_PROTOCOL
*PciIo
;
1445 // If no device resource of this PPB, return anyway
1446 // Apperture is set default in the initialization code
1448 if (Node
->Length
== 0 || Node
->ResourceUsage
== PciResUsagePadding
) {
1450 // For padding resource node, just ignore when programming
1455 PciIo
= &(Node
->PciDev
->PciIo
);
1456 Address
= Base
+ Node
->Offset
;
1459 // Indicate the PPB resource has been allocated
1461 Node
->PciDev
->Allocated
= TRUE
;
1463 switch (Node
->Bar
) {
1469 EfiPciIoWidthUint32
,
1470 (Node
->PciDev
->PciBar
[Node
->Bar
]).Offset
,
1475 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1476 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
1482 Address32
= ((UINT32
) (Address
)) >> 8;
1494 EfiPciIoWidthUint16
,
1500 Address32
= (UINT32
) (Address
+ Node
->Length
- 1);
1501 Address32
= ((UINT32
) (Address32
)) >> 8;
1513 EfiPciIoWidthUint16
,
1519 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1520 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
1523 case PPB_MEM32_RANGE
:
1525 Address32
= ((UINT32
) (Address
)) >> 16;
1528 EfiPciIoWidthUint16
,
1534 Address32
= (UINT32
) (Address
+ Node
->Length
- 1);
1535 Address32
= ((UINT32
) (Address32
)) >> 16;
1538 EfiPciIoWidthUint16
,
1544 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1545 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
1548 case PPB_PMEM32_RANGE
:
1549 case PPB_PMEM64_RANGE
:
1551 Address32
= ((UINT32
) (Address
)) >> 16;
1554 EfiPciIoWidthUint16
,
1560 Address32
= (UINT32
) (Address
+ Node
->Length
- 1);
1561 Address32
= ((UINT32
) (Address32
)) >> 16;
1564 EfiPciIoWidthUint16
,
1570 Address32
= (UINT32
) RShiftU64 (Address
, 32);
1573 EfiPciIoWidthUint32
,
1579 Address32
= (UINT32
) RShiftU64 ((Address
+ Node
->Length
- 1), 32);
1582 EfiPciIoWidthUint32
,
1588 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1589 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
1598 Program parent bridge for Option Rom.
1600 @param PciDevice Pci deivce instance.
1601 @param OptionRomBase Base address for Optiona Rom.
1602 @param Enable Enable or disable PCI memory.
1606 ProgrameUpstreamBridgeForRom (
1607 IN PCI_IO_DEVICE
*PciDevice
,
1608 IN UINT32 OptionRomBase
,
1612 PCI_IO_DEVICE
*Parent
;
1613 PCI_RESOURCE_NODE Node
;
1615 // For root bridge, just return.
1617 Parent
= PciDevice
->Parent
;
1618 ZeroMem (&Node
, sizeof (Node
));
1619 while (Parent
!= NULL
) {
1620 if (!IS_PCI_BRIDGE (&Parent
->Pci
)) {
1624 Node
.PciDev
= Parent
;
1625 Node
.Length
= PciDevice
->RomSize
;
1627 Node
.Bar
= PPB_MEM32_RANGE
;
1628 Node
.ResType
= PciBarTypeMem32
;
1632 // Program PPB to only open a single <= 16MB apperture
1635 ProgramPpbApperture (OptionRomBase
, &Node
);
1636 PCI_ENABLE_COMMAND_REGISTER (Parent
, EFI_PCI_COMMAND_MEMORY_SPACE
);
1638 InitializePpb (Parent
);
1639 PCI_DISABLE_COMMAND_REGISTER (Parent
, EFI_PCI_COMMAND_MEMORY_SPACE
);
1642 Parent
= Parent
->Parent
;
1647 Test whether resource exists for a bridge.
1649 @param Bridge Point to resource node for a bridge.
1651 @retval TRUE There is resource on the given bridge.
1652 @retval FALSE There isn't resource on the given bridge.
1656 ResourceRequestExisted (
1657 IN PCI_RESOURCE_NODE
*Bridge
1660 if (Bridge
!= NULL
) {
1661 if (!IsListEmpty (&Bridge
->ChildList
) || Bridge
->Length
!= 0) {
1670 Initialize resource pool structure.
1672 @param ResourcePool Point to resource pool structure. This pool
1673 is reset to all zero when returned.
1674 @param ResourceType Type of resource.
1678 InitializeResourcePool (
1679 IN OUT PCI_RESOURCE_NODE
*ResourcePool
,
1680 IN PCI_BAR_TYPE ResourceType
1683 ZeroMem (ResourcePool
, sizeof (PCI_RESOURCE_NODE
));
1684 ResourcePool
->ResType
= ResourceType
;
1685 ResourcePool
->Signature
= PCI_RESOURCE_SIGNATURE
;
1686 InitializeListHead (&ResourcePool
->ChildList
);
1691 Get all resource information for given Pci device.
1693 @param PciDev Pci device instance.
1694 @param IoBridge Io resource node.
1695 @param Mem32Bridge 32-bit memory node.
1696 @param PMem32Bridge 32-bit Pmemory node.
1697 @param Mem64Bridge 64-bit memory node.
1698 @param PMem64Bridge 64-bit PMemory node.
1699 @param IoPool Link list header for Io resource.
1700 @param Mem32Pool Link list header for 32-bit memory.
1701 @param PMem32Pool Link list header for 32-bit Prefetchable memory.
1702 @param Mem64Pool Link list header for 64-bit memory.
1703 @param PMem64Pool Link list header for 64-bit Prefetchable memory.
1708 IN PCI_IO_DEVICE
*PciDev
,
1709 IN PCI_RESOURCE_NODE
**IoBridge
,
1710 IN PCI_RESOURCE_NODE
**Mem32Bridge
,
1711 IN PCI_RESOURCE_NODE
**PMem32Bridge
,
1712 IN PCI_RESOURCE_NODE
**Mem64Bridge
,
1713 IN PCI_RESOURCE_NODE
**PMem64Bridge
,
1714 IN PCI_RESOURCE_NODE
*IoPool
,
1715 IN PCI_RESOURCE_NODE
*Mem32Pool
,
1716 IN PCI_RESOURCE_NODE
*PMem32Pool
,
1717 IN PCI_RESOURCE_NODE
*Mem64Pool
,
1718 IN PCI_RESOURCE_NODE
*PMem64Pool
1722 PCI_RESOURCE_NODE
*Temp
;
1723 LIST_ENTRY
*CurrentLink
;
1725 CurrentLink
= IoPool
->ChildList
.ForwardLink
;
1728 // Get Io resource map
1730 while (CurrentLink
!= &IoPool
->ChildList
) {
1732 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1734 if (Temp
->PciDev
== PciDev
) {
1738 CurrentLink
= CurrentLink
->ForwardLink
;
1742 // Get Mem32 resource map
1744 CurrentLink
= Mem32Pool
->ChildList
.ForwardLink
;
1746 while (CurrentLink
!= &Mem32Pool
->ChildList
) {
1748 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1750 if (Temp
->PciDev
== PciDev
) {
1751 *Mem32Bridge
= Temp
;
1754 CurrentLink
= CurrentLink
->ForwardLink
;
1758 // Get Pmem32 resource map
1760 CurrentLink
= PMem32Pool
->ChildList
.ForwardLink
;
1762 while (CurrentLink
!= &PMem32Pool
->ChildList
) {
1764 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1766 if (Temp
->PciDev
== PciDev
) {
1767 *PMem32Bridge
= Temp
;
1770 CurrentLink
= CurrentLink
->ForwardLink
;
1774 // Get Mem64 resource map
1776 CurrentLink
= Mem64Pool
->ChildList
.ForwardLink
;
1778 while (CurrentLink
!= &Mem64Pool
->ChildList
) {
1780 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1782 if (Temp
->PciDev
== PciDev
) {
1783 *Mem64Bridge
= Temp
;
1786 CurrentLink
= CurrentLink
->ForwardLink
;
1790 // Get Pmem64 resource map
1792 CurrentLink
= PMem64Pool
->ChildList
.ForwardLink
;
1794 while (CurrentLink
!= &PMem64Pool
->ChildList
) {
1796 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1798 if (Temp
->PciDev
== PciDev
) {
1799 *PMem64Bridge
= Temp
;
1802 CurrentLink
= CurrentLink
->ForwardLink
;
1807 Destory given resource tree.
1809 @param Bridge PCI resource root node of resource tree.
1813 DestroyResourceTree (
1814 IN PCI_RESOURCE_NODE
*Bridge
1817 PCI_RESOURCE_NODE
*Temp
;
1818 LIST_ENTRY
*CurrentLink
;
1820 while (!IsListEmpty (&Bridge
->ChildList
)) {
1822 CurrentLink
= Bridge
->ChildList
.ForwardLink
;
1824 Temp
= RESOURCE_NODE_FROM_LINK (CurrentLink
);
1827 RemoveEntryList (CurrentLink
);
1829 if (IS_PCI_BRIDGE (&(Temp
->PciDev
->Pci
))) {
1830 DestroyResourceTree (Temp
);
1838 Insert resource padding for P2C.
1840 @param PciDev Pci device instance.
1841 @param IoNode Resource info node for IO.
1842 @param Mem32Node Resource info node for 32-bit memory.
1843 @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
1844 @param Mem64Node Resource info node for 64-bit memory.
1845 @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
1849 ResourcePaddingForCardBusBridge (
1850 IN PCI_IO_DEVICE
*PciDev
,
1851 IN PCI_RESOURCE_NODE
*IoNode
,
1852 IN PCI_RESOURCE_NODE
*Mem32Node
,
1853 IN PCI_RESOURCE_NODE
*PMem32Node
,
1854 IN PCI_RESOURCE_NODE
*Mem64Node
,
1855 IN PCI_RESOURCE_NODE
*PMem64Node
1858 PCI_RESOURCE_NODE
*Node
;
1863 // Memory Base/Limit Register 0
1864 // Bar 1 denodes memory range 0
1866 Node
= CreateResourceNode (
1875 InsertResourceNode (
1881 // Memory Base/Limit Register 1
1882 // Bar 2 denodes memory range1
1884 Node
= CreateResourceNode (
1893 InsertResourceNode (
1900 // Bar 3 denodes io range 0
1902 Node
= CreateResourceNode (
1911 InsertResourceNode (
1918 // Bar 4 denodes io range 0
1920 Node
= CreateResourceNode (
1929 InsertResourceNode (
1936 Program PCI Card device register for given resource node.
1938 @param Base Base address of PCI Card device to be programmed.
1939 @param Node Given resource node.
1945 IN PCI_RESOURCE_NODE
*Node
1948 EFI_PCI_IO_PROTOCOL
*PciIo
;
1951 UINT16 BridgeControl
;
1954 PciIo
= &(Node
->PciDev
->PciIo
);
1956 Address
= Base
+ Node
->Offset
;
1959 // Indicate pci bus driver has allocated
1960 // resource for this device
1961 // It might be a temporary solution here since
1962 // pci device could have multiple bar
1964 Node
->PciDev
->Allocated
= TRUE
;
1966 switch (Node
->Bar
) {
1971 EfiPciIoWidthUint32
,
1972 (Node
->PciDev
->PciBar
[Node
->Bar
]).Offset
,
1977 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
1978 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
1984 EfiPciIoWidthUint32
,
1985 PCI_CARD_MEMORY_BASE_0
,
1990 TempAddress
= Address
+ Node
->Length
- 1;
1993 EfiPciIoWidthUint32
,
1994 PCI_CARD_MEMORY_LIMIT_0
,
1999 if (Node
->ResType
== PciBarTypeMem32
) {
2001 // Set non-prefetchable bit
2005 EfiPciIoWidthUint16
,
2006 PCI_CARD_BRIDGE_CONTROL
,
2011 BridgeControl
&= (UINT16
) ~PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE
;
2014 EfiPciIoWidthUint16
,
2015 PCI_CARD_BRIDGE_CONTROL
,
2022 // Set pre-fetchable bit
2026 EfiPciIoWidthUint16
,
2027 PCI_CARD_BRIDGE_CONTROL
,
2032 BridgeControl
|= PCI_CARD_PREFETCHABLE_MEMORY_0_ENABLE
;
2035 EfiPciIoWidthUint16
,
2036 PCI_CARD_BRIDGE_CONTROL
,
2042 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
2043 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
2044 Node
->PciDev
->PciBar
[Node
->Bar
].BarType
= Node
->ResType
;
2051 EfiPciIoWidthUint32
,
2052 PCI_CARD_MEMORY_BASE_1
,
2057 TempAddress
= Address
+ Node
->Length
- 1;
2061 EfiPciIoWidthUint32
,
2062 PCI_CARD_MEMORY_LIMIT_1
,
2067 if (Node
->ResType
== PciBarTypeMem32
) {
2070 // Set non-prefetchable bit
2074 EfiPciIoWidthUint16
,
2075 PCI_CARD_BRIDGE_CONTROL
,
2080 BridgeControl
&= (UINT16
) ~(PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE
);
2083 EfiPciIoWidthUint16
,
2084 PCI_CARD_BRIDGE_CONTROL
,
2092 // Set pre-fetchable bit
2096 EfiPciIoWidthUint16
,
2097 PCI_CARD_BRIDGE_CONTROL
,
2102 BridgeControl
|= PCI_CARD_PREFETCHABLE_MEMORY_1_ENABLE
;
2105 EfiPciIoWidthUint16
,
2106 PCI_CARD_BRIDGE_CONTROL
,
2112 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
2113 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
2114 Node
->PciDev
->PciBar
[Node
->Bar
].BarType
= Node
->ResType
;
2120 EfiPciIoWidthUint32
,
2121 PCI_CARD_IO_BASE_0_LOWER
,
2126 TempAddress
= Address
+ Node
->Length
- 1;
2129 EfiPciIoWidthUint32
,
2130 PCI_CARD_IO_LIMIT_0_LOWER
,
2135 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
2136 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
2137 Node
->PciDev
->PciBar
[Node
->Bar
].BarType
= Node
->ResType
;
2144 EfiPciIoWidthUint32
,
2145 PCI_CARD_IO_BASE_1_LOWER
,
2150 TempAddress
= Address
+ Node
->Length
- 1;
2153 EfiPciIoWidthUint32
,
2154 PCI_CARD_IO_LIMIT_1_LOWER
,
2159 Node
->PciDev
->PciBar
[Node
->Bar
].BaseAddress
= Address
;
2160 Node
->PciDev
->PciBar
[Node
->Bar
].Length
= Node
->Length
;
2161 Node
->PciDev
->PciBar
[Node
->Bar
].BarType
= Node
->ResType
;
2170 Create padding resource node.
2172 @param PciDev Pci device instance.
2173 @param IoNode Resource info node for IO.
2174 @param Mem32Node Resource info node for 32-bit memory.
2175 @param PMem32Node Resource info node for 32-bit Prefetchable Memory.
2176 @param Mem64Node Resource info node for 64-bit memory.
2177 @param PMem64Node Resource info node for 64-bit Prefetchable Memory.
2181 ApplyResourcePadding (
2182 IN PCI_IO_DEVICE
*PciDev
,
2183 IN PCI_RESOURCE_NODE
*IoNode
,
2184 IN PCI_RESOURCE_NODE
*Mem32Node
,
2185 IN PCI_RESOURCE_NODE
*PMem32Node
,
2186 IN PCI_RESOURCE_NODE
*Mem64Node
,
2187 IN PCI_RESOURCE_NODE
*PMem64Node
2190 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
*Ptr
;
2191 PCI_RESOURCE_NODE
*Node
;
2192 UINT8 DummyBarIndex
;
2195 Ptr
= PciDev
->ResourcePaddingDescriptors
;
2197 while (((EFI_ACPI_END_TAG_DESCRIPTOR
*) Ptr
)->Desc
!= ACPI_END_TAG_DESCRIPTOR
) {
2199 if (Ptr
->Desc
== ACPI_ADDRESS_SPACE_DESCRIPTOR
&& Ptr
->ResType
== ACPI_ADDRESS_SPACE_TYPE_IO
) {
2200 if (Ptr
->AddrLen
!= 0) {
2202 Node
= CreateResourceNode (
2210 InsertResourceNode (
2220 if (Ptr
->Desc
== ACPI_ADDRESS_SPACE_DESCRIPTOR
&& Ptr
->ResType
== ACPI_ADDRESS_SPACE_TYPE_MEM
) {
2222 if (Ptr
->AddrSpaceGranularity
== 32) {
2227 if (Ptr
->SpecificFlag
== 0x6) {
2228 if (Ptr
->AddrLen
!= 0) {
2229 Node
= CreateResourceNode (
2237 InsertResourceNode (
2250 if (Ptr
->SpecificFlag
== 0) {
2251 if (Ptr
->AddrLen
!= 0) {
2252 Node
= CreateResourceNode (
2260 InsertResourceNode (
2271 if (Ptr
->AddrSpaceGranularity
== 64) {
2276 if (Ptr
->SpecificFlag
== 0x6) {
2277 if (Ptr
->AddrLen
!= 0) {
2278 Node
= CreateResourceNode (
2286 InsertResourceNode (
2299 if (Ptr
->SpecificFlag
== 0) {
2300 if (Ptr
->AddrLen
!= 0) {
2301 Node
= CreateResourceNode (
2309 InsertResourceNode (
2326 Get padding resource for PCI-PCI bridge.
2328 @param PciIoDevice PCI-PCI bridge device instance.
2330 @note Feature flag PcdPciBusHotplugDeviceSupport determines
2331 whether need to pad resource for them.
2334 GetResourcePaddingPpb (
2335 IN PCI_IO_DEVICE
*PciIoDevice
2338 if (gPciHotPlugInit
!= NULL
&& FeaturePcdGet (PcdPciBusHotplugDeviceSupport
)) {
2339 if (PciIoDevice
->ResourcePaddingDescriptors
== NULL
) {
2340 GetResourcePaddingForHpb (PciIoDevice
);