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.
20 Single Segment Pci Configuration PPI
26 #include "PciCfgInternal.h"
32 @param PeiServices An indirect pointer to the PEI Services Table
33 published by the PEI Foundation.
34 @param This Pointer to local data for the interface.
35 @param Width The width of the access. Enumerated in bytes.
36 @param Address The physical address of the access.
37 @param Buffer A pointer to the buffer of data.
39 @retval EFI_SUCCESS The function completed successfully.
40 @retval EFI_INVALID_PARAMETER Unsupported width
47 IN EFI_PEI_SERVICES
**PeiServices
,
48 IN EFI_PEI_PCI_CFG_PPI
*This
,
49 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
56 PciLibAddress
= PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS
*) &Address
);
58 case EfiPeiPciCfgWidthUint8
:
59 * (UINT8
*) Buffer
= PciRead8 (PciLibAddress
);
62 case EfiPeiPciCfgWidthUint16
:
63 * (UINT16
*) Buffer
= PciRead16 (PciLibAddress
);
66 case EfiPeiPciCfgWidthUint32
:
67 * (UINT32
*) Buffer
= PciRead32 (PciLibAddress
);
71 return EFI_INVALID_PARAMETER
;
80 @param PeiServices An indirect pointer to the PEI Services Table
81 published by the PEI Foundation.
82 @param This Pointer to local data for the interface.
83 @param Width The width of the access. Enumerated in bytes.
84 @param Address The physical address of the access.
85 @param Buffer A pointer to the buffer of data.
87 @retval EFI_SUCCESS The function completed successfully.
90 @retval EFI_INVALID_PARAMETER Unsupported width
97 IN EFI_PEI_SERVICES
**PeiServices
,
98 IN EFI_PEI_PCI_CFG_PPI
*This
,
99 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
106 PciLibAddress
= PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS
*) &Address
);
108 case EfiPeiPciCfgWidthUint8
:
109 PciWrite8 (PciLibAddress
, *(UINT8
*) Buffer
);
112 case EfiPeiPciCfgWidthUint16
:
113 PciWrite16 (PciLibAddress
, *(UINT16
*) Buffer
);
116 case EfiPeiPciCfgWidthUint32
:
117 PciWrite32 (PciLibAddress
, *(UINT32
*) Buffer
);
121 return EFI_INVALID_PARAMETER
;
128 PCI read-modify-write operation.
130 @param PeiServices An indirect pointer to the PEI Services Table
131 published by the PEI Foundation.
132 @param This Pointer to local data for the interface.
133 @param Width The width of the access. Enumerated in bytes.
134 @param Address The physical address of the access.
135 @param SetBits Value of the bits to set.
136 @param ClearBits Value of the bits to clear.
138 @retval EFI_SUCCESS The function completed successfully.
139 @retval EFI_INVALID_PARAMETER Unsupported width
146 IN EFI_PEI_SERVICES
**PeiServices
,
147 IN EFI_PEI_PCI_CFG_PPI
*This
,
148 IN EFI_PEI_PCI_CFG_PPI_WIDTH Width
,
156 PciLibAddress
= PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS
*) &Address
);
158 case EfiPeiPciCfgWidthUint8
:
159 PciAndThenOr8 (PciLibAddress
, (UINT8
)~ClearBits
, (UINT8
)SetBits
);
162 case EfiPeiPciCfgWidthUint16
:
163 PciAndThenOr16 (PciLibAddress
, (UINT16
)~ClearBits
, (UINT16
)SetBits
);
166 case EfiPeiPciCfgWidthUint32
:
167 PciAndThenOr32 (PciLibAddress
, (UINT32
)~ClearBits
, (UINT32
)SetBits
);
171 return EFI_INVALID_PARAMETER
;