-/*++\r
+/**\r
+Module produce PciCfgPpi on top of PciCfgPpi2.\r
+\r
+PIWG's PI specification replaces Inte's EFI Specification 1.10.\r
+EFI_PEI_PCI_CFG_PPI defined in Inte's EFI Specification 1.10 is replaced by\r
+EFI_PEI_PCI_CFG2_PPI in PI 1.0.\r
+This module produces PciCfgPpi on top of PciCfgPpi2. This module is used on platform when both of\r
+these two conditions are true:\r
+1) Framework module is present that consumes PCI CFG AND\r
+2) R9 module is present that produces PCI CFG2 but not PCI CFG\r
+\r
\r
Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
Module Name:\r
-\r
- Variable.c\r
-\r
-Abstract:\r
-\r
- PEIM to provide the Variable functionality\r
-\r
---*/\r
+**/\r
\r
#include <PiPei.h>\r
#include <Ppi/PciCfg.h>\r
//\r
// Function Prototypes\r
//\r
+\r
+/**\r
+ Reads from a given location in the PCI configuration space.\r
+\r
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+\r
+ @param This Pointer to local data for the interface.\r
+\r
+ @param Width The width of the access. Enumerated in bytes.\r
+ See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
+\r
+ @param Address The physical address of the access. The format of\r
+ the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
+\r
+ @param Buffer A pointer to the buffer of data..\r
+\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+\r
+ @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
+\r
+ @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
+ time.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PciCfgRead (\r
IN OUT VOID *Buffer\r
);\r
\r
+/**\r
+ Write to a given location in the PCI configuration space.\r
+\r
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+\r
+ @param This Pointer to local data for the interface.\r
+\r
+ @param Width The width of the access. Enumerated in bytes.\r
+ See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
+\r
+ @param Address The physical address of the access. The format of\r
+ the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
+\r
+ @param Buffer A pointer to the buffer of data..\r
+\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+\r
+ @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
+\r
+ @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
+ time.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PciCfgWrite (\r
IN OUT VOID *Buffer\r
);\r
\r
+/**\r
+ PCI read-modify-write operation.\r
+\r
+ @param PeiServices An indirect pointer to the PEI Services Table\r
+ published by the PEI Foundation.\r
+\r
+ @param This Pointer to local data for the interface.\r
+\r
+ @param Width The width of the access. Enumerated in bytes. Type\r
+ EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
+\r
+ @param Address The physical address of the access.\r
+\r
+ @param SetBits Points to value to bitwise-OR with the read configuration value.\r
+ The size of the value is determined by Width.\r
+\r
+ @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
+ The size of the value is determined by Width.\r
+\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+\r
+ @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
+\r
+ @retval EFI_DEVICE_NOT_READY The device is not capable of supporting\r
+ the operation at this time.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PciCfgModify (\r
&mPciCfgPpi\r
};\r
\r
+/**\r
+\r
+ Standard PEIM entry point.\r
+\r
+ @param FfsHeadher The FFS file header\r
+ @param PeiServices General purpose services available to every PEIM.\r
+\r
+\r
+ @retval EFI_SUCCESS if the interface could be successfully\r
+ installed\r
+\r
+--*/\r
EFI_STATUS\r
EFIAPI\r
PeimInitializePciCfg (\r
- IN EFI_FFS_FILE_HEADER *FfsHeader,\r
+ IN EFI_PEI_FILE_HANDLE FfsHeader,\r
IN CONST EFI_PEI_SERVICES **PeiServices\r
)\r
-/*++\r
+{\r
+ //\r
+ // Publish the PciCfgToPciCfg2 Thunk capability to other modules\r
+ //\r
+ return (*PeiServices)->InstallPpi (PeiServices, &mPpiListPciCfg);\r
+}\r
\r
-Routine Description:\r
+/**\r
+ Reads from a given location in the PCI configuration space.\r
\r
- Provide the functionality of the variable services.\r
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
\r
-Arguments:\r
+ @param This Pointer to local data for the interface.\r
\r
- FfsHeadher - The FFS file header\r
- PeiServices - General purpose services available to every PEIM.\r
+ @param Width The width of the access. Enumerated in bytes.\r
+ See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
\r
-Returns:\r
+ @param Address The physical address of the access. The format of\r
+ the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
\r
- Status - EFI_SUCCESS if the interface could be successfully\r
- installed\r
+ @param Buffer A pointer to the buffer of data..\r
\r
---*/\r
-{\r
- //\r
- // Publish the variable capability to other modules\r
- //\r
- return (*PeiServices)->InstallPpi (PeiServices, &mPpiListPciCfg);\r
-}\r
\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+\r
+ @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
+\r
+ @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
+ time.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PciCfgRead (\r
return PciCfg2->Read ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);\r
}\r
\r
+\r
+/**\r
+ Write to a given location in the PCI configuration space.\r
+\r
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.\r
+\r
+ @param This Pointer to local data for the interface.\r
+\r
+ @param Width The width of the access. Enumerated in bytes.\r
+ See EFI_PEI_PCI_CFG_PPI_WIDTH above.\r
+\r
+ @param Address The physical address of the access. The format of\r
+ the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.\r
+\r
+ @param Buffer A pointer to the buffer of data..\r
+\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+\r
+ @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
+\r
+ @retval EFI_DEVICE_NOT_READY The device is not capable of supporting the operation at this\r
+ time.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PciCfgWrite (\r
return PciCfg2->Write ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);\r
}\r
\r
+/**\r
+ PCI read-modify-write operation.\r
+\r
+ @param PeiServices An indirect pointer to the PEI Services Table\r
+ published by the PEI Foundation.\r
+\r
+ @param This Pointer to local data for the interface.\r
+\r
+ @param Width The width of the access. Enumerated in bytes. Type\r
+ EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().\r
+\r
+ @param Address The physical address of the access.\r
+\r
+ @param SetBits Points to value to bitwise-OR with the read configuration value.\r
+ The size of the value is determined by Width.\r
+\r
+ @param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.\r
+ The size of the value is determined by Width.\r
+\r
+\r
+ @retval EFI_SUCCESS The function completed successfully.\r
+\r
+ @retval EFI_DEVICE_ERROR There was a problem with the transaction.\r
+\r
+ @retval EFI_DEVICE_NOT_READY The device is not capable of supporting\r
+ the operation at this time.\r
+\r
+**/\r
EFI_STATUS\r
EFIAPI\r
PciCfgModify (\r