1 /** @file 2 3 Vfr common library functions. 4 5 Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 7 are licensed and made available under the terms and conditions of the BSD License 8 which accompanies this distribution. The full text of the license may be found at 9 http://opensource.org/licenses/bsd-license.php 10 11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 14 **/ 15 16 #ifndef _VFRUTILITYLIB_H_ 17 #define _VFRUTILITYLIB_H_ 18 19 #include "string.h" 20 #include "Common/UefiBaseTypes.h" 21 #include "EfiVfr.h" 22 #include "VfrError.h" 23 24 extern BOOLEAN VfrCompatibleMode; 25 26 #define MAX_NAME_LEN 64 27 #define MAX_STRING_LEN 0x100 28 #define DEFAULT_ALIGN 1 29 #define DEFAULT_PACK_ALIGN 0x8 30 #define DEFAULT_NAME_TABLE_ITEMS 1024 31 32 #define EFI_BITS_SHIFT_PER_UINT32 0x5 33 #define EFI_BITS_PER_UINT32 (1 << EFI_BITS_SHIFT_PER_UINT32) 34 35 #define BUFFER_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete (Buf); } } while (0); 36 #define ARRAY_SAFE_FREE(Buf) do { if ((Buf) != NULL) { delete[] (Buf); } } while (0); 37 38 39 class CVfrBinaryOutput { 40 public: 41 virtual VOID WriteLine (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32); 42 virtual VOID WriteEnd (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32); 43 }; 44 45 UINT32 46 _STR2U32 ( 47 IN CHAR8 *Str 48 ); 49 50 struct SConfigInfo { 51 UINT16 mOffset; 52 UINT16 mWidth; 53 UINT8 *mValue; 54 SConfigInfo *mNext; 55 56 SConfigInfo (IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE); 57 ~SConfigInfo (VOID); 58 59 private: 60 SConfigInfo (IN CONST SConfigInfo&); // Prevent copy-construction 61 SConfigInfo& operator= (IN CONST SConfigInfo&); // Prevent assignment 62 }; 63 64 struct SConfigItem { 65 CHAR8 *mName; // varstore name 66 EFI_GUID *mGuid; // varstore guid, varstore name + guid deside one varstore 67 CHAR8 *mId; // default ID 68 SConfigInfo *mInfoStrList; // list of Offset/Value in the varstore 69 SConfigItem *mNext; 70 71 public: 72 SConfigItem (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *); 73 SConfigItem (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT16, IN EFI_IFR_TYPE_VALUE); 74 virtual ~SConfigItem (); 75 76 private: 77 SConfigItem (IN CONST SConfigItem&); // Prevent copy-construction 78 SConfigItem& operator= (IN CONST SConfigItem&); // Prevent assignment 79 }; 80 81 class CVfrBufferConfig { 82 private: 83 SConfigItem *mItemListHead; 84 SConfigItem *mItemListTail; 85 SConfigItem *mItemListPos; 86 87 public: 88 CVfrBufferConfig (VOID); 89 virtual ~CVfrBufferConfig (VOID); 90 91 virtual UINT8 Register (IN CHAR8 *, IN EFI_GUID *,IN CHAR8 *Info = NULL); 92 virtual VOID Open (VOID); 93 virtual BOOLEAN Eof(VOID); 94 virtual UINT8 Select (IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *Info = NULL); 95 virtual UINT8 Write (IN CONST CHAR8, IN CHAR8 *, IN EFI_GUID *, IN CHAR8 *, IN UINT8, IN UINT16, IN UINT32, IN EFI_IFR_TYPE_VALUE); 96 #if 0 97 virtual UINT8 Read (OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **, OUT CHAR8 **); 98 #endif 99 virtual VOID Close (VOID); 100 virtual VOID OutputCFile (IN FILE *, IN CHAR8 *); 101 102 private: 103 CVfrBufferConfig (IN CONST CVfrBufferConfig&); // Prevent copy-construction 104 CVfrBufferConfig& operator= (IN CONST CVfrBufferConfig&); // Prevent assignment 105 }; 106 107 extern CVfrBufferConfig gCVfrBufferConfig; 108 109 #define ALIGN_STUFF(Size, Align) ((Align) - (Size) % (Align)) 110 #define INVALID_ARRAY_INDEX 0xFFFFFFFF 111 112 struct SVfrDataType; 113 114 struct SVfrDataField { 115 CHAR8 mFieldName[MAX_NAME_LEN]; 116 SVfrDataType *mFieldType; 117 UINT32 mOffset; 118 UINT32 mArrayNum; 119 SVfrDataField *mNext; 120 }; 121 122 struct SVfrDataType { 123 CHAR8 mTypeName[MAX_NAME_LEN]; 124 UINT8 mType; 125 UINT32 mAlign; 126 UINT32 mTotalSize; 127 SVfrDataField *mMembers; 128 SVfrDataType *mNext; 129 }; 130 131 #define VFR_PACK_ASSIGN 0x01 132 #define VFR_PACK_SHOW 0x02 133 #define VFR_PACK_PUSH 0x04 134 #define VFR_PACK_POP 0x08 135 136 #define PACKSTACK_MAX_SIZE 0x400 137 138 struct SVfrPackStackNode { 139 CHAR8 *mIdentifier; 140 UINT32 mNumber; 141 SVfrPackStackNode *mNext; 142 143 SVfrPackStackNode (IN CHAR8 *Identifier, IN UINT32 Number) { 144 mIdentifier = NULL; 145 mNumber = Number; 146 mNext = NULL; 147 148 if (Identifier != NULL) { 149 mIdentifier = new CHAR8[strlen (Identifier) + 1]; 150 strcpy (mIdentifier, Identifier); 151 } 152 } 153 154 ~SVfrPackStackNode (VOID) { 155 if (mIdentifier != NULL) { 156 delete[] mIdentifier; 157 } 158 mNext = NULL; 159 } 160 161 bool Match (IN CHAR8 *Identifier) { 162 if (Identifier == NULL) { 163 return TRUE; 164 } else if (mIdentifier == NULL) { 165 return FALSE; 166 } else if (strcmp (Identifier, mIdentifier) == 0) { 167 return TRUE; 168 } else { 169 return FALSE; 170 } 171 } 172 173 private: 174 SVfrPackStackNode (IN CONST SVfrPackStackNode&); // Prevent copy-construction 175 SVfrPackStackNode& operator= (IN CONST SVfrPackStackNode&); // Prevent assignment 176 }; 177 178 class CVfrVarDataTypeDB { 179 private: 180 UINT32 mPackAlign; 181 SVfrPackStackNode *mPackStack; 182 183 public: 184 EFI_VFR_RETURN_CODE Pack (IN UINT32, IN UINT8, IN CHAR8 *Identifier = NULL, IN UINT32 Number = DEFAULT_PACK_ALIGN); 185 186 private: 187 SVfrDataType *mDataTypeList; 188 189 SVfrDataType *mNewDataType; 190 SVfrDataType *mCurrDataType; 191 SVfrDataField *mCurrDataField; 192 193 VOID InternalTypesListInit (VOID); 194 VOID RegisterNewType (IN SVfrDataType *); 195 196 EFI_VFR_RETURN_CODE ExtractStructTypeName (IN CHAR8 *&, OUT CHAR8 *); 197 EFI_VFR_RETURN_CODE GetTypeField (IN CONST CHAR8 *, IN SVfrDataType *, IN SVfrDataField *&); 198 EFI_VFR_RETURN_CODE GetFieldOffset (IN SVfrDataField *, IN UINT32, OUT UINT32 &); 199 UINT8 GetFieldWidth (IN SVfrDataField *); 200 UINT32 GetFieldSize (IN SVfrDataField *, IN UINT32); 201 202 public: 203 CVfrVarDataTypeDB (VOID); 204 ~CVfrVarDataTypeDB (VOID); 205 206 VOID DeclareDataTypeBegin (VOID); 207 EFI_VFR_RETURN_CODE SetNewTypeName (IN CHAR8 *); 208 EFI_VFR_RETURN_CODE DataTypeAddField (IN CHAR8 *, IN CHAR8 *, IN UINT32); 209 VOID DeclareDataTypeEnd (VOID); 210 211 EFI_VFR_RETURN_CODE GetDataType (IN CHAR8 *, OUT SVfrDataType **); 212 EFI_VFR_RETURN_CODE GetDataTypeSize (IN CHAR8 *, OUT UINT32 *); 213 EFI_VFR_RETURN_CODE GetDataTypeSize (IN UINT8, OUT UINT32 *); 214 EFI_VFR_RETURN_CODE GetDataFieldInfo (IN CHAR8 *, OUT UINT16 &, OUT UINT8 &, OUT UINT32 &); 215 216 EFI_VFR_RETURN_CODE GetUserDefinedTypeNameList (OUT CHAR8 ***, OUT UINT32 *); 217 EFI_VFR_RETURN_CODE ExtractFieldNameAndArrary (IN CHAR8 *&, OUT CHAR8 *, OUT UINT32 &); 218 219 BOOLEAN IsTypeNameDefined (IN CHAR8 *); 220 221 VOID Dump(IN FILE *); 222 // 223 // First the declared 224 // 225 CHAR8 *mFirstNewDataTypeName; 226 #ifdef CVFR_VARDATATYPEDB_DEBUG 227 VOID ParserDB (); 228 #endif 229 230 private: 231 CVfrVarDataTypeDB (IN CONST CVfrVarDataTypeDB&); // Prevent copy-construction 232 CVfrVarDataTypeDB& operator= (IN CONST CVfrVarDataTypeDB&); // Prevent assignment 233 }; 234 235 extern CVfrVarDataTypeDB gCVfrVarDataTypeDB; 236 237 typedef enum { 238 EFI_VFR_VARSTORE_INVALID, 239 EFI_VFR_VARSTORE_BUFFER, 240 EFI_VFR_VARSTORE_EFI, 241 EFI_VFR_VARSTORE_NAME 242 } EFI_VFR_VARSTORE_TYPE; 243 244 struct SVfrVarStorageNode { 245 EFI_GUID mGuid; 246 CHAR8 *mVarStoreName; 247 EFI_VARSTORE_ID mVarStoreId; 248 BOOLEAN mAssignedFlag; //Create varstore opcode 249 struct SVfrVarStorageNode *mNext; 250 251 EFI_VFR_VARSTORE_TYPE mVarStoreType; 252 union { 253 // EFI Variable 254 struct { 255 EFI_STRING_ID mEfiVarName; 256 UINT32 mEfiVarSize; 257 } mEfiVar; 258 259 // Buffer Storage 260 SVfrDataType *mDataType; 261 262 // NameValue Storage 263 struct { 264 EFI_STRING_ID *mNameTable; 265 UINT32 mTableSize; 266 } mNameSpace; 267 } mStorageInfo; 268 269 public: 270 SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN EFI_STRING_ID, IN UINT32, IN BOOLEAN Flag = TRUE); 271 SVfrVarStorageNode (IN EFI_GUID *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN SVfrDataType *, IN BOOLEAN Flag = TRUE); 272 SVfrVarStorageNode (IN CHAR8 *, IN EFI_VARSTORE_ID); 273 ~SVfrVarStorageNode (VOID); 274 275 private: 276 SVfrVarStorageNode (IN CONST SVfrVarStorageNode&); // Prevent copy-construction 277 SVfrVarStorageNode& operator= (IN CONST SVfrVarStorageNode&); // Prevent assignment 278 }; 279 280 struct EFI_VARSTORE_INFO { 281 EFI_VARSTORE_ID mVarStoreId; 282 union { 283 EFI_STRING_ID mVarName; 284 UINT16 mVarOffset; 285 } mInfo; 286 UINT8 mVarType; 287 UINT32 mVarTotalSize; 288 289 EFI_VARSTORE_INFO (VOID); 290 EFI_VARSTORE_INFO (IN EFI_VARSTORE_INFO &); 291 EFI_VARSTORE_INFO& operator=(IN CONST EFI_VARSTORE_INFO &); 292 BOOLEAN operator == (IN EFI_VARSTORE_INFO *); 293 }; 294 295 struct BufferVarStoreFieldInfoNode { 296 EFI_VARSTORE_INFO mVarStoreInfo; 297 struct BufferVarStoreFieldInfoNode *mNext; 298 299 BufferVarStoreFieldInfoNode( IN EFI_VARSTORE_INFO *Info ); 300 ~BufferVarStoreFieldInfoNode (); 301 }; 302 303 #define EFI_VARSTORE_ID_MAX 0xFFFF 304 #define EFI_FREE_VARSTORE_ID_BITMAP_SIZE ((EFI_VARSTORE_ID_MAX + 1) / EFI_BITS_PER_UINT32) 305 306 class CVfrDataStorage { 307 private: 308 UINT32 mFreeVarStoreIdBitMap[EFI_FREE_VARSTORE_ID_BITMAP_SIZE]; 309 310 struct SVfrVarStorageNode *mBufferVarStoreList; 311 struct SVfrVarStorageNode *mEfiVarStoreList; 312 struct SVfrVarStorageNode *mNameVarStoreList; 313 314 struct SVfrVarStorageNode *mCurrVarStorageNode; 315 struct SVfrVarStorageNode *mNewVarStorageNode; 316 BufferVarStoreFieldInfoNode *mBufferFieldInfoListHead; 317 BufferVarStoreFieldInfoNode *mBufferFieldInfoListTail; 318 319 private: 320 321 EFI_VARSTORE_ID GetFreeVarStoreId (EFI_VFR_VARSTORE_TYPE VarType = EFI_VFR_VARSTORE_BUFFER); 322 BOOLEAN ChekVarStoreIdFree (IN EFI_VARSTORE_ID); 323 VOID MarkVarStoreIdUsed (IN EFI_VARSTORE_ID); 324 VOID MarkVarStoreIdUnused (IN EFI_VARSTORE_ID); 325 EFI_VARSTORE_ID CheckGuidField (IN SVfrVarStorageNode *, 326 IN EFI_GUID *, 327 IN BOOLEAN *, 328 OUT EFI_VFR_RETURN_CODE *); 329 330 public: 331 CVfrDataStorage (); 332 ~CVfrDataStorage (); 333 334 SVfrVarStorageNode * GetBufferVarStoreList () { 335 return mBufferVarStoreList; 336 } 337 SVfrVarStorageNode * GetEfiVarStoreList () { 338 return mEfiVarStoreList; 339 } 340 EFI_VFR_RETURN_CODE DeclareNameVarStoreBegin (CHAR8 *, EFI_VARSTORE_ID); 341 EFI_VFR_RETURN_CODE NameTableAddItem (EFI_STRING_ID); 342 EFI_VFR_RETURN_CODE DeclareNameVarStoreEnd (EFI_GUID *); 343 344 EFI_VFR_RETURN_CODE DeclareEfiVarStore (IN CHAR8 *, IN EFI_GUID *, IN EFI_STRING_ID, IN UINT32, IN BOOLEAN Flag = TRUE); 345 346 EFI_VFR_RETURN_CODE DeclareBufferVarStore (IN CHAR8 *, IN EFI_GUID *, IN CVfrVarDataTypeDB *, IN CHAR8 *, IN EFI_VARSTORE_ID, IN BOOLEAN Flag = TRUE); 347 348 EFI_VFR_RETURN_CODE GetVarStoreId (IN CHAR8 *, OUT EFI_VARSTORE_ID *, IN EFI_GUID *VarGuid = NULL); 349 EFI_VFR_VARSTORE_TYPE GetVarStoreType (IN EFI_VARSTORE_ID); 350 EFI_GUID * GetVarStoreGuid (IN EFI_VARSTORE_ID); 351 EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT CHAR8 **); 352 EFI_VFR_RETURN_CODE GetVarStoreByDataType (IN CHAR8 *, OUT SVfrVarStorageNode **, IN EFI_GUID *VarGuid = NULL); 353 354 EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN EFI_VARSTORE_ID, OUT CHAR8 **); 355 EFI_VFR_RETURN_CODE GetEfiVarStoreInfo (IN EFI_VARSTORE_INFO *); 356 EFI_VFR_RETURN_CODE GetNameVarStoreInfo (IN EFI_VARSTORE_INFO *, IN UINT32); 357 EFI_VFR_RETURN_CODE AddBufferVarStoreFieldInfo (IN EFI_VARSTORE_INFO *); 358 EFI_VFR_RETURN_CODE GetBufferVarStoreFieldInfo (IN OUT EFI_VARSTORE_INFO *); 359 360 private: 361 CVfrDataStorage (IN CONST CVfrDataStorage&); // Prevent copy-construction 362 CVfrDataStorage& operator= (IN CONST CVfrDataStorage&); // Prevent assignment 363 }; 364 365 extern CVfrDataStorage gCVfrDataStorage; 366 367 #define EFI_QUESTION_ID_MAX 0xFFFF 368 #define EFI_FREE_QUESTION_ID_BITMAP_SIZE ((EFI_QUESTION_ID_MAX + 1) / EFI_BITS_PER_UINT32) 369 #define EFI_QUESTION_ID_INVALID 0x0 370 371 #define DATE_YEAR_BITMASK 0x0000FFFF 372 #define DATE_MONTH_BITMASK 0x00FF0000 373 #define DATE_DAY_BITMASK 0xFF000000 374 #define TIME_HOUR_BITMASK 0x000000FF 375 #define TIME_MINUTE_BITMASK 0x0000FF00 376 #define TIME_SECOND_BITMASK 0x00FF0000 377 378 struct SVfrQuestionNode { 379 CHAR8 *mName; 380 CHAR8 *mVarIdStr; 381 EFI_QUESTION_ID mQuestionId; 382 UINT32 mBitMask; 383 SVfrQuestionNode *mNext; 384 EFI_QUESION_TYPE mQtype; 385 386 SVfrQuestionNode (IN CHAR8 *, IN CHAR8 *, IN UINT32 BitMask = 0); 387 ~SVfrQuestionNode (); 388 389 private: 390 SVfrQuestionNode (IN CONST SVfrQuestionNode&); // Prevent copy-construction 391 SVfrQuestionNode& operator= (IN CONST SVfrQuestionNode&); // Prevent assignment 392 }; 393 394 class CVfrQuestionDB { 395 private: 396 SVfrQuestionNode *mQuestionList; 397 UINT32 mFreeQIdBitMap[EFI_FREE_QUESTION_ID_BITMAP_SIZE]; 398 399 private: 400 EFI_QUESTION_ID GetFreeQuestionId (VOID); 401 BOOLEAN ChekQuestionIdFree (IN EFI_QUESTION_ID); 402 VOID MarkQuestionIdUsed (IN EFI_QUESTION_ID); 403 VOID MarkQuestionIdUnused (IN EFI_QUESTION_ID); 404 405 public: 406 CVfrQuestionDB (); 407 ~CVfrQuestionDB(); 408 409 EFI_VFR_RETURN_CODE RegisterQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); 410 VOID RegisterOldDateQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); 411 VOID RegisterNewDateQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); 412 VOID RegisterOldTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); 413 VOID RegisterNewTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); 414 VOID RegisterRefQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); 415 EFI_VFR_RETURN_CODE UpdateQuestionId (IN EFI_QUESTION_ID, IN EFI_QUESTION_ID); 416 VOID GetQuestionId (IN CHAR8 *, IN CHAR8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &, OUT EFI_QUESION_TYPE *QType = NULL); 417 EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID); 418 EFI_VFR_RETURN_CODE FindQuestion (IN CHAR8 *); 419 VOID PrintAllQuestion (IN VOID); 420 VOID ResetInit (IN VOID); 421 422 VOID SetCompatibleMode (IN BOOLEAN Mode) { 423 VfrCompatibleMode = Mode; 424 } 425 426 private: 427 CVfrQuestionDB (IN CONST CVfrQuestionDB&); // Prevent copy-construction 428 CVfrQuestionDB& operator= (IN CONST CVfrQuestionDB&); // Prevent assignment 429 }; 430 431 struct SVfrDefaultStoreNode { 432 EFI_IFR_DEFAULTSTORE *mObjBinAddr; 433 CHAR8 *mRefName; 434 EFI_STRING_ID mDefaultStoreNameId; 435 UINT16 mDefaultId; 436 437 SVfrDefaultStoreNode *mNext; 438 439 SVfrDefaultStoreNode (IN EFI_IFR_DEFAULTSTORE *, IN CHAR8 *, IN EFI_STRING_ID, IN UINT16); 440 ~SVfrDefaultStoreNode(); 441 442 private: 443 SVfrDefaultStoreNode (IN CONST SVfrDefaultStoreNode&); // Prevent copy-construction 444 SVfrDefaultStoreNode& operator= (IN CONST SVfrDefaultStoreNode&); // Prevent assignment 445 }; 446 447 class CVfrDefaultStore { 448 private: 449 SVfrDefaultStoreNode *mDefaultStoreList; 450 451 public: 452 CVfrDefaultStore (); 453 ~CVfrDefaultStore (); 454 455 EFI_VFR_RETURN_CODE RegisterDefaultStore (IN CHAR8 *, IN CHAR8 *, IN EFI_STRING_ID, IN UINT16); 456 EFI_VFR_RETURN_CODE ReRegisterDefaultStoreById (IN UINT16, IN CHAR8 *, IN EFI_STRING_ID); 457 BOOLEAN DefaultIdRegistered (IN UINT16); 458 EFI_VFR_RETURN_CODE GetDefaultId (IN CHAR8 *, OUT UINT16 *); 459 EFI_VFR_RETURN_CODE BufferVarStoreAltConfigAdd (IN EFI_VARSTORE_ID, IN EFI_VARSTORE_INFO &, IN CHAR8 *, IN EFI_GUID *, IN UINT8, IN EFI_IFR_TYPE_VALUE); 460 461 private: 462 CVfrDefaultStore (IN CONST CVfrDefaultStore&); // Prevent copy-construction 463 CVfrDefaultStore& operator= (IN CONST CVfrDefaultStore&); // Prevent assignment 464 }; 465 466 extern CVfrDefaultStore gCVfrDefaultStore; 467 468 #define EFI_RULE_ID_START 0x01 469 #define EFI_RULE_ID_INVALID 0x00 470 471 struct SVfrRuleNode { 472 UINT8 mRuleId; 473 CHAR8 *mRuleName; 474 SVfrRuleNode *mNext; 475 476 SVfrRuleNode(IN CHAR8 *, IN UINT8); 477 ~SVfrRuleNode(); 478 479 private: 480 SVfrRuleNode (IN CONST SVfrRuleNode&); // Prevent copy-construction 481 SVfrRuleNode& operator= (IN CONST SVfrRuleNode&); // Prevent assignment 482 }; 483 484 class CVfrRulesDB { 485 private: 486 SVfrRuleNode *mRuleList; 487 UINT8 mFreeRuleId; 488 489 public: 490 CVfrRulesDB (); 491 ~CVfrRulesDB(); 492 493 VOID RegisterRule (IN CHAR8 *); 494 UINT8 GetRuleId (IN CHAR8 *); 495 496 private: 497 CVfrRulesDB (IN CONST CVfrRulesDB&); // Prevent copy-construction 498 CVfrRulesDB& operator= (IN CONST CVfrRulesDB&); // Prevent assignment 499 }; 500 501 class CVfrStringDB { 502 private: 503 CHAR8 *mStringFileName; 504 505 EFI_STATUS FindStringBlock ( 506 IN UINT8 *StringData, 507 IN EFI_STRING_ID StringId, 508 OUT UINT32 *StringTextOffset, 509 OUT UINT8 *BlockType 510 ); 511 512 UINT32 GetUnicodeStringTextSize ( 513 IN UINT8 *StringSrc 514 ); 515 516 BOOLEAN GetBestLanguage ( 517 IN CONST CHAR8 *SupportedLanguages, 518 IN CHAR8 *Language 519 ); 520 521 public: 522 CVfrStringDB (); 523 ~CVfrStringDB (); 524 525 VOID SetStringFileName ( 526 IN CHAR8 *StringFileName 527 ); 528 529 CHAR8 * GetVarStoreNameFormStringId ( 530 IN EFI_STRING_ID StringId 531 ); 532 533 private: 534 CVfrStringDB (IN CONST CVfrStringDB&); // Prevent copy-construction 535 CVfrStringDB& operator= (IN CONST CVfrStringDB&); // Prevent assignment 536 }; 537 538 #endif 539