From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Eric Dong <eric.dong@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [RFC patch 2/4] MdeModulePkg/SetupBrowser: Handle questions with Bit VarStore
Date: Tue, 18 Apr 2017 20:46:30 +0800 [thread overview]
Message-ID: <1492519592-173060-3-git-send-email-dandan.bi@intel.com> (raw)
In-Reply-To: <1492519592-173060-1-git-send-email-dandan.bi@intel.com>
For oneof/numeric/CheckBox(storage can be Bit EFI VarStore)
If we want 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 EFI VarStore info correctly.
2. Set/get value to/from bit EFI VarStore correctly.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 137 +++++++++++++++++-----
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 106 ++++++++++++++++-
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 3 +
3 files changed, 208 insertions(+), 38 deletions(-)
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index 6b3e5e0..ccd6790 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -15,10 +15,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Setup.h"
UINT16 mStatementIndex;
UINT16 mExpressionOpCodeIndex;
EFI_QUESTION_ID mUsedQuestionId;
+EFI_GUID mBitVarstoreGuid = {0x82DDD68B, 0x9163, 0x4187, {0x9B, 0x27, 0x20, 0xA8, 0xFD, 0x60 ,0xA7 , 0x1D}};
+BOOLEAN mQuestionReferBitVar = FALSE;
+
extern LIST_ENTRY gBrowserStorageList;
/**
Initialize Statement header members.
@param OpCodeData Pointer of the raw OpCode data.
@@ -559,10 +562,11 @@ CreateStorage (
}
BrowserStorage->HiiHandle = FormSet->HiiHandle;
BrowserStorage->Initialized = FALSE;
+ BrowserStorage->IsBitVarStore = FALSE;
}
Storage->BrowserStorage = BrowserStorage;
InitializeConfigHdr (FormSet, Storage);
Storage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigHdr), Storage->ConfigHdr);
@@ -1312,10 +1316,12 @@ ParseOpCodes (
BOOLEAN InUnknownScope;
UINT8 UnknownDepth;
FORMSET_DEFAULTSTORE *PreDefaultStore;
LIST_ENTRY *DefaultLink;
BOOLEAN HaveInserted;
+ UINT16 ByteWidth;
+ UINT16 BitWidth;
SuppressForQuestion = FALSE;
SuppressForOption = FALSE;
InScopeDisable = FALSE;
DepthOfDisable = 0;
@@ -1978,47 +1984,99 @@ ParseOpCodes (
ASSERT(CurrentStatement != NULL);
CurrentStatement->Flags = ((EFI_IFR_ONE_OF *) OpCodeData)->Flags;
Value = &CurrentStatement->HiiValue;
- switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) {
- case EFI_IFR_NUMERIC_SIZE_1:
- CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue;
- CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue;
- CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step;
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT8);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
- break;
+ if (mQuestionReferBitVar) {
+ mQuestionReferBitVar = FALSE;
+ CurrentStatement->StorageBitWidth = CurrentStatement->Flags & 0X0F;
+ CurrentStatement->Storage->IsBitVarStore = TRUE;
+ CurrentStatement->VarBitOffset = CurrentStatement->VarStoreInfo.VarOffset;
+ CurrentStatement->VarStoreInfo.VarOffset = CurrentStatement->VarBitOffset / 8;
+ BitWidth = CurrentStatement->VarBitOffset - (CurrentStatement->VarStoreInfo.VarOffset * 8) + CurrentStatement->StorageBitWidth;
+ ByteWidth = BitWidth / 8;
+ CurrentStatement->StorageWidth = (BitWidth % 8 == 0? ByteWidth: ByteWidth + 1);
+ CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue;
+ CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue;
+ CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step;
+ if (Operand == EFI_IFR_NUMERIC_OP) {
+ switch (CurrentStatement->StorageWidth) {
+ case 1:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_8;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue = (UINT8)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue = (UINT8)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step = (UINT8)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
+ break;
+ case 2:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_16;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue = (UINT16)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue = (UINT16)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step = (UINT16)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
+ case 3:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue = (UINT32)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue = (UINT32)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step = (UINT32)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
+ case 4:
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags &= 0x30;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->Flags |= EFI_IFR_TYPE_NUM_SIZE_32;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue = (UINT32)CurrentStatement->Minimum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue = (UINT32)CurrentStatement->Maximum;
+ ((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step = (UINT32)CurrentStatement->Step;
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
+ default:
+ break;
+ }
+ }
+ } else {
- case EFI_IFR_NUMERIC_SIZE_2:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue, sizeof (UINT16));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step, sizeof (UINT16));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT16);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
- break;
+ switch (CurrentStatement->Flags & EFI_IFR_NUMERIC_SIZE) {
+ case EFI_IFR_NUMERIC_SIZE_1:
+ CurrentStatement->Minimum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MinValue;
+ CurrentStatement->Maximum = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.MaxValue;
+ CurrentStatement->Step = ((EFI_IFR_NUMERIC *) OpCodeData)->data.u8.Step;
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT8);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
+ break;
- case EFI_IFR_NUMERIC_SIZE_4:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue, sizeof (UINT32));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step, sizeof (UINT32));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT32);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
- break;
+ case EFI_IFR_NUMERIC_SIZE_2:
+ CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MinValue, sizeof (UINT16));
+ CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.MaxValue, sizeof (UINT16));
+ CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u16.Step, sizeof (UINT16));
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT16);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
+ break;
- case EFI_IFR_NUMERIC_SIZE_8:
- CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MinValue, sizeof (UINT64));
- CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
- CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.Step, sizeof (UINT64));
- CurrentStatement->StorageWidth = (UINT16) sizeof (UINT64);
- Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
- break;
+ case EFI_IFR_NUMERIC_SIZE_4:
+ CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MinValue, sizeof (UINT32));
+ CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.MaxValue, sizeof (UINT32));
+ CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u32.Step, sizeof (UINT32));
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT32);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_32;
+ break;
- default:
- break;
- }
+ case EFI_IFR_NUMERIC_SIZE_8:
+ CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MinValue, sizeof (UINT64));
+ CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.MaxValue, sizeof (UINT64));
+ CopyMem (&CurrentStatement->Step, &((EFI_IFR_NUMERIC *) OpCodeData)->data.u64.Step, sizeof (UINT64));
+ CurrentStatement->StorageWidth = (UINT16) sizeof (UINT64);
+ Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
+ break;
+ default:
+ break;
+ }
+ }
InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
if ((Operand == EFI_IFR_ONE_OF_OP) && Scope != 0) {
SuppressForOption = TRUE;
}
@@ -2045,10 +2103,21 @@ ParseOpCodes (
CurrentStatement->Flags = ((EFI_IFR_CHECKBOX *) OpCodeData)->Flags;
CurrentStatement->StorageWidth = (UINT16) sizeof (BOOLEAN);
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_BOOLEAN;
+ if (mQuestionReferBitVar) {
+ mQuestionReferBitVar = FALSE;
+ CurrentStatement->StorageBitWidth = 1;
+ CurrentStatement->Storage->IsBitVarStore = TRUE;
+ CurrentStatement->VarBitOffset = CurrentStatement->VarStoreInfo.VarOffset;
+ CurrentStatement->VarStoreInfo.VarOffset = CurrentStatement->VarBitOffset / 8;
+ BitWidth = CurrentStatement->VarBitOffset - (CurrentStatement->VarStoreInfo.VarOffset * 8) + CurrentStatement->StorageBitWidth;
+ ByteWidth = BitWidth / 8;
+ CurrentStatement->StorageWidth = (BitWidth % 8 == 0? ByteWidth: ByteWidth + 1);
+ }
+
InitializeRequestElement (FormSet, CurrentStatement, CurrentForm);
break;
case EFI_IFR_STRING_OP:
@@ -2594,10 +2663,14 @@ ParseOpCodes (
//
// Vendor specific
//
case EFI_IFR_GUID_OP:
CurrentStatement = CreateStatement (OpCodeData, FormSet, CurrentForm);
+ if (CompareGuid ((EFI_GUID *)(OpCodeData + sizeof (EFI_IFR_OP_HEADER)), &mBitVarstoreGuid)) {
+ Scope = 0;
+ mQuestionReferBitVar = TRUE;
+ }
break;
//
// Scope End
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 83dc2b8..6b46581 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -1392,10 +1392,14 @@ BufferToValue (
UINTN Index;
UINT8 DigitUint8;
BOOLEAN IsString;
UINTN Length;
EFI_STATUS Status;
+ UINT8 *Buffer;
+ UINT32 Mask;
+ UINT32 PreBits;
+ UINT32 BufferValue;
IsString = (BOOLEAN) ((Question->HiiValue.Type == EFI_IFR_TYPE_STRING) ? TRUE : FALSE);
if (Question->Storage->Type == EFI_HII_VARSTORE_BUFFER ||
Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) {
IsBufferStorage = TRUE;
@@ -1413,11 +1417,17 @@ BufferToValue (
Dst = Question->BufferValue;
} else {
//
// Other type of Questions
//
- Dst = (UINT8 *) &Question->HiiValue.Value;
+ if (Question->Storage->IsBitVarStore) {
+ Buffer = (UINT8 *)AllocateZeroPool (Question->StorageWidth);
+ ASSERT (Buffer != NULL);
+ Dst = Buffer;
+ } else {
+ Dst = (UINT8 *) &Question->HiiValue.Value;
+ }
}
//
// Temp cut at the end of this section, end with '\0' or '&'.
//
@@ -1471,10 +1481,27 @@ BufferToValue (
}
}
*StringPtr = TempChar;
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;
+ Mask = (1 << Question->StorageBitWidth) - 1;
+ BufferValue = *(Buffer);
+ BufferValue |= *(Buffer + 1) << 8;
+ BufferValue |= *(Buffer + 2) << 16;
+ BufferValue |= *(Buffer + 3) << 24;
+ BufferValue >>= PreBits;
+ BufferValue &= Mask;
+
+ CopyMem ((UINT8 *) &Question->HiiValue.Value, (UINT8*)&BufferValue, Question->StorageWidth);
+
+ if (Buffer != NULL) {
+ FreePool (Buffer);
+ }
+ }
+
return Status;
}
/**
Get Question's current Value.
@@ -1509,10 +1536,13 @@ GetQuestionValue (
CHAR16 *Result;
CHAR16 *Value;
UINTN Length;
BOOLEAN IsBufferStorage;
UINTN MaxLen;
+ UINT32 PreBits;
+ UINT32 Mask;
+ UINT32 BufferValue;
Status = EFI_SUCCESS;
Value = NULL;
Result = NULL;
@@ -1676,16 +1706,40 @@ GetQuestionValue (
if (IsBufferStorage) {
if (GetValueFrom == GetSetValueWithEditBuffer) {
//
// Copy from storage Edit buffer
//
- CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ BufferValue = *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset);
+ BufferValue |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ BufferValue |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ BufferValue |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+ BufferValue >>= PreBits;
+ BufferValue &= Mask;
+ CopyMem (Dst, (UINT8*)&BufferValue, StorageWidth);
+ } else {
+ CopyMem (Dst, Storage->EditBuffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ }
} else {
//
// Copy from storage Edit buffer
//
- CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ BufferValue = *(Storage->Buffer + Question->VarStoreInfo.VarOffset);
+ BufferValue |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ BufferValue |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ BufferValue |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+ BufferValue >>= PreBits;
+ BufferValue &= Mask;
+ CopyMem (Dst, (UINT8*)&BufferValue, StorageWidth);
+ } else {
+ CopyMem (Dst, Storage->Buffer + Question->VarStoreInfo.VarOffset, StorageWidth);
+ }
}
} else {
Value = NULL;
Status = GetValueByName (Storage, Question->VariableName, &Value, GetValueFrom);
if (EFI_ERROR (Status)) {
@@ -1825,10 +1879,14 @@ SetQuestionValue (
CHAR16 *TemName;
CHAR16 *TemString;
UINTN Index;
NAME_VALUE_NODE *Node;
UINTN MaxLen;
+ UINT32 PreBits;
+ UINT32 Mask;
+ UINT32 Buffer;
+ UINT32 SrcValue;
Status = EFI_SUCCESS;
Node = NULL;
if (SetValueTo >= GetSetValueWithMax) {
@@ -1947,17 +2005,53 @@ SetQuestionValue (
if (SetValueTo == GetSetValueWithEditBuffer || SetValueTo == GetSetValueWithBuffer) {
if (IsBufferStorage) {
if (SetValueTo == GetSetValueWithEditBuffer) {
//
// Copy to storage edit buffer
- //
- CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ //
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;
+ SrcValue = (UINT32)(*Src);
+ SrcValue <<= PreBits;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ Mask <<= PreBits;
+ Buffer = *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset);
+ Buffer |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ Buffer |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ Buffer |= *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+
+ Buffer = (Buffer & (~Mask)) | SrcValue;
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset) = (UINT8) Buffer & 0xFF;
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 1) = (UINT8) (Buffer >> 8);
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 2) = (UINT8) (Buffer >> 16);
+ *(Storage->EditBuffer + Question->VarStoreInfo.VarOffset + 3) = (UINT8) (Buffer >> 24);
+ } else {
+ CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ }
} else if (SetValueTo == GetSetValueWithBuffer) {
//
// Copy to storage edit buffer
//
- CopyMem (Storage->Buffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
+ if (Question->Storage->IsBitVarStore) {
+ PreBits = Question->VarBitOffset - Question->VarStoreInfo.VarOffset * 8;
+ SrcValue = (UINT32)(*Src);
+ SrcValue <<= PreBits;
+ Mask = (1<< Question->StorageBitWidth) -1;
+ Mask <<= PreBits;
+ Buffer = *(Storage->Buffer + Question->VarStoreInfo.VarOffset);
+ Buffer |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 1) << 8;
+ Buffer |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 2) << 16;
+ Buffer |= *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 3) << 24;
+
+ Buffer = (Buffer & (~Mask)) | SrcValue;
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset) = (UINT8) Buffer & 0xFF;
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 1) = (UINT8) (Buffer >> 8);
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 2) = (UINT8) (Buffer >> 16);
+ *(Storage->Buffer + Question->VarStoreInfo.VarOffset + 3) = (UINT8) (Buffer >> 24);
+ } 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 f1accdf..f919b76 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -137,10 +137,11 @@ typedef struct {
LIST_ENTRY Link;
UINT8 Type; // Storage type
BOOLEAN Initialized; // Whether this varstore is initialized, efi varstore not used.
+ BOOLEAN IsBitVarStore; // whether this is bit varstore.
EFI_HII_HANDLE HiiHandle; // HiiHandle for this varstore, efi varstore not used.
EFI_GUID Guid;
CHAR16 *Name; // For EFI_IFR_VARSTORE
@@ -327,10 +328,12 @@ 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 StorageBitWidth;
+ UINT16 VarBitOffset;
UINT8 QuestionFlags;
CHAR16 *VariableName; // Name/Value or EFI Variable name
CHAR16 *BlockName; // Buffer storage block name: "OFFSET=...WIDTH=..."
EFI_HII_VALUE HiiValue; // Edit copy for checkbox, numberic, oneof
--
1.9.5.msysgit.1
next prev parent reply other threads:[~2017-04-18 12:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-18 12:46 [RFC patch 0/4] Support Bit fields in EFI Variable Storage Dandan Bi
2017-04-18 12:46 ` [RFC patch 1/4] BaseTool/VfrCompiler: Support bit " Dandan Bi
2017-04-18 12:46 ` Dandan Bi [this message]
2017-04-18 12:46 ` [RFC patch 3/4] MdeModulePkg/HiiDatabase: Handle questions with Bit VarStore Dandan Bi
2017-04-18 12:46 ` [RFC patch 4/4] MdeModulePkg/DriverSample: Add smaple questions with bit VarStore Dandan Bi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492519592-173060-3-git-send-email-dandan.bi@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox