From nobody Thu Dec 26 13:36:13 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1505187900708836.0463972428454; Mon, 11 Sep 2017 20:45:00 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 36C1C21D492DD; Mon, 11 Sep 2017 20:41:59 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 76E4521CEB11B for ; Mon, 11 Sep 2017 20:41:57 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2017 20:44:53 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by orsmga002.jf.intel.com with ESMTP; 11 Sep 2017 20:44:52 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,381,1500966000"; d="scan'208";a="134300917" From: Dandan Bi To: edk2-devel@lists.01.org Date: Tue, 12 Sep 2017 11:44:07 +0800 Message-Id: <1505187848-389908-6-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1505187848-389908-1-git-send-email-dandan.bi@intel.com> References: <1505187848-389908-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [PATCH v2 5/6] MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D545 For oneof/numeric/CheckBox(storage can be Bit VarStore) If the question value can be updated and shown correctly in UI page, we need do enhancements in following cases: 1. Parse the Ifr data to get the bit VarStore info correctly. 2. Set/get value to/from bit VarStore correctly. Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi --- MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 139 ++++++++++++++++-= ---- MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 120 ++++++++++++++++-- MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 3 + .../Universal/SetupBrowserDxe/SetupBrowserDxe.inf | 3 +- 4 files changed, 223 insertions(+), 42 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModuleP= kg/Universal/SetupBrowserDxe/IfrParse.c index 6b3e5e0..63232ee 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c @@ -15,10 +15,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. #include "Setup.h" =20 UINT16 mStatementIndex; UINT16 mExpressionOpCodeIndex; EFI_QUESTION_ID mUsedQuestionId; +BOOLEAN mQuestionReferBitVar =3D FALSE; + extern LIST_ENTRY gBrowserStorageList; /** Initialize Statement header members. =20 @param OpCodeData Pointer of the raw OpCode data. @@ -57,10 +59,11 @@ CreateStatement ( =20 Statement->Signature =3D FORM_BROWSER_STATEMENT_SIGNATURE; =20 Statement->Operand =3D ((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode; Statement->OpCode =3D (EFI_IFR_OP_HEADER *) OpCodeData; + Statement->QuestionReferToBitField =3D FALSE; =20 StatementHdr =3D (EFI_IFR_STATEMENT_HEADER *) (OpCodeData + sizeof (EFI_= IFR_OP_HEADER)); CopyMem (&Statement->Prompt, &StatementHdr->Prompt, sizeof (EFI_STRING_I= D)); CopyMem (&Statement->Help, &StatementHdr->Help, sizeof (EFI_STRING_ID)); =20 @@ -1312,10 +1315,11 @@ ParseOpCodes ( BOOLEAN InUnknownScope; UINT8 UnknownDepth; FORMSET_DEFAULTSTORE *PreDefaultStore; LIST_ENTRY *DefaultLink; BOOLEAN HaveInserted; + UINT16 TotalBits; =20 SuppressForQuestion =3D FALSE; SuppressForOption =3D FALSE; InScopeDisable =3D FALSE; DepthOfDisable =3D 0; @@ -1978,47 +1982,99 @@ ParseOpCodes ( ASSERT(CurrentStatement !=3D NULL); =20 CurrentStatement->Flags =3D ((EFI_IFR_ONE_OF *) OpCodeData)->Flags; Value =3D &CurrentStatement->HiiValue; =20 - switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) { - case EFI_IFR_NUMERIC_SIZE_1: - CurrentStatement->Minimum =3D ((EFI_IFR_NUMERIC *) OpCodeData)->da= ta.u8.MinValue; - CurrentStatement->Maximum =3D ((EFI_IFR_NUMERIC *) OpCodeData)->da= ta.u8.MaxValue; - CurrentStatement->Step =3D ((EFI_IFR_NUMERIC *) OpCodeData)->da= ta.u8.Step; - CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT8); - Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_8; - break; + if (mQuestionReferBitVar) { + mQuestionReferBitVar =3D FALSE; + // + // Get the bit var store info (bit/byte offset, bit/byte offset) + // + CurrentStatement->BitStorageWidth =3D CurrentStatement->Flags & EF= I_IFR_NUMERIC_SIZE_BIT; + CurrentStatement->QuestionReferToBitField =3D TRUE; + CurrentStatement->BitVarOffset =3D CurrentStatement->VarStoreInfo.= VarOffset; + CurrentStatement->VarStoreInfo.VarOffset =3D CurrentStatement->Bit= VarOffset / 8; + TotalBits =3D CurrentStatement->BitVarOffset - (CurrentStatement->= VarStoreInfo.VarOffset * 8) + CurrentStatement->BitStorageWidth; + CurrentStatement->StorageWidth =3D (TotalBits % 8 =3D=3D 0? TotalB= its / 8: TotalBits / 8 + 1); =20 - case EFI_IFR_NUMERIC_SIZE_2: - CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u16.MinValue, sizeof (UINT16)); - CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u16.MaxValue, sizeof (UINT16)); - CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u16.Step, sizeof (UINT16)); - CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT16); - Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_16; - break; + // + // Get the Minimum/Maximum/Step value(Note: bit field type has bee= n stored as UINT32 type) + // + CurrentStatement->Minimum =3D ((EFI_IFR_NUMERIC *) OpCodeData)->da= ta.u32.MinValue; + CurrentStatement->Maximum =3D ((EFI_IFR_NUMERIC *) OpCodeData)->da= ta.u32.MaxValue; + CurrentStatement->Step =3D ((EFI_IFR_NUMERIC *) OpCodeData)->da= ta.u32.Step; =20 - case EFI_IFR_NUMERIC_SIZE_4: - CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u32.MinValue, sizeof (UINT32)); - CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u32.MaxValue, sizeof (UINT32)); - CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u32.Step, sizeof (UINT32)); - CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT32); - Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_32; - break; + // + // Update the Flag and type of Minimum/Maximum/Step according to t= he actual width of bit field, + // in order to make Browser handle these question with bit varstor= e correctly. + // + ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &=3D EFI_IFR_DISPLAY_BIT; + ((EFI_IFR_NUMERIC *) OpCodeData)->Flags >>=3D 2; + switch (CurrentStatement->StorageWidth) { + case 1: + ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |=3D EFI_IFR_TYPE_NUM_SI= ZE_8; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue =3D (UINT8)Cu= rrentStatement->Minimum; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue =3D (UINT8)Cu= rrentStatement->Maximum; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step =3D (UINT8)Curren= tStatement->Step; + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_8; + break; + case 2: + ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |=3D EFI_IFR_TYPE_NUM_SI= ZE_16; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue =3D (UINT16)= CurrentStatement->Minimum; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue =3D (UINT16)= CurrentStatement->Maximum; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step =3D (UINT16)Curr= entStatement->Step; + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_16; + break; + case 3: + case 4: + ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |=3D EFI_IFR_TYPE_NUM_SI= ZE_32; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue =3D (UINT32)= CurrentStatement->Minimum; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue =3D (UINT32)= CurrentStatement->Maximum; + ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step =3D (UINT32)Curr= entStatement->Step; + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_32; + break; + default: + break; + } + } else { + switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) { + case EFI_IFR_NUMERIC_SIZE_1: + CurrentStatement->Minimum =3D ((EFI_IFR_NUMERIC *) OpCodeData)->= data.u8.MinValue; + CurrentStatement->Maximum =3D ((EFI_IFR_NUMERIC *) OpCodeData)->= data.u8.MaxValue; + CurrentStatement->Step =3D ((EFI_IFR_NUMERIC *) OpCodeData)->= data.u8.Step; + CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT8); + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_8; + break; =20 - case EFI_IFR_NUMERIC_SIZE_8: - CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u64.MinValue, sizeof (UINT64)); - CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u64.MaxValue, sizeof (UINT64)); - CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeD= ata)->data.u64.Step, sizeof (UINT64)); - CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT64); - Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_64; - break; + case EFI_IFR_NUMERIC_SIZE_2: + CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u16.MinValue, sizeof (UINT16)); + CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u16.MaxValue, sizeof (UINT16)); + CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u16.Step, sizeof (UINT16)); + CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT16); + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_16; + break; =20 - default: - break; - } + case EFI_IFR_NUMERIC_SIZE_4: + CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u32.MinValue, sizeof (UINT32)); + CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u32.MaxValue, sizeof (UINT32)); + CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u32.Step, sizeof (UINT32)); + CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT32); + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_32; + break; + + case EFI_IFR_NUMERIC_SIZE_8: + CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u64.MinValue, sizeof (UINT64)); + CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u64.MaxValue, sizeof (UINT64)); + CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCod= eData)->data.u64.Step, sizeof (UINT64)); + CurrentStatement->StorageWidth =3D (UINT16) sizeof (UINT64); + Value->Type =3D EFI_IFR_TYPE_NUM_SIZE_64; + break; =20 + default: + break; + } + } InitializeRequestElement (FormSet, CurrentStatement, CurrentForm); =20 if ((Operand =3D=3D EFI_IFR_ONE_OF_OP) && Scope !=3D 0) { SuppressForOption =3D TRUE; } @@ -2045,10 +2101,23 @@ ParseOpCodes ( =20 CurrentStatement->Flags =3D ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags; CurrentStatement->StorageWidth =3D (UINT16) sizeof (BOOLEAN); CurrentStatement->HiiValue.Type =3D EFI_IFR_TYPE_BOOLEAN; =20 + if (mQuestionReferBitVar) { + // + // Get the bit var store info (bit/byte offset, bit/byte offset) + // + mQuestionReferBitVar =3D FALSE; + CurrentStatement->BitStorageWidth =3D 1; + CurrentStatement->QuestionReferToBitField =3D TRUE; + CurrentStatement->BitVarOffset =3D CurrentStatement->VarStoreInfo.= VarOffset; + CurrentStatement->VarStoreInfo.VarOffset =3D CurrentStatement->Bit= VarOffset / 8; + TotalBits =3D CurrentStatement->BitVarOffset - (CurrentStatement->= VarStoreInfo.VarOffset * 8) + CurrentStatement->BitStorageWidth; + CurrentStatement->StorageWidth =3D (TotalBits % 8 =3D=3D 0? TotalB= its / 8: TotalBits / 8 + 1); + } + InitializeRequestElement (FormSet, CurrentStatement, CurrentForm); =20 break; =20 case EFI_IFR_STRING_OP: @@ -2592,12 +2661,16 @@ ParseOpCodes ( break; =20 // // Vendor specific // - case EFI_IFR_GUID_OP: =20 + case EFI_IFR_GUID_OP: CurrentStatement =3D CreateStatement (OpCodeData, FormSet, CurrentFo= rm); + if (CompareGuid ((EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER= )), &gEfiIfrBitvarstoreGuid)) { + Scope =3D 0; + mQuestionReferBitVar =3D TRUE; + } break; =20 // // Scope End // diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/= Universal/SetupBrowserDxe/Setup.c index 89e06de..2884e45 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -1367,10 +1367,73 @@ ConfigRespToStorage ( =20 return Status; } =20 /** + Get the question value with bit field from the buffer. + + @param Question The question refer to bit field. + @param Buffer The buffer which the question value get from. + @param Value Retun the value. + +**/ +VOID +GetBitsQuestionValue( + IN FORM_BROWSER_STATEMENT *Question, + IN UINT8 *Buffer, + OUT UINT32 *Value + ) +{ + UINT32 PreBits; + UINT32 Mask; + + PreBits =3D Question->BitVarOffset - Question->VarStoreInfo.VarOffset * = 8; + Mask =3D (1<< Question->BitStorageWidth) -1; + (*Value) =3D *(Buffer); + (*Value) |=3D *(Buffer + 1) << 8; + (*Value) |=3D *(Buffer + 2) << 16; + (*Value) |=3D *(Buffer + 3) << 24; + (*Value) >>=3D PreBits; + (*Value) &=3D Mask; +} + +/** + Set the question value with bit field to the buffer. + + @param Question The question refer to bit field. + @param Buffer The buffer which the question value set to. + @param Value The value need to set. + +**/ +VOID +SetBitsQuestionValue ( + IN FORM_BROWSER_STATEMENT *Question, + IN UINT8 *Buffer, + IN UINT32 Value + ) +{ + UINT32 PreBits; + UINT32 Mask; + UINT32 TmpBuffer; + + PreBits =3D Question->BitVarOffset - Question->VarStoreInfo.VarOffset * = 8; + Value <<=3D PreBits; + Mask =3D (1<< Question->BitStorageWidth) -1; + Mask <<=3D PreBits; + TmpBuffer =3D *(Buffer); + TmpBuffer |=3D *(Buffer + 1) << 8; + TmpBuffer |=3D *(Buffer + 2) << 16; + TmpBuffer |=3D *(Buffer + 3) << 24; + + TmpBuffer =3D (TmpBuffer & (~Mask)) | Value; + *(Buffer) =3D (UINT8) TmpBuffer & 0xFF; + *(Buffer + 1) =3D (UINT8) (TmpBuffer >> 8); + *(Buffer + 2) =3D (UINT8) (TmpBuffer >> 16); + *(Buffer + 3) =3D (UINT8) (TmpBuffer >> 24); +} + +/** Convert the buffer value to HiiValue. =20 @param Question The question. @param Value Unicode buffer save the question value. =20 @@ -1393,10 +1456,14 @@ BufferToValue ( UINTN Index; UINT8 DigitUint8; BOOLEAN IsString; UINTN Length; EFI_STATUS Status; + UINT8 *Buffer; + UINT32 BufferValue; + + Buffer =3D NULL; =20 IsString =3D (BOOLEAN) ((Question->HiiValue.Type =3D=3D EFI_IFR_TYPE_STR= ING) ? TRUE : FALSE); if (Question->Storage->Type =3D=3D EFI_HII_VARSTORE_BUFFER ||=20 Question->Storage->Type =3D=3D EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER)= { IsBufferStorage =3D TRUE; @@ -1414,11 +1481,17 @@ BufferToValue ( Dst =3D Question->BufferValue; } else { // // Other type of Questions // - Dst =3D (UINT8 *) &Question->HiiValue.Value; + if (Question->QuestionReferToBitField) { + Buffer =3D (UINT8 *)AllocateZeroPool (Question->StorageWidth); + ASSERT (Buffer !=3D NULL); + Dst =3D Buffer; + } else { + Dst =3D (UINT8 *) &Question->HiiValue.Value; + } } =20 // // Temp cut at the end of this section, end with '\0' or '&'. // @@ -1472,10 +1545,18 @@ BufferToValue ( } } =20 *StringPtr =3D TempChar; =20 + if (Question->QuestionReferToBitField) { + GetBitsQuestionValue (Question, Buffer, &BufferValue); + CopyMem ((UINT8 *) &Question->HiiValue.Value, (UINT8*)&BufferValue, Qu= estion->StorageWidth); + if (Buffer !=3D NULL) { + FreePool (Buffer); + } + } + return Status; } =20 /** Get Question's current Value. @@ -1510,10 +1591,11 @@ GetQuestionValue ( CHAR16 *Result; CHAR16 *Value; UINTN Length; BOOLEAN IsBufferStorage; UINTN MaxLen; + UINT32 BufferValue; =20 Status =3D EFI_SUCCESS; Value =3D NULL; Result =3D NULL; =20 @@ -1676,17 +1758,29 @@ GetQuestionValue ( if (GetValueFrom =3D=3D GetSetValueWithEditBuffer || GetValueFrom =3D=3D= GetSetValueWithBuffer ) { if (IsBufferStorage) { if (GetValueFrom =3D=3D GetSetValueWithEditBuffer) { // // Copy from storage Edit buffer + // If the Question refer to bit filed, get the value in the relate= d bit filed. // - CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffs= et, StorageWidth); + if (Question->QuestionReferToBitField) { + GetBitsQuestionValue (Question, Storage->EditBuffer + Question->= VarStoreInfo.VarOffset, &BufferValue); + CopyMem (Dst, (UINT8*)&BufferValue, StorageWidth); + } else { + CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOf= fset, StorageWidth); + } } else { // // Copy from storage Edit buffer + // If the Question refer to bit filed, get the value in the relate= d bit filed. // - CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset, = StorageWidth); + if (Question->QuestionReferToBitField) { + GetBitsQuestionValue (Question, Storage->Buffer + Question->VarS= toreInfo.VarOffset, &BufferValue); + CopyMem (Dst, (UINT8*)&BufferValue, StorageWidth); + } else { + CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset= , StorageWidth); + } } } else { Value =3D NULL; Status =3D GetValueByName (Storage, Question->VariableName, &Value, = GetValueFrom); if (EFI_ERROR (Status)) { @@ -1948,17 +2042,27 @@ SetQuestionValue ( if (SetValueTo =3D=3D GetSetValueWithEditBuffer || SetValueTo =3D=3D Get= SetValueWithBuffer) { if (IsBufferStorage) { if (SetValueTo =3D=3D GetSetValueWithEditBuffer) { // // Copy to storage edit buffer - // =20 - CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, S= rc, StorageWidth); + // If the Question refer to bit filed, copy the value in related b= it filed to storage edit buffer. + // + if (Question->QuestionReferToBitField) { + SetBitsQuestionValue (Question, Storage->EditBuffer + Question->= VarStoreInfo.VarOffset, (UINT32)(*Src)); + } else { + CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset,= Src, StorageWidth); + } } else if (SetValueTo =3D=3D GetSetValueWithBuffer) { // - // Copy to storage edit buffer - // =20 - CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, = StorageWidth); + // Copy to storage buffer + // If the Question refer to bit filed, copy the value in related b= it filed to storage buffer. + // + if (Question->QuestionReferToBitField) { + SetBitsQuestionValue (Question, Storage->Buffer + Question->VarS= toreInfo.VarOffset, (UINT32)(*Src)); + } else { + CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src= , StorageWidth); + } } } else { if (IsString) { // // Allocate enough string buffer. diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/= Universal/SetupBrowserDxe/Setup.h index de140e9..09e0be7 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -327,11 +327,14 @@ struct _FORM_BROWSER_STATEMENT{ EFI_QUESTION_ID QuestionId; // The value of zero is reserved EFI_VARSTORE_ID VarStoreId; // A value of zero indicates no = variable storage BROWSER_STORAGE *Storage; VAR_STORE_INFO VarStoreInfo; UINT16 StorageWidth; + UINT16 BitStorageWidth; + UINT16 BitVarOffset; UINT8 QuestionFlags; + BOOLEAN QuestionReferToBitField;// Whether the question is= stored in a bit field. CHAR16 *VariableName; // Name/Value or EFI Variable na= me CHAR16 *BlockName; // Buffer storage block name: "O= FFSET=3D...WIDTH=3D..." =20 EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numbe= ric, oneof UINT8 *BufferValue; // Edit copy for string, passwor= d, orderedlist diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf b/M= deModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf index 012a39b..f979a2f 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf +++ b/MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf @@ -1,11 +1,11 @@ ## @file # The DXE driver produces FORM BROWSER2 protocol defined in UEFI specifica= tion. # # It also produces FormBrowserEx(2) protocol to let user register the diff= erent Hot key service.=20 # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License # which accompanies this distribution. The full text of the license may b= e found at # http://opensource.org/licenses/bsd-license.php @@ -60,10 +60,11 @@ [Guids] gEfiIfrFrameworkGuid ## SOMETIMES_CONSUMES ## = GUID gEfiHiiPlatformSetupFormsetGuid ## SOMETIMES_CONSUMES ## = GUID gEfiHiiStandardFormGuid ## SOMETIMES_CONSUMES ## = GUID gZeroGuid ## SOMETIMES_CONSUMES ## = GUID + gEfiIfrBitvarstoreGuid ## SOMETIMES_CONSUMES ## = GUID =20 [Protocols] gEfiHiiConfigAccessProtocolGuid ## SOMETIMES_CONSUMES gEfiFormBrowser2ProtocolGuid ## PRODUCES gEdkiiFormBrowserEx2ProtocolGuid ## PRODUCES --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel