From 81b618fe85f67f70a81d38a968cb5eca719e64d9 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Tue, 19 Apr 2011 03:04:06 +0000 Subject: [PATCH] Update ALTCFG reference from default name token to default ID. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11558 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/UefiHiiLib/HiiLib.c | 65 +--------------- .../Universal/HiiDatabaseDxe/ConfigRouting.c | 76 ++----------------- .../Universal/HiiDatabaseDxe/HiiDatabase.h | 1 - 3 files changed, 10 insertions(+), 132 deletions(-) diff --git a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c index d2b25a0036..7e93df9ada 100644 --- a/MdeModulePkg/Library/UefiHiiLib/HiiLib.c +++ b/MdeModulePkg/Library/UefiHiiLib/HiiLib.c @@ -1629,15 +1629,10 @@ InternalHiiIfrValueAction ( UINT32 Index; EFI_GUID *VarGuid; EFI_STRING VarName; - EFI_STRING_ID DefaultName; UINT8 *PackageData; - UINTN IfrOffset; - EFI_IFR_OP_HEADER *IfrOpHdr; EFI_HII_PACKAGE_LIST_HEADER *HiiPackageList; - UINT32 PackageOffset; UINTN PackageListLength; - EFI_HII_PACKAGE_HEADER PacakgeHeader; EFI_DEVICE_PATH_PROTOCOL *DevicePath; EFI_DEVICE_PATH_PROTOCOL *TempDevicePath; @@ -1772,13 +1767,9 @@ InternalHiiIfrValueAction ( Status = EFI_SUCCESS; goto NextConfigAltResp; } - - // - // 2. Get DefaultName string ID by parsing the PacakgeList - // // - // Get HiiPackage by HiiHandle + // 2. Get HiiPackage by HiiHandle // PackageListLength = 0; HiiPackageList = NULL; @@ -1806,59 +1797,9 @@ InternalHiiIfrValueAction ( goto Done; } - // - // Parse the form package and get the default name string ID. - // - if (ActionType == ACTION_SET_DEFAUTL_VALUE) { - PackageOffset = sizeof (EFI_HII_PACKAGE_LIST_HEADER); - Status = EFI_NOT_FOUND; - while (PackageOffset < PackageListLength) { - CopyMem (&PacakgeHeader, (UINT8 *) HiiPackageList + PackageOffset, sizeof (PacakgeHeader)); - - // - // Parse IFR opcode to get default store opcode - // - if (PacakgeHeader.Type == EFI_HII_PACKAGE_FORMS) { - IfrOffset = sizeof (PacakgeHeader); - PackageData = (UINT8 *) HiiPackageList + PackageOffset; - while (IfrOffset < PacakgeHeader.Length) { - IfrOpHdr = (EFI_IFR_OP_HEADER *) (PackageData + IfrOffset); - // - // Match DefaultId to find its DefaultName - // - if (IfrOpHdr->OpCode == EFI_IFR_DEFAULTSTORE_OP) { - if (((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultId == DefaultId) { - DefaultName = ((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultName; - Status = EFI_SUCCESS; - break; - } - } - IfrOffset += IfrOpHdr->Length; - } - // - // Only one form is in a package list. - // - break; - } - - // - // Go to next package. - // - PackageOffset += PacakgeHeader.Length; - } - - // - // Not found the matched default string ID - // - if (EFI_ERROR (Status)) { - Status = EFI_SUCCESS; - goto NextConfigAltResp; - } - } - // // 3. Call ConfigRouting GetAltCfg(ConfigRoute, , Guid, Name, DevicePath, AltCfgId, AltCfgResp) - // Get the default configuration string according to the found default name string ID. + // Get the default configuration string according to the default ID. // Status = gHiiConfigRouting->GetAltConfig ( gHiiConfigRouting, @@ -1866,7 +1807,7 @@ InternalHiiIfrValueAction ( VarGuid, VarName, DevicePath, - (ActionType == ACTION_SET_DEFAUTL_VALUE) ? &DefaultName:NULL, // it can be NULL to get the current setting. + (ActionType == ACTION_SET_DEFAUTL_VALUE) ? &DefaultId:NULL, // it can be NULL to get the current setting. &ConfigResp ); diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index 30f602d30f..02d7d7b5fa 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -635,37 +635,6 @@ MergeDefaultString ( return EFI_SUCCESS; } -/** - This function finds the matched DefaultName for the input DefaultId - - @param DefaultIdArray Array stores the map table between DefaultId and DefaultName. - @param VarDefaultId Default Id - @param VarDefaultName Default Name string ID for the input default ID. - - @retval EFI_SUCCESS The mapped default name string ID is found. - @retval EFI_NOT_FOUND The mapped default name string ID is not found. -**/ -EFI_STATUS -FindDefaultName ( - IN IFR_DEFAULT_DATA *DefaultIdArray, - IN UINT16 VarDefaultId, - OUT EFI_STRING_ID *VarDefaultName - ) -{ - LIST_ENTRY *Link; - IFR_DEFAULT_DATA *DefaultData; - - for (Link = DefaultIdArray->Entry.ForwardLink; Link != &DefaultIdArray->Entry; Link = Link->ForwardLink) { - DefaultData = BASE_CR (Link, IFR_DEFAULT_DATA, Entry); - if (DefaultData->DefaultId == VarDefaultId) { - *VarDefaultName = DefaultData->DefaultName; - return EFI_SUCCESS; - } - } - - return EFI_NOT_FOUND; -} - /** This function inserts new DefaultValueData into the BlockData DefaultValue array. @@ -948,7 +917,6 @@ ParseIfrData ( goto Done; } DefaultData->DefaultId = ((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultId; - DefaultData->DefaultName = ((EFI_IFR_DEFAULTSTORE *) IfrOpHdr)->DefaultName; InsertTailList (&DefaultIdArray->Entry, &DefaultData->Entry); DefaultData = NULL; break; @@ -1038,13 +1006,9 @@ ParseIfrData ( // // - // Set standard ID and Get DefaultName String ID + // Set standard ID // VarDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; - Status = FindDefaultName (DefaultIdArray, VarDefaultId, &VarDefaultName); - if (EFI_ERROR (Status)) { - goto Done; - } // // Prepare new DefaultValue // @@ -1055,7 +1019,6 @@ ParseIfrData ( } DefaultData->OpCode = IfrOpHdr->OpCode; DefaultData->DefaultId = VarDefaultId; - DefaultData->DefaultName = VarDefaultName; switch (IfrOneOf->Flags & EFI_IFR_NUMERIC_SIZE) { case EFI_IFR_NUMERIC_SIZE_1: @@ -1199,13 +1162,9 @@ ParseIfrData ( // if ((IfrCheckBox->Flags & EFI_IFR_CHECKBOX_DEFAULT) == EFI_IFR_CHECKBOX_DEFAULT) { // - // Set standard ID to Manufacture ID and Get DefaultName String ID + // Set standard ID to Manufacture ID // VarDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; - Status = FindDefaultName (DefaultIdArray, VarDefaultId, &VarDefaultName); - if (EFI_ERROR (Status)) { - goto Done; - } // // Prepare new DefaultValue // @@ -1216,7 +1175,6 @@ ParseIfrData ( } DefaultData->OpCode = IfrOpHdr->OpCode; DefaultData->DefaultId = VarDefaultId; - DefaultData->DefaultName = VarDefaultName; DefaultData->Value = 1; // // Add DefaultValue into current BlockData @@ -1226,13 +1184,9 @@ ParseIfrData ( if ((IfrCheckBox->Flags & EFI_IFR_CHECKBOX_DEFAULT_MFG) == EFI_IFR_CHECKBOX_DEFAULT_MFG) { // - // Set standard ID to Manufacture ID and Get DefaultName String ID + // Set standard ID to Manufacture ID // VarDefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING; - Status = FindDefaultName (DefaultIdArray, VarDefaultId, &VarDefaultName); - if (EFI_ERROR (Status)) { - goto Done; - } // // Prepare new DefaultValue // @@ -1243,7 +1197,6 @@ ParseIfrData ( } DefaultData->OpCode = IfrOpHdr->OpCode; DefaultData->DefaultId = VarDefaultId; - DefaultData->DefaultName = VarDefaultName; DefaultData->Value = 1; // // Add DefaultValue into current BlockData @@ -1466,13 +1419,9 @@ ParseIfrData ( // FirstOneOfOption = FALSE; // - // Set standard ID to Manufacture ID and Get DefaultName String ID + // Set standard ID to Manufacture ID // VarDefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; - Status = FindDefaultName (DefaultIdArray, VarDefaultId, &VarDefaultName); - if (EFI_ERROR (Status)) { - goto Done; - } // // Prepare new DefaultValue // @@ -1483,7 +1432,6 @@ ParseIfrData ( } DefaultData->OpCode = IfrOpHdr->OpCode; DefaultData->DefaultId = VarDefaultId; - DefaultData->DefaultName = VarDefaultName; DefaultData->Value = IfrOneOfOption->Value.u64; // // Add DefaultValue into current BlockData @@ -1493,13 +1441,9 @@ ParseIfrData ( if ((IfrOneOfOption->Flags & EFI_IFR_OPTION_DEFAULT_MFG) == EFI_IFR_OPTION_DEFAULT_MFG) { // - // Set default ID to Manufacture ID and Get DefaultName String ID + // Set default ID to Manufacture ID // VarDefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING; - Status = FindDefaultName (DefaultIdArray, VarDefaultId, &VarDefaultName); - if (EFI_ERROR (Status)) { - goto Done; - } // // Prepare new DefaultValue // @@ -1510,7 +1454,6 @@ ParseIfrData ( } DefaultData->OpCode = IfrOpHdr->OpCode; DefaultData->DefaultId = VarDefaultId; - DefaultData->DefaultName = VarDefaultName; DefaultData->Value = IfrOneOfOption->Value.u64; // // Add DefaultValue into current BlockData @@ -1537,14 +1480,10 @@ ParseIfrData ( break; } // - // Get the DefaultId and DefaultName String ID + // Get the DefaultId // IfrDefault = (EFI_IFR_DEFAULT *) IfrOpHdr; VarDefaultId = IfrDefault->DefaultId; - Status = FindDefaultName (DefaultIdArray, VarDefaultId, &VarDefaultName); - if (EFI_ERROR (Status)) { - goto Done; - } // // Prepare new DefaultValue // @@ -1555,7 +1494,6 @@ ParseIfrData ( } DefaultData->OpCode = IfrOpHdr->OpCode; DefaultData->DefaultId = VarDefaultId; - DefaultData->DefaultName = VarDefaultName; DefaultData->Value = IfrDefault->Value.u64; // // Add DefaultValue into current BlockData @@ -2128,7 +2066,7 @@ GetFullStringFromHiiFormPackages ( (1 + StrLen (ConfigHdr) + 8 + 4 + 1) * sizeof (CHAR16), L"&%s&ALTCFG=%04X", ConfigHdr, - DefaultId->DefaultName + DefaultId->DefaultId ); StringPtr += StrLen (StringPtr); diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h index d01a672189..d4f730abb8 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h @@ -89,7 +89,6 @@ typedef struct { typedef struct { LIST_ENTRY Entry; UINT8 OpCode; - EFI_STRING_ID DefaultName; UINT16 DefaultId; UINT64 Value; } IFR_DEFAULT_DATA;