]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PciCfgInternal.h
Fix bug in PciCfg to support PCI express address.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / PcatSingleSegmentPciCfgPei / PciCfgInternal.h
CommitLineData
12232778 1/**\r
2\r
3 Copyright (c) 2006 - 2007, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12**/\r
13\r
14#ifndef __PCICFGPPI_INTERLNAL_H_\r
15#define __PCICFGPPI_INTERLNAL_H_\r
16\r
17#include <PiPei.h>\r
18#include <FrameworkPei.h>\r
19\r
20#include <Ppi/PciCfg2.h>\r
21#include <Ppi/PciCfg.h>\r
22\r
23#include <Library/BaseLib.h>\r
24#include <Library/PcdLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/PciLib.h>\r
27#include <Library/PeimEntryPoint.h>\r
28\r
29#include <IndustryStandard\Pci.h>\r
30\r
d8b61daa 31\r
32/**\r
33 Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.\r
34\r
35 @param Address PCI address with\r
36 EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.\r
37 \r
38 @return The PCI address with PCI_LIB_ADDRESS format.\r
39 \r
40**/\r
41UINTN\r
42PciCfgAddressConvert (\r
43 EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address\r
44 );\r
12232778 45\r
46\r
47/**\r
48 Reads from a given location in the PCI configuration space.\r
49\r
50 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
51\r
52 @param This Pointer to local data for the interface.\r
53\r
54 @param Width The width of the access. Enumerated in bytes.\r
55 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
56\r
57 @param Address The physical address of the access. The format of\r
58 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
59\r
60 @param Buffer A pointer to the buffer of data..\r
61\r
62\r
63 @retval EFI_SUCCESS The function completed successfully.\r
64\r
65 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
66\r
67 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
68 time.\r
69\r
70**/\r
71EFI_STATUS\r
72EFIAPI \r
73PciCfg2Read (\r
74 IN CONST EFI_PEI_SERVICES **PeiServices,\r
75 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
76 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
77 IN UINT64 Address,\r
78 IN OUT VOID *Buffer\r
79);\r
80\r
81/**\r
82 Write to a given location in the PCI configuration space.\r
83\r
84 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
85\r
86 @param This Pointer to local data for the interface.\r
87\r
88 @param Width The width of the access. Enumerated in bytes.\r
89 See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
90\r
91 @param Address The physical address of the access. The format of\r
92 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
93\r
94 @param Buffer A pointer to the buffer of data..\r
95\r
96\r
97 @retval EFI_SUCCESS The function completed successfully.\r
98\r
99 @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
100\r
101 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
102 time.\r
103\r
104**/\r
105EFI_STATUS\r
106EFIAPI \r
107PciCfg2Write (\r
108 IN CONST EFI_PEI_SERVICES **PeiServices,\r
109 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
110 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
111 IN UINT64 Address,\r
112 IN OUT VOID *Buffer\r
113);\r
114\r
115\r
116/**\r
117 PCI read-modify-write operation.\r
118\r
119 @param PeiServices An indirect pointer to the PEI Services Table\r
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
129 @param SetBits Points to value to bitwise-OR with the read configuration value.\r
130\r
131 The size of the value is determined by Width.\r
132\r
133 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
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
141 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting\r
142 the operation at this time.\r
143\r
144**/\r
145EFI_STATUS\r
146EFIAPI \r
147PciCfg2Modify (\r
148 IN CONST EFI_PEI_SERVICES **PeiServices,\r
149 IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
150 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
151 IN UINT64 Address,\r
152 IN CONST VOID *SetBits,\r
153 IN CONST VOID *ClearBits\r
154);\r
155\r
156\r
157\r
158/**\r
159 PCI read operation.\r
160\r
161 @param PeiServices An indirect pointer to the PEI Services Table\r
162 published by the PEI Foundation.\r
163 @param This Pointer to local data for the interface.\r
164 @param Width The width of the access. Enumerated in bytes.\r
165 @param Address The physical address of the access.\r
166 @param Buffer A pointer to the buffer of data.\r
167\r
168 @retval EFI_SUCCESS The function completed successfully.\r
169 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
170\r
171**/\r
172EFI_STATUS\r
173EFIAPI \r
174PciCfgRead (\r
175 IN EFI_PEI_SERVICES **PeiServices,\r
176 IN EFI_PEI_PCI_CFG_PPI *This,\r
177 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
178 IN UINT64 Address,\r
179 IN OUT VOID *Buffer\r
180 );\r
181\r
182/**\r
183 PCI write operation.\r
184\r
185 @param PeiServices An indirect pointer to the PEI Services Table\r
186 published by the PEI Foundation.\r
187 @param This Pointer to local data for the interface.\r
188 @param Width The width of the access. Enumerated in bytes.\r
189 @param Address The physical address of the access.\r
190 @param Buffer A pointer to the buffer of data.\r
191\r
192 @retval EFI_SUCCESS The function completed successfully.\r
193 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
194\r
195**/\r
196EFI_STATUS\r
197EFIAPI \r
198PciCfgWrite (\r
199 IN EFI_PEI_SERVICES **PeiServices,\r
200 IN EFI_PEI_PCI_CFG_PPI *This,\r
201 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
202 IN UINT64 Address,\r
203 IN OUT VOID *Buffer\r
204 );\r
205\r
206/**\r
207 PCI read-modify-write operation.\r
208\r
209 @param PeiServices An indirect pointer to the PEI Services Table\r
210 published by the PEI Foundation.\r
211 @param This Pointer to local data for the interface.\r
212 @param Width The width of the access. Enumerated in bytes.\r
213 @param Address The physical address of the access.\r
214 @param SetBits Value of the bits to set.\r
215 @param ClearBits Value of the bits to clear.\r
216\r
217 @retval EFI_SUCCESS The function completed successfully.\r
218\r
219**/\r
220EFI_STATUS\r
221EFIAPI \r
222PciCfgModify (\r
223 IN EFI_PEI_SERVICES **PeiServices,\r
224 IN EFI_PEI_PCI_CFG_PPI *This,\r
225 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
226 IN UINT64 Address,\r
227 IN UINTN SetBits,\r
228 IN UINTN ClearBits\r
229 );\r
230\r
231//\r
232// Global Variables\r
233//\r
234extern EFI_PEI_PCI_CFG_PPI gPciCfgPpi;\r
235extern EFI_PEI_PPI_DESCRIPTOR gPciCfgPpiList;\r
236\r
237\r
238#endif\r