]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PciCfgInternal.h
Use <> in #include statements instead of "" for include files from packages
[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 Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.
34
35 @param Address PCI address with
36 EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.
37
38 @return The PCI address with PCI_LIB_ADDRESS format.
39
40 **/
41 UINTN
42 PciCfgAddressConvert (
43 EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address
44 );
45
46
47 /**
48 Reads from a given location in the PCI configuration space.
49
50 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
51
52 @param This Pointer to local data for the interface.
53
54 @param Width The width of the access. Enumerated in bytes.
55 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
56
57 @param Address The physical address of the access. The format of
58 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
59
60 @param Buffer A pointer to the buffer of data..
61
62
63 @retval EFI_SUCCESS The function completed successfully.
64
65 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
66
67 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
68 time.
69
70 **/
71 EFI_STATUS
72 EFIAPI
73 PciCfg2Read (
74 IN CONST EFI_PEI_SERVICES **PeiServices,
75 IN CONST EFI_PEI_PCI_CFG2_PPI *This,
76 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
77 IN UINT64 Address,
78 IN OUT VOID *Buffer
79 );
80
81 /**
82 Write to a given location in the PCI configuration space.
83
84 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
85
86 @param This Pointer to local data for the interface.
87
88 @param Width The width of the access. Enumerated in bytes.
89 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
90
91 @param Address The physical address of the access. The format of
92 the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
93
94 @param Buffer A pointer to the buffer of data..
95
96
97 @retval EFI_SUCCESS The function completed successfully.
98
99 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
100
101 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
102 time.
103
104 **/
105 EFI_STATUS
106 EFIAPI
107 PciCfg2Write (
108 IN CONST EFI_PEI_SERVICES **PeiServices,
109 IN CONST EFI_PEI_PCI_CFG2_PPI *This,
110 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
111 IN UINT64 Address,
112 IN OUT VOID *Buffer
113 );
114
115
116 /**
117 PCI read-modify-write operation.
118
119 @param PeiServices An indirect pointer to the PEI Services Table
120 published by the PEI Foundation.
121
122 @param This Pointer to local data for the interface.
123
124 @param Width The width of the access. Enumerated in bytes. Type
125 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
126
127 @param Address The physical address of the access.
128
129 @param SetBits Points to value to bitwise-OR with the read configuration value.
130
131 The size of the value is determined by Width.
132
133 @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
134 The size of the value is determined by Width.
135
136
137 @retval EFI_SUCCESS The function completed successfully.
138
139 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
140
141 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
142 the operation at this time.
143
144 **/
145 EFI_STATUS
146 EFIAPI
147 PciCfg2Modify (
148 IN CONST EFI_PEI_SERVICES **PeiServices,
149 IN CONST EFI_PEI_PCI_CFG2_PPI *This,
150 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
151 IN UINT64 Address,
152 IN CONST VOID *SetBits,
153 IN CONST VOID *ClearBits
154 );
155
156
157
158 /**
159 PCI read operation.
160
161 @param PeiServices An indirect pointer to the PEI Services Table
162 published by the PEI Foundation.
163 @param This Pointer to local data for the interface.
164 @param Width The width of the access. Enumerated in bytes.
165 @param Address The physical address of the access.
166 @param Buffer A pointer to the buffer of data.
167
168 @retval EFI_SUCCESS The function completed successfully.
169 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
170
171 **/
172 EFI_STATUS
173 EFIAPI
174 PciCfgRead (
175 IN EFI_PEI_SERVICES **PeiServices,
176 IN EFI_PEI_PCI_CFG_PPI *This,
177 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
178 IN UINT64 Address,
179 IN OUT VOID *Buffer
180 );
181
182 /**
183 PCI write operation.
184
185 @param PeiServices An indirect pointer to the PEI Services Table
186 published by the PEI Foundation.
187 @param This Pointer to local data for the interface.
188 @param Width The width of the access. Enumerated in bytes.
189 @param Address The physical address of the access.
190 @param Buffer A pointer to the buffer of data.
191
192 @retval EFI_SUCCESS The function completed successfully.
193 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
194
195 **/
196 EFI_STATUS
197 EFIAPI
198 PciCfgWrite (
199 IN EFI_PEI_SERVICES **PeiServices,
200 IN EFI_PEI_PCI_CFG_PPI *This,
201 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
202 IN UINT64 Address,
203 IN OUT VOID *Buffer
204 );
205
206 /**
207 PCI read-modify-write operation.
208
209 @param PeiServices An indirect pointer to the PEI Services Table
210 published by the PEI Foundation.
211 @param This Pointer to local data for the interface.
212 @param Width The width of the access. Enumerated in bytes.
213 @param Address The physical address of the access.
214 @param SetBits Value of the bits to set.
215 @param ClearBits Value of the bits to clear.
216
217 @retval EFI_SUCCESS The function completed successfully.
218
219 **/
220 EFI_STATUS
221 EFIAPI
222 PciCfgModify (
223 IN EFI_PEI_SERVICES **PeiServices,
224 IN EFI_PEI_PCI_CFG_PPI *This,
225 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
226 IN UINT64 Address,
227 IN UINTN SetBits,
228 IN UINTN ClearBits
229 );
230
231 //
232 // Global Variables
233 //
234 extern EFI_PEI_PCI_CFG_PPI gPciCfgPpi;
235 extern EFI_PEI_PPI_DESCRIPTOR gPciCfgPpiList;
236
237
238 #endif