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>
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 \
40 Reads from a given location in the PCI configuration space.
42 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
44 @param This Pointer to local data for the interface.
46 @param Width The width of the access. Enumerated in bytes.
47 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
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.
52 @param Buffer A pointer to the buffer of data..
55 @retval EFI_SUCCESS The function completed successfully.
57 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
59 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
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
,
74 Write to a given location in the PCI configuration space.
76 @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
78 @param This Pointer to local data for the interface.
80 @param Width The width of the access. Enumerated in bytes.
81 See EFI_PEI_PCI_CFG_PPI_WIDTH above.
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.
86 @param Buffer A pointer to the buffer of data..
89 @retval EFI_SUCCESS The function completed successfully.
91 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
93 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this
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
,
109 PCI read-modify-write operation.
111 @param PeiServices An indirect pointer to the PEI Services Table
112 published by the PEI Foundation.
114 @param This Pointer to local data for the interface.
116 @param Width The width of the access. Enumerated in bytes. Type
117 EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
119 @param Address The physical address of the access.
121 @param SetBits Points to value to bitwise-OR with the read configuration value.
123 The size of the value is determined by Width.
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.
129 @retval EFI_SUCCESS The function completed successfully.
131 @retval EFI_DEVICE_ERROR There was a problem with the transaction.
133 @retval EFI_DEVICE_NOT_READY The device is not capable of supporting
134 the operation at this time.
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
,
144 IN CONST VOID
*SetBits
,
145 IN CONST VOID
*ClearBits
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.
160 @retval EFI_SUCCESS The function completed successfully.
161 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
167 IN EFI_PEI_SERVICES
**PeiServices
,
168 IN EFI_PEI_PCI_CFG_PPI
*This
,
169 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
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.
184 @retval EFI_SUCCESS The function completed successfully.
185 @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
191 IN EFI_PEI_SERVICES
**PeiServices
,
192 IN EFI_PEI_PCI_CFG_PPI
*This
,
193 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
199 PCI read-modify-write operation.
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.
209 @retval EFI_SUCCESS The function completed successfully.
215 IN EFI_PEI_SERVICES
**PeiServices
,
216 IN EFI_PEI_PCI_CFG_PPI
*This
,
217 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
226 extern EFI_PEI_PCI_CFG_PPI gPciCfgPpi
;
227 extern EFI_PEI_PPI_DESCRIPTOR gPciCfgPpiList
;