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
| 1089 | @retval EFI_NOT_FOUND Can not find the PCD type according to token number. |
| 1090 | **/ |
| 1091 | EFI_STATUS |
| 1092 | SetWorker ( |
| 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 |
no test coverage detected