]>
Commit | Line | Data |
---|---|---|
5879b875 | 1 | /** @file\r |
d7132512 | 2 | This file declares PciCfg2 PPI.\r |
5879b875 | 3 | \r |
9095d37b | 4 | This ppi Provides platform or chipset-specific access to\r |
d7132512 LG |
5 | the PCI configuration space for a specific PCI segment.\r |
6 | \r | |
9095d37b | 7 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
5879b875 | 9 | \r |
5879b875 | 10 | @par Revision Reference:\r |
0047820e | 11 | This PPI is introduced in PI Version 1.0.\r |
5879b875 | 12 | \r |
13 | **/\r | |
14 | \r | |
15 | #ifndef __PEI_PCI_CFG2_H__\r | |
16 | #define __PEI_PCI_CFG2_H__\r | |
17 | \r | |
de1fad68 LG |
18 | #include <Library/BaseLib.h>\r |
19 | \r | |
5879b875 | 20 | #define EFI_PEI_PCI_CFG2_PPI_GUID \\r |
21 | { 0x57a449a, 0x1fdc, 0x4c06, { 0xbf, 0xc9, 0xf5, 0x3f, 0x6a, 0x99, 0xbb, 0x92 } }\r | |
22 | \r | |
2f88bd3a | 23 | typedef struct _EFI_PEI_PCI_CFG2_PPI EFI_PEI_PCI_CFG2_PPI;\r |
5879b875 | 24 | \r |
2f88bd3a | 25 | #define EFI_PEI_PCI_CFG_ADDRESS(bus, dev, func, reg) \\r |
de1fad68 LG |
26 | (UINT64) ( \\r |
27 | (((UINTN) bus) << 24) | \\r | |
28 | (((UINTN) dev) << 16) | \\r | |
29 | (((UINTN) func) << 8) | \\r | |
fbd26c4b | 30 | (((UINTN) (reg)) < 256 ? ((UINTN) (reg)) : (UINT64) (LShiftU64 ((UINT64) (reg), 32))))\r |
5879b875 | 31 | \r |
06889842 | 32 | ///\r |
33 | /// EFI_PEI_PCI_CFG_PPI_WIDTH\r | |
34 | ///\r | |
5879b875 | 35 | typedef enum {\r |
97c4afff | 36 | ///\r |
37 | /// 8-bit access\r | |
38 | ///\r | |
2f88bd3a | 39 | EfiPeiPciCfgWidthUint8 = 0,\r |
97c4afff | 40 | ///\r |
41 | /// 16-bit access\r | |
42 | ///\r | |
5879b875 | 43 | EfiPeiPciCfgWidthUint16 = 1,\r |
97c4afff | 44 | ///\r |
45 | /// 32-bit access\r | |
46 | ///\r | |
5879b875 | 47 | EfiPeiPciCfgWidthUint32 = 2,\r |
97c4afff | 48 | ///\r |
49 | /// 64-bit access\r | |
50 | ///\r | |
5879b875 | 51 | EfiPeiPciCfgWidthUint64 = 3,\r |
52 | EfiPeiPciCfgWidthMaximum\r | |
53 | } EFI_PEI_PCI_CFG_PPI_WIDTH;\r | |
54 | \r | |
06889842 | 55 | ///\r |
56 | /// EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS\r | |
57 | ///\r | |
5879b875 | 58 | typedef struct {\r |
11227adb | 59 | ///\r |
60 | /// 8-bit register offset within the PCI configuration space for a given device's function\r | |
61 | /// space.\r | |
62 | ///\r | |
2f88bd3a | 63 | UINT8 Register;\r |
11227adb | 64 | ///\r |
65 | /// Only the 3 least-significant bits are used to encode one of 8 possible functions within a\r | |
66 | /// given device.\r | |
67 | ///\r | |
2f88bd3a | 68 | UINT8 Function;\r |
11227adb | 69 | ///\r |
70 | /// Only the 5 least-significant bits are used to encode one of 32 possible devices.\r | |
71 | ///\r | |
2f88bd3a | 72 | UINT8 Device;\r |
11227adb | 73 | ///\r |
74 | /// 8-bit value to encode between 0 and 255 buses.\r | |
75 | ///\r | |
2f88bd3a | 76 | UINT8 Bus;\r |
11227adb | 77 | ///\r |
78 | /// Register number in PCI configuration space. If this field is zero, then Register is used\r | |
79 | /// for the register number. If this field is non-zero, then Register is ignored and this field\r | |
80 | /// is used for the register number.\r | |
81 | ///\r | |
2f88bd3a | 82 | UINT32 ExtendedRegister;\r |
5879b875 | 83 | } EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS;\r |
84 | \r | |
85 | /**\r | |
86 | Reads from or write to a given location in the PCI configuration space.\r | |
87 | \r | |
88 | @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r | |
89 | \r | |
90 | @param This Pointer to local data for the interface.\r | |
91 | \r | |
845effb3 | 92 | @param Width The width of the access. Enumerated in bytes.\r |
5879b875 | 93 | See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r |
94 | \r | |
845effb3 | 95 | @param Address The physical address of the access. The format of\r |
5879b875 | 96 | the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r |
97 | \r | |
98 | @param Buffer A pointer to the buffer of data..\r | |
99 | \r | |
100 | \r | |
101 | @retval EFI_SUCCESS The function completed successfully.\r | |
102 | \r | |
103 | @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r | |
104 | \r | |
105 | @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r | |
106 | time.\r | |
107 | \r | |
108 | **/\r | |
109 | typedef\r | |
110 | EFI_STATUS\r | |
8b13229b | 111 | (EFIAPI *EFI_PEI_PCI_CFG2_PPI_IO)(\r |
00edb218 A |
112 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
113 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
ef4fa1a4 | 114 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r |
115 | IN UINT64 Address,\r | |
5879b875 | 116 | IN OUT VOID *Buffer\r |
2f88bd3a | 117 | );\r |
5879b875 | 118 | \r |
119 | /**\r | |
9095d37b | 120 | Performs a read-modify-write operation on the contents\r |
d7132512 | 121 | from a given location in the PCI configuration space.\r |
5879b875 | 122 | \r |
845effb3 | 123 | @param PeiServices An indirect pointer to the PEI Services Table\r |
5879b875 | 124 | published by the PEI Foundation.\r |
125 | \r | |
126 | @param This Pointer to local data for the interface.\r | |
127 | \r | |
128 | @param Width The width of the access. Enumerated in bytes. Type\r | |
129 | EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r | |
130 | \r | |
131 | @param Address The physical address of the access.\r | |
132 | \r | |
845effb3 | 133 | @param SetBits Points to value to bitwise-OR with the read configuration value.\r |
5879b875 | 134 | \r |
135 | The size of the value is determined by Width.\r | |
136 | \r | |
845effb3 | 137 | @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r |
5879b875 | 138 | The size of the value is determined by Width.\r |
139 | \r | |
140 | \r | |
141 | @retval EFI_SUCCESS The function completed successfully.\r | |
142 | \r | |
143 | @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r | |
144 | \r | |
845effb3 | 145 | @retval EFI_DEVICE_NOT_READY The device is not capable of supporting\r |
5879b875 | 146 | the operation at this time.\r |
147 | \r | |
148 | **/\r | |
149 | typedef\r | |
150 | EFI_STATUS\r | |
8b13229b | 151 | (EFIAPI *EFI_PEI_PCI_CFG2_PPI_RW)(\r |
5879b875 | 152 | IN CONST EFI_PEI_SERVICES **PeiServices,\r |
153 | IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r | |
ef4fa1a4 | 154 | IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r |
155 | IN UINT64 Address,\r | |
11227adb | 156 | IN VOID *SetBits,\r |
157 | IN VOID *ClearBits\r | |
2f88bd3a | 158 | );\r |
5879b875 | 159 | \r |
44717a39 | 160 | ///\r |
161 | /// The EFI_PEI_PCI_CFG_PPI interfaces are used to abstract accesses to PCI\r | |
162 | /// controllers behind a PCI root bridge controller.\r | |
163 | ///\r | |
5879b875 | 164 | struct _EFI_PEI_PCI_CFG2_PPI {\r |
2f88bd3a MK |
165 | EFI_PEI_PCI_CFG2_PPI_IO Read;\r |
166 | EFI_PEI_PCI_CFG2_PPI_IO Write;\r | |
167 | EFI_PEI_PCI_CFG2_PPI_RW Modify;\r | |
44717a39 | 168 | ///\r |
169 | /// The PCI bus segment which the specified functions will access.\r | |
170 | ///\r | |
2f88bd3a | 171 | UINT16 Segment;\r |
5879b875 | 172 | };\r |
173 | \r | |
2f88bd3a | 174 | extern EFI_GUID gEfiPciCfg2PpiGuid;\r |
5879b875 | 175 | \r |
176 | #endif\r |