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