]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBridgeLibNull.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Library / PciHostBridgeLibNull / PciHostBridgeLibNull.c
... / ...
CommitLineData
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
5\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9#include <PiDxe.h>\r
10#include <Library/PciHostBridgeLib.h>\r
11#include <Library/DebugLib.h>\r
12\r
13GLOBAL_REMOVE_IF_UNREFERENCED\r
14CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {\r
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
38 Free the root bridge instances array returned from PciHostBridgeGetRootBridges().\r
39\r
40 @param Bridges The root bridge instances array.\r
41 @param Count The count of the array.\r
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
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
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
84 (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /\r
85 sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0])\r
86 )\r
87 );\r
88 DEBUG ((EFI_D_ERROR, " %s: Length/Alignment = 0x%lx / 0x%lx\n",\r
89 mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType],\r
90 Descriptor->AddrLen, Descriptor->AddrRangeMax\r
91 ));\r
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
95 ((Descriptor->SpecificFlag &\r
96 EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE\r
97 ) != 0) ? L" (Prefetchable)" : L""\r
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
105 Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(\r
106 (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1\r
107 );\r
108 }\r
109}\r