]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/PciHostBridgeLib.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Include / Library / PciHostBridgeLib.h
CommitLineData
9e9a30bd
RN
1/** @file\r
2 PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning\r
3 the platform specific information about the PCI Host Bridge.\r
4\r
5 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9e9a30bd
RN
7\r
8**/\r
9#ifndef __PCI_HOST_BRIDGE_LIB_H__\r
10#define __PCI_HOST_BRIDGE_LIB_H__\r
11\r
12//\r
13// (Base > Limit) indicates an aperture is not available.\r
14//\r
15typedef struct {\r
5bb1866e
HG
16 //\r
17 // Base and Limit are the device address instead of host address when\r
18 // Translation is not zero\r
19 //\r
9e9a30bd
RN
20 UINT64 Base;\r
21 UINT64 Limit;\r
5bb1866e
HG
22 //\r
23 // According to UEFI 2.7, Device Address = Host Address + Translation,\r
24 // so Translation = Device Address - Host Address.\r
25 // On platforms where Translation is not zero, the subtraction is probably to\r
26 // be performed with UINT64 wrap-around semantics, for we may translate an\r
27 // above-4G host address into a below-4G device address for legacy PCIe device\r
28 // compatibility.\r
29 //\r
30 // NOTE: The alignment of Translation is required to be larger than any BAR\r
31 // alignment in the same root bridge, so that the same alignment can be\r
32 // applied to both device address and host address, which simplifies the\r
33 // situation and makes the current resource allocation code in generic PCI\r
34 // host bridge driver still work.\r
35 //\r
36 UINT64 Translation;\r
9e9a30bd
RN
37} PCI_ROOT_BRIDGE_APERTURE;\r
38\r
39typedef struct {\r
3da82965
LE
40 UINT32 Segment; ///< Segment number.\r
41 UINT64 Supports; ///< Supported attributes.\r
42 ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()\r
43 ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
44 UINT64 Attributes; ///< Initial attributes.\r
45 ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()\r
46 ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
47 BOOLEAN DmaAbove4G; ///< DMA above 4GB memory.\r
48 ///< Set to TRUE when root bridge supports DMA above 4GB memory.\r
014b4720
LE
49 BOOLEAN NoExtendedConfigSpace; ///< When FALSE, the root bridge supports\r
50 ///< Extended (4096-byte) Configuration Space.\r
51 ///< When TRUE, the root bridge supports\r
52 ///< 256-byte Configuration Space only.\r
c5be19f3
RN
53 BOOLEAN ResourceAssigned; ///< Resource assignment status of the root bridge.\r
54 ///< Set to TRUE if Bus/IO/MMIO resources for root bridge have been assigned.\r
3da82965
LE
55 UINT64 AllocationAttributes; ///< Allocation attributes.\r
56 ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and\r
57 ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes()\r
58 ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
59 PCI_ROOT_BRIDGE_APERTURE Bus; ///< Bus aperture which can be used by the root bridge.\r
60 PCI_ROOT_BRIDGE_APERTURE Io; ///< IO aperture which can be used by the root bridge.\r
61 PCI_ROOT_BRIDGE_APERTURE Mem; ///< MMIO aperture below 4GB which can be used by the root bridge.\r
62 PCI_ROOT_BRIDGE_APERTURE MemAbove4G; ///< MMIO aperture above 4GB which can be used by the root bridge.\r
63 PCI_ROOT_BRIDGE_APERTURE PMem; ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge.\r
64 PCI_ROOT_BRIDGE_APERTURE PMemAbove4G; ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge.\r
65 EFI_DEVICE_PATH_PROTOCOL *DevicePath; ///< Device path.\r
9e9a30bd
RN
66} PCI_ROOT_BRIDGE;\r
67\r
68/**\r
69 Return all the root bridge instances in an array.\r
70\r
71 @param Count Return the count of root bridge instances.\r
72\r
73 @return All the root bridge instances in an array.\r
74 The array should be passed into PciHostBridgeFreeRootBridges()\r
75 when it's not used.\r
76**/\r
77PCI_ROOT_BRIDGE *\r
78EFIAPI\r
79PciHostBridgeGetRootBridges (\r
80 UINTN *Count\r
81 );\r
82\r
83/**\r
84 Free the root bridge instances array returned from PciHostBridgeGetRootBridges().\r
85\r
eea222ce
RN
86 @param Bridges The root bridge instances array.\r
87 @param Count The count of the array.\r
9e9a30bd
RN
88**/\r
89VOID\r
90EFIAPI\r
91PciHostBridgeFreeRootBridges (\r
92 PCI_ROOT_BRIDGE *Bridges,\r
93 UINTN Count\r
94 );\r
95\r
96/**\r
97 Inform the platform that the resource conflict happens.\r
98\r
99 @param HostBridgeHandle Handle of the Host Bridge.\r
100 @param Configuration Pointer to PCI I/O and PCI memory resource descriptors.\r
101 The Configuration contains the resources for all the\r
102 root bridges. The resource for each root bridge is\r
103 terminated with END descriptor and an additional END\r
104 is appended indicating the end of the entire resources.\r
105 The resource descriptor field values follow the description\r
106 in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources().\r
107**/\r
108VOID\r
109EFIAPI\r
110PciHostBridgeResourceConflict (\r
111 EFI_HANDLE HostBridgeHandle,\r
112 VOID *Configuration\r
113 );\r
114\r
115#endif\r