gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusOnlySupportSlaveDma|FALSE|BOOLEAN|0x00010041\r
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusSupportIsaMemory|TRUE|BOOLEAN|0x00010042\r
\r
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable|FALSE|BOOLEAN|0x00010043\r
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfg2Disable|FALSE|BOOLEAN|0x00010044\r
-\r
[PcdsFixedAtBuild]\r
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciIncompatibleDeviceSupportMask|0|UINT8|0x0001003f\r
\r
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusSupportDma|TRUE\r
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusOnlySupportSlaveDma|FALSE\r
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdIsaBusSupportIsaMemory|TRUE\r
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable|TRUE\r
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfg2Disable|TRUE\r
-\r
\r
[PcdsFixedAtBuild.common]\r
gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000\r
IntelFrameworkModulePkg/Universal/DataHubStdErrDxe/DataHubStdErrDxe.inf\r
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf\r
IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClassDxe.inf\r
- IntelFrameworkModulePkg/Universal/PcatSingleSegmentPciCfgPei/PcatSingleSegmentPciCfgPei.inf\r
- IntelFrameworkModulePkg/Universal/VariablePei/VariablePei.inf\r
IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf\r
\r
\r
+++ /dev/null
-#/** @file\r
-# Single Segment Pci Configuration PPI\r
-#\r
-# This file declares PciCfg PPI used to access PCI configuration space in PEI\r
-# Copyright (c) 2006 - 2009, Intel Corporation\r
-#\r
-# All rights reserved. This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\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
-#\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = PcatSingleSegmentPciCfgPei\r
- FILE_GUID = 27A5159D-5E61-4809-919A-422E887101EF\r
- MODULE_TYPE = PEIM\r
- VERSION_STRING = 1.0\r
- EFI_SPECIFICATION_VERSION = 0x00020000\r
- ENTRY_POINT = PeimInitializePciCfg\r
-\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources.common]\r
- PciCfg.c\r
- PciCfg2.c\r
- PciCfgInternal.h\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- IntelFrameworkPkg/IntelFrameworkPkg.dec\r
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
-\r
-\r
-[LibraryClasses]\r
- PeimEntryPoint\r
- PciLib\r
- BaseLib\r
- DebugLib\r
-\r
-\r
-[Ppis]\r
- gEfiPciCfg2PpiGuid # PPI ALWAYS_PRODUCED\r
- gEfiPciCfgPpiInServiceTableGuid # PPI ALWAYS_PRODUCED\r
-\r
-[FeaturePcd.common]\r
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable\r
- gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfg2Disable\r
-\r
-[Depex]\r
- TRUE\r
-\r
+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2006 - 2007, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\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
-\r
-\r
-\r
-Module Name:\r
-\r
- PciCfg.c\r
-\r
-Abstract:\r
-\r
- Single Segment Pci Configuration PPI\r
-\r
-Revision History\r
-\r
-**/\r
-\r
-#include "PciCfgInternal.h"\r
-\r
-\r
-/**\r
- PCI read operation.\r
-\r
- @param PeiServices An indirect pointer to the PEI Services Table\r
- published by the PEI Foundation.\r
- @param This Pointer to local data for the interface.\r
- @param Width The width of the access. Enumerated in bytes.\r
- @param Address The physical address of the access.\r
- @param Buffer A pointer to the buffer of data.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
- @retval EFI_INVALID_PARAMETER Unsupported width\r
- enumeration.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfgRead (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_PEI_PCI_CFG_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- UINTN PciLibAddress;\r
-\r
- PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
-\r
- if (Width == EfiPeiPciCfgWidthUint8) {\r
- *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
- } else if (Width == EfiPeiPciCfgWidthUint16) {\r
- if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
- *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
- }\r
- } else if (Width == EfiPeiPciCfgWidthUint32) {\r
- if ((PciLibAddress & 0x03) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- WriteUnaligned32 (((UINT32 *) Buffer), PciRead32 (PciLibAddress));\r
- } else if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Unaligned Pci address access, break up the request into word by word.\r
- //\r
- WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
- WriteUnaligned16 (((UINT16 *) Buffer + 1), PciRead16 (PciLibAddress + 2));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
- *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
- *((UINT8 *) Buffer + 2) = PciRead8 (PciLibAddress + 2);\r
- *((UINT8 *) Buffer + 3) = PciRead8 (PciLibAddress + 3);\r
- }\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- PCI write operation.\r
-\r
- @param PeiServices An indirect pointer to the PEI Services Table\r
- published by the PEI Foundation.\r
- @param This Pointer to local data for the interface.\r
- @param Width The width of the access. Enumerated in bytes.\r
- @param Address The physical address of the access.\r
- @param Buffer A pointer to the buffer of data.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
- \r
- \r
- @retval EFI_INVALID_PARAMETER Unsupported width\r
- enumeration.\r
- \r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfgWrite (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_PEI_PCI_CFG_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- UINTN PciLibAddress;\r
-\r
- PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
-\r
- if (Width == EfiPeiPciCfgWidthUint8) {\r
- PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
- } else if (Width == EfiPeiPciCfgWidthUint16) {\r
- if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
- PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
- }\r
- } else if (Width == EfiPeiPciCfgWidthUint32) {\r
- if ((PciLibAddress & 0x03) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- PciWrite32 (PciLibAddress, ReadUnaligned32 ((UINT32 *) Buffer));\r
- } else if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Unaligned Pci address access, break up the request into word by word.\r
- //\r
- PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
- PciWrite16 (PciLibAddress + 2, ReadUnaligned16 ((UINT16 *) Buffer + 1));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
- PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
- PciWrite8 (PciLibAddress + 2, *((UINT8 *) Buffer + 2)); \r
- PciWrite8 (PciLibAddress + 3, *((UINT8 *) Buffer + 3)); \r
- }\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\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
- @param This Pointer to local data for the interface.\r
- @param Width The width of the access. Enumerated in bytes.\r
- @param Address The physical address of the access.\r
- @param SetBits Value of the bits to set.\r
- @param ClearBits Value of the bits to clear.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
- @retval EFI_INVALID_PARAMETER Unsupported width\r
- enumeration.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PciCfgModify (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_PEI_PCI_CFG_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN UINTN SetBits,\r
- IN UINTN ClearBits\r
- )\r
-{\r
- UINTN PciLibAddress;\r
-\r
- PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
- if (Width == EfiPeiPciCfgWidthUint8) {\r
- PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
- } else if (Width == EfiPeiPciCfgWidthUint16) {\r
- if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- PciAndThenOr16 (PciLibAddress, (UINT16)~ClearBits, (UINT16)SetBits);\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
- PciAndThenOr8 (PciLibAddress + 1, (UINT8)~(ClearBits >> 8), (UINT8)(SetBits >> 8));\r
- }\r
- } else if (Width == EfiPeiPciCfgWidthUint32) {\r
- if ((PciLibAddress & 0x03) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- PciAndThenOr32 (PciLibAddress, (UINT32)~ClearBits, (UINT32)SetBits);\r
- } else if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Unaligned Pci address access, break up the request into word by word.\r
- //\r
- PciAndThenOr16 (PciLibAddress, (UINT16)~ClearBits, (UINT16)SetBits);\r
- PciAndThenOr16 (PciLibAddress + 2, (UINT16)~(ClearBits >> 16), (UINT16)(SetBits >> 16));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
- PciAndThenOr8 (PciLibAddress + 1, (UINT8)~(ClearBits >> 8), (UINT8)(SetBits >> 8));\r
- PciAndThenOr8 (PciLibAddress + 2, (UINT8)~(ClearBits >> 16), (UINT8)(SetBits >> 16));\r
- PciAndThenOr8 (PciLibAddress + 3, (UINT8)~(ClearBits >> 24), (UINT8)(SetBits >> 24));\r
- }\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
+++ /dev/null
-/**\r
-\r
- Copyright (c) 2006 - 2007, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\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
-\r
-**/\r
-\r
-#include "PciCfgInternal.h"\r
-\r
-/**\r
- @par Ppi Description:\r
- The EFI_PEI_PCI_CFG2_PPI interfaces are used to abstract\r
- accesses to PCI controllers behind a PCI root bridge\r
- controller.\r
-\r
- @param Read PCI read services. See the Read() function description.\r
-\r
- @param Write PCI write services. See the Write() function description.\r
-\r
- @param Modify PCI read-modify-write services. See the Modify() function description.\r
-\r
- @param Segment The PCI bus segment which the specified functions will access.\r
-\r
-**/\r
-GLOBAL_REMOVE_IF_UNREFERENCED\r
-EFI_PEI_PCI_CFG2_PPI gPciCfg2Ppi = {\r
- PciCfg2Read,\r
- PciCfg2Write,\r
- PciCfg2Modify\r
-};\r
-\r
-GLOBAL_REMOVE_IF_UNREFERENCED\r
-EFI_PEI_PPI_DESCRIPTOR gPciCfg2PpiList = {\r
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
- &gEfiPciCfg2PpiGuid,\r
- &gPciCfg2Ppi\r
-};\r
-\r
-\r
-/**\r
- @par Ppi Description:\r
- The EFI_PEI_PCI_CFG_PPI interfaces are used to abstract accesses to PCI\r
- controllers behind a PCI root bridge controller.\r
-\r
- @param Read PCI read services. See the Read() function description.\r
-\r
- @param Write PCI write services. See the Write() function description.\r
-\r
- @param Modify PCI read-modify-write services. See the Modify() function description.\r
-\r
- @param Segment The PCI bus segment which the specified functions will access.\r
-\r
-**/\r
-GLOBAL_REMOVE_IF_UNREFERENCED\r
-EFI_PEI_PCI_CFG_PPI gPciCfgPpi = {\r
- PciCfgRead,\r
- PciCfgWrite,\r
- PciCfgModify\r
-};\r
-\r
-GLOBAL_REMOVE_IF_UNREFERENCED\r
-EFI_PEI_PPI_DESCRIPTOR gPciCfgPpiList = {\r
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
- &gEfiPciCfgPpiInServiceTableGuid,\r
- &gPciCfgPpi\r
-};\r
-\r
-\r
-/**\r
- Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.\r
-\r
- @param Address PCI address with\r
- EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.\r
- \r
- @return The PCI address with PCI_LIB_ADDRESS format.\r
- \r
-**/\r
-UINTN\r
-PciCfgAddressConvert (\r
- EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address\r
- )\r
-{\r
- if (Address->ExtendedRegister == 0) {\r
- return PCI_LIB_ADDRESS (Address->Bus, Address->Device, Address->Function, Address->Register);\r
- }\r
-\r
- return PCI_LIB_ADDRESS (Address->Bus, Address->Device, Address->Function, Address->ExtendedRegister);\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
-PciCfg2Read (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN OUT VOID *Buffer\r
-)\r
-{\r
- UINTN PciLibAddress;\r
-\r
- PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
-\r
- if (Width == EfiPeiPciCfgWidthUint8) {\r
- *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
- } else if (Width == EfiPeiPciCfgWidthUint16) {\r
- if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
- *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
- }\r
- } else if (Width == EfiPeiPciCfgWidthUint32) {\r
- if ((PciLibAddress & 0x03) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- WriteUnaligned32 (((UINT32 *) Buffer), PciRead32 (PciLibAddress));\r
- } else if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Unaligned Pci address access, break up the request into word by word.\r
- //\r
- WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
- WriteUnaligned16 (((UINT16 *) Buffer + 1), PciRead16 (PciLibAddress + 2));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
- *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
- *((UINT8 *) Buffer + 2) = PciRead8 (PciLibAddress + 2);\r
- *((UINT8 *) Buffer + 3) = PciRead8 (PciLibAddress + 3);\r
- }\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return EFI_SUCCESS;\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
-PciCfg2Write (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN OUT VOID *Buffer\r
-)\r
-{\r
- UINTN PciLibAddress;\r
-\r
- PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
-\r
- if (Width == EfiPeiPciCfgWidthUint8) {\r
- PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
- } else if (Width == EfiPeiPciCfgWidthUint16) {\r
- if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
- PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
- }\r
- } else if (Width == EfiPeiPciCfgWidthUint32) {\r
- if ((PciLibAddress & 0x03) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- PciWrite32 (PciLibAddress, ReadUnaligned32 ((UINT32 *) Buffer));\r
- } else if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Unaligned Pci address access, break up the request into word by word.\r
- //\r
- PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
- PciWrite16 (PciLibAddress + 2, ReadUnaligned16 ((UINT16 *) Buffer + 1));\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
- PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
- PciWrite8 (PciLibAddress + 2, *((UINT8 *) Buffer + 2)); \r
- PciWrite8 (PciLibAddress + 3, *((UINT8 *) Buffer + 3)); \r
- }\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\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
-\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
-PciCfg2Modify (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN VOID *SetBits,\r
- IN VOID *ClearBits\r
-)\r
-{\r
- UINTN PciLibAddress;\r
- UINT16 ClearValue16;\r
- UINT16 SetValue16;\r
- UINT32 ClearValue32;\r
- UINT32 SetValue32;\r
-\r
- PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
-\r
- if (Width == EfiPeiPciCfgWidthUint8) {\r
- PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
- } else if (Width == EfiPeiPciCfgWidthUint16) {\r
- if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits));\r
- SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits);\r
- PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16);\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
- PciAndThenOr8 (PciLibAddress + 1, (UINT8) (~(*((UINT8 *) ClearBits + 1))), *((UINT8 *) SetBits + 1));\r
- }\r
- } else if (Width == EfiPeiPciCfgWidthUint32) {\r
- if ((PciLibAddress & 0x03) == 0) {\r
- //\r
- // Aligned Pci address access\r
- //\r
- ClearValue32 = (UINT32) (~ReadUnaligned32 ((UINT32 *) ClearBits));\r
- SetValue32 = ReadUnaligned32 ((UINT32 *) SetBits);\r
- PciAndThenOr32 (PciLibAddress, ClearValue32, SetValue32);\r
- } else if ((PciLibAddress & 0x01) == 0) {\r
- //\r
- // Unaligned Pci address access, break up the request into word by word.\r
- //\r
- ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits));\r
- SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits);\r
- PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16);\r
-\r
- ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits + 1));\r
- SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits + 1);\r
- PciAndThenOr16 (PciLibAddress + 2, ClearValue16, SetValue16);\r
- } else {\r
- //\r
- // Unaligned Pci address access, break up the request into byte by byte.\r
- //\r
- PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
- PciAndThenOr8 (PciLibAddress + 1, (UINT8) (~(*((UINT8 *) ClearBits + 1))), *((UINT8 *) SetBits + 1));\r
- PciAndThenOr8 (PciLibAddress + 2, (UINT8) (~(*((UINT8 *) ClearBits + 2))), *((UINT8 *) SetBits + 2));\r
- PciAndThenOr8 (PciLibAddress + 3, (UINT8) (~(*((UINT8 *) ClearBits + 3))), *((UINT8 *) SetBits + 3));\r
- }\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Module's entry function. \r
- This routine will install EFI_PEI_PCI_CFG2_PPI or EFI_PEI_PCI_CFG_PPI\r
- according to PeiServices's version.\r
- \r
- @param FileHandle Handle of the file being invoked.\r
- @param PeiServices Describes the list of possible PEI Services.\r
-\r
- @return Whether success to install service\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeimInitializePciCfg (\r
- IN EFI_PEI_FILE_HANDLE FileHandle,\r
- IN CONST EFI_PEI_SERVICES **PeiServices\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- if ((**PeiServices).Hdr.Revision < PEI_SERVICES_REVISION) {\r
- //\r
- // BugBug: Curently, the FrameworkPkg does not define\r
- // FRAMEWORK_PEI_SERVICES. So, In order to install \r
- // the PeiServices.PciCfg(), we casttype \r
- // EFI_PEI_PCI_CFG_PPI to EFI_PEI_PCI_CFG2_PPI.\r
- // After defining the FRAMEWORK_PEI_SERVICES. this should\r
- // be updated as:\r
- // \r
- // FrameworkPeiServices = (FRAMEWORK_PEI_SERVICES **) PeiServices;\r
- // (**FrameworkPeiServices).PciCfg = &mPciCfgPpi;\r
- // \r
- (**(EFI_PEI_SERVICES**)PeiServices).PciCfg = (EFI_PEI_PCI_CFG2_PPI *) &gPciCfgPpi;\r
- } else {\r
- (**(EFI_PEI_SERVICES**)PeiServices).PciCfg = &gPciCfg2Ppi;\r
- }\r
- \r
- if (!FeaturePcdGet (PcdPciCfgDisable)) {\r
- Status = (**PeiServices).InstallPpi (PeiServices, &gPciCfgPpiList);\r
- } \r
- if (!FeaturePcdGet (PcdPciCfg2Disable)) {\r
- Status = (**PeiServices).InstallPpi (PeiServices, &gPciCfg2PpiList);\r
- }\r
-\r
- return Status;\r
-}\r
-\r
+++ /dev/null
-/**\r
-\r
- Copyright (c) 2006 - 2007, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\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
-\r
-**/\r
-\r
-#ifndef __PCICFGPPI_INTERLNAL_H_\r
-#define __PCICFGPPI_INTERLNAL_H_\r
-\r
-#include <PiPei.h>\r
-#include <FrameworkPei.h>\r
-\r
-#include <Ppi/PciCfg2.h>\r
-#include <Ppi/PciCfg.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PciLib.h>\r
-#include <Library/PeimEntryPoint.h>\r
-\r
-#include <IndustryStandard/Pci.h>\r
-\r
-\r
-//\r
-// Global Variables\r
-//\r
-extern EFI_PEI_PCI_CFG_PPI gPciCfgPpi;\r
-extern EFI_PEI_PPI_DESCRIPTOR gPciCfgPpiList;\r
-\r
-/**\r
- Convert EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS to PCI_LIB_ADDRESS.\r
-\r
- @param Address PCI address with\r
- EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS format.\r
- \r
- @return The PCI address with PCI_LIB_ADDRESS format.\r
- \r
-**/\r
-UINTN\r
-PciCfgAddressConvert (\r
- EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *Address\r
- );\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
-PciCfg2Read (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\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
-PciCfg2Write (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN OUT VOID *Buffer\r
-);\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
-\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
-PciCfg2Modify (\r
- IN CONST EFI_PEI_SERVICES **PeiServices,\r
- IN CONST EFI_PEI_PCI_CFG2_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN VOID *SetBits,\r
- IN VOID *ClearBits\r
-);\r
-\r
-\r
-\r
-/**\r
- PCI read operation.\r
-\r
- @param PeiServices An indirect pointer to the PEI Services Table\r
- published by the PEI Foundation.\r
- @param This Pointer to local data for the interface.\r
- @param Width The width of the access. Enumerated in bytes.\r
- @param Address The physical address of the access.\r
- @param Buffer A pointer to the buffer of data.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
- @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI \r
-PciCfgRead (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_PEI_PCI_CFG_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN OUT VOID *Buffer\r
- );\r
-\r
-/**\r
- PCI write operation.\r
-\r
- @param PeiServices An indirect pointer to the PEI Services Table\r
- published by the PEI Foundation.\r
- @param This Pointer to local data for the interface.\r
- @param Width The width of the access. Enumerated in bytes.\r
- @param Address The physical address of the access.\r
- @param Buffer A pointer to the buffer of data.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
- @retval EFI_NOT_YET_AVAILABLE The service has not been installed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI \r
-PciCfgWrite (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_PEI_PCI_CFG_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\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
- @param This Pointer to local data for the interface.\r
- @param Width The width of the access. Enumerated in bytes.\r
- @param Address The physical address of the access.\r
- @param SetBits Value of the bits to set.\r
- @param ClearBits Value of the bits to clear.\r
-\r
- @retval EFI_SUCCESS The function completed successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI \r
-PciCfgModify (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN EFI_PEI_PCI_CFG_PPI *This,\r
- IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,\r
- IN UINT64 Address,\r
- IN UINTN SetBits,\r
- IN UINTN ClearBits\r
- );\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- Variable worker functions.\r
-\r
- Copyright (c) 2006, Intel Corporation<BR>\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\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
-\r
-**/\r
-\r
-#include <Variable.h>\r
-\r
-\r
-/**\r
- Get one variable by the index count.\r
-\r
- @param IndexTable The pointer to variable index table.\r
- @param Count The index count of variable in index table.\r
-\r
- @return The pointer to variable header indexed by count.\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetVariableByIndex (\r
- IN VARIABLE_INDEX_TABLE *IndexTable,\r
- IN UINT32 Count\r
- )\r
-{\r
- return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );\r
-}\r
-\r
-/**\r
- Record Variable in VariableIndex HOB.\r
-\r
- Record Variable in VariableIndex HOB and update the length of variable index table.\r
-\r
- @param IndexTable The pointer to variable index table.\r
- @param Variable The pointer to the variable that will be recorded.\r
-\r
- @retval VOID\r
-\r
-**/\r
-VOID\r
-VariableIndexTableUpdate (\r
- IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-{\r
- IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);\r
-\r
- return;\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- Framework PEIM to provide the Variable functionality\r
- \r
-Copyright (c) 2006 - 2009 Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\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
-**/\r
-\r
-\r
-#include "Variable.h"\r
-\r
-//\r
-// Module globals\r
-//\r
-EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi = {\r
- PeiGetVariable,\r
- PeiGetNextVariableName\r
-};\r
-\r
-EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariable2Ppi = {\r
- PeiGetVariable2,\r
- PeiGetNextVariableName2\r
-};\r
-\r
-EFI_PEI_PPI_DESCRIPTOR mPpiListVariable[] = {\r
- {\r
- (EFI_PEI_PPI_DESCRIPTOR_PPI),\r
- &gEfiPeiReadOnlyVariable2PpiGuid,\r
- &mVariable2Ppi\r
- },\r
- {\r
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
- &gEfiPeiReadOnlyVariablePpiGuid,\r
- &mVariablePpi\r
- }\r
-};\r
-\r
-EFI_GUID mEfiVariableIndexTableGuid = EFI_VARIABLE_INDEX_TABLE_GUID;\r
-\r
-/**\r
- Provide the functionality of the variable services.\r
-\r
- @param FileHandle Handle of the file being invoked.\r
- @param PeiServices Describes the list of possible PEI Services.\r
-\r
- @return EFI_SUCCESS If the interface could be successfully installed.\r
- @return EFI_UNSUPPORTED If current boot path is in recovery mode, then does not\r
- install this interface.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeimInitializeVariableServices (\r
- IN EFI_PEI_FILE_HANDLE FileHandle,\r
- IN CONST EFI_PEI_SERVICES **PeiServices\r
- )\r
-{\r
- EFI_BOOT_MODE BootMode;\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Check if this is recovery boot path. If no, publish the variable access capability\r
- // to other modules. If yes, the content of variable area is not reliable. Therefore,\r
- // in this case we should not provide variable service to other pei modules. \r
- // \r
- Status = (*PeiServices)->GetBootMode (PeiServices, &BootMode);\r
- ASSERT_EFI_ERROR (Status);\r
- \r
- if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
- return EFI_UNSUPPORTED;\r
- }\r
- \r
- return (**PeiServices).InstallPpi (PeiServices, &mPpiListVariable[0]);\r
-\r
-}\r
-\r
-/**\r
- This code gets the pointer to the first variable memory pointer byte\r
-\r
- @param VarStoreHeader Pointer to the Variable Store Header.\r
-\r
- @return VARIABLE_HEADER* Pointer to last unavailable Variable Header\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetStartPointer (\r
- IN VARIABLE_STORE_HEADER *VarStoreHeader\r
- )\r
-{\r
- //\r
- // The end of variable store\r
- //\r
- return (VARIABLE_HEADER *) HEADER_ALIGN (VarStoreHeader + 1);\r
-}\r
-\r
-/**\r
- This code gets the pointer to the last variable memory pointer byte\r
-\r
- @param VarStoreHeader Pointer to the Variable Store Header.\r
-\r
- @return VARIABLE_HEADER* Pointer to last unavailable Variable Header\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetEndPointer (\r
- IN VARIABLE_STORE_HEADER *VarStoreHeader\r
- )\r
-\r
-{\r
- //\r
- // The end of variable store\r
- //\r
- return (VARIABLE_HEADER *) HEADER_ALIGN ((UINTN) VarStoreHeader + VarStoreHeader->Size);\r
-}\r
-\r
-/**\r
-\r
- This code checks if variable header is valid or not.\r
-\r
- @param Variable Pointer to the Variable Header.\r
-\r
- @retval TRUE Variable header is valid.\r
- @retval FALSE Variable header is not valid.\r
-\r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-IsValidVariableHeader (\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-{\r
- if (Variable == NULL || Variable->StartId != VARIABLE_DATA ) {\r
- return FALSE;\r
- }\r
-\r
- return TRUE;\r
-}\r
-\r
-/**\r
- This code gets the size of name of variable.\r
-\r
- @param Variable Pointer to the Variable Header.\r
-\r
- @return UINTN Size of variable in bytes\r
-\r
-**/\r
-UINTN\r
-NameSizeOfVariable (\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-{\r
- if (Variable->State == (UINT8) (-1) ||\r
- Variable->DataSize == (UINT32) -1 ||\r
- Variable->NameSize == (UINT32) -1 ||\r
- Variable->Attributes == (UINT32) -1) {\r
- return 0;\r
- }\r
- return (UINTN) Variable->NameSize;\r
-}\r
-\r
-/**\r
- This code gets the size of name of variable.\r
-\r
- @param Variable Pointer to the Variable Header.\r
-\r
- @return UINTN Size of variable in bytes\r
-\r
-**/\r
-UINTN\r
-DataSizeOfVariable (\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-{\r
- if (Variable->State == (UINT8) -1 ||\r
- Variable->DataSize == (UINT32) -1 ||\r
- Variable->NameSize == (UINT32) -1 ||\r
- Variable->Attributes == (UINT32) -1) {\r
- return 0;\r
- }\r
- return (UINTN) Variable->DataSize;\r
-}\r
-\r
-/**\r
- This code gets the pointer to the variable name.\r
-\r
- @param Variable Pointer to the Variable Header.\r
-\r
- @return CHAR16* Pointer to Variable Name\r
-\r
-**/\r
-CHAR16 *\r
-GetVariableNamePtr (\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-\r
-{\r
-\r
- return (CHAR16 *) (Variable + 1);\r
-}\r
-\r
-/**\r
- This code gets the pointer to the variable data.\r
-\r
- @param Variable Pointer to the Variable Header.\r
-\r
- @return UINT8* Pointer to Variable Data\r
-\r
-**/\r
-UINT8 *\r
-GetVariableDataPtr (\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-{\r
- UINTN Value;\r
- \r
- //\r
- // Be careful about pad size for alignment\r
- //\r
- Value = (UINTN) GetVariableNamePtr (Variable);\r
- Value += NameSizeOfVariable (Variable);\r
- Value += GET_PAD_SIZE (NameSizeOfVariable (Variable));\r
-\r
- return (UINT8 *) Value;\r
-}\r
-\r
-/**\r
- This code gets the pointer to the next variable header.\r
-\r
- @param Variable Pointer to the Variable Header.\r
-\r
- @return VARIABLE_HEADER* Pointer to next variable header.\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetNextVariablePtr (\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-\r
-{\r
- UINTN Value;\r
-\r
- if (!IsValidVariableHeader (Variable)) {\r
- return NULL;\r
- }\r
-\r
- Value = (UINTN) GetVariableDataPtr (Variable);\r
- Value += DataSizeOfVariable (Variable);\r
- Value += GET_PAD_SIZE (DataSizeOfVariable (Variable));\r
-\r
- //\r
- // Be careful about pad size for alignment\r
- //\r
- return (VARIABLE_HEADER *) HEADER_ALIGN (Value);\r
-}\r
-\r
-/**\r
- This code gets the pointer to the variable name.\r
-\r
- @param VarStoreHeader Pointer to the Variable Store Header.\r
-\r
- @retval EfiRaw Variable store is raw\r
- @retval EfiValid Variable store is valid\r
- @retval EfiInvalid Variable store is invalid\r
-\r
-**/\r
-VARIABLE_STORE_STATUS\r
-EFIAPI\r
-GetVariableStoreStatus (\r
- IN VARIABLE_STORE_HEADER *VarStoreHeader\r
- )\r
-\r
-{\r
- \r
- if (CompareGuid (&VarStoreHeader->Signature, &gEfiVariableGuid) &&\r
- VarStoreHeader->Format == VARIABLE_STORE_FORMATTED &&\r
- VarStoreHeader->State == VARIABLE_STORE_HEALTHY\r
- ) {\r
-\r
- return EfiValid;\r
- }\r
-\r
- if (((UINT32 *)(&VarStoreHeader->Signature))[0] == 0xffffffff &&\r
- ((UINT32 *)(&VarStoreHeader->Signature))[1] == 0xffffffff &&\r
- ((UINT32 *)(&VarStoreHeader->Signature))[2] == 0xffffffff &&\r
- ((UINT32 *)(&VarStoreHeader->Signature))[3] == 0xffffffff &&\r
- VarStoreHeader->Size == 0xffffffff &&\r
- VarStoreHeader->Format == 0xff &&\r
- VarStoreHeader->State == 0xff\r
- ) {\r
-\r
- return EfiRaw;\r
- } else {\r
- return EfiInvalid;\r
- }\r
-}\r
-\r
-/**\r
- This function compares a variable with variable entries in database\r
-\r
- @param Variable - Pointer to the variable in our database\r
- @param VariableName - Name of the variable to compare to 'Variable'\r
- @param VendorGuid - GUID of the variable to compare to 'Variable'\r
- @param PtrTrack - Variable Track Pointer structure that contains\r
- Variable Information.\r
-\r
- @retval EFI_SUCCESS - Found match variable\r
- @retval EFI_NOT_FOUND - Variable not found\r
-\r
-**/\r
-EFI_STATUS\r
-CompareWithValidVariable (\r
- IN VARIABLE_HEADER *Variable,\r
- IN CONST CHAR16 *VariableName,\r
- IN CONST EFI_GUID *VendorGuid,\r
- OUT VARIABLE_POINTER_TRACK *PtrTrack\r
- )\r
-\r
-{\r
- VOID *Point;\r
-\r
- if (VariableName[0] == 0) {\r
- PtrTrack->CurrPtr = Variable;\r
- return EFI_SUCCESS;\r
- } else {\r
- //\r
- // Don't use CompareGuid function here for performance reasons.\r
- // Instead we compare the GUID a UINT32 at a time and branch\r
- // on the first failed comparison.\r
- //\r
- if ((((INT32 *) VendorGuid)[0] == ((INT32 *) &Variable->VendorGuid)[0]) &&\r
- (((INT32 *) VendorGuid)[1] == ((INT32 *) &Variable->VendorGuid)[1]) &&\r
- (((INT32 *) VendorGuid)[2] == ((INT32 *) &Variable->VendorGuid)[2]) &&\r
- (((INT32 *) VendorGuid)[3] == ((INT32 *) &Variable->VendorGuid)[3])\r
- ) {\r
- ASSERT (NameSizeOfVariable (Variable) != 0);\r
- Point = (VOID *) GetVariableNamePtr (Variable);\r
- if (!CompareMem (VariableName, Point, NameSizeOfVariable (Variable))) {\r
- PtrTrack->CurrPtr = Variable;\r
- return EFI_SUCCESS;\r
- }\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- This code finds variable in storage blocks (Non-Volatile)\r
-\r
- @param PeiServices - General purpose services available to every PEIM.\r
- @param VariableName - Name of the variable to be found\r
- @param VendorGuid - Vendor GUID to be found.\r
- @param PtrTrack - Variable Track Pointer structure that contains\r
- Variable Information.\r
-\r
- @retval EFI_SUCCESS - Variable found successfully\r
- @retval EFI_NOT_FOUND - Variable not found\r
- @retval EFI_INVALID_PARAMETER - Invalid variable name\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-FindVariable (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN CONST CHAR16 *VariableName,\r
- IN CONST EFI_GUID *VendorGuid,\r
- OUT VARIABLE_POINTER_TRACK *PtrTrack\r
- )\r
-\r
-{\r
- EFI_HOB_GUID_TYPE *GuidHob;\r
- VARIABLE_STORE_HEADER *VariableStoreHeader;\r
- VARIABLE_HEADER *Variable;\r
- VARIABLE_HEADER *MaxIndex;\r
- VARIABLE_INDEX_TABLE *IndexTable;\r
- UINT32 Count;\r
- UINT8 *VariableBase;\r
-\r
- if (VariableName[0] != 0 && VendorGuid == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // No Variable Address equals zero, so 0 as initial value is safe.\r
- //\r
- MaxIndex = 0;\r
-\r
- GuidHob = GetFirstGuidHob (&mEfiVariableIndexTableGuid);\r
- if (GuidHob == NULL) {\r
- IndexTable = BuildGuidHob (&mEfiVariableIndexTableGuid, sizeof (VARIABLE_INDEX_TABLE));\r
- IndexTable->Length = 0;\r
- IndexTable->StartPtr = NULL;\r
- IndexTable->EndPtr = NULL;\r
- IndexTable->GoneThrough = 0;\r
- } else {\r
- IndexTable = GET_GUID_HOB_DATA (GuidHob);\r
- for (Count = 0; Count < IndexTable->Length; Count++)\r
- {\r
- MaxIndex = GetVariableByIndex (IndexTable, Count);\r
-\r
- if (CompareWithValidVariable (MaxIndex, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {\r
- PtrTrack->StartPtr = IndexTable->StartPtr;\r
- PtrTrack->EndPtr = IndexTable->EndPtr;\r
-\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- if (IndexTable->GoneThrough) {\r
- return EFI_NOT_FOUND;\r
- }\r
- }\r
- //\r
- // If not found in HOB, then let's start from the MaxIndex we've found.\r
- //\r
- if (MaxIndex != NULL) {\r
- Variable = GetNextVariablePtr (MaxIndex);\r
- } else {\r
- if (IndexTable->StartPtr || IndexTable->EndPtr) {\r
- Variable = IndexTable->StartPtr;\r
- } else {\r
- VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);\r
-\r
- //\r
- // Check if FV header is valid.\r
- //\r
- if (((EFI_FIRMWARE_VOLUME_HEADER *) VariableBase)->Signature != EFI_FVH_SIGNATURE) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \\r
- ((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);\r
-\r
- if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- if (~VariableStoreHeader->Size == 0) {\r
- return EFI_NOT_FOUND;\r
- }\r
- //\r
- // Find the variable by walk through non-volatile variable store\r
- //\r
- IndexTable->StartPtr = GetStartPointer (VariableStoreHeader);\r
- IndexTable->EndPtr = GetEndPointer (VariableStoreHeader);\r
-\r
- //\r
- // Start Pointers for the variable.\r
- // Actual Data Pointer where data can be written.\r
- //\r
- Variable = IndexTable->StartPtr;\r
- }\r
- }\r
- //\r
- // Find the variable by walk through non-volatile variable store\r
- //\r
- PtrTrack->StartPtr = IndexTable->StartPtr;\r
- PtrTrack->EndPtr = IndexTable->EndPtr;\r
-\r
- while ((Variable < IndexTable->EndPtr) && IsValidVariableHeader (Variable)) {\r
- if (Variable->State == VAR_ADDED) {\r
- //\r
- // Record Variable in VariableIndex HOB\r
- //\r
- if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME)\r
- {\r
- VariableIndexTableUpdate (IndexTable, Variable);\r
- }\r
-\r
- if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {\r
- return EFI_SUCCESS;\r
- }\r
- }\r
-\r
- Variable = GetNextVariablePtr (Variable);\r
- }\r
- //\r
- // If gone through the VariableStore, that means we never find in Firmware any more.\r
- //\r
- if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME) {\r
- IndexTable->GoneThrough = 1;\r
- }\r
-\r
- PtrTrack->CurrPtr = NULL;\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- Provide the read variable functionality of the variable services.\r
-\r
- @param PeiServices - General purpose services available to every PEIM.\r
-\r
- @param VariableName - The variable name\r
-\r
- @param VendorGuid - The vendor's GUID\r
-\r
- @param Attributes - Pointer to the attribute\r
-\r
- @param DataSize - Size of data\r
-\r
- @param Data - Pointer to data\r
-\r
- @retval EFI_SUCCESS - The interface could be successfully installed\r
-\r
- @retval EFI_NOT_FOUND - The variable could not be discovered\r
-\r
- @retval EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetVariable (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID * VendorGuid,\r
- OUT UINT32 *Attributes OPTIONAL,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
- )\r
-\r
-{\r
- VARIABLE_POINTER_TRACK Variable;\r
- UINTN VarDataSize;\r
- EFI_STATUS Status;\r
-\r
- if (VariableName == NULL || VendorGuid == NULL || DataSize == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- //\r
- // Find existing variable\r
- //\r
- Status = FindVariable (PeiServices, VariableName, VendorGuid, &Variable);\r
-\r
- if (Variable.CurrPtr == NULL || Status != EFI_SUCCESS) {\r
- return Status;\r
- }\r
- //\r
- // Get data size\r
- //\r
- VarDataSize = DataSizeOfVariable (Variable.CurrPtr);\r
- if (*DataSize >= VarDataSize) {\r
- //\r
- // PO-TKW: Address one checking in this place\r
- //\r
- if (Data == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- (*PeiServices)->CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSize);\r
-\r
- if (Attributes != NULL) {\r
- *Attributes = Variable.CurrPtr->Attributes;\r
- }\r
-\r
- *DataSize = VarDataSize;\r
- return EFI_SUCCESS;\r
- } else {\r
- *DataSize = VarDataSize;\r
- return EFI_BUFFER_TOO_SMALL;\r
- }\r
-}\r
-\r
-/**\r
- Provide the read variable functionality of the variable services.\r
-\r
- @param PeiServices - General purpose services available to every PEIM.\r
-\r
- @param VariableName - The variable name\r
-\r
- @param VendorGuid - The vendor's GUID\r
-\r
- @param Attributes - Pointer to the attribute\r
-\r
- @param DataSize - Size of data\r
-\r
- @param Data - Pointer to data\r
-\r
- @retval EFI_SUCCESS - The interface could be successfully installed\r
-\r
- @retval EFI_NOT_FOUND - The variable could not be discovered\r
-\r
- @retval EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetVariable2 (\r
- IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
- IN CONST CHAR16 *VariableName,\r
- IN CONST EFI_GUID *VariableGuid,\r
- OUT UINT32 *Attributes,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
- )\r
-\r
-{\r
- return PeiGetVariable (\r
- (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),\r
- (CHAR16*)VariableName,\r
- (EFI_GUID*)VariableGuid,\r
- Attributes,\r
- DataSize,\r
- Data\r
- );\r
-}\r
-\r
-/**\r
- Provide the get next variable functionality of the variable services.\r
-\r
- @param PeiServices - General purpose services available to every PEIM.\r
- @param VariabvleNameSize - The variable name's size.\r
- @param VariableName - A pointer to the variable's name.\r
- @param VendorGuid - A pointer to the EFI_GUID structure.\r
-\r
- @param VariableNameSize - Size of the variable name\r
-\r
- @param VariableName - The variable name\r
-\r
- @param VendorGuid - The vendor's GUID\r
-\r
- @retval EFI_SUCCESS - The interface could be successfully installed\r
-\r
- @retval EFI_NOT_FOUND - The variable could not be discovered\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetNextVariableName (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VendorGuid\r
- )\r
-\r
-{\r
- VARIABLE_POINTER_TRACK Variable;\r
- UINTN VarNameSize;\r
- EFI_STATUS Status;\r
-\r
- if (VariableNameSize == NULL || VariableName == NULL || VendorGuid == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Status = FindVariable (PeiServices, VariableName, VendorGuid, &Variable);\r
-\r
- if (Variable.CurrPtr == NULL || Status != EFI_SUCCESS) {\r
- return Status;\r
- }\r
-\r
- if (VariableName[0] != 0) {\r
- //\r
- // If variable name is not NULL, get next variable\r
- //\r
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);\r
- }\r
-\r
- while (!(Variable.CurrPtr >= Variable.EndPtr || Variable.CurrPtr == NULL)) {\r
- if (IsValidVariableHeader (Variable.CurrPtr)) {\r
- if (Variable.CurrPtr->State == VAR_ADDED) {\r
- ASSERT (NameSizeOfVariable (Variable.CurrPtr) != 0);\r
-\r
- VarNameSize = (UINTN) NameSizeOfVariable (Variable.CurrPtr);\r
- if (VarNameSize <= *VariableNameSize) {\r
- (*PeiServices)->CopyMem (VariableName, GetVariableNamePtr (Variable.CurrPtr), VarNameSize);\r
-\r
- (*PeiServices)->CopyMem (VendorGuid, &Variable.CurrPtr->VendorGuid, sizeof (EFI_GUID));\r
-\r
- Status = EFI_SUCCESS;\r
- } else {\r
- Status = EFI_BUFFER_TOO_SMALL;\r
- }\r
-\r
- *VariableNameSize = VarNameSize;\r
- return Status;\r
- //\r
- // Variable is found\r
- //\r
- } else {\r
- Variable.CurrPtr = GetNextVariablePtr (Variable.CurrPtr);\r
- }\r
- } else {\r
- break;\r
- }\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- Provide the get next variable functionality of the variable services.\r
-\r
- @param PeiServices - General purpose services available to every PEIM.\r
- @param VariabvleNameSize - The variable name's size.\r
- @param VariableName - A pointer to the variable's name.\r
- @param VariableGuid - A pointer to the EFI_GUID structure.\r
-\r
- @param VariableNameSize - Size of the variable name\r
-\r
- @param VariableName - The variable name\r
-\r
- @param VendorGuid - The vendor's GUID\r
-\r
-\r
- @retval EFI_SUCCESS - The interface could be successfully installed\r
-\r
- @retval EFI_NOT_FOUND - The variable could not be discovered\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetNextVariableName2 (\r
- IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VariableGuid\r
- )\r
-\r
-{\r
- return PeiGetNextVariableName (\r
- (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),\r
- VariableNameSize,\r
- VariableName,\r
- VariableGuid\r
- );\r
-}\r
-\r
+++ /dev/null
-/** @file\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\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
-\r
-**/\r
-\r
-#ifndef _PEI_VARIABLE_H\r
-#define _PEI_VARIABLE_H\r
-\r
-#include <PiPei.h>\r
-#include <Ppi/ReadOnlyVariable.h>\r
-#include <Ppi/ReadOnlyVariable2.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PeimEntryPoint.h>\r
-#include <Library/HobLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/PeiServicesTablePointerLib.h>\r
-#include <Guid/VariableFormat.h>\r
-\r
-typedef struct {\r
- VARIABLE_HEADER *CurrPtr;\r
- VARIABLE_HEADER *EndPtr;\r
- VARIABLE_HEADER *StartPtr;\r
-} VARIABLE_POINTER_TRACK;\r
-\r
-#define VARIABLE_INDEX_TABLE_VOLUME 122\r
-\r
-#define EFI_VARIABLE_INDEX_TABLE_GUID \\r
- { 0x8cfdb8c8, 0xd6b2, 0x40f3, { 0x8e, 0x97, 0x02, 0x30, 0x7c, 0xc9, 0x8b, 0x7c } }\r
-\r
-typedef struct {\r
- UINT16 Length;\r
- UINT16 GoneThrough;\r
- VARIABLE_HEADER *EndPtr;\r
- VARIABLE_HEADER *StartPtr;\r
- UINT16 Index[VARIABLE_INDEX_TABLE_VOLUME];\r
-} VARIABLE_INDEX_TABLE;\r
-\r
-//\r
-// Functions\r
-//\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetVariable (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID * VendorGuid,\r
- OUT UINT32 *Attributes OPTIONAL,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
- );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetVariable2 (\r
- IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
- IN CONST CHAR16 *VariableName,\r
- IN CONST EFI_GUID *VariableGuid,\r
- OUT UINT32 *Attributes,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
- ); \r
- \r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetNextVariableName2 (\r
- IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VariableGuid\r
- );\r
- \r
-EFI_STATUS\r
-EFIAPI\r
-PeiGetNextVariableName (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VendorGuid\r
- );\r
-\r
-/**\r
- Get one variable by the index count.\r
-\r
- @param IndexTable The pointer to variable index table.\r
- @param Count The index count of variable in index table.\r
-\r
- @return The pointer to variable header indexed by count.\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetVariableByIndex (\r
- IN VARIABLE_INDEX_TABLE *IndexTable,\r
- IN UINT32 Count\r
- );\r
-\r
-/**\r
- Record Variable in VariableIndex HOB.\r
-\r
- Record Variable in VariableIndex HOB and update the length of variable index table.\r
-\r
- @param IndexTable The pointer to variable index table.\r
- @param Variable The pointer to the variable that will be recorded.\r
-\r
- @retval VOID\r
-\r
-**/\r
-VOID\r
-VariableIndexTableUpdate (\r
- IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
- IN VARIABLE_HEADER *Variable\r
- );\r
-\r
-#endif // _PEI_VARIABLE_H\r
+++ /dev/null
-#/** @file\r
-# Component description file for PeiVariable module.\r
-# \r
-# This module will produce EFI_PEI_READ_ONLY_VARIABLE_PPI and EFI_PEI_READ_ONLY_VARIABLE2_PPI\r
-# Framework PEIM to provide the Variable functionality.\r
-# Copyright (c) 2006 - 2009, Intel Corporation\r
-#\r
-# All rights reserved. This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\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
-#\r
-#\r
-#**/\r
-\r
-################################################################################\r
-#\r
-# Defines Section - statements that will be processed to create a Makefile.\r
-#\r
-################################################################################\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = PeiVariable\r
- FILE_GUID = 34C8C28F-B61C-45a2-8F2E-89E46BECC63B\r
- MODULE_TYPE = PEIM\r
- VERSION_STRING = 1.0\r
- EFI_SPECIFICATION_VERSION = 0x00020000\r
- ENTRY_POINT = PeimInitializeVariableServices\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-\r
-################################################################################\r
-#\r
-# Sources Section - list of files that are required for the build to succeed.\r
-#\r
-################################################################################\r
-\r
-[Sources.common]\r
- Variable.c\r
- Variable.h\r
-\r
-[Sources.Ia32]\r
- VariableWorker.c\r
-\r
-[Sources.X64]\r
- VariableWorker.c\r
-\r
-[Sources.IPF]\r
- Ipf/VariableWorker.c\r
-\r
-[Sources.EBC]\r
- VariableWorker.c\r
-\r
-\r
-################################################################################\r
-#\r
-# Package Dependency Section - list of Package files that are required for\r
-# this module.\r
-#\r
-################################################################################\r
-\r
-[Packages]\r
- MdeModulePkg/MdeModulePkg.dec\r
- MdePkg/MdePkg.dec\r
- IntelFrameworkPkg/IntelFrameworkPkg.dec\r
-\r
-\r
-################################################################################\r
-#\r
-# Library Class Section - list of Library Classes that are required for\r
-# this module.\r
-#\r
-################################################################################\r
-\r
-[LibraryClasses]\r
- BaseMemoryLib\r
- PcdLib\r
- HobLib\r
- PeimEntryPoint\r
- DebugLib\r
-\r
-\r
-################################################################################\r
-#\r
-# PPI C Name Section - list of PPI and PPI Notify C Names that this module\r
-# uses or produces.\r
-#\r
-################################################################################\r
-\r
-[Ppis]\r
- gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_PRODUCED\r
- gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_PRODUCED\r
-\r
-[Guids]\r
- gEfiVariableGuid\r
-\r
-################################################################################\r
-#\r
-# Pcd DYNAMIC - list of PCDs that this module is coded for.\r
-#\r
-################################################################################\r
-\r
-[Pcd.common]\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize\r
-\r
-[depex]\r
- TRUE\r
+++ /dev/null
-/** @file\r
-\r
-Copyright (c) 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\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
-\r
-Module Name:\r
-\r
- VariableWorker.c\r
-\r
-Abstract:\r
-\r
- Framework PEIM to provide the Variable functionality\r
-\r
-**/\r
-\r
-#include <Variable.h>\r
-\r
-/**\r
- Get one variable by the index count.\r
-\r
- @param IndexTable The pointer to variable index table.\r
- @param Count The index count of variable in index table.\r
-\r
- @return The pointer to variable header indexed by count.\r
-\r
-**/\r
-VARIABLE_HEADER *\r
-GetVariableByIndex (\r
- IN VARIABLE_INDEX_TABLE *IndexTable,\r
- IN UINT32 Count\r
- )\r
-{\r
- return (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));\r
-}\r
-\r
-/**\r
- Record Variable in VariableIndex HOB.\r
-\r
- Record Variable in VariableIndex HOB and update the length of variable index table.\r
-\r
- @param IndexTable The pointer to variable index table.\r
- @param Variable The pointer to the variable that will be recorded.\r
-\r
- @retval VOID\r
-\r
-**/\r
-VOID\r
-VariableIndexTableUpdate (\r
- IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r
- IN VARIABLE_HEADER *Variable\r
- )\r
-{\r
- IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;\r
-\r
- return;\r
-}\r
-\r