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