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