1 | /** @file
|
---|
2 | Null instance of PCI Host Bridge Library with empty functions.
|
---|
3 |
|
---|
4 | Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
|
---|
5 |
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 | #include <PiDxe.h>
|
---|
10 | #include <Library/PciHostBridgeLib.h>
|
---|
11 | #include <Library/DebugLib.h>
|
---|
12 |
|
---|
13 | GLOBAL_REMOVE_IF_UNREFERENCED
|
---|
14 | CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
|
---|
15 | L"Mem", L"I/O", L"Bus"
|
---|
16 | };
|
---|
17 |
|
---|
18 | /**
|
---|
19 | Return all the root bridge instances in an array.
|
---|
20 |
|
---|
21 | @param Count Return the count of root bridge instances.
|
---|
22 |
|
---|
23 | @return All the root bridge instances in an array.
|
---|
24 | The array should be passed into PciHostBridgeFreeRootBridges()
|
---|
25 | when it's not used.
|
---|
26 | **/
|
---|
27 | PCI_ROOT_BRIDGE *
|
---|
28 | EFIAPI
|
---|
29 | PciHostBridgeGetRootBridges (
|
---|
30 | UINTN *Count
|
---|
31 | )
|
---|
32 | {
|
---|
33 | *Count = 0;
|
---|
34 | return NULL;
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | Free the root bridge instances array returned from PciHostBridgeGetRootBridges().
|
---|
39 |
|
---|
40 | @param Bridges The root bridge instances array.
|
---|
41 | @param Count The count of the array.
|
---|
42 | **/
|
---|
43 | VOID
|
---|
44 | EFIAPI
|
---|
45 | PciHostBridgeFreeRootBridges (
|
---|
46 | PCI_ROOT_BRIDGE *Bridges,
|
---|
47 | UINTN Count
|
---|
48 | )
|
---|
49 | {
|
---|
50 | return;
|
---|
51 | }
|
---|
52 |
|
---|
53 | /**
|
---|
54 | Inform the platform that the resource conflict happens.
|
---|
55 |
|
---|
56 | @param HostBridgeHandle Handle of the Host Bridge.
|
---|
57 | @param Configuration Pointer to PCI I/O and PCI memory resource
|
---|
58 | descriptors. The Configuration contains the resources
|
---|
59 | for all the root bridges. The resource for each root
|
---|
60 | bridge is terminated with END descriptor and an
|
---|
61 | additional END is appended indicating the end of the
|
---|
62 | entire resources. The resource descriptor field
|
---|
63 | values follow the description in
|
---|
64 | EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
|
---|
65 | .SubmitResources().
|
---|
66 | **/
|
---|
67 | VOID
|
---|
68 | EFIAPI
|
---|
69 | PciHostBridgeResourceConflict (
|
---|
70 | EFI_HANDLE HostBridgeHandle,
|
---|
71 | VOID *Configuration
|
---|
72 | )
|
---|
73 | {
|
---|
74 | EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
|
---|
75 | UINTN RootBridgeIndex;
|
---|
76 | DEBUG ((EFI_D_ERROR, "PciHostBridge: Resource conflict happens!\n"));
|
---|
77 |
|
---|
78 | RootBridgeIndex = 0;
|
---|
79 | Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;
|
---|
80 | while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
|
---|
81 | DEBUG ((EFI_D_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));
|
---|
82 | for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {
|
---|
83 | ASSERT (Descriptor->ResType <
|
---|
84 | (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /
|
---|
85 | sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0])
|
---|
86 | )
|
---|
87 | );
|
---|
88 | DEBUG ((EFI_D_ERROR, " %s: Length/Alignment = 0x%lx / 0x%lx\n",
|
---|
89 | mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType],
|
---|
90 | Descriptor->AddrLen, Descriptor->AddrRangeMax
|
---|
91 | ));
|
---|
92 | if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {
|
---|
93 | DEBUG ((EFI_D_ERROR, " Granularity/SpecificFlag = %ld / %02x%s\n",
|
---|
94 | Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag,
|
---|
95 | ((Descriptor->SpecificFlag &
|
---|
96 | EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE
|
---|
97 | ) != 0) ? L" (Prefetchable)" : L""
|
---|
98 | ));
|
---|
99 | }
|
---|
100 | }
|
---|
101 | //
|
---|
102 | // Skip the END descriptor for root bridge
|
---|
103 | //
|
---|
104 | ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);
|
---|
105 | Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(
|
---|
106 | (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1
|
---|
107 | );
|
---|
108 | }
|
---|
109 | }
|
---|