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