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
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.
14 #ifndef __PCICFGPPI_INTERLNAL_H_
15 #define __PCICFGPPI_INTERLNAL_H_
18 #include <FrameworkPei.h>
20 #include <Ppi/PciCfg2.h>
21 #include <Ppi/PciCfg.h>
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>
29 #include <IndustryStandard/Pci.h>
35 extern EFI_PEI_PCI_CFG_PPI gPciCfgPpi
;
36 extern EFI_PEI_PPI_DESCRIPTOR gPciCfgPpiList
;
39 Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.
41 @param Address PCI address with
42 EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.
44 @return The PCI address with PCI_LIB_ADDRESS format.
48 PciCfgAddressConvert (
49 EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS
*Address
54 Reads from a given location in the PCI configuration space.
56 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
58 @param This Pointer to local data for the interface.
60 @param Width The width of the access. Enumerated in bytes.
61 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
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.
66 @param Buffer A pointer to the buffer of data..
69 @retval EFI_SUCCESS The function completed successfully.
71 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
73 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
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
,
88 Write to a given location in the PCI configuration space.
90 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
92 @param This Pointer to local data for the interface.
94 @param Width The width of the access. Enumerated in bytes.
95 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
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.
100 @param Buffer A pointer to the buffer of data..
103 @retval EFI_SUCCESS The function completed successfully.
105 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
107 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
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
,
123 PCI read-modify-write operation.
125 @param PeiServices An indirect pointer to the PEI Services Table
126 published by the PEI Foundation.
128 @param This Pointer to local data for the interface.
130 @param Width The width of the access. Enumerated in bytes. Type
131 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
133 @param Address The physical address of the access.
135 @param SetBits Points to value to bitwise-OR with the read configuration value.
137 The size of the value is determined by Width.
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.
143 @retval EFI_SUCCESS The function completed successfully.
145 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
147 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
148 the operation at this time.
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
,
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.
174 @retval EFI_SUCCESS The function completed successfully.
175 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
181 IN EFI_PEI_SERVICES
**PeiServices
,
182 IN EFI_PEI_PCI_CFG_PPI
*This
,
183 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
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.
198 @retval EFI_SUCCESS The function completed successfully.
199 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
205 IN EFI_PEI_SERVICES
**PeiServices
,
206 IN EFI_PEI_PCI_CFG_PPI
*This
,
207 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
213 PCI read-modify-write operation.
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.
223 @retval EFI_SUCCESS The function completed successfully.
229 IN EFI_PEI_SERVICES
**PeiServices
,
230 IN EFI_PEI_PCI_CFG_PPI
*This
,
231 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,