mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
1) Add in support to traverse taken space
2) Remove unused import in DynamicTokenValue.java. 3) Support Byte Stream input for Pointer type Dynamic PCD entry in FPD file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@616 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e88ea4239b
commit
4276d5dacf
@ -553,7 +553,9 @@ DxePcdGetNextToken (
|
||||
);
|
||||
}
|
||||
|
||||
if (!DXE_EXMAP_TABLE_EMPTY) {
|
||||
if ((ExTokenNumber == PCD_INVALID_TOKEN_NUMBER) &&
|
||||
!DXE_EXMAP_TABLE_EMPTY
|
||||
) {
|
||||
ExTokenNumber = ExGetNextTokeNumber (
|
||||
Guid,
|
||||
ExTokenNumber,
|
||||
@ -569,3 +571,119 @@ DxePcdGetNextToken (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_GUID **
|
||||
GetDistinctTokenSpace (
|
||||
IN OUT UINTN *ExMapTableSize,
|
||||
IN DYNAMICEX_MAPPING *ExMapTable,
|
||||
IN EFI_GUID *GuidTable
|
||||
)
|
||||
{
|
||||
EFI_GUID **DistinctTokenSpace;
|
||||
UINTN OldGuidIndex;
|
||||
UINTN TsIdx;
|
||||
UINTN Idx;
|
||||
|
||||
|
||||
DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));
|
||||
ASSERT (DistinctTokenSpace != NULL);
|
||||
|
||||
TsIdx = 0;
|
||||
OldGuidIndex = ExMapTable[0].ExGuidIndex;
|
||||
DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];
|
||||
for (Idx = 1; Idx < PEI_EXMAPPING_TABLE_SIZE; Idx++) {
|
||||
if (ExMapTable[Idx].ExGuidIndex != OldGuidIndex) {
|
||||
OldGuidIndex = ExMapTable[Idx].ExGuidIndex;
|
||||
DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];
|
||||
}
|
||||
}
|
||||
|
||||
*ExMapTableSize = TsIdx;
|
||||
return DistinctTokenSpace;
|
||||
|
||||
}
|
||||
|
||||
|
||||
STATIC EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE] = { 0 };
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DxePcdGetNextTokenSpace (
|
||||
IN OUT CONST EFI_GUID **Guid
|
||||
)
|
||||
{
|
||||
UINTN Idx;
|
||||
UINTN Idx2;
|
||||
UINTN Idx3;
|
||||
UINTN PeiTokenSpaceTableSize;
|
||||
UINTN DxeTokenSpaceTableSize;
|
||||
EFI_GUID **PeiTokenSpaceTable;
|
||||
EFI_GUID **DxeTokenSpaceTable;
|
||||
BOOLEAN Match;
|
||||
|
||||
ASSERT (Guid != NULL);
|
||||
|
||||
if (PEI_EXMAP_TABLE_EMPTY && DXE_EXMAP_TABLE_EMPTY) {
|
||||
if (*Guid != NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (TmpTokenSpaceBuffer[0] != NULL) {
|
||||
PeiTokenSpaceTableSize = 0;
|
||||
|
||||
if (!PEI_EXMAP_TABLE_EMPTY) {
|
||||
PeiTokenSpaceTableSize = PEI_EXMAPPING_TABLE_SIZE;
|
||||
PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,
|
||||
mPcdDatabase->PeiDb.Init.ExMapTable,
|
||||
mPcdDatabase->PeiDb.Init.GuidTable
|
||||
);
|
||||
CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);
|
||||
}
|
||||
|
||||
if (!DXE_EXMAP_TABLE_EMPTY) {
|
||||
DxeTokenSpaceTableSize = DXE_EXMAPPING_TABLE_SIZE;
|
||||
DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,
|
||||
mPcdDatabase->DxeDb.Init.ExMapTable,
|
||||
mPcdDatabase->DxeDb.Init.GuidTable
|
||||
);
|
||||
|
||||
//
|
||||
// Make sure EFI_GUID in DxeTokenSpaceTable does not exist in PeiTokenSpaceTable
|
||||
//
|
||||
for (Idx2 = 0, Idx3 = PeiTokenSpaceTableSize; Idx2 < DxeTokenSpaceTableSize; Idx2++) {
|
||||
Match = FALSE;
|
||||
for (Idx = 0; Idx < PeiTokenSpaceTableSize; Idx++) {
|
||||
if (CompareGuid (TmpTokenSpaceBuffer[Idx], DxeTokenSpaceTable[Idx2])) {
|
||||
Match = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!Match) {
|
||||
TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (*Guid == NULL) {
|
||||
*Guid = TmpTokenSpaceBuffer[0];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
for (Idx = 0; Idx < (PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE); Idx++) {
|
||||
if(CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {
|
||||
Idx++;
|
||||
*Guid = TmpTokenSpaceBuffer[Idx];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -263,7 +263,7 @@ ExGetNextTokeNumber (
|
||||
if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
|
||||
return ExMapTable[Idx].ExTokenNumber;
|
||||
}
|
||||
|
||||
|
||||
for ( ; Idx < SizeOfExMapTable; Idx++) {
|
||||
if (ExMapTable[Idx].ExTokenNumber == TokenNumber) {
|
||||
Idx++;
|
||||
|
@ -52,7 +52,8 @@ PCD_PPI mPcdPpiInstance = {
|
||||
|
||||
PeiRegisterCallBackOnSet,
|
||||
PcdUnRegisterCallBackOnSet,
|
||||
PeiPcdGetNextToken
|
||||
PeiPcdGetNextToken,
|
||||
PeiPcdGetNextTokenSpace
|
||||
};
|
||||
|
||||
|
||||
@ -568,7 +569,7 @@ PeiPcdGetNextToken (
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiPcdGetNextTokenSpaceGuid (
|
||||
PeiPcdGetNextTokenSpace (
|
||||
IN OUT CONST EFI_GUID **Guid
|
||||
)
|
||||
{
|
||||
@ -579,17 +580,15 @@ PeiPcdGetNextTokenSpaceGuid (
|
||||
UINTN i;
|
||||
BOOLEAN Found;
|
||||
|
||||
if (*Guid == NULL) {
|
||||
if (PEI_EXMAP_TABLE_EMPTY) {
|
||||
return EFI_SUCCESS;
|
||||
ASSERT (Guid != NULL);
|
||||
|
||||
if (PEI_EXMAP_TABLE_EMPTY) {
|
||||
if (*Guid != NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
} else {
|
||||
//
|
||||
// return the first Token Space Guid.
|
||||
//
|
||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Assume PCD Database AutoGen tool is sorting the ExMap based on the following order
|
||||
@ -598,6 +597,16 @@ PeiPcdGetNextTokenSpaceGuid (
|
||||
//
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
|
||||
ExMapTable = PeiPcdDb->Init.ExMapTable;
|
||||
|
||||
if (*Guid == NULL) {
|
||||
//
|
||||
// return the first Token Space Guid.
|
||||
//
|
||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);
|
||||
|
||||
if (MatchGuid == NULL) {
|
||||
@ -606,8 +615,6 @@ PeiPcdGetNextTokenSpaceGuid (
|
||||
|
||||
GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
|
||||
|
||||
ExMapTable = PeiPcdDb->Init.ExMapTable;
|
||||
|
||||
Found = FALSE;
|
||||
for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
|
||||
if (ExMapTable[i].ExGuidIndex == GuidTableIdx) {
|
||||
@ -617,12 +624,15 @@ PeiPcdGetNextTokenSpaceGuid (
|
||||
}
|
||||
|
||||
if (Found) {
|
||||
i++;
|
||||
for ( ; i < PEI_EXMAPPING_TABLE_SIZE; i++ ) {
|
||||
if (ExMapTable[i].ExGuidIndex != GuidTableIdx ) {
|
||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[i].ExGuidIndex];
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
*Guid = NULL;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
|
@ -381,6 +381,14 @@ PeiPcdGetNextToken (
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PeiPcdGetNextTokenSpace (
|
||||
IN CONST EFI_GUID **Guid
|
||||
)
|
||||
;
|
||||
|
||||
extern EFI_GUID gPcdDataBaseHobGuid;
|
||||
|
||||
extern EFI_GUID gPcdPeiCallbackFnTableHobGuid;
|
||||
|
@ -436,10 +436,20 @@ LibPcdSet64 (
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber to
|
||||
the value specified by Value. Value is returned.
|
||||
If Value is NULL, then ASSERT().
|
||||
the value specified by Buffer and SizeOfValue. Buffer to
|
||||
be set is returned. The content of the buffer could be
|
||||
overwritten if a Callback on SET is registered with this
|
||||
TokenNumber.
|
||||
|
||||
If SizeOfValue is greater than the maximum
|
||||
size support by TokenNumber, then set SizeOfValue to the
|
||||
maximum size supported by TokenNumber and return NULL to
|
||||
indicate that the set operation was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Value A pointer to the buffer to set.
|
||||
|
||||
@retval VOID* Return the pointer for the buffer been set.
|
||||
@ -448,9 +458,9 @@ LibPcdSet64 (
|
||||
VOID*
|
||||
EFIAPI
|
||||
LibPcdSetPtr (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Value
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Value
|
||||
);
|
||||
|
||||
|
||||
@ -561,26 +571,30 @@ LibPcdSetEx64 (
|
||||
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If Value is NULL, then ASSERT().
|
||||
Sets a buffer for the token specified by TokenNumber to the value specified by
|
||||
Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
|
||||
the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
|
||||
supported by TokenNumber and return NULL to indicate that the set operation
|
||||
was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 8-bit value to set.
|
||||
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Buffer A pointer to the buffer to set.
|
||||
|
||||
@retval VOID * Return the value been set.
|
||||
@retval VOID * Return the pinter to the buffer been set.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetExPtr (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Value
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
|
||||
@ -697,4 +711,30 @@ LibPcdGetNextToken (
|
||||
IN UINTN TokenNumber
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the next PCD token space from a token space specified by Guid.
|
||||
Guid of NULL is reserved to mark the default local token namespace on the current
|
||||
platform. If Guid is NULL, then the GUID of the first non-local token space of the
|
||||
current platform is returned. If Guid is the last non-local token space,
|
||||
then NULL is returned.
|
||||
|
||||
If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
|
||||
|
||||
|
||||
|
||||
@param[in] Pointer to a 128-bit unique value that designates from which namespace
|
||||
to start the search.
|
||||
|
||||
@retval CONST GUID * The next valid token namespace.
|
||||
|
||||
**/
|
||||
|
||||
CONST GUID*
|
||||
EFIAPI
|
||||
LibPcdGetNextTokenSpace (
|
||||
IN CONST GUID *Guid
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -256,6 +256,12 @@ EFI_STATUS
|
||||
IN OUT UINTN *TokenNumber
|
||||
);
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *PCD_PPI_GET_NEXT_TOKENSPACE) (
|
||||
IN OUT CONST EFI_GUID **Guid
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
PCD_PPI_SET_SKU SetSku;
|
||||
|
||||
@ -292,6 +298,7 @@ typedef struct {
|
||||
PCD_PPI_CALLBACK_ONSET CallbackOnSet;
|
||||
PCD_PPI_CANCEL_CALLBACK CancelCallback;
|
||||
PCD_PPI_GET_NEXT_TOKEN GetNextToken;
|
||||
PCD_PPI_GET_NEXT_TOKENSPACE GetNextTokenSpace;
|
||||
} PCD_PPI;
|
||||
|
||||
|
||||
|
@ -256,6 +256,14 @@ EFI_STATUS
|
||||
IN OUT UINTN *TokenNumber
|
||||
);
|
||||
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *PCD_PROTOCOL_GET_NEXT_TOKENSPACE) (
|
||||
IN CONST EFI_GUID **Guid
|
||||
);
|
||||
|
||||
|
||||
typedef struct {
|
||||
PCD_PROTOCOL_SET_SKU SetSku;
|
||||
|
||||
@ -292,6 +300,7 @@ typedef struct {
|
||||
PCD_PROTOCOL_CALLBACK_ONSET CallbackOnSet;
|
||||
PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;
|
||||
PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;
|
||||
PCD_PROTOCOL_GET_NEXT_TOKENSPACE GetNextTokenSpace;
|
||||
} PCD_PROTOCOL;
|
||||
|
||||
#endif
|
||||
|
@ -434,10 +434,20 @@ LibPcdSet64 (
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber to
|
||||
the value specified by Value. Value is returned.
|
||||
If Value is NULL, then ASSERT().
|
||||
the value specified by Buffer and SizeOfValue. Buffer to
|
||||
be set is returned. The content of the buffer could be
|
||||
overwritten if a Callback on SET is registered with this
|
||||
TokenNumber.
|
||||
|
||||
If SizeOfValue is greater than the maximum
|
||||
size support by TokenNumber, then set SizeOfValue to the
|
||||
maximum size supported by TokenNumber and return NULL to
|
||||
indicate that the set operation was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Value A pointer to the buffer to set.
|
||||
|
||||
@retval VOID* Return the pointer for the buffer been set.
|
||||
@ -446,9 +456,9 @@ LibPcdSet64 (
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetPtr (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
ASSERT (Buffer != NULL);
|
||||
@ -593,26 +603,30 @@ LibPcdSetEx64 (
|
||||
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If Value is NULL, then ASSERT().
|
||||
Sets a buffer for the token specified by TokenNumber to the value specified by
|
||||
Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
|
||||
the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
|
||||
supported by TokenNumber and return NULL to indicate that the set operation
|
||||
was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 8-bit value to set.
|
||||
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Buffer A pointer to the buffer to set.
|
||||
|
||||
@retval VOID * Return the value been set.
|
||||
@retval VOID * Return the pinter to the buffer been set.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetExPtr (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
ASSERT (Guid != NULL);
|
||||
@ -729,3 +743,31 @@ LibPcdGetNextToken (
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the next PCD token space from a token space specified by Guid.
|
||||
Guid of NULL is reserved to mark the default local token namespace on the current
|
||||
platform. If Guid is NULL, then the GUID of the first non-local token space of the
|
||||
current platform is returned. If Guid is the last non-local token space,
|
||||
then NULL is returned.
|
||||
|
||||
If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
|
||||
|
||||
|
||||
|
||||
@param[in] Pointer to a 128-bit unique value that designates from which namespace
|
||||
to start the search.
|
||||
|
||||
@retval CONST GUID * The next valid token namespace.
|
||||
|
||||
**/
|
||||
CONST GUID*
|
||||
EFIAPI
|
||||
LibPcdGetNextTokenSpace (
|
||||
IN CONST GUID *Guid
|
||||
)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -483,28 +483,47 @@ LibPcdSet64 (
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber to
|
||||
the value specified by Value. Value is returned.
|
||||
If Value is NULL, then ASSERT().
|
||||
the value specified by Buffer and SizeOfValue. Buffer to
|
||||
be set is returned. The content of the buffer could be
|
||||
overwritten if a Callback on SET is registered with this
|
||||
TokenNumber.
|
||||
|
||||
If SizeOfValue is greater than the maximum
|
||||
size support by TokenNumber, then set SizeOfValue to the
|
||||
maximum size supported by TokenNumber and return NULL to
|
||||
indicate that the set operation was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Value A pointer to the buffer to set.
|
||||
|
||||
@retval VOID* Return the pointer for the buffer been set.
|
||||
|
||||
**/
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetPtr (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
|
||||
ASSERT (Buffer != NULL);
|
||||
ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);
|
||||
|
||||
Status = mPcd->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
|
||||
Size = LibPcdGetSize (TokenNumber);
|
||||
|
||||
if (*SizeOfBuffer > Size) {
|
||||
*SizeOfBuffer = Size;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = mPcd->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -678,34 +697,45 @@ LibPcdSetEx64 (
|
||||
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If Value is NULL, then ASSERT().
|
||||
Sets a buffer for the token specified by TokenNumber to the value specified by
|
||||
Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
|
||||
the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
|
||||
supported by TokenNumber and return NULL to indicate that the set operation
|
||||
was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 8-bit value to set.
|
||||
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Buffer A pointer to the buffer to set.
|
||||
|
||||
@retval VOID * Return the value been set.
|
||||
@retval VOID * Return the pinter to the buffer been set.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetExPtr (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
|
||||
ASSERT (Guid != NULL);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
Status = mPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
|
||||
Size = LibPcdGetExSize (Guid, TokenNumber);
|
||||
if (*SizeOfBuffer > Size) {
|
||||
*SizeOfBuffer = Size;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = mPcd->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -849,3 +879,37 @@ LibPcdGetNextToken (
|
||||
return TokenNumber;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the next PCD token space from a token space specified by Guid.
|
||||
Guid of NULL is reserved to mark the default local token namespace on the current
|
||||
platform. If Guid is NULL, then the GUID of the first non-local token space of the
|
||||
current platform is returned. If Guid is the last non-local token space,
|
||||
then NULL is returned.
|
||||
|
||||
If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
|
||||
|
||||
|
||||
|
||||
@param[in] Pointer to a 128-bit unique value that designates from which namespace
|
||||
to start the search.
|
||||
|
||||
@retval CONST GUID * The next valid token namespace.
|
||||
|
||||
**/
|
||||
CONST GUID*
|
||||
EFIAPI
|
||||
LibPcdGetNextTokenSpace (
|
||||
IN CONST GUID *Guid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = mPcd->GetNextTokenSpace (&Guid);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Guid;
|
||||
}
|
||||
|
||||
|
@ -555,10 +555,20 @@ LibPcdSet64 (
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber to
|
||||
the value specified by Value. Value is returned.
|
||||
If Value is NULL, then ASSERT().
|
||||
the value specified by Buffer and SizeOfValue. Buffer to
|
||||
be set is returned. The content of the buffer could be
|
||||
overwritten if a Callback on SET is registered with this
|
||||
TokenNumber.
|
||||
|
||||
If SizeOfValue is greater than the maximum
|
||||
size support by TokenNumber, then set SizeOfValue to the
|
||||
maximum size supported by TokenNumber and return NULL to
|
||||
indicate that the set operation was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in,out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Value A pointer to the buffer to set.
|
||||
|
||||
@retval VOID* Return the pointer for the buffer been set.
|
||||
@ -567,18 +577,27 @@ LibPcdSet64 (
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetPtr (
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PCD_PPI * PcdPpi;
|
||||
PCD_PPI *PcdPpi;
|
||||
UINTN Size;
|
||||
|
||||
PcdPpi = GetPcdPpiPtr ();
|
||||
|
||||
ASSERT ((*SizeOfBuffer > 0) && Buffer == NULL);
|
||||
|
||||
Size = LibPcdGetSize (TokenNumber);
|
||||
|
||||
if (*SizeOfBuffer > Size) {
|
||||
*SizeOfBuffer = Size;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = PcdPpi->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
|
||||
Status = PcdPpi->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -764,34 +783,45 @@ LibPcdSetEx64 (
|
||||
|
||||
|
||||
/**
|
||||
Sets a buffer for the token specified by TokenNumber and
|
||||
Guid to the value specified by Value. Value is returned.
|
||||
If Guid is NULL, then ASSERT().
|
||||
If Value is NULL, then ASSERT().
|
||||
Sets a buffer for the token specified by TokenNumber to the value specified by
|
||||
Buffer and SizeOfValue. Buffer is returned. If SizeOfValue is greater than
|
||||
the maximum size support by TokenNumber, then set SizeOfValue to the maximum size
|
||||
supported by TokenNumber and return NULL to indicate that the set operation
|
||||
was not actually performed.
|
||||
|
||||
If SizeOfValue > 0 and Buffer is NULL, then ASSERT().
|
||||
|
||||
@param[in] Guid Pointer to a 128-bit unique value that
|
||||
designates which namespace to set a value from.
|
||||
@param[in] TokenNumber The PCD token number to set a current value for.
|
||||
@param[in] Value The 8-bit value to set.
|
||||
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
||||
@param[in] Buffer A pointer to the buffer to set.
|
||||
|
||||
@retval VOID * Return the value been set.
|
||||
@retval VOID * Return the pinter to the buffer been set.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
LibPcdSetExPtr (
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN UINTN SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
IN CONST GUID *Guid,
|
||||
IN UINTN TokenNumber,
|
||||
IN OUT UINTN *SizeOfBuffer,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PCD_PPI * PcdPpi;
|
||||
EFI_STATUS Status;
|
||||
PCD_PPI *PcdPpi;
|
||||
UINTN Size;
|
||||
|
||||
PcdPpi = GetPcdPpiPtr ();
|
||||
|
||||
Status = PcdPpi->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
|
||||
Size = LibPcdGetExSize (Guid, TokenNumber);
|
||||
if (*SizeOfBuffer > Size) {
|
||||
*SizeOfBuffer = Size;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Status = PcdPpi->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -944,3 +974,41 @@ LibPcdGetNextToken (
|
||||
|
||||
return TokenNumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Retrieves the next PCD token space from a token space specified by Guid.
|
||||
Guid of NULL is reserved to mark the default local token namespace on the current
|
||||
platform. If Guid is NULL, then the GUID of the first non-local token space of the
|
||||
current platform is returned. If Guid is the last non-local token space,
|
||||
then NULL is returned.
|
||||
|
||||
If Guid is not NULL and is not a valid token space in the current platform, then ASSERT().
|
||||
|
||||
|
||||
|
||||
@param[in] Pointer to a 128-bit unique value that designates from which namespace
|
||||
to start the search.
|
||||
|
||||
@retval CONST GUID * The next valid token namespace.
|
||||
|
||||
**/
|
||||
CONST GUID*
|
||||
EFIAPI
|
||||
LibPcdGetNextTokenSpace (
|
||||
IN CONST GUID *Guid
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PCD_PPI * PcdPpi;
|
||||
|
||||
PcdPpi = GetPcdPpiPtr ();
|
||||
|
||||
|
||||
Status = PcdPpi->GetNextTokenSpace (&Guid);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Guid;
|
||||
}
|
||||
|
||||
|
@ -1684,7 +1684,14 @@ class PcdDatabase {
|
||||
*/
|
||||
s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.vpdOffset);
|
||||
} else {
|
||||
s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.value);
|
||||
if (t.isByteStreamType()) {
|
||||
//
|
||||
// Byte stream type input has their own "{" "}", so we won't help to insert.
|
||||
//
|
||||
s += tab + tab + String.format(" %s ", t.skuData.get(i).value.value);
|
||||
} else {
|
||||
s += tab + tab + String.format("{ %s }", t.skuData.get(i).value.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (i != t.skuData.size() - 1) {
|
||||
|
@ -15,10 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
package org.tianocore.build.pcd.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.tianocore.build.pcd.exception.EntityException;
|
||||
|
@ -707,6 +707,23 @@ public class Token {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isByteStreamType () {
|
||||
String str = getDynamicDefaultValue();
|
||||
|
||||
if (str == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (datumType == Token.DATUM_TYPE.POINTER &&
|
||||
str.startsWith("{") &&
|
||||
str.endsWith("}")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public String getStringTypeString () {
|
||||
return getDefaultSku().value.substring(2, getDefaultSku().value.length() - 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user