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