\r
TmpTokenNumber = TokenNumber;\r
\r
- ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);\r
+ //\r
+ // PCD_TOTAL_TOKEN_NUMBER is a auto-generated constant.\r
+ // It could be zero. EBC compiler is very choosy. It may\r
+ // report warning. So we add 1 in each size of the \r
+ // comparison.\r
+ //\r
+ ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);\r
\r
ASSERT ((GetSize == DxePcdGetSize (TokenNumber + 1)) || (GetSize == 0));\r
\r
- \r
- IsPeiDb = (TokenNumber < PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+ IsPeiDb = (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE;\r
\r
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable : \r
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;\r
// Initialized the Callback Function Table\r
//\r
\r
- if (PCD_TOTAL_TOKEN_NUMBER != 0) {\r
- mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER * sizeof (LIST_ENTRY));\r
- }\r
+ mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER * sizeof (LIST_ENTRY));\r
\r
- for (Idx = 0; Idx < PCD_TOTAL_TOKEN_NUMBER; Idx++) {\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+ for (Idx = 0; Idx + 1 < PCD_TOTAL_TOKEN_NUMBER + 1; Idx++) {\r
InitializeListHead (&mCallbackFnTable[Idx]);\r
}\r
\r
Size = 0;\r
Buffer = NULL;\r
\r
- Status = EfiGetVariable (\r
+ Status = gRT->GetVariable (\r
(UINT16 *)VariableName,\r
VariableGuid,\r
NULL,\r
\r
ASSERT (Buffer != NULL);\r
\r
- Status = EfiGetVariable (\r
+ Status = gRT->GetVariable (\r
VariableName,\r
VariableGuid,\r
NULL,\r
\r
TmpTokenNumber = TokenNumber;\r
\r
- ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+\r
+ ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);\r
\r
if (!PtrType) {\r
ASSERT (*Size == DxePcdGetSize (TokenNumber + 1));\r
}\r
\r
- IsPeiDb = (TokenNumber < PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+ IsPeiDb = (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE;\r
\r
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable : \r
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;\r
\r
- if ((TokenNumber < PEI_NEX_TOKEN_NUMBER) ||\r
- (TokenNumber >= PEI_LOCAL_TOKEN_NUMBER || TokenNumber < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER))) {\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+ if ((TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) ||\r
+ (TokenNumber + 1 >= PEI_LOCAL_TOKEN_NUMBER + 1 || TokenNumber + 1 < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1))) {\r
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);\r
}\r
\r
\r
Size = 0;\r
\r
- Status = EfiGetVariable (\r
+ Status = gRT->GetVariable (\r
(UINT16 *)VariableName,\r
VariableGuid,\r
&Attribute,\r
\r
ASSERT (Buffer != NULL);\r
\r
- Status = EfiGetVariable (\r
+ Status = gRT->GetVariable (\r
VariableName,\r
VariableGuid,\r
&Attribute,\r
\r
CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);\r
\r
- Status = EfiSetVariable (\r
+ Status = gRT->SetVariable (\r
VariableName,\r
VariableGuid,\r
Attribute,\r
BOOLEAN IsPeiDb;\r
UINT32 *LocalTokenNumberTable;\r
\r
- IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx < PEI_LOCAL_TOKEN_NUMBER);\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+ IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);\r
\r
\r
if (IsPeiDb) {\r
BOOLEAN IsPeiDb;\r
UINT32 *LocalTokenNumberTable;\r
\r
- IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx < PEI_LOCAL_TOKEN_NUMBER);\r
+ // EBC compiler is very choosy. It may report warning about comparison\r
+ // between UINTN and 0 . So we add 1 in each size of the \r
+ // comparison.\r
+ IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);\r
\r
if (IsPeiDb) {\r
LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;\r