]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/PciHostBridgeLibNull/PciHostBridgeLibNull.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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 13GLOBAL_REMOVE_IF_UNREFERENCED\r
1436aea4 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
1436aea4 30 UINTN *Count\r
7ff66d3c
RN
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
1436aea4
MK
46 PCI_ROOT_BRIDGE *Bridges,\r
47 UINTN Count\r
7ff66d3c
RN
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
1436aea4
MK
70 EFI_HANDLE HostBridgeHandle,\r
71 VOID *Configuration\r
7ff66d3c
RN
72 )\r
73{\r
1436aea4
MK
74 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;\r
75 UINTN RootBridgeIndex;\r
76\r
87000d77 77 DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n"));\r
7ff66d3c
RN
78\r
79 RootBridgeIndex = 0;\r
1436aea4 80 Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)Configuration;\r
7ff66d3c 81 while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {\r
87000d77 82 DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));\r
1436aea4
MK
83 for ( ; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {\r
84 ASSERT (\r
85 Descriptor->ResType <\r
86 (sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /\r
87 sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0])\r
88 )\r
89 );\r
90 DEBUG ((\r
91 DEBUG_ERROR,\r
92 " %s: Length/Alignment = 0x%lx / 0x%lx\n",\r
93 mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType],\r
94 Descriptor->AddrLen,\r
95 Descriptor->AddrRangeMax\r
96 ));\r
7ff66d3c 97 if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {\r
1436aea4
MK
98 DEBUG ((\r
99 DEBUG_ERROR,\r
100 " Granularity/SpecificFlag = %ld / %02x%s\n",\r
101 Descriptor->AddrSpaceGranularity,\r
102 Descriptor->SpecificFlag,\r
103 ((Descriptor->SpecificFlag &\r
104 EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE\r
105 ) != 0) ? L" (Prefetchable)" : L""\r
106 ));\r
7ff66d3c
RN
107 }\r
108 }\r
1436aea4 109\r
7ff66d3c
RN
110 //\r
111 // Skip the END descriptor for root bridge\r
112 //\r
113 ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);\r
9b6b9385 114 Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(\r
1436aea4
MK
115 (EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1\r
116 );\r
7ff66d3c
RN
117 }\r
118}\r