TianoCore EDK2 master
Loading...
Searching...
No Matches
PciLib.c
Go to the documentation of this file.
1
10#include "PciBus.h"
11
13CHAR16 *mBarTypeStr[] = {
14 L"Unknow",
15 L" Io16",
16 L" Io32",
17 L" Mem32",
18 L"PMem32",
19 L" Mem64",
20 L"PMem64",
21 L" OpRom",
22 L" Io",
23 L" Mem",
24 L"Unknow"
25};
26
36UINT16
38 IN PCI_IO_DEVICE *Bridge
39 )
40{
41 PCI_IO_DEVICE *RootBridge;
42 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *BusNumberRanges;
43 UINT64 MaxNumberInRange;
44
45 //
46 // Get PCI Root Bridge device
47 //
48 RootBridge = Bridge;
49 while (RootBridge->Parent != NULL) {
50 RootBridge = RootBridge->Parent;
51 }
52
53 MaxNumberInRange = 0;
54 //
55 // Iterate the bus number ranges to get max PCI bus number
56 //
57 BusNumberRanges = RootBridge->BusNumberRanges;
58 while (BusNumberRanges->Desc != ACPI_END_TAG_DESCRIPTOR) {
59 MaxNumberInRange = BusNumberRanges->AddrRangeMin + BusNumberRanges->AddrLen - 1;
60 BusNumberRanges++;
61 }
62
63 return (UINT16)MaxNumberInRange;
64}
65
72VOID
74 IN PCI_IO_DEVICE *PciIoDevice
75 )
76{
77 UINT32 Address;
78
79 if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
80 return;
81 }
82
83 //
84 // Read PciBar information from the bar register
85 //
86 if (!gFullEnumeration) {
87 Address = 0;
88 PciIoDevice->PciIo.Pci.Read (
89 &(PciIoDevice->PciIo),
90 EfiPciIoWidthUint32,
91 PCI_CARD_MEMORY_BASE_0,
92 1,
93 &Address
94 );
95
96 (PciIoDevice->PciBar)[P2C_MEM_1].BaseAddress = (UINT64)(Address);
97 (PciIoDevice->PciBar)[P2C_MEM_1].Length = 0x2000000;
98 (PciIoDevice->PciBar)[P2C_MEM_1].BarType = PciBarTypeMem32;
99
100 Address = 0;
101 PciIoDevice->PciIo.Pci.Read (
102 &(PciIoDevice->PciIo),
103 EfiPciIoWidthUint32,
104 PCI_CARD_MEMORY_BASE_1,
105 1,
106 &Address
107 );
108 (PciIoDevice->PciBar)[P2C_MEM_2].BaseAddress = (UINT64)(Address);
109 (PciIoDevice->PciBar)[P2C_MEM_2].Length = 0x2000000;
110 (PciIoDevice->PciBar)[P2C_MEM_2].BarType = PciBarTypePMem32;
111
112 Address = 0;
113 PciIoDevice->PciIo.Pci.Read (
114 &(PciIoDevice->PciIo),
115 EfiPciIoWidthUint32,
116 PCI_CARD_IO_BASE_0_LOWER,
117 1,
118 &Address
119 );
120 (PciIoDevice->PciBar)[P2C_IO_1].BaseAddress = (UINT64)(Address);
121 (PciIoDevice->PciBar)[P2C_IO_1].Length = 0x100;
122 (PciIoDevice->PciBar)[P2C_IO_1].BarType = PciBarTypeIo16;
123
124 Address = 0;
125 PciIoDevice->PciIo.Pci.Read (
126 &(PciIoDevice->PciIo),
127 EfiPciIoWidthUint32,
128 PCI_CARD_IO_BASE_1_LOWER,
129 1,
130 &Address
131 );
132 (PciIoDevice->PciBar)[P2C_IO_2].BaseAddress = (UINT64)(Address);
133 (PciIoDevice->PciBar)[P2C_IO_2].Length = 0x100;
134 (PciIoDevice->PciBar)[P2C_IO_2].BarType = PciBarTypeIo16;
135 }
136
137 if ((gPciHotPlugInit != NULL) && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
138 GetResourcePaddingForHpb (PciIoDevice);
139 }
140}
141
150VOID
152 IN EFI_HANDLE RootBridgeHandle,
153 IN PCI_IO_DEVICE *Bridge
154 )
155{
156 PCI_IO_DEVICE *Temp;
157 LIST_ENTRY *CurrentLink;
158 LIST_ENTRY *LastLink;
159
160 if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
161 return;
162 }
163
164 CurrentLink = Bridge->ChildList.ForwardLink;
165
166 while (CurrentLink != NULL && CurrentLink != &Bridge->ChildList) {
167 Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
168
169 if (IS_PCI_BRIDGE (&Temp->Pci)) {
170 //
171 // Remove rejected devices recusively
172 //
173 RemoveRejectedPciDevices (RootBridgeHandle, Temp);
174 } else {
175 //
176 // Skip rejection for all PPBs, while detect rejection for others
177 //
178 if (IsPciDeviceRejected (Temp)) {
179 //
180 // For P2C, remove all devices on it
181 //
182 if (!IsListEmpty (&Temp->ChildList)) {
183 RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);
184 }
185
186 //
187 // Finally remove itself
188 //
189 LastLink = CurrentLink->BackLink;
190 RemoveEntryList (CurrentLink);
191 FreePciDevice (Temp);
192
193 CurrentLink = LastLink;
194 }
195 }
196
197 CurrentLink = CurrentLink->ForwardLink;
198 }
199}
200
206VOID
208 IN PCI_RESOURCE_NODE *BridgeResource
209 )
210{
211 LIST_ENTRY *Link;
212 PCI_RESOURCE_NODE *Resource;
213 PCI_BAR *Bar;
214
215 if ((BridgeResource != NULL) && (BridgeResource->Length != 0)) {
216 DEBUG ((
217 DEBUG_INFO,
218 "Type = %s; Base = 0x%lx;\tLength = 0x%lx;\tAlignment = 0x%lx\n",
219 mBarTypeStr[MIN (BridgeResource->ResType, PciBarTypeMaxType)],
220 BridgeResource->PciDev->PciBar[BridgeResource->Bar].BaseAddress,
221 BridgeResource->Length,
222 BridgeResource->Alignment
223 ));
224 for ( Link = GetFirstNode (&BridgeResource->ChildList)
225 ; !IsNull (&BridgeResource->ChildList, Link)
226 ; Link = GetNextNode (&BridgeResource->ChildList, Link)
227 )
228 {
229 Resource = RESOURCE_NODE_FROM_LINK (Link);
230 if (Resource->ResourceUsage == PciResUsageTypical) {
231 Bar = Resource->Virtual ? Resource->PciDev->VfPciBar : Resource->PciDev->PciBar;
232 DEBUG ((
233 DEBUG_INFO,
234 " Base = 0x%lx;\tLength = 0x%lx;\tAlignment = 0x%lx;\tOwner = %s [%02x|%02x|%02x:",
235 Bar[Resource->Bar].BaseAddress,
236 Resource->Length,
237 Resource->Alignment,
238 IS_PCI_BRIDGE (&Resource->PciDev->Pci) ? L"PPB" :
239 IS_CARDBUS_BRIDGE (&Resource->PciDev->Pci) ? L"P2C" :
240 L"PCI",
241 Resource->PciDev->BusNumber,
242 Resource->PciDev->DeviceNumber,
243 Resource->PciDev->FunctionNumber
244 ));
245
246 if ((!IS_PCI_BRIDGE (&Resource->PciDev->Pci) && !IS_CARDBUS_BRIDGE (&Resource->PciDev->Pci)) ||
247 (IS_PCI_BRIDGE (&Resource->PciDev->Pci) && (Resource->Bar < PPB_IO_RANGE)) ||
248 (IS_CARDBUS_BRIDGE (&Resource->PciDev->Pci) && (Resource->Bar < P2C_MEM_1))
249 )
250 {
251 //
252 // The resource requirement comes from the device itself.
253 //
254 DEBUG ((DEBUG_INFO, "%02x]", Bar[Resource->Bar].Offset));
255 } else {
256 //
257 // The resource requirement comes from the subordinate devices.
258 //
259 DEBUG ((DEBUG_INFO, "**]"));
260 }
261 } else {
262 DEBUG ((DEBUG_INFO, " Base = Padding;\tLength = 0x%lx;\tAlignment = 0x%lx", Resource->Length, Resource->Alignment));
263 }
264
265 if (BridgeResource->ResType != Resource->ResType) {
266 DEBUG ((DEBUG_INFO, "; Type = %s", mBarTypeStr[MIN (Resource->ResType, PciBarTypeMaxType)]));
267 }
268
269 DEBUG ((DEBUG_INFO, "\n"));
270 }
271 }
272}
273
283UINTN
285 IN PCI_IO_DEVICE *Device,
286 IN PCI_RESOURCE_NODE *BridgeResource,
287 OUT PCI_RESOURCE_NODE **DeviceResources OPTIONAL
288 )
289{
290 LIST_ENTRY *Link;
291 PCI_RESOURCE_NODE *Resource;
292 UINTN Count;
293
294 Count = 0;
295 for ( Link = BridgeResource->ChildList.ForwardLink
296 ; Link != &BridgeResource->ChildList
297 ; Link = Link->ForwardLink
298 )
299 {
300 Resource = RESOURCE_NODE_FROM_LINK (Link);
301 if (Resource->PciDev == Device) {
302 if (DeviceResources != NULL) {
303 DeviceResources[Count] = Resource;
304 }
305
306 Count++;
307 }
308 }
309
310 return Count;
311}
312
320VOID
322 IN PCI_IO_DEVICE *Bridge,
323 IN PCI_RESOURCE_NODE **Resources,
324 IN UINTN ResourceCount
325 )
326{
327 EFI_STATUS Status;
328 LIST_ENTRY *Link;
329 PCI_IO_DEVICE *Device;
330 UINTN Index;
331 CHAR16 *Str;
332 PCI_RESOURCE_NODE **ChildResources;
333 UINTN ChildResourceCount;
334
335 DEBUG ((DEBUG_INFO, "PciBus: Resource Map for "));
336
337 Status = gBS->OpenProtocol (
338 Bridge->Handle,
339 &gEfiPciRootBridgeIoProtocolGuid,
340 NULL,
341 NULL,
342 NULL,
343 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
344 );
345 if (EFI_ERROR (Status)) {
346 DEBUG ((
347 DEBUG_INFO,
348 "Bridge [%02x|%02x|%02x]\n",
349 Bridge->BusNumber,
350 Bridge->DeviceNumber,
351 Bridge->FunctionNumber
352 ));
353 } else {
355 DevicePathFromHandle (Bridge->Handle),
356 FALSE,
357 FALSE
358 );
359 DEBUG ((DEBUG_INFO, "Root Bridge %s\n", Str != NULL ? Str : L""));
360 if (Str != NULL) {
361 FreePool (Str);
362 }
363 }
364
365 for (Index = 0; Index < ResourceCount; Index++) {
366 DumpBridgeResource (Resources[Index]);
367 }
368
369 DEBUG ((DEBUG_INFO, "\n"));
370
371 for ( Link = Bridge->ChildList.ForwardLink
372 ; Link != &Bridge->ChildList
373 ; Link = Link->ForwardLink
374 )
375 {
376 Device = PCI_IO_DEVICE_FROM_LINK (Link);
377 if (IS_PCI_BRIDGE (&Device->Pci)) {
378 ChildResourceCount = 0;
379 for (Index = 0; Index < ResourceCount; Index++) {
380 ChildResourceCount += FindResourceNode (Device, Resources[Index], NULL);
381 }
382
383 ChildResources = AllocatePool (sizeof (PCI_RESOURCE_NODE *) * ChildResourceCount);
384 ASSERT (ChildResources != NULL);
385 ChildResourceCount = 0;
386 for (Index = 0; Index < ResourceCount; Index++) {
387 ChildResourceCount += FindResourceNode (Device, Resources[Index], &ChildResources[ChildResourceCount]);
388 }
389
390 DumpResourceMap (Device, ChildResources, ChildResourceCount);
391 FreePool (ChildResources);
392 }
393 }
394}
395
404BOOLEAN
406 IN PCI_IO_DEVICE *RootBridgeDev
407 )
408{
409 PCI_IO_DEVICE *PciIoDevice;
410 LIST_ENTRY *CurrentLink;
411 BOOLEAN Adjusted;
412 UINTN Offset;
413 UINTN BarIndex;
414
415 Adjusted = FALSE;
416 CurrentLink = RootBridgeDev->ChildList.ForwardLink;
417
418 while (CurrentLink != NULL && CurrentLink != &RootBridgeDev->ChildList) {
419 PciIoDevice = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
420
421 if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) {
422 if (AdjustPciDeviceBarSize (PciIoDevice)) {
423 Adjusted = TRUE;
424 }
425 } else {
426 if (PciIoDevice->ResizableBarOffset != 0) {
427 DEBUG ((
428 DEBUG_ERROR,
429 "PciBus: [%02x|%02x|%02x] Adjust Pci Device Bar Size\n",
430 PciIoDevice->BusNumber,
431 PciIoDevice->DeviceNumber,
432 PciIoDevice->FunctionNumber
433 ));
434 PciProgramResizableBar (PciIoDevice, PciResizableBarMin);
435 //
436 // Start to parse the bars
437 //
438 for (Offset = 0x10, BarIndex = 0; Offset <= 0x24 && BarIndex < PCI_MAX_BAR; BarIndex++) {
439 Offset = PciParseBar (PciIoDevice, Offset, BarIndex);
440 }
441
442 Adjusted = TRUE;
443 DEBUG_CODE (
444 DumpPciBars (PciIoDevice);
445 );
446 }
447 }
448
449 CurrentLink = CurrentLink->ForwardLink;
450 }
451
452 return Adjusted;
453}
454
471 )
472{
473 PCI_IO_DEVICE *RootBridgeDev;
474 EFI_HANDLE RootBridgeHandle;
475 VOID *AcpiConfig;
476 EFI_STATUS Status;
477 UINT64 IoBase;
478 UINT64 Mem32Base;
479 UINT64 PMem32Base;
480 UINT64 Mem64Base;
481 UINT64 PMem64Base;
482 UINT64 IoResStatus;
483 UINT64 Mem32ResStatus;
484 UINT64 PMem32ResStatus;
485 UINT64 Mem64ResStatus;
486 UINT64 PMem64ResStatus;
487 UINT32 MaxOptionRomSize;
488 PCI_RESOURCE_NODE *IoBridge;
489 PCI_RESOURCE_NODE *Mem32Bridge;
490 PCI_RESOURCE_NODE *PMem32Bridge;
491 PCI_RESOURCE_NODE *Mem64Bridge;
492 PCI_RESOURCE_NODE *PMem64Bridge;
493 PCI_RESOURCE_NODE IoPool;
494 PCI_RESOURCE_NODE Mem32Pool;
495 PCI_RESOURCE_NODE PMem32Pool;
496 PCI_RESOURCE_NODE Mem64Pool;
497 PCI_RESOURCE_NODE PMem64Pool;
500 BOOLEAN ResizableBarNeedAdjust;
501 BOOLEAN ResizableBarAdjusted;
502
503 ResizableBarNeedAdjust = PcdGetBool (PcdPcieResizableBarSupport);
504
505 //
506 // It may try several times if the resource allocation fails
507 //
508 while (TRUE) {
509 //
510 // Initialize resource pool
511 //
512 InitializeResourcePool (&IoPool, PciBarTypeIo16);
513 InitializeResourcePool (&Mem32Pool, PciBarTypeMem32);
514 InitializeResourcePool (&PMem32Pool, PciBarTypePMem32);
515 InitializeResourcePool (&Mem64Pool, PciBarTypeMem64);
516 InitializeResourcePool (&PMem64Pool, PciBarTypePMem64);
517
518 RootBridgeDev = NULL;
519 RootBridgeHandle = 0;
520
521 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
522 //
523 // Get Root Bridge Device by handle
524 //
525 RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
526
527 if (RootBridgeDev == NULL) {
528 return EFI_NOT_FOUND;
529 }
530
531 //
532 // Create the entire system resource map from the information collected by
533 // enumerator. Several resource tree was created
534 //
535
536 //
537 // If non-standard PCI Bridge I/O window alignment is supported,
538 // set I/O aligment to minimum possible alignment for root bridge.
539 //
540 IoBridge = CreateResourceNode (
541 RootBridgeDev,
542 0,
543 FeaturePcdGet (PcdPciBridgeIoAlignmentProbe) ? 0x1FF : 0xFFF,
544 RB_IO_RANGE,
545 PciBarTypeIo16,
546 PciResUsageTypical
547 );
548
549 Mem32Bridge = CreateResourceNode (
550 RootBridgeDev,
551 0,
552 0xFFFFF,
553 RB_MEM32_RANGE,
554 PciBarTypeMem32,
555 PciResUsageTypical
556 );
557
558 PMem32Bridge = CreateResourceNode (
559 RootBridgeDev,
560 0,
561 0xFFFFF,
562 RB_PMEM32_RANGE,
563 PciBarTypePMem32,
564 PciResUsageTypical
565 );
566
567 Mem64Bridge = CreateResourceNode (
568 RootBridgeDev,
569 0,
570 0xFFFFF,
571 RB_MEM64_RANGE,
572 PciBarTypeMem64,
573 PciResUsageTypical
574 );
575
576 PMem64Bridge = CreateResourceNode (
577 RootBridgeDev,
578 0,
579 0xFFFFF,
580 RB_PMEM64_RANGE,
581 PciBarTypePMem64,
582 PciResUsageTypical
583 );
584
585 //
586 // Get the max ROM size that the root bridge can process
587 // Insert to resource map so that there will be dedicate MEM32 resource range for Option ROM.
588 // All devices' Option ROM share the same MEM32 resource.
589 //
590 MaxOptionRomSize = GetMaxOptionRomSize (RootBridgeDev);
591 if (MaxOptionRomSize != 0) {
592 RootBridgeDev->PciBar[0].BarType = PciBarTypeOpRom;
593 RootBridgeDev->PciBar[0].Length = MaxOptionRomSize;
594 RootBridgeDev->PciBar[0].Alignment = MaxOptionRomSize - 1;
595 GetResourceFromDevice (RootBridgeDev, IoBridge, Mem32Bridge, PMem32Bridge, Mem64Bridge, PMem64Bridge);
596 }
597
598 //
599 // Create resourcemap by going through all the devices subject to this root bridge
600 //
602 RootBridgeDev,
603 IoBridge,
604 Mem32Bridge,
605 PMem32Bridge,
606 Mem64Bridge,
607 PMem64Bridge
608 );
609
610 //
611 // Based on the all the resource tree, construct ACPI resource node to
612 // submit the resource aperture to pci host bridge protocol
613 //
615 RootBridgeDev,
616 IoBridge,
617 Mem32Bridge,
618 PMem32Bridge,
619 Mem64Bridge,
620 PMem64Bridge,
621 &AcpiConfig
622 );
623
624 //
625 // Insert these resource nodes into the database
626 //
627 InsertResourceNode (&IoPool, IoBridge);
628 InsertResourceNode (&Mem32Pool, Mem32Bridge);
629 InsertResourceNode (&PMem32Pool, PMem32Bridge);
630 InsertResourceNode (&Mem64Pool, Mem64Bridge);
631 InsertResourceNode (&PMem64Pool, PMem64Bridge);
632
633 if (Status == EFI_SUCCESS) {
634 //
635 // Submit the resource requirement
636 //
637 Status = PciResAlloc->SubmitResources (
638 PciResAlloc,
639 RootBridgeDev->Handle,
640 AcpiConfig
641 );
642 //
643 // If SubmitResources returns error, PciBus isn't able to start.
644 // It's a fatal error so assertion is added.
645 //
646 DEBUG ((DEBUG_INFO, "PciBus: HostBridge->SubmitResources() - %r\n", Status));
647 ASSERT_EFI_ERROR (Status);
648 }
649
650 //
651 // Free acpi resource node
652 //
653 if (AcpiConfig != NULL) {
654 FreePool (AcpiConfig);
655 }
656
657 if (EFI_ERROR (Status)) {
658 //
659 // Destroy all the resource tree
660 //
661 DestroyResourceTree (&IoPool);
662 DestroyResourceTree (&Mem32Pool);
663 DestroyResourceTree (&PMem32Pool);
664 DestroyResourceTree (&Mem64Pool);
665 DestroyResourceTree (&PMem64Pool);
666 return Status;
667 }
668 }
669
670 //
671 // End while, at least one Root Bridge should be found.
672 //
673 ASSERT (RootBridgeDev != NULL);
674
675 //
676 // Notify platform to start to program the resource
677 //
678 Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeAllocateResources);
679 DEBUG ((DEBUG_INFO, "PciBus: HostBridge->NotifyPhase(AllocateResources) - %r\n", Status));
680 if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
681 //
682 // If Hot Plug is not supported
683 //
684 if (EFI_ERROR (Status)) {
685 //
686 // Allocation failed, then return
687 //
688 return EFI_OUT_OF_RESOURCES;
689 }
690
691 //
692 // Allocation succeed.
693 // Get host bridge handle for status report, and then skip the main while
694 //
695 HandleExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
696
697 break;
698 } else {
699 //
700 // If Hot Plug is supported
701 //
702 if (!EFI_ERROR (Status)) {
703 //
704 // Allocation succeed, then continue the following
705 //
706 break;
707 }
708
709 //
710 // If the resource allocation is unsuccessful, free resources on bridge
711 //
712
713 RootBridgeDev = NULL;
714 RootBridgeHandle = 0;
715
716 IoResStatus = EFI_RESOURCE_SATISFIED;
717 Mem32ResStatus = EFI_RESOURCE_SATISFIED;
718 PMem32ResStatus = EFI_RESOURCE_SATISFIED;
719 Mem64ResStatus = EFI_RESOURCE_SATISFIED;
720 PMem64ResStatus = EFI_RESOURCE_SATISFIED;
721
722 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
723 //
724 // Get RootBridg Device by handle
725 //
726 RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
727 if (RootBridgeDev == NULL) {
728 return EFI_NOT_FOUND;
729 }
730
731 //
732 // Get host bridge handle for status report
733 //
734 HandleExtendedData.Handle = RootBridgeDev->PciRootBridgeIo->ParentHandle;
735
736 //
737 // Get acpi resource node for all the resource types
738 //
739 AcpiConfig = NULL;
740
741 Status = PciResAlloc->GetProposedResources (
742 PciResAlloc,
743 RootBridgeDev->Handle,
744 &AcpiConfig
745 );
746
747 if (EFI_ERROR (Status)) {
748 return Status;
749 }
750
751 if (AcpiConfig != NULL) {
752 //
753 // Adjust resource allocation policy for each RB
754 //
756 AcpiConfig,
757 &IoResStatus,
758 &Mem32ResStatus,
759 &PMem32ResStatus,
760 &Mem64ResStatus,
761 &PMem64ResStatus
762 );
763 FreePool (AcpiConfig);
764 }
765 }
766
767 //
768 // End while
769 //
770
771 //
772 // Raise the EFI_IOB_EC_RESOURCE_CONFLICT status code
773 //
774 //
775 // It is very difficult to follow the spec here
776 // Device path , Bar index can not be get here
777 //
778 ZeroMem (&AllocFailExtendedData, sizeof (AllocFailExtendedData));
779
782 EFI_IO_BUS_PCI | EFI_IOB_EC_RESOURCE_CONFLICT,
783 (VOID *)&AllocFailExtendedData,
784 sizeof (AllocFailExtendedData)
785 );
786
787 //
788 // When resource conflict happens, adjust the BAR size first.
789 // Only when adjusting BAR size doesn't help or BAR size cannot be adjusted,
790 // reject the device who requests largest resource that causes conflict.
791 //
792 ResizableBarAdjusted = FALSE;
793 if (ResizableBarNeedAdjust) {
794 ResizableBarAdjusted = AdjustPciDeviceBarSize (RootBridgeDev);
795 ResizableBarNeedAdjust = FALSE;
796 }
797
798 if (!ResizableBarAdjusted) {
800 &IoPool,
801 &Mem32Pool,
802 &PMem32Pool,
803 &Mem64Pool,
804 &PMem64Pool,
805 IoResStatus,
806 Mem32ResStatus,
807 PMem32ResStatus,
808 Mem64ResStatus,
809 PMem64ResStatus
810 );
811 }
812
813 //
814 // Destroy all the resource tree
815 //
816 DestroyResourceTree (&IoPool);
817 DestroyResourceTree (&Mem32Pool);
818 DestroyResourceTree (&PMem32Pool);
819 DestroyResourceTree (&Mem64Pool);
820 DestroyResourceTree (&PMem64Pool);
821
823
824 if (EFI_ERROR (Status)) {
825 return Status;
826 }
827 }
828 }
829
830 //
831 // End main while
832 //
833
834 //
835 // Raise the EFI_IOB_PCI_RES_ALLOC status code
836 //
839 EFI_IO_BUS_PCI | EFI_IOB_PCI_RES_ALLOC,
840 (VOID *)&HandleExtendedData,
841 sizeof (HandleExtendedData)
842 );
843
844 //
845 // Notify pci bus driver starts to program the resource
846 //
847 Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
848
849 if (EFI_ERROR (Status)) {
850 return Status;
851 }
852
853 RootBridgeDev = NULL;
854
855 RootBridgeHandle = 0;
856
857 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
858 //
859 // Get RootBridg Device by handle
860 //
861 RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
862
863 if (RootBridgeDev == NULL) {
864 return EFI_NOT_FOUND;
865 }
866
867 //
868 // Get acpi resource node for all the resource types
869 //
870 AcpiConfig = NULL;
871 Status = PciResAlloc->GetProposedResources (
872 PciResAlloc,
873 RootBridgeDev->Handle,
874 &AcpiConfig
875 );
876
877 if (EFI_ERROR (Status)) {
878 return Status;
879 }
880
881 //
882 // Get the resource base by interpreting acpi resource node
883 //
884 //
886 AcpiConfig,
887 &IoBase,
888 &Mem32Base,
889 &PMem32Base,
890 &Mem64Base,
891 &PMem64Base
892 );
893
894 //
895 // Create the entire system resource map from the information collected by
896 // enumerator. Several resource tree was created
897 //
898 FindResourceNode (RootBridgeDev, &IoPool, &IoBridge);
899 FindResourceNode (RootBridgeDev, &Mem32Pool, &Mem32Bridge);
900 FindResourceNode (RootBridgeDev, &PMem32Pool, &PMem32Bridge);
901 FindResourceNode (RootBridgeDev, &Mem64Pool, &Mem64Bridge);
902 FindResourceNode (RootBridgeDev, &PMem64Pool, &PMem64Bridge);
903
904 ASSERT (IoBridge != NULL);
905 ASSERT (Mem32Bridge != NULL);
906 ASSERT (PMem32Bridge != NULL);
907 ASSERT (Mem64Bridge != NULL);
908 ASSERT (PMem64Bridge != NULL);
909
910 //
911 // Program IO resources
912 //
914 IoBase,
915 IoBridge
916 );
917
918 //
919 // Program Mem32 resources
920 //
922 Mem32Base,
923 Mem32Bridge
924 );
925
926 //
927 // Program PMem32 resources
928 //
930 PMem32Base,
931 PMem32Bridge
932 );
933
934 //
935 // Program Mem64 resources
936 //
938 Mem64Base,
939 Mem64Bridge
940 );
941
942 //
943 // Program PMem64 resources
944 //
946 PMem64Base,
947 PMem64Bridge
948 );
949
950 //
951 // Process Option ROM for this root bridge after all BARs are programmed.
952 // The PPB's MEM32 RANGE BAR is re-programmed to the Option ROM BAR Base in order to
953 // shadow the Option ROM of the devices under the PPB.
954 // After the shadow, Option ROM BAR decoding is turned off and the PPB's MEM32 RANGE
955 // BAR is restored back to the original value.
956 // The original value is programmed by ProgramResource() above.
957 //
958 DEBUG ((
959 DEBUG_INFO,
960 "Process Option ROM: BAR Base/Length = %lx/%lx\n",
961 RootBridgeDev->PciBar[0].BaseAddress,
962 RootBridgeDev->PciBar[0].Length
963 ));
964 ProcessOptionRom (RootBridgeDev, RootBridgeDev->PciBar[0].BaseAddress, RootBridgeDev->PciBar[0].Length);
965
966 IoBridge->PciDev->PciBar[IoBridge->Bar].BaseAddress = IoBase;
967 Mem32Bridge->PciDev->PciBar[Mem32Bridge->Bar].BaseAddress = Mem32Base;
968 PMem32Bridge->PciDev->PciBar[PMem32Bridge->Bar].BaseAddress = PMem32Base;
969 Mem64Bridge->PciDev->PciBar[Mem64Bridge->Bar].BaseAddress = Mem64Base;
970 PMem64Bridge->PciDev->PciBar[PMem64Bridge->Bar].BaseAddress = PMem64Base;
971
972 //
973 // Dump the resource map for current root bridge
974 //
975 DEBUG_CODE (
976 PCI_RESOURCE_NODE *Resources[5];
977 Resources[0] = IoBridge;
978 Resources[1] = Mem32Bridge;
979 Resources[2] = PMem32Bridge;
980 Resources[3] = Mem64Bridge;
981 Resources[4] = PMem64Bridge;
982 DumpResourceMap (RootBridgeDev, Resources, ARRAY_SIZE (Resources));
983 );
984
985 FreePool (AcpiConfig);
986 }
987
988 //
989 // Destroy all the resource tree
990 //
991 DestroyResourceTree (&IoPool);
992 DestroyResourceTree (&Mem32Pool);
993 DestroyResourceTree (&PMem32Pool);
994 DestroyResourceTree (&Mem64Pool);
995 DestroyResourceTree (&PMem64Pool);
996
997 //
998 // Notify the resource allocation phase is to end
999 //
1000 Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
1001
1002 return Status;
1003}
1004
1020 IN PCI_IO_DEVICE *Bridge,
1021 IN UINT8 StartBusNumber,
1022 IN UINT8 NumberOfBuses,
1023 OUT UINT8 *NextBusNumber
1024 )
1025{
1026 PCI_IO_DEVICE *RootBridge;
1027 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *BusNumberRanges;
1028 UINT16 NextNumber;
1029 UINT64 MaxNumberInRange;
1030
1031 //
1032 // Get PCI Root Bridge device
1033 //
1034 RootBridge = Bridge;
1035 while (RootBridge->Parent != NULL) {
1036 RootBridge = RootBridge->Parent;
1037 }
1038
1039 //
1040 // Get next available PCI bus number
1041 //
1042 BusNumberRanges = RootBridge->BusNumberRanges;
1043 while (BusNumberRanges->Desc != ACPI_END_TAG_DESCRIPTOR) {
1044 MaxNumberInRange = BusNumberRanges->AddrRangeMin + BusNumberRanges->AddrLen - 1;
1045 if ((StartBusNumber >= BusNumberRanges->AddrRangeMin) && (StartBusNumber <= MaxNumberInRange)) {
1046 NextNumber = (StartBusNumber + NumberOfBuses);
1047 while (NextNumber > MaxNumberInRange) {
1048 ++BusNumberRanges;
1049 if (BusNumberRanges->Desc == ACPI_END_TAG_DESCRIPTOR) {
1050 return EFI_OUT_OF_RESOURCES;
1051 }
1052
1053 NextNumber = (UINT16)(NextNumber + (BusNumberRanges->AddrRangeMin - (MaxNumberInRange + 1)));
1054 MaxNumberInRange = BusNumberRanges->AddrRangeMin + BusNumberRanges->AddrLen - 1;
1055 }
1056
1057 *NextBusNumber = (UINT8)NextNumber;
1058 return EFI_SUCCESS;
1059 }
1060
1061 BusNumberRanges++;
1062 }
1063
1064 return EFI_OUT_OF_RESOURCES;
1065}
1066
1083 IN PCI_IO_DEVICE *Bridge,
1084 IN UINT8 StartBusNumber,
1085 OUT UINT8 *SubBusNumber,
1086 OUT UINT8 *PaddedBusRange
1087 )
1088{
1089 EFI_STATUS Status;
1090 PCI_TYPE00 Pci;
1091 UINT8 Device;
1092 UINT8 Func;
1093 UINT64 Address;
1094 UINT8 SecondBus;
1095 UINT8 PaddedSubBus;
1096 UINT16 Register;
1097 UINTN HpIndex;
1098 PCI_IO_DEVICE *PciDevice;
1099 EFI_EVENT Event;
1100 EFI_HPC_STATE State;
1101 UINT64 PciAddress;
1102 EFI_HPC_PADDING_ATTRIBUTES Attributes;
1103 VOID *DescriptorsBuffer;
1105 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *NextDescriptors;
1106 UINT16 BusRange;
1107 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
1108 BOOLEAN BusPadding;
1109 UINT32 TempReservedBusNum;
1110 BOOLEAN IsAriEnabled;
1111
1112 PciRootBridgeIo = Bridge->PciRootBridgeIo;
1113 SecondBus = 0;
1114 Register = 0;
1115 State = 0;
1116 Attributes = (EFI_HPC_PADDING_ATTRIBUTES)0;
1117 BusRange = 0;
1118 BusPadding = FALSE;
1119 PciDevice = NULL;
1120 PciAddress = 0;
1121 IsAriEnabled = FALSE;
1122 DescriptorsBuffer = NULL;
1123
1124 for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
1125 if (!IsAriEnabled) {
1126 TempReservedBusNum = 0;
1127 }
1128
1129 for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
1130 //
1131 // Check to see whether a pci device is present
1132 //
1133 Status = PciDevicePresent (
1134 PciRootBridgeIo,
1135 &Pci,
1136 StartBusNumber,
1137 Device,
1138 Func
1139 );
1140
1141 if (EFI_ERROR (Status) && (Func == 0)) {
1142 //
1143 // go to next device if there is no Function 0
1144 //
1145 break;
1146 }
1147
1148 if (EFI_ERROR (Status)) {
1149 continue;
1150 }
1151
1152 //
1153 // Get the PCI device information
1154 //
1155 Status = PciSearchDevice (
1156 Bridge,
1157 &Pci,
1158 StartBusNumber,
1159 Device,
1160 Func,
1161 &PciDevice
1162 );
1163
1164 if (EFI_ERROR (Status)) {
1165 continue;
1166 }
1167
1168 //
1169 // Per Pcie spec ARI Extended Capability
1170 // This capability must be implemented by each function in an ARI device.
1171 // It is not applicable to a Root Port, a Switch Downstream Port, an RCiEP, or a Root Complex Event Collector
1172 //
1173 if (((Device == 0) && (Func == 0)) && (PciDevice->IsAriEnabled)) {
1174 IsAriEnabled = TRUE;
1175 }
1176
1177 if (PciDevice->IsAriEnabled != IsAriEnabled) {
1178 DEBUG ((
1179 DEBUG_ERROR,
1180 "ERROR: %02x:%02x:%02x device ARI Feature(%x) is not consistent with others Function\n",
1181 StartBusNumber,
1182 Device,
1183 Func,
1184 PciDevice->IsAriEnabled
1185 ));
1186 return EFI_DEVICE_ERROR;
1187 }
1188
1189 PciAddress = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, 0);
1190
1191 if (!IS_PCI_BRIDGE (&Pci)) {
1192 //
1193 // PCI bridges will be called later
1194 // Here just need for PCI device or PCI to cardbus controller
1195 // EfiPciBeforeChildBusEnumeration for PCI Device Node
1196 //
1198 PciDevice,
1199 PciDevice->BusNumber,
1200 PciDevice->DeviceNumber,
1201 PciDevice->FunctionNumber,
1203 );
1204 }
1205
1206 if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1207 //
1208 // For Pci Hotplug controller devcie only
1209 //
1210 if (gPciHotPlugInit != NULL) {
1211 //
1212 // Check if it is a Hotplug PCI controller
1213 //
1214 if (IsRootPciHotPlugController (PciDevice->DevicePath, &HpIndex)) {
1215 gPciRootHpcData[HpIndex].Found = TRUE;
1216
1217 if (!gPciRootHpcData[HpIndex].Initialized) {
1218 Status = CreateEventForHpc (HpIndex, &Event);
1219
1220 ASSERT (!EFI_ERROR (Status));
1221
1222 Status = gPciHotPlugInit->InitializeRootHpc (
1223 gPciHotPlugInit,
1224 gPciRootHpcPool[HpIndex].HpcDevicePath,
1225 PciAddress,
1226 Event,
1227 &State
1228 );
1229
1231 PciDevice,
1232 PciDevice->BusNumber,
1233 PciDevice->DeviceNumber,
1234 PciDevice->FunctionNumber,
1236 );
1237 }
1238 }
1239 }
1240 }
1241
1242 if (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci)) {
1243 //
1244 // For PPB
1245 //
1246 if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1247 //
1248 // If Hot Plug is supported,
1249 // Get the bridge information
1250 //
1251 BusPadding = FALSE;
1252 if (gPciHotPlugInit != NULL) {
1253 if (IsPciHotPlugBus (PciDevice)) {
1254 //
1255 // If it is initialized, get the padded bus range
1256 //
1257 Status = gPciHotPlugInit->GetResourcePadding (
1258 gPciHotPlugInit,
1259 PciDevice->DevicePath,
1260 PciAddress,
1261 &State,
1262 &DescriptorsBuffer,
1263 &Attributes
1264 );
1265
1266 if (EFI_ERROR (Status)) {
1267 return Status;
1268 }
1269
1270 Descriptors = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)DescriptorsBuffer;
1271 BusRange = 0;
1272 NextDescriptors = Descriptors;
1273 Status = PciGetBusRange (
1274 &NextDescriptors,
1275 NULL,
1276 NULL,
1277 &BusRange
1278 );
1279
1280 FreePool (DescriptorsBuffer);
1281 DescriptorsBuffer = NULL;
1282 Descriptors = NULL;
1283
1284 if (!EFI_ERROR (Status)) {
1285 BusPadding = TRUE;
1286 } else if (Status != EFI_NOT_FOUND) {
1287 //
1288 // EFI_NOT_FOUND is not a real error. It indicates no bus number padding requested.
1289 //
1290 return Status;
1291 }
1292 }
1293 }
1294 }
1295
1296 Status = PciAllocateBusNumber (Bridge, *SubBusNumber, 1, SubBusNumber);
1297 if (EFI_ERROR (Status)) {
1298 return Status;
1299 }
1300
1301 SecondBus = *SubBusNumber;
1302
1303 Register = (UINT16)((SecondBus << 8) | (UINT16)StartBusNumber);
1304 Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, PCI_BRIDGE_PRIMARY_BUS_REGISTER_OFFSET);
1305
1306 Status = PciRootBridgeIo->Pci.Write (
1307 PciRootBridgeIo,
1308 EfiPciWidthUint16,
1309 Address,
1310 1,
1311 &Register
1312 );
1313
1314 //
1315 // If it is PPB, resursively search down this bridge
1316 //
1317 if (IS_PCI_BRIDGE (&Pci)) {
1318 //
1319 // Temporarily initialize SubBusNumber to maximum bus number to ensure the
1320 // PCI configuration transaction to go through any PPB
1321 //
1322 Register = PciGetMaxBusNumber (Bridge);
1323 Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET);
1324 Status = PciRootBridgeIo->Pci.Write (
1325 PciRootBridgeIo,
1326 EfiPciWidthUint8,
1327 Address,
1328 1,
1329 &Register
1330 );
1331
1332 //
1333 // Nofify EfiPciBeforeChildBusEnumeration for PCI Brige
1334 //
1336 PciDevice,
1337 PciDevice->BusNumber,
1338 PciDevice->DeviceNumber,
1339 PciDevice->FunctionNumber,
1341 );
1342
1343 Status = PciScanBus (
1344 PciDevice,
1345 SecondBus,
1346 SubBusNumber,
1347 PaddedBusRange
1348 );
1349 if (EFI_ERROR (Status)) {
1350 return Status;
1351 }
1352 }
1353
1354 if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport) && BusPadding) {
1355 //
1356 // Ensure the device is enabled and initialized
1357 //
1358 if ((Attributes == EfiPaddingPciRootBridge) &&
1359 ((State & EFI_HPC_STATE_ENABLED) != 0) &&
1360 ((State & EFI_HPC_STATE_INITIALIZED) != 0))
1361 {
1362 *PaddedBusRange = (UINT8)((UINT8)(BusRange) + *PaddedBusRange);
1363 } else {
1364 //
1365 // Reserve the larger one between the actual occupied bus number and padded bus number
1366 //
1367 Status = PciAllocateBusNumber (PciDevice, SecondBus, (UINT8)(BusRange), &PaddedSubBus);
1368 if (EFI_ERROR (Status)) {
1369 return Status;
1370 }
1371
1372 *SubBusNumber = MAX (PaddedSubBus, *SubBusNumber);
1373 }
1374 }
1375
1376 //
1377 // Set the current maximum bus number under the PPB
1378 //
1379 Address = EFI_PCI_ADDRESS (StartBusNumber, Device, Func, PCI_BRIDGE_SUBORDINATE_BUS_REGISTER_OFFSET);
1380
1381 Status = PciRootBridgeIo->Pci.Write (
1382 PciRootBridgeIo,
1383 EfiPciWidthUint8,
1384 Address,
1385 1,
1386 SubBusNumber
1387 );
1388 } else {
1389 //
1390 // It is device. Check PCI IOV for Bus reservation
1391 // Go through each function, just reserve the MAX ReservedBusNum for one device
1392 //
1393 if (PcdGetBool (PcdSrIovSupport) && (PciDevice->SrIovCapabilityOffset != 0)) {
1394 if (TempReservedBusNum < PciDevice->ReservedBusNum) {
1395 Status = PciAllocateBusNumber (PciDevice, *SubBusNumber, (UINT8)(PciDevice->ReservedBusNum - TempReservedBusNum), SubBusNumber);
1396 if (EFI_ERROR (Status)) {
1397 return Status;
1398 }
1399
1400 TempReservedBusNum = PciDevice->ReservedBusNum;
1401
1402 if (Func == 0) {
1403 DEBUG ((DEBUG_INFO, "PCI-IOV ScanBus - SubBusNumber - 0x%x\n", *SubBusNumber));
1404 } else {
1405 DEBUG ((DEBUG_INFO, "PCI-IOV ScanBus - SubBusNumber - 0x%x (Update)\n", *SubBusNumber));
1406 }
1407 }
1408 }
1409 }
1410
1411 if ((Func == 0) && !IS_PCI_MULTI_FUNC (&Pci)) {
1412 //
1413 // Skip sub functions, this is not a multi function device
1414 //
1415
1416 Func = PCI_MAX_FUNC;
1417 }
1418 }
1419 }
1420
1421 return EFI_SUCCESS;
1422}
1423
1435 IN PCI_IO_DEVICE *Bridge
1436 )
1437{
1438 LIST_ENTRY *CurrentLink;
1439 PCI_IO_DEVICE *Temp;
1440 EFI_HPC_STATE State;
1441 UINT64 PciAddress;
1442 EFI_STATUS Status;
1443
1444 CurrentLink = Bridge->ChildList.ForwardLink;
1445
1446 while (CurrentLink != NULL && CurrentLink != &Bridge->ChildList) {
1447 Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
1448
1449 if (IS_CARDBUS_BRIDGE (&Temp->Pci)) {
1450 if ((gPciHotPlugInit != NULL) && Temp->Allocated && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1451 //
1452 // Raise the EFI_IOB_PCI_HPC_INIT status code
1453 //
1456 EFI_IO_BUS_PCI | EFI_IOB_PCI_HPC_INIT,
1457 Temp->DevicePath
1458 );
1459
1460 PciAddress = EFI_PCI_ADDRESS (Temp->BusNumber, Temp->DeviceNumber, Temp->FunctionNumber, 0);
1461 Status = gPciHotPlugInit->InitializeRootHpc (
1462 gPciHotPlugInit,
1463 Temp->DevicePath,
1464 PciAddress,
1465 NULL,
1466 &State
1467 );
1468
1469 if (!EFI_ERROR (Status)) {
1470 Status = PciBridgeEnumerator (Temp);
1471
1472 if (EFI_ERROR (Status)) {
1473 return Status;
1474 }
1475 }
1476
1477 CurrentLink = CurrentLink->ForwardLink;
1478 continue;
1479 }
1480 }
1481
1482 if (!IsListEmpty (&Temp->ChildList)) {
1483 Status = PciRootBridgeP2CProcess (Temp);
1484 }
1485
1486 CurrentLink = CurrentLink->ForwardLink;
1487 }
1488
1489 return EFI_SUCCESS;
1490}
1491
1505 )
1506{
1507 EFI_HANDLE RootBridgeHandle;
1508 PCI_IO_DEVICE *RootBridgeDev;
1509 EFI_STATUS Status;
1510
1511 if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1512 return EFI_SUCCESS;
1513 }
1514
1515 RootBridgeHandle = NULL;
1516
1517 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
1518 //
1519 // Get RootBridg Device by handle
1520 //
1521 RootBridgeDev = GetRootBridgeByHandle (RootBridgeHandle);
1522
1523 if (RootBridgeDev == NULL) {
1524 return EFI_NOT_FOUND;
1525 }
1526
1527 Status = PciRootBridgeP2CProcess (RootBridgeDev);
1528 if (EFI_ERROR (Status)) {
1529 return Status;
1530 }
1531 }
1532
1533 return EFI_SUCCESS;
1534}
1535
1550 )
1551{
1552 EFI_HANDLE RootBridgeHandle;
1553 PCI_IO_DEVICE *RootBridgeDev;
1554 EFI_STATUS Status;
1555 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;
1556 UINT16 MinBus;
1558 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration;
1559 UINT8 StartBusNumber;
1560 LIST_ENTRY RootBridgeList;
1561 LIST_ENTRY *Link;
1562 EFI_STATUS RootBridgeEnumerationStatus;
1563
1564 if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1566 }
1567
1568 InitializeListHead (&RootBridgeList);
1569
1570 //
1571 // Notify the bus allocation phase is about to start
1572 //
1573 Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
1574
1575 if (EFI_ERROR (Status)) {
1576 return Status;
1577 }
1578
1579 DEBUG ((DEBUG_INFO, "PCI Bus First Scanning\n"));
1580 RootBridgeHandle = NULL;
1581 RootBridgeEnumerationStatus = EFI_SUCCESS;
1582 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
1583 //
1584 // if a root bridge instance is found, create root bridge device for it
1585 //
1586
1587 RootBridgeDev = CreateRootBridge (RootBridgeHandle);
1588
1589 if (RootBridgeDev == NULL) {
1590 return EFI_OUT_OF_RESOURCES;
1591 }
1592
1593 //
1594 // Enumerate all the buses under this root bridge
1595 //
1596 Status = PciRootBridgeEnumerator (
1597 PciResAlloc,
1598 RootBridgeDev
1599 );
1600
1601 if ((gPciHotPlugInit != NULL) && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1602 InsertTailList (&RootBridgeList, &(RootBridgeDev->Link));
1603 } else {
1604 DestroyRootBridge (RootBridgeDev);
1605 }
1606
1607 if (EFI_ERROR (Status)) {
1608 RootBridgeEnumerationStatus = Status;
1609 }
1610 }
1611
1612 //
1613 // Notify the bus allocation phase is finished for the first time
1614 //
1616
1617 if (EFI_ERROR (RootBridgeEnumerationStatus)) {
1618 return RootBridgeEnumerationStatus;
1619 }
1620
1621 if ((gPciHotPlugInit != NULL) && FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {
1622 //
1623 // Reset all assigned PCI bus number in all PPB
1624 //
1625 RootBridgeHandle = NULL;
1626 Link = GetFirstNode (&RootBridgeList);
1627 while ((PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) &&
1628 (!IsNull (&RootBridgeList, Link)))
1629 {
1630 RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (Link);
1631 //
1632 // Get the Bus information
1633 //
1634 Status = PciResAlloc->StartBusEnumeration (
1635 PciResAlloc,
1636 RootBridgeHandle,
1637 (VOID **)&Configuration
1638 );
1639 if (EFI_ERROR (Status)) {
1640 return Status;
1641 }
1642
1643 //
1644 // Get the bus number to start with
1645 //
1646 StartBusNumber = (UINT8)(Configuration->AddrRangeMin);
1647
1649 RootBridgeDev,
1650 StartBusNumber
1651 );
1652
1653 FreePool (Configuration);
1654 Link = RemoveEntryList (Link);
1655 DestroyRootBridge (RootBridgeDev);
1656 }
1657
1658 //
1659 // Wait for all HPC initialized
1660 //
1661 Status = AllRootHPCInitialized (STALL_1_SECOND * 15);
1662
1663 if (EFI_ERROR (Status)) {
1664 DEBUG ((DEBUG_ERROR, "Some root HPC failed to initialize\n"));
1665 return Status;
1666 }
1667
1668 //
1669 // Notify the bus allocation phase is about to start for the 2nd time
1670 //
1671 Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
1672
1673 if (EFI_ERROR (Status)) {
1674 return Status;
1675 }
1676
1677 DEBUG ((DEBUG_INFO, "PCI Bus Second Scanning\n"));
1678 RootBridgeHandle = NULL;
1679 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
1680 //
1681 // if a root bridge instance is found, create root bridge device for it
1682 //
1683 RootBridgeDev = CreateRootBridge (RootBridgeHandle);
1684
1685 if (RootBridgeDev == NULL) {
1686 return EFI_OUT_OF_RESOURCES;
1687 }
1688
1689 //
1690 // Enumerate all the buses under this root bridge
1691 //
1692 Status = PciRootBridgeEnumerator (
1693 PciResAlloc,
1694 RootBridgeDev
1695 );
1696
1697 DestroyRootBridge (RootBridgeDev);
1698 if (EFI_ERROR (Status)) {
1699 RootBridgeEnumerationStatus = Status;
1700 }
1701 }
1702
1703 //
1704 // Notify the bus allocation phase is to end for the 2nd time
1705 //
1707
1708 if (EFI_ERROR (RootBridgeEnumerationStatus)) {
1709 return RootBridgeEnumerationStatus;
1710 }
1711 }
1712
1713 //
1714 // Notify the resource allocation phase is to start
1715 //
1717
1718 if (EFI_ERROR (Status)) {
1719 return Status;
1720 }
1721
1722 RootBridgeHandle = NULL;
1723 while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
1724 //
1725 // if a root bridge instance is found, create root bridge device for it
1726 //
1727 RootBridgeDev = CreateRootBridge (RootBridgeHandle);
1728
1729 if (RootBridgeDev == NULL) {
1730 return EFI_OUT_OF_RESOURCES;
1731 }
1732
1733 Status = StartManagingRootBridge (RootBridgeDev);
1734
1735 if (EFI_ERROR (Status)) {
1736 return Status;
1737 }
1738
1739 PciRootBridgeIo = RootBridgeDev->PciRootBridgeIo;
1740 Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **)&Descriptors);
1741
1742 if (EFI_ERROR (Status)) {
1743 return Status;
1744 }
1745
1746 Status = PciGetBusRange (&Descriptors, &MinBus, NULL, NULL);
1747
1748 if (EFI_ERROR (Status)) {
1749 return Status;
1750 }
1751
1752 //
1753 // Determine root bridge attribute by calling interface of Pcihostbridge
1754 // protocol
1755 //
1757 PciResAlloc,
1758 RootBridgeDev
1759 );
1760
1761 //
1762 // Collect all the resource information under this root bridge
1763 // A database that records all the information about pci device subject to this
1764 // root bridge will then be created
1765 //
1766 Status = PciPciDeviceInfoCollector (
1767 RootBridgeDev,
1768 (UINT8)MinBus
1769 );
1770
1771 if (EFI_ERROR (Status)) {
1772 return Status;
1773 }
1774
1775 InsertRootBridge (RootBridgeDev);
1776
1777 //
1778 // Record the hostbridge handle
1779 //
1780 AddHostBridgeEnumerator (RootBridgeDev->PciRootBridgeIo->ParentHandle);
1781 }
1782
1783 return EFI_SUCCESS;
1784}
1785
1799 IN PCI_IO_DEVICE *PciIoDevice,
1800 IN PCI_RESIZABLE_BAR_OPERATION ResizableBarOp
1801 )
1802{
1803 EFI_PCI_IO_PROTOCOL *PciIo;
1804 UINT64 Capabilities;
1805 UINT32 Index;
1806 UINT32 Offset;
1807 INTN Bit;
1808 UINTN ResizableBarNumber;
1809 EFI_STATUS Status;
1811
1812 ASSERT (PciIoDevice->ResizableBarOffset != 0);
1813
1814 DEBUG ((
1815 DEBUG_INFO,
1816 " Programs Resizable BAR register, offset: 0x%08x, number: %d\n",
1817 PciIoDevice->ResizableBarOffset,
1818 PciIoDevice->ResizableBarNumber
1819 ));
1820
1821 ResizableBarNumber = MIN (PciIoDevice->ResizableBarNumber, PCI_MAX_BAR);
1822 PciIo = &PciIoDevice->PciIo;
1823 Status = PciIo->Pci.Read (
1824 PciIo,
1825 EfiPciIoWidthUint8,
1826 PciIoDevice->ResizableBarOffset + sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER),
1827 sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY) * ResizableBarNumber,
1828 (VOID *)(&Entries)
1829 );
1830 ASSERT_EFI_ERROR (Status);
1831
1832 for (Index = 0; Index < ResizableBarNumber; Index++) {
1833 //
1834 // When the bit of Capabilities Set, indicates that the Function supports
1835 // operating with the BAR sized to (2^Bit) MB.
1836 // Example:
1837 // Bit 0 is set: supports operating with the BAR sized to 1 MB
1838 // Bit 1 is set: supports operating with the BAR sized to 2 MB
1839 // Bit n is set: supports operating with the BAR sized to (2^n) MB
1840 //
1841 Capabilities = LShiftU64 (Entries[Index].ResizableBarControl.Bits.BarSizeCapability, 28)
1842 | Entries[Index].ResizableBarCapability.Bits.BarSizeCapability;
1843
1844 if (ResizableBarOp == PciResizableBarMax) {
1845 Bit = HighBitSet64 (Capabilities);
1846 } else {
1847 ASSERT (ResizableBarOp == PciResizableBarMin);
1848 Bit = LowBitSet64 (Capabilities);
1849 }
1850
1851 ASSERT (Bit >= 0);
1852
1853 Offset = PciIoDevice->ResizableBarOffset + sizeof (PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER)
1856
1857 Entries[Index].ResizableBarControl.Bits.BarSize = (UINT32)Bit;
1858 DEBUG ((
1859 DEBUG_INFO,
1860 " Resizable Bar: Offset = 0x%x, Bar Size Capability = 0x%016lx, New Bar Size = 0x%lx\n",
1861 OFFSET_OF (PCI_TYPE00, Device.Bar[Entries[Index].ResizableBarControl.Bits.BarIndex]),
1862 Capabilities,
1863 LShiftU64 (SIZE_1MB, Bit)
1864 ));
1865 PciIo->Pci.Write (
1866 PciIo,
1867 EfiPciIoWidthUint32,
1868 Offset,
1869 1,
1870 &Entries[Index].ResizableBarControl.Uint32
1871 );
1872 }
1873
1874 return EFI_SUCCESS;
1875}
UINT64 UINTN
INT64 INTN
PACKED struct @100 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:443
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:333
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
Definition: LinkedList.c:298
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
Definition: LinkedList.c:182
INTN EFIAPI LowBitSet64(IN UINT64 Operand)
Definition: LowBitSet64.c:27
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
Definition: LShiftU64.c:28
INTN EFIAPI HighBitSet64(IN UINT64 Operand)
Definition: HighBitSet64.c:27
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID RemoveRejectedPciDevices(IN EFI_HANDLE RootBridgeHandle, IN PCI_IO_DEVICE *Bridge)
Definition: PciLib.c:151
EFI_STATUS PciHostBridgeEnumerator(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc)
Definition: PciLib.c:1548
VOID DumpResourceMap(IN PCI_IO_DEVICE *Bridge, IN PCI_RESOURCE_NODE **Resources, IN UINTN ResourceCount)
Definition: PciLib.c:321
VOID GetBackPcCardBar(IN PCI_IO_DEVICE *PciIoDevice)
Definition: PciLib.c:73
VOID DumpBridgeResource(IN PCI_RESOURCE_NODE *BridgeResource)
Definition: PciLib.c:207
EFI_STATUS PciProgramResizableBar(IN PCI_IO_DEVICE *PciIoDevice, IN PCI_RESIZABLE_BAR_OPERATION ResizableBarOp)
Definition: PciLib.c:1798
UINT16 PciGetMaxBusNumber(IN PCI_IO_DEVICE *Bridge)
Definition: PciLib.c:37
EFI_STATUS PciHostBridgeP2CProcess(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc)
Definition: PciLib.c:1503
EFI_STATUS PciHostBridgeResourceAllocator(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc)
Definition: PciLib.c:469
EFI_STATUS PciScanBus(IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber, OUT UINT8 *SubBusNumber, OUT UINT8 *PaddedBusRange)
Definition: PciLib.c:1082
BOOLEAN AdjustPciDeviceBarSize(IN PCI_IO_DEVICE *RootBridgeDev)
Definition: PciLib.c:405
EFI_STATUS PciAllocateBusNumber(IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber, IN UINT8 NumberOfBuses, OUT UINT8 *NextBusNumber)
Definition: PciLib.c:1019
EFI_STATUS PciRootBridgeP2CProcess(IN PCI_IO_DEVICE *Bridge)
Definition: PciLib.c:1434
UINTN FindResourceNode(IN PCI_IO_DEVICE *Device, IN PCI_RESOURCE_NODE *BridgeResource, OUT PCI_RESOURCE_NODE **DeviceResources OPTIONAL)
Definition: PciLib.c:284
#define NULL
Definition: Base.h:319
#define MIN(a, b)
Definition: Base.h:1007
#define VOID
Definition: Base.h:269
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define GLOBAL_REMOVE_IF_UNREFERENCED
Definition: Base.h:48
#define MAX(a, b)
Definition: Base.h:992
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:463
#define DEBUG(Expression)
Definition: DebugLib.h:435
#define DEBUG_CODE(Expression)
Definition: DebugLib.h:591
#define REPORT_STATUS_CODE_WITH_DEVICE_PATH(Type, Value, DevicePathParameter)
#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type, Value, ExtendedData, ExtendedDataSize)
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
#define FeaturePcdGet(TokenName)
Definition: PcdLib.h:50
#define IS_PCI_BRIDGE(_p)
Definition: Pci22.h:504
#define IS_PCI_MULTI_FUNC(_p)
Definition: Pci22.h:526
#define IS_CARDBUS_BRIDGE(_p)
Definition: Pci22.h:515
PCI_IO_DEVICE * CreateRootBridge(IN EFI_HANDLE RootBridgeHandle)
VOID DestroyRootBridge(IN PCI_IO_DEVICE *RootBridge)
VOID InsertRootBridge(IN PCI_IO_DEVICE *RootBridge)
PCI_IO_DEVICE * GetRootBridgeByHandle(EFI_HANDLE RootBridgeHandle)
VOID FreePciDevice(IN PCI_IO_DEVICE *PciIoDevice)
VOID RemoveAllPciDeviceOnBridge(EFI_HANDLE RootBridgeHandle, PCI_IO_DEVICE *Bridge)
VOID GetResourceBase(IN VOID *Config, OUT UINT64 *IoBase, OUT UINT64 *Mem32Base, OUT UINT64 *PMem32Base, OUT UINT64 *Mem64Base, OUT UINT64 *PMem64Base)
EFI_STATUS PciRootBridgeEnumerator(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc, IN PCI_IO_DEVICE *RootBridgeDev)
VOID ProcessOptionRom(IN PCI_IO_DEVICE *Bridge, IN UINT64 RomBase, IN UINT64 MaxLength)
EFI_STATUS AddHostBridgeEnumerator(IN EFI_HANDLE HostBridgeHandle)
EFI_STATUS DetermineRootBridgeAttributes(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc, IN PCI_IO_DEVICE *RootBridgeDev)
VOID GetResourceAllocationStatus(VOID *AcpiConfig, OUT UINT64 *IoResStatus, OUT UINT64 *Mem32ResStatus, OUT UINT64 *PMem32ResStatus, OUT UINT64 *Mem64ResStatus, OUT UINT64 *PMem64ResStatus)
EFI_STATUS PreprocessController(IN PCI_IO_DEVICE *Bridge, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func, IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase)
UINT32 GetMaxOptionRomSize(IN PCI_IO_DEVICE *Bridge)
EFI_STATUS PciBridgeEnumerator(IN PCI_IO_DEVICE *BridgeDev)
EFI_STATUS PciHostBridgeAdjustAllocation(IN PCI_RESOURCE_NODE *IoPool, IN PCI_RESOURCE_NODE *Mem32Pool, IN PCI_RESOURCE_NODE *PMem32Pool, IN PCI_RESOURCE_NODE *Mem64Pool, IN PCI_RESOURCE_NODE *PMem64Pool, IN UINT64 IoResStatus, IN UINT64 Mem32ResStatus, IN UINT64 PMem32ResStatus, IN UINT64 Mem64ResStatus, IN UINT64 PMem64ResStatus)
EFI_STATUS ConstructAcpiResourceRequestor(IN PCI_IO_DEVICE *Bridge, IN PCI_RESOURCE_NODE *IoNode, IN PCI_RESOURCE_NODE *Mem32Node, IN PCI_RESOURCE_NODE *PMem32Node, IN PCI_RESOURCE_NODE *Mem64Node, IN PCI_RESOURCE_NODE *PMem64Node, OUT VOID **Config)
EFI_STATUS NotifyPhase(IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc, EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase)
EFI_STATUS PciPciDeviceInfoCollector(IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber)
EFI_STATUS StartManagingRootBridge(IN PCI_IO_DEVICE *RootBridgeDev)
EFI_STATUS PciDevicePresent(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo, OUT PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func)
EFI_STATUS PciSearchDevice(IN PCI_IO_DEVICE *Bridge, IN PCI_TYPE00 *Pci, IN UINT8 Bus, IN UINT8 Device, IN UINT8 Func, OUT PCI_IO_DEVICE **PciDevice)
VOID DumpPciBars(IN PCI_IO_DEVICE *PciIoDevice)
VOID ResetAllPpbBusNumber(IN PCI_IO_DEVICE *Bridge, IN UINT8 StartBusNumber)
UINTN PciParseBar(IN PCI_IO_DEVICE *PciIoDevice, IN UINTN Offset, IN UINTN BarIndex)
BOOLEAN IsPciDeviceRejected(IN PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS PciGetBusRange(IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors, OUT UINT16 *MinBus, OUT UINT16 *MaxBus, OUT UINT16 *BusRange)
#define EFI_RESOURCE_SATISFIED
@ EfiPciHostBridgeBeginResourceAllocation
@ EfiPciHostBridgeAllocateResources
@ EfiPciHostBridgeBeginBusAllocation
@ EfiPciHostBridgeEndResourceAllocation
@ EfiPciHostBridgeEndBusAllocation
#define EFI_HPC_STATE_ENABLED
EFI_HPC_PADDING_ATTRIBUTES
@ EfiPaddingPciRootBridge
UINT16 EFI_HPC_STATE
#define EFI_HPC_STATE_INITIALIZED
EFI_STATUS CreateEventForHpc(IN UINTN HpIndex, OUT EFI_EVENT *Event)
BOOLEAN IsRootPciHotPlugController(IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath, OUT UINTN *HpIndex)
VOID GetResourcePaddingForHpb(IN PCI_IO_DEVICE *PciIoDevice)
BOOLEAN IsPciHotPlugBus(PCI_IO_DEVICE *PciIoDevice)
EFI_STATUS AllRootHPCInitialized(IN UINTN TimeoutInMicroSeconds)
EFI_STATUS InitializeHotPlugSupport(VOID)
VOID GetResourceFromDevice(IN PCI_IO_DEVICE *PciDev, IN OUT PCI_RESOURCE_NODE *IoNode, IN OUT PCI_RESOURCE_NODE *Mem32Node, IN OUT PCI_RESOURCE_NODE *PMem32Node, IN OUT PCI_RESOURCE_NODE *Mem64Node, IN OUT PCI_RESOURCE_NODE *PMem64Node)
EFI_STATUS ProgramResource(IN UINT64 Base, IN PCI_RESOURCE_NODE *Bridge)
VOID CreateResourceMap(IN PCI_IO_DEVICE *Bridge, IN OUT PCI_RESOURCE_NODE *IoNode, IN OUT PCI_RESOURCE_NODE *Mem32Node, IN OUT PCI_RESOURCE_NODE *PMem32Node, IN OUT PCI_RESOURCE_NODE *Mem64Node, IN OUT PCI_RESOURCE_NODE *PMem64Node)
VOID InitializeResourcePool(IN OUT PCI_RESOURCE_NODE *ResourcePool, IN PCI_BAR_TYPE ResourceType)
VOID InsertResourceNode(IN OUT PCI_RESOURCE_NODE *Bridge, IN PCI_RESOURCE_NODE *ResNode)
PCI_RESOURCE_NODE * CreateResourceNode(IN PCI_IO_DEVICE *PciDev, IN UINT64 Length, IN UINT64 Alignment, IN UINT8 Bar, IN PCI_BAR_TYPE ResType, IN PCI_RESOURCE_USAGE ResUsage)
VOID DestroyResourceTree(IN PCI_RESOURCE_NODE *Bridge)
#define EFI_PROGRESS_CODE
Definition: PiStatusCode.h:44
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_INITIALIZE_ROOT_HPC InitializeRootHpc
EFI_GET_HOT_PLUG_PADDING GetResourcePadding
EFI_PCI_IO_PROTOCOL_CONFIG Read
Definition: PciIo.h:232
EFI_PCI_IO_PROTOCOL_CONFIG Write
Definition: PciIo.h:236
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_IO_MEM Write