+++ /dev/null
-/** @file\r
-Common functions used by PCD PEIM and PCD DXE.\r
-\r
-Copyright (c) 2006, 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
-Module Name: PcdCommon.c\r
-\r
-**/\r
-#include "PcdCommon.h"\r
-\r
-\r
-\r
-/**\r
- The function retrieves the PCD data value according to\r
- the PCD_DATA_TYPE specified.\r
-\r
- @param[in] Type The PCD_DATA_TYPE used to interpret the data.\r
- @param[in] InData The input data.\r
- @param[in] OutData The output data.\r
- @param[in] Len The length of the data; it is mainly used for PcdPointer type.\r
-\r
- @retval VOID\r
---*/\r
-VOID\r
-GetDataBasedOnType (\r
- IN PCD_DATA_TYPE Type,\r
- IN VOID *InData,\r
- OUT VOID *OutData,\r
- IN UINTN Len\r
- )\r
-{\r
- if (Type == PcdPointer) {\r
- //\r
- // When the Type is PcdPointer, we are returning \r
- // the address of the internal buffer kpet by\r
- // PCD database. Therefore, we treat OutData as\r
- // a pointer to a "VOID *". Thus, the ugly type cast\r
- // (VOID **) is used.\r
- //\r
-\r
- *((VOID **) OutData) = InData;\r
- } else {\r
- CopyMem (OutData, InData, Len);\r
- }\r
- \r
- return;\r
- \r
-}\r
-\r
-UINTN\r
-GetExtendedDataOffset (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN UINTN SkuIdx,\r
- IN CONST PCD_DATABASE_HEADER *Info\r
- )\r
-{\r
- UINT8 *OffsetAddress;\r
- UINTN Offset;\r
-\r
- OffsetAddress = GetAbsoluteAddress (PcdIndex->ExtendedDataOffset, \r
- Info->ImageIndexOffset, \r
- Info\r
- );\r
-\r
- OffsetAddress += (SkuIdx * Info->ExtendedOffsetLength);\r
-\r
-\r
- CopyMem (&Offset, OffsetAddress, Info->ExtendedOffsetLength);\r
-\r
- return Offset;\r
-}\r
-\r
-\r
-\r
-VOID\r
-GetHiiDataProperty (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN UINTN SkuIdx,\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- OUT EFI_GUID **VariableGuid,\r
- OUT UINT16 **VariableName\r
- )\r
-{\r
- UINT16 NameOffset;\r
- UINT16 GuidOffset;\r
- UINT8 *HiiDataOffset;\r
-\r
- HiiDataOffset = GetAbsoluteAddress (PcdIndex->HiiData, Info->ImageIndexOffset, Info);\r
- HiiDataOffset += (SkuIdx * (Info->HiiGuidOffsetLength + Info->HiiVariableOffsetLength));\r
-\r
- CopyMem (&GuidOffset, HiiDataOffset, Info->HiiGuidOffsetLength);\r
- CopyMem (&NameOffset, HiiDataOffset + Info->HiiGuidOffsetLength, Info->HiiVariableOffsetLength);\r
- \r
- *VariableGuid = (EFI_GUID *) GetAbsoluteAddress (GuidOffset * sizeof (EFI_GUID), Info->GuidTableOffset, Info);\r
- *VariableName = (UINT16 *) GetAbsoluteAddress (NameOffset * sizeof (UINT16) , Info->StringTableOffset, Info);\r
- \r
- return;\r
-}\r
-\r
-\r
-\r
-UINTN\r
-GetSkuIdIdx (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN CONST PCD_DATABASE_HEADER *Info\r
- )\r
-{\r
- UINT8 *SkuIdArray;\r
- UINTN SkuIdx;\r
-\r
- SkuIdArray = GetAbsoluteAddress (PcdIndex->SkuIdArray, Info->ImageIndexOffset, Info);\r
- \r
- SkuIdx = 0;\r
-\r
- if (PcdIndex->StateByte.SkuEnable) {\r
-\r
- for (; SkuIdx < PcdIndex->SkuCount; SkuIdx++) {\r
- if (SkuIdArray[SkuIdx] == Info->SkuId) {\r
- break;\r
- }\r
- }\r
-\r
- if (SkuIdx > PcdIndex->SkuCount) {\r
- if (Info->SkuId == 0) {\r
- //\r
- // If no SKU_ID is set previously\r
- // Just retrieve the first value\r
- //\r
- SkuIdx = 0;\r
- } else {\r
- //\r
- // Just can't find the SKU_ID, ASSERT according to Spec.\r
- //\r
- ASSERT (FALSE);\r
- }\r
- }\r
- \r
- }\r
-\r
- return SkuIdx;\r
-\r
-}\r
-\r
-\r
-\r
-/**\r
- The function is the worker function to get the data of a PCD entry.\r
-\r
- @param[in] PcdIndex The PCD Index.\r
- @param[in] Info The attributes of the PCD database.\r
- @param[out] Data The output data.\r
-\r
- @retval VOID\r
---*/\r
-UINT8*\r
-GetPcdDataPtr (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN CONST PCD_DATABASE_HEADER *Info\r
- )\r
-{\r
- UINTN VariableDataSize;\r
- VOID *VariableData;\r
- UINT16 *VariableName;\r
- UINT8 *PcdData;\r
- EFI_GUID *VariableGuid;\r
- EFI_STATUS Status;\r
- UINTN SkuIdx;\r
- UINTN ExtendedOffset;\r
-\r
- //\r
- // If Sku is not enalbed for this PCD Entry.\r
- // SkuIdx 0 will be used to compute PcdData\r
- //\r
- SkuIdx = GetSkuIdIdx (PcdIndex, Info);\r
-\r
- if (PcdIndex->StateByte.HiiEnable) {\r
-\r
- GetHiiDataProperty (PcdIndex, SkuIdx, Info, &VariableGuid, &VariableName);\r
-\r
- Status = GetHiiVariable (VariableGuid, VariableName, &VariableData, &VariableDataSize);\r
- ASSERT_EFI_ERROR (Status);\r
- ASSERT (VariableDataSize >= (PcdIndex->DatumSize + PcdIndex->ExtendedDataOffset));\r
-\r
- PcdData = (UINT8 *) VariableData + PcdIndex->ExtendedDataOffset;\r
-\r
- return PcdData;\r
- }\r
-\r
- //\r
- // For VPD and Data type, we need the ExtendedOffset.\r
- // So get it here.\r
- //\r
- ExtendedOffset = GetExtendedDataOffset (PcdIndex, SkuIdx, Info);\r
-\r
- if (PcdIndex->StateByte.VpdEnable) {\r
-\r
- PcdData = (VOID *) (Info->VpdStart + ExtendedOffset);\r
- \r
- return PcdData;\r
- }\r
-\r
- //\r
- // For data type, we just need the pointer\r
- //\r
- PcdData = GetAbsoluteAddress (\r
- ExtendedOffset,\r
- Info->DataBufferOffset,\r
- Info\r
- );\r
-\r
- return PcdData;\r
-\r
-}\r
-\r
-\r
-\r
-/**\r
- The function locates the PCD_INDEX according to TokeNumber and GUID space given.\r
-\r
- @param[in] TokenNumber The token number.\r
- @param[in] Guid The GUID token space.\r
- @param[out] Info The attributes of the PCD database.\r
-\r
- @retval PCD_INDEX* The PCD_INDEX found.\r
---*/\r
-PCD_INDEX *\r
-FindPcdIndex (\r
- IN UINTN TokenNumber,\r
- IN CONST EFI_GUID *Guid,\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- OUT UINTN *Index\r
- )\r
-{\r
- PCD_INDEX *PcdIndex;\r
- UINTN Idx;\r
- EFI_GUID *GuidSpace;\r
-\r
- PcdIndex = (PCD_INDEX *) GetAbsoluteAddress (0, Info->PcdIndexOffset, Info);\r
-\r
- for (Idx = 0; Idx < Info->EntryCount; Idx++, PcdIndex++) {\r
- if (Index != NULL) {\r
- *Index = Idx;\r
- }\r
- \r
- if (PcdIndex->TokenNumber == TokenNumber) {\r
- if (Guid == NULL) {\r
- if (!PcdIndex->StateByte.ExtendedGuidPresent) {\r
- return PcdIndex;\r
- }\r
- } else {\r
- if (PcdIndex->StateByte.ExtendedGuidPresent) {\r
- GuidSpace = (EFI_GUID *) GetAbsoluteAddress (PcdIndex->DynamicExGuid, Info->GuidTableOffset, Info);\r
- if (CompareGuid (GuidSpace, Guid)) {\r
- return PcdIndex;\r
- }\r
- }\r
- }\r
- }\r
-\r
- }\r
-\r
- if (Index != NULL) {\r
- *Index = 0;\r
- }\r
- \r
- return NULL;\r
-\r
-}\r
-\r
-\r
-\r
-/**\r
- The function set the PCD Entry data value according to the\r
- PCD_DATA_TYPE given.\r
-\r
- @param[out] OutData The output data.\r
- @param[in] InData The input data.\r
- @param[in] Len The length of the data.\r
-\r
-\r
- @retval EFI_SUCESS If data value is found according to SKU_ID.\r
- @retval EFI_NOT_FOUND If not such a value is found.\r
-\r
---*/\r
-VOID\r
-SetDataBasedOnType (\r
- OUT VOID * OutData,\r
- IN CONST VOID * InData,\r
- IN UINTN Len\r
-)\r
-{\r
- CopyMem (OutData, InData, Len);\r
-\r
- return;\r
-}\r
-\r
-\r
-\r
-/**\r
- The function returns the actual address of item in the PCD\r
- database according to its Segment and Offset.\r
-\r
- @param[out] Offset The offset within the segment.\r
- @param[in] SegmentStart The starting address of the segment.\r
- @param[in] DatabaseStart The base address of the PCD DataBase.\r
-\r
-\r
- @retval UINT8* The absolute address.\r
-\r
---*/\r
-UINT8 *\r
-GetAbsoluteAddress (\r
- IN UINTN Offset,\r
- IN UINTN SegmentStart,\r
- IN CONST PCD_DATABASE_HEADER *DatabaseStart\r
- )\r
-{\r
- UINT8 *Address;\r
-\r
- Address = (UINT8 *) DatabaseStart + SegmentStart + Offset;\r
-\r
- return Address;\r
-}\r
-\r
-\r
-\r
-/**\r
- The function retrieves the PCD data value according to\r
- TokenNumber and Guid space given.\r
-\r
- @param[in] Database The PCD Database Instance.\r
- @param[in] TokenNumber The token number.\r
- @param[in] Guid The Guid space.\r
- @param[in] Type The storage type.\r
- @param[out] Data The output data.\r
-\r
- @retval VOID\r
-\r
---*/\r
-VOID\r
-GetPcdEntryWorker (\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN UINTN TokenNumber,\r
- IN CONST EFI_GUID *Guid, OPTIONAL\r
- IN PCD_DATA_TYPE Type,\r
- OUT VOID *Data\r
- )\r
-{\r
- PCD_INDEX *PcdIndex;\r
- UINT8 *PcdData;\r
-\r
- ASSERT (Data != NULL);\r
-\r
- //\r
- // Find the PCD entry in list in memory first\r
- //\r
- PcdIndex = FindPcdIndex (TokenNumber, Guid, Info, NULL);\r
-\r
- ASSERT (PcdIndex != NULL);\r
-\r
- ASSERT (PcdIndex->StateByte.DataType == Type);\r
-\r
- PcdData = GetPcdDataPtr (PcdIndex, Info);\r
-\r
- GetDataBasedOnType (PcdIndex->StateByte.DataType, PcdData, Data, PcdIndex->DatumSize);\r
-\r
- return;\r
-}\r
-\r
-\r
-\r
-/**\r
- The function retrieves the PCD data value according to\r
- TokenNumber and Guid space given.\r
-\r
- @param[in] Database The PCD Database Instance.\r
- @param[in] TokenNumber The token number.\r
- @param[in] Guid The Guid space.\r
-\r
- @retval UINTN The size of the PCD Entry.\r
-\r
---*/\r
-UINTN\r
-GetPcdEntrySizeWorker (\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN UINTN TokenNumber,\r
- IN CONST EFI_GUID *Guid OPTIONAL\r
- )\r
-{\r
- PCD_INDEX *PcdIndex;\r
-\r
- //\r
- // Find the PCD entry in list in memory first\r
- //\r
- PcdIndex = FindPcdIndex (TokenNumber, Guid, Info, NULL);\r
-\r
- ASSERT (PcdIndex != NULL);\r
-\r
- return PcdIndex->DatumSize;\r
-\r
-}\r
-\r
-\r
-\r
-/**\r
- The function checks if given GUID space match the record\r
- in the PCD_INDEX.\r
-\r
- @param[in] Guid The GUID space.\r
- @param[in] PcdIndex The PCD_INDEX.\r
- @param[in] Info The attribute of the PCD DATABASE.\r
-\r
- @retval TRUE The GUID space match the record.\r
- @retval FALSE Othewise.\r
-\r
---*/\r
-BOOLEAN\r
-PeiImageIndexMatchGuidSpace (\r
- IN CONST EFI_GUID *Guid,\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN CONST PCD_DATABASE_HEADER *Info\r
-)\r
-{\r
- EFI_GUID *GuidSpace;\r
-\r
- if (PcdIndex->StateByte.ExtendedGuidPresent) {\r
- GuidSpace = (EFI_GUID *) GetAbsoluteAddress (PcdIndex->DynamicExGuid, Info->GuidTableOffset, Info);\r
- return CompareGuid (GuidSpace, Guid);\r
- }\r
-\r
- return FALSE;\r
-}\r
-\r
-\r
-/**\r
- The function looks for the next PCD ENTRY.\r
- If *TokenNumber is 0, the first TokenNumber in\r
- the GUID token space is return.\r
- If there is no next TokenNumber found,\r
- *TokenNumber will be 0.\r
-\r
- @param[in] Database The PCD Database Instance.\r
- @param[in,out] TokenNumber The token number.\r
- @param[in] Guid The Guid space.\r
-\r
- @retval EFI_NOT_FOUND Can't find the PCD_ENTRY.\r
- @retval EFI_SUCCESS Operation succesful.\r
-\r
---*/\r
-EFI_STATUS\r
-GetNextTokenWorker (\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN OUT UINTN *TokenNumber,\r
- IN CONST EFI_GUID *Guid OPTIONAL\r
- )\r
-{\r
- PCD_INDEX *PcdIndex;\r
- UINTN Idx;\r
- BOOLEAN Found;\r
-\r
- Idx = 0;\r
- Found = FALSE;\r
- PcdIndex = (PCD_INDEX *) GetAbsoluteAddress (0, Info->PcdIndexOffset, Info);\r
-\r
- while ((Idx < Info->EntryCount) && !Found) {\r
- if (*TokenNumber == 0) {\r
- if (Guid == NULL || PeiImageIndexMatchGuidSpace (Guid, PcdIndex, Info)) {\r
- *TokenNumber = PcdIndex->TokenNumber;\r
- return EFI_SUCCESS;\r
- }\r
- } else {\r
- if (PcdIndex->TokenNumber == *TokenNumber) {\r
- if (Guid == NULL || PeiImageIndexMatchGuidSpace (Guid, PcdIndex, Info)) {\r
- Found = TRUE;\r
- }\r
- }\r
- }\r
-\r
- PcdIndex++;\r
- Idx++;\r
- }\r
-\r
- //\r
- // No PCD Entry in the database match the GUID space given.\r
- //\r
- if (*TokenNumber == 0) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- //\r
- // Can't find the PCD Entry\r
- //\r
- if (!Found) {\r
- return EFI_NOT_FOUND;\r
- }\r
-\r
- //\r
- // Move to the Next Entry\r
- //\r
- Idx++;\r
- PcdIndex++;\r
-\r
- //\r
- // Now look for the Next TokenNumber\r
- //\r
- while (Idx < Info->EntryCount) {\r
- if (Guid == NULL || PeiImageIndexMatchGuidSpace (Guid, PcdIndex, Info)) {\r
- *TokenNumber = PcdIndex->TokenNumber;\r
- return EFI_SUCCESS;\r
- }\r
- PcdIndex++;\r
- Idx++;\r
- }\r
-\r
- //\r
- // Reache the last TokeNumber.\r
- //\r
- *TokenNumber = 0;\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- The function is the worker function to set the data of a PCD entry.\r
-\r
- @param[in] PcdIndex The PCD Index.\r
- @param[in] Info The attributes of the PCD database.\r
- @param[in] Data The input data.\r
-\r
- @retval VOID\r
---*/\r
-EFI_STATUS\r
-SetPcdData (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN CONST VOID *Data\r
- )\r
-{\r
- UINT16 *VariableName;\r
- UINT8 *PcdData;\r
- EFI_GUID *VariableGuid;\r
- EFI_STATUS Status;\r
- UINTN SkuIdx;\r
- UINTN ExtendedOffset;\r
-\r
- if (PcdIndex->StateByte.VpdEnable) {\r
- ASSERT (FALSE);\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- SkuIdx = GetSkuIdIdx (PcdIndex, Info);\r
-\r
- //\r
- // For Hii and Data type, we need the ExtendedOffset.\r
- // So get it here.\r
- //\r
- ExtendedOffset = GetExtendedDataOffset (PcdIndex, SkuIdx, Info);\r
-\r
- if (PcdIndex->StateByte.HiiEnable) {\r
- GetHiiDataProperty (PcdIndex, SkuIdx, Info, &VariableGuid, &VariableName);\r
-\r
- Status = SetHiiVariable (VariableGuid,\r
- VariableName,\r
- Data,\r
- PcdIndex->DatumSize,\r
- ExtendedOffset\r
- );\r
-\r
- return Status;\r
- }\r
-\r
-\r
- PcdData = GetAbsoluteAddress (\r
- ExtendedOffset,\r
- Info->DataBufferOffset,\r
- Info\r
- );\r
-\r
- CopyMem (PcdData, Data, PcdIndex->DatumSize);\r
-\r
- return EFI_SUCCESS;\r
-\r
-}\r
-\r
+++ /dev/null
-/** @file\r
-Common functions used by PCD PEIM and PCD DXE.\r
-\r
-Copyright (c) 2006, 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
-Module Name: PcdCommon.h\r
-\r
-**/\r
-\r
-#ifndef __PCD_COMMON_H__\r
-#define __PCD_COMMON_H__\r
-\r
-//\r
-// Enumeration for PCD_DATA_TYPE\r
-//\r
-typedef enum {\r
- PcdByte8,\r
- PcdByte16,\r
- PcdByte32,\r
- PcdByte64,\r
- PcdPointer,\r
- PcdBoolean\r
-} PCD_DATA_TYPE;\r
-\r
-\r
-//\r
-// The definitions for Global PCD Length Fields\r
-//\r
-#define PCD_LENGTH_BIT8 0x01\r
-#define PCD_LENGTH_BIT16 0x02\r
-#define PCD_LENGTH_BIT24 0x03\r
-#define PCD_LENGTH_BIT32 0x04\r
-\r
-\r
-\r
-/*\r
- * This data structure is used in <PCD_IMAGE> transverse\r
- */\r
-typedef struct {\r
- UINTN EntryCount;\r
- UINTN GlobalOffsetLength;\r
- UINTN GlobalTokenLength;\r
- UINTN GlobalGuidTabIdxLength;\r
- UINTN GlobalDatumLength;\r
- UINTN GlobalStrTabIdxLength;\r
- \r
- CONST UINT8 *DataDefaultStart;\r
- UINTN DataDefaultLength;\r
- UINTN WholeDataDefaultLength;\r
- CONST UINT8 *IndexStart;\r
- UINTN IndexLength;\r
- CONST GUID *GuidTableStart;\r
- UINTN GuidTableLength;\r
- CONST UINT16 *StringTableStart;\r
- UINTN StringTableLength;\r
- /* Length of the <PCD_IMAGE> in byte.\r
- This info is from Section header\r
- in FFS */\r
- UINTN ImageLength;\r
- CONST UINT8 *ImageStart;\r
-\r
-} PCD_IMAGE_RECORD;\r
-\r
-\r
-\r
-typedef struct {\r
- BOOLEAN HiiEnable;\r
- BOOLEAN SkuEnable;\r
- BOOLEAN VpdEnable;\r
- BOOLEAN SkuDataArrayEnable;\r
- PCD_DATA_TYPE DataType;\r
- BOOLEAN ExtendedGuidPresent;\r
-} PCD_STATEBYTE;\r
-\r
-\r
-\r
-typedef struct {\r
- //\r
- // All Pointer's Offset in byte\r
- //\r
- UINT32 TokenNumber;\r
- PCD_STATEBYTE StateByte;\r
- UINT32 HiiData;\r
- UINT32 SkuIdArray; //Pointer\r
- UINT32 ExtendedDataOffset;\r
- UINT32 DatumSize;\r
- UINT16 DynamicExGuid; //Pointer\r
- UINT8 SkuCount;\r
-} PCD_INDEX;\r
-\r
-\r
-\r
-/* \r
- * PCD Image Definition according PCD Specification 0.51. \r
- *\r
- */\r
-#pragma pack(1)\r
-typedef struct {\r
- UINT8 ImageLength[3]; \r
- //\r
- // The length of PCD_FFS_ENCODING is included\r
- // in ImageLength\r
- //\r
- UINT8 DataBufferLength[3];\r
- UINT8 WholeDataBufferLength[3];\r
- UINT8 PcdIndexLength[3];\r
- UINT8 GuidTableLength[3];\r
- //\r
- // The StringTable can be computed using:\r
- // ImageLength, DataBufferLength, PcdIndexLength, GuidTableLength,\r
- // and length of PCD_FFS_ENCODING\r
- //\r
- UINT8 EntryCount[3];\r
- UINT8 GlobalOffsetLength[1];\r
- UINT8 GlobalTokenLength[1];\r
- UINT8 GuidLength[1];\r
- UINT8 GlobalDatumLength[1];\r
- UINT8 GlobalStrTabIdxLength[1];\r
-} PCD_FFS_ENCODING;\r
-#pragma pack()\r
-\r
-\r
- \r
-typedef struct {\r
- UINTN DatabaseLen;\r
- UINTN EntryCount;\r
- UINTN InfoLength;\r
- UINTN GuidTableOffset;\r
- UINTN PcdIndexOffset;\r
- UINTN StringTableOffset;\r
- UINTN CallbackTableOffset;\r
- UINTN ImageIndexOffset;\r
- UINTN DataBufferOffset;\r
- UINTN MaxCallbackNum;\r
- UINTN HiiVariableOffsetLength;\r
- UINTN HiiGuidOffsetLength;\r
- UINTN ExtendedOffsetLength;\r
- UINT8 *VpdStart;\r
- UINTN SkuId;\r
-} PCD_DATABASE_HEADER;\r
-\r
-\r
-\r
-typedef struct {\r
- PCD_DATABASE_HEADER Info;\r
- EFI_GUID GuidTable[1];\r
-} PCD_DATABASE;\r
-\r
-extern EFI_GUID gPcdDataBaseHobGuid;\r
-\r
-\r
-/**\r
- The function returns the actual address of item in the PCD\r
- database according to its Segment and Offset.\r
-\r
- @param[out] Offset The offset within the segment.\r
- @param[in] SegmentStart The starting address of the segment.\r
- @param[in] DatabaseStart The base address of the PCD DataBase.\r
- \r
-\r
- @retval EFI_SUCESS If data value is found according to SKU_ID.\r
- @retval EFI_NOT_FOUND If not such a value is found.\r
-\r
---*/\r
-UINT8 *\r
-GetAbsoluteAddress (\r
- IN UINTN Offset, \r
- IN UINTN SegmentStart, \r
- IN CONST VOID *Base\r
- )\r
-;\r
-\r
-\r
-\r
-/**\r
- The function return the number of Unicode Character in a NULL terminated string.\r
- The NULL is NOT counted.\r
- \r
- @param[in] String The unicode string starts from an unaligned address.\r
- \r
- @retval UINTN The number of Unicode characters.\r
---*/\r
-UINTN\r
-GetUnalignedStrLen (\r
- UINT16 *String\r
-);\r
-\r
-\r
-/**\r
- The function retrieves the PCD data value according to \r
- TokenNumber and Guid space given.\r
-\r
- @param[in] Info The PCD Database Info.\r
- @param[in] TokenNumber The token number.\r
- @param[in] Guid The Guid space.\r
- @param[in] Type The storage type.\r
- @param[out] Data The output data.\r
-\r
- @retval VOID\r
-\r
---*/\r
-VOID\r
-GetPcdEntryWorker (\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN UINTN TokenNumber,\r
- IN CONST GUID *Guid, OPTIONAL\r
- IN PCD_DATA_TYPE Type,\r
- OUT VOID *Data\r
- )\r
-;\r
-\r
-\r
-\r
-/**\r
- The function retrieves the PCD data value according to \r
- TokenNumber and Guid space given.\r
-\r
- @param[in] Info The PCD Database info.\r
- @param[in] TokenNumber The token number.\r
- @param[in] Guid The Guid space.\r
-\r
- @retval UINTN The size of the PCD Entry.\r
-\r
---*/\r
-UINTN\r
-GetPcdEntrySizeWorker (\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN UINTN TokenNumber,\r
- IN CONST GUID *Guid OPTIONAL\r
- )\r
-;\r
-\r
-\r
-\r
-/**\r
- The function looks for the next PCD ENTRY.\r
- If *TokenNumber is 0, the first TokenNumber in\r
- the GUID token space is return.\r
- If there is no next TokenNumber found,\r
- *TokenNumber will be 0.\r
-\r
- @param[in] Info The PCD Database info.\r
- @param[in,out] TokenNumber The token number.\r
- @param[in] Guid The Guid space.\r
- \r
- @retval EFI_NOT_FOUND Can't find the PCD_ENTRY.\r
- @retval EFI_SUCCESS Operation succesful.\r
-\r
---*/\r
-EFI_STATUS\r
-GetNextTokenWorker (\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN OUT UINTN *TokenNumber,\r
- IN CONST GUID *Guid OPTIONAL\r
- )\r
-;\r
-\r
-\r
-\r
-/**\r
- The function is the worker function to set the data of a PCD entry.\r
- \r
- @param[in] PcdIndex The PCD Index.\r
- @param[in] Info The attributes of the PCD database.\r
- @param[in] Data The input data.\r
- \r
- @retval VOID\r
---*/\r
-EFI_STATUS\r
-SetPcdData (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- IN CONST VOID *Data\r
- )\r
-;\r
-\r
-\r
-/**\r
- The function is provided by PCD PEIM and PCD DXE driver to\r
- do the work of reading a HII variable from variable service.\r
- \r
- @param[in] VariableGuid The Variable GUID.\r
- @param[in] VariableName The Variable Name.\r
- @param[out] VariableData The output data.\r
- @param[out] VariableSize The size of the variable.\r
- \r
- @retval EFI_SUCCESS Operation successful.\r
- @retval EFI_SUCCESS Variablel not found.\r
---*/\r
-EFI_STATUS\r
-GetHiiVariable (\r
- IN EFI_GUID *VariableGuid,\r
- IN UINT16 *VariableName,\r
- OUT VOID **VariableData,\r
- OUT UINTN *VariableSize\r
- )\r
-;\r
-\r
-\r
-\r
-/**\r
- The function is provided by PCD PEIM and PCD DXE driver to\r
- do the work of reading a HII variable from variable service.\r
- \r
- @param[in] VariableGuid The Variable GUID.\r
- @param[in] VariableName The Variable Name.\r
- @param[in] Data The input data.\r
- @param[out] VariableSize The size of the variable.\r
- @param[in] Offset The offset of the variable data that a PCD entry will starts from.\r
- \r
- @retval EFI_SUCCESS Operation successful.\r
- @retval EFI_SUCCESS Variablel not found.\r
---*/\r
-EFI_STATUS\r
-SetHiiVariable (\r
- IN EFI_GUID *VariableGuid,\r
- IN UINT16 *VariableName,\r
- IN CONST VOID *Data,\r
- IN UINTN VariableSize,\r
- IN UINTN Offset\r
- )\r
-;\r
-\r
-/**\r
- The function locates the PCD_INDEX according to TokeNumber and GUID space given.\r
-\r
- @param[in] TokenNumber The token number.\r
- @param[in] Guid The GUID token space.\r
- @param[out] Info The attributes of the PCD database.\r
-\r
- @retval PCD_INDEX* The PCD_INDEX found.\r
---*/\r
-PCD_INDEX *\r
-FindPcdIndex (\r
- IN UINTN TokenNumber,\r
- IN CONST GUID *Guid,\r
- IN CONST PCD_DATABASE_HEADER *Info,\r
- OUT UINTN *Index\r
- )\r
-;\r
-\r
-/**\r
- (WQBUGBUG: You must handle the new SKU_ID encoding.\r
- The function is the worker function to get the data of a PCD entry.\r
-\r
- @param[in] PcdIndex The PCD Index.\r
- @param[in] Info The attributes of the PCD database.\r
- @param[out] Data The output data.\r
-\r
- @retval VOID\r
---*/\r
-UINT8*\r
-GetPcdDataPtr (\r
- IN CONST PCD_INDEX *PcdIndex,\r
- IN CONST PCD_DATABASE_HEADER *Info\r
- )\r
-;\r
-\r
-/**\r
- The function retrieves the PCD data value according to\r
- the PCD_DATA_TYPE specified.\r
-\r
- @param[in] Type The PCD_DATA_TYPE used to interpret the data.\r
- @param[in] InData The input data.\r
- @param[in] OutData The output data.\r
- @param[in] Len The length of the data; it is mainly used for PcdPointer type.\r
-\r
- @retval VOID\r
---*/\r
-VOID\r
-GetDataBasedOnType (\r
- IN PCD_DATA_TYPE Type,\r
- IN VOID *InData,\r
- OUT VOID *OutData,\r
- IN UINTN Len\r
- )\r
-;\r
-#endif\r