MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / SetWorker

Function SetWorker

MdeModulePkg/Universal/PCD/Dxe/Service.c:1091–1267  ·  view source on GitHub ↗

Set value for an PCD entry @param TokenNumber Pcd token number autogenerated by build tools. @param Data Value want to be set for PCD entry @param Size Size of value. @param PtrType If TRUE, the type of PCD entry's value is Pointer. If False, the type of PCD entry's value is not Pointer. @retval EFI_INVALID_PARAMETER I

Source from the content-addressed store, hash-verified

1089 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
1090**/
1091EFI_STATUS
1092SetWorker (
1093 IN UINTN TokenNumber,
1094 IN VOID *Data,
1095 IN OUT UINTN *Size,
1096 IN BOOLEAN PtrType
1097 )
1098{
1099 BOOLEAN IsPeiDb;
1100 UINT32 LocalTokenNumber;
1101 EFI_GUID *GuidTable;
1102 UINT8 *StringTable;
1103 EFI_GUID *Guid;
1104 UINT16 *Name;
1105 UINTN VariableOffset;
1106 UINT32 Attributes;
1107 VOID *InternalData;
1108 VARIABLE_HEAD *VariableHead;
1109 UINTN Offset;
1110 UINT8 *PcdDb;
1111 EFI_STATUS Status;
1112 UINTN MaxSize;
1113 UINTN TmpTokenNumber;
1114
1115 //
1116 // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
1117 // We have to decrement TokenNumber by 1 to make it usable
1118 // as the array index.
1119 //
1120 TokenNumber--;
1121
1122 TmpTokenNumber = TokenNumber;
1123
1124 //
1125 // EBC compiler is very choosy. It may report warning about comparison
1126 // between UINTN and 0 . So we add 1 in each size of the
1127 // comparison.
1128 //
1129 ASSERT (TokenNumber + 1 < mPcdTotalTokenCount + 1);
1130
1131 if (PtrType) {
1132 //
1133 // Get MaxSize first, then check new size with max buffer size.
1134 //
1135 GetPtrTypeSize (TokenNumber, &MaxSize);
1136 if (*Size > MaxSize) {
1137 *Size = MaxSize;
1138 return EFI_INVALID_PARAMETER;
1139 }
1140 } else {
1141 if (*Size != DxePcdGetSize (TokenNumber + 1)) {
1142 return EFI_INVALID_PARAMETER;
1143 }
1144 }
1145
1146 //
1147 // EBC compiler is very choosy. It may report warning about comparison
1148 // between UINTN and 0 . So we add 1 in each size of the

Callers 3

SetValueWorkerFunction · 0.70
ExSetWorkerFunction · 0.70
DxePcdSetPtrFunction · 0.70

Calls 9

DxePcdGetSizeFunction · 0.85
EfiAcquireLockFunction · 0.85
SetHiiVariableFunction · 0.85
EfiReleaseLockFunction · 0.85
GetPtrTypeSizeFunction · 0.70
InvokeCallbackOnSetFunction · 0.70
GetLocalTokenNumberFunction · 0.70
SetPtrTypeSizeFunction · 0.70
CopyMemFunction · 0.50

Tested by

no test coverage detected