]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBridgeLibNull.c
IntelSiliconPkg: Replace BSD License with BSD+Patent License
[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
LE
5\r
6 This program and the accompanying materials are licensed and made available\r
7 under the terms and conditions of the BSD License which accompanies this\r
8 distribution. The full text of the license may be found at\r
7ff66d3c
RN
9 http://opensource.org/licenses/bsd-license.php.\r
10\r
9b6b9385
LE
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
12 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
7ff66d3c
RN
13\r
14**/\r
15#include <PiDxe.h>\r
16#include <Library/PciHostBridgeLib.h>\r
17#include <Library/DebugLib.h>\r
18\r
9b6b9385
LE
19GLOBAL_REMOVE_IF_UNREFERENCED\r
20CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {\r
7ff66d3c
RN
21 L"Mem", L"I/O", L"Bus"\r
22};\r
23\r
24/**\r
25 Return all the root bridge instances in an array.\r
26\r
27 @param Count Return the count of root bridge instances.\r
28\r
29 @return All the root bridge instances in an array.\r
30 The array should be passed into PciHostBridgeFreeRootBridges()\r
31 when it's not used.\r
32**/\r
33PCI_ROOT_BRIDGE *\r
34EFIAPI\r
35PciHostBridgeGetRootBridges (\r
36 UINTN *Count\r
37 )\r
38{\r
39 *Count = 0;\r
40 return NULL;\r
41}\r
42\r
43/**\r
eea222ce 44 Free the root bridge instances array returned from PciHostBridgeGetRootBridges().\r
7ff66d3c 45\r
eea222ce
RN
46 @param Bridges The root bridge instances array.\r
47 @param Count The count of the array.\r
7ff66d3c
RN
48**/\r
49VOID\r
50EFIAPI\r
51PciHostBridgeFreeRootBridges (\r
52 PCI_ROOT_BRIDGE *Bridges,\r
53 UINTN Count\r
54 )\r
55{\r
56 return;\r
57}\r
58\r
59/**\r
60 Inform the platform that the resource conflict happens.\r
61\r
62 @param HostBridgeHandle Handle of the Host Bridge.\r
9b6b9385
LE
63 @param Configuration Pointer to PCI I/O and PCI memory resource\r
64 descriptors. The Configuration contains the resources\r
65 for all the root bridges. The resource for each root\r
66 bridge is terminated with END descriptor and an\r
67 additional END is appended indicating the end of the\r
68 entire resources. The resource descriptor field\r
69 values follow the description in\r
70 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL\r
71 .SubmitResources().\r
7ff66d3c
RN
72**/\r
73VOID\r
74EFIAPI\r
75PciHostBridgeResourceConflict (\r
76 EFI_HANDLE HostBridgeHandle,\r
77 VOID *Configuration\r
78 )\r
79{\r
80 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;\r
81 UINTN RootBridgeIndex;\r
82 DEBUG ((EFI_D_ERROR, "PciHostBridge: Resource conflict happens!\n"));\r
83\r
84 RootBridgeIndex = 0;\r
85 Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;\r
86 while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {\r
87 DEBUG ((EFI_D_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));\r
88 for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {\r
89 ASSERT (Descriptor->ResType <\r
9b6b9385
LE
90 (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /\r
91 sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0])\r
92 )\r
7ff66d3c
RN
93 );\r
94 DEBUG ((EFI_D_ERROR, " %s: Length/Alignment = 0x%lx / 0x%lx\n",\r
9b6b9385
LE
95 mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType],\r
96 Descriptor->AddrLen, Descriptor->AddrRangeMax\r
97 ));\r
7ff66d3c
RN
98 if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {\r
99 DEBUG ((EFI_D_ERROR, " Granularity/SpecificFlag = %ld / %02x%s\n",\r
100 Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag,\r
9b6b9385
LE
101 ((Descriptor->SpecificFlag &\r
102 EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE\r
103 ) != 0) ? L" (Prefetchable)" : L""\r
7ff66d3c
RN
104 ));\r
105 }\r
106 }\r
107 //\r
108 // Skip the END descriptor for root bridge\r
109 //\r
110 ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);\r
9b6b9385
LE
111 Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(\r
112 (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1\r
113 );\r
7ff66d3c
RN
114 }\r
115}\r