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