Update the code of processing device path info in browser to follow UEFI spec.
Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14076 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7f7dba5c86
commit
80a047f04a
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Utility functions for expression evaluation.
|
||||
|
||||
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -2470,22 +2470,21 @@ EvaluateExpression (
|
|||
}
|
||||
|
||||
if (OpCode->DevicePath != 0) {
|
||||
Value->Type = EFI_IFR_TYPE_UNDEFINED;
|
||||
|
||||
StrPtr = GetToken (OpCode->DevicePath, FormSet->HiiHandle);
|
||||
if (StrPtr == NULL) {
|
||||
Value->Type = EFI_IFR_TYPE_UNDEFINED;
|
||||
break;
|
||||
if (StrPtr != NULL && mPathFromText != NULL) {
|
||||
DevicePath = mPathFromText->ConvertTextToDevicePath(StrPtr);
|
||||
if (DevicePath != NULL && GetQuestionValueFromForm(DevicePath, NULL, &OpCode->Guid, Value->Value.u16, &QuestionVal)) {
|
||||
Value = &QuestionVal;
|
||||
}
|
||||
if (DevicePath != NULL) {
|
||||
FreePool (DevicePath);
|
||||
}
|
||||
}
|
||||
|
||||
DevicePath = ConvertDevicePathFromText(StrPtr);
|
||||
|
||||
if (!GetQuestionValueFromForm(DevicePath, NULL, &OpCode->Guid, Value->Value.u16, &QuestionVal)){
|
||||
Value->Type = EFI_IFR_TYPE_UNDEFINED;
|
||||
} else {
|
||||
Value = &QuestionVal;
|
||||
}
|
||||
|
||||
if (DevicePath != NULL) {
|
||||
FreePool (DevicePath);
|
||||
if (StrPtr != NULL) {
|
||||
FreePool (StrPtr);
|
||||
}
|
||||
} else if (CompareGuid (&OpCode->Guid, &gZeroGuid) != 0) {
|
||||
if (!GetQuestionValueFromForm(NULL, FormSet->HiiHandle, &OpCode->Guid, Value->Value.u16, &QuestionVal)){
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Utility functions for UI presentation.
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -602,6 +602,7 @@ InitializeBrowserStrings (
|
|||
gSaveChanges = GetToken (STRING_TOKEN (SAVE_CHANGES), gHiiHandle);
|
||||
gOptionMismatch = GetToken (STRING_TOKEN (OPTION_MISMATCH), gHiiHandle);
|
||||
gFormSuppress = GetToken (STRING_TOKEN (FORM_SUPPRESSED), gHiiHandle);
|
||||
gProtocolNotFound = GetToken (STRING_TOKEN (PROTOCOL_NOT_FOUND), gHiiHandle);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -642,6 +643,7 @@ FreeBrowserStrings (
|
|||
FreePool (gSaveChanges);
|
||||
FreePool (gOptionMismatch);
|
||||
FreePool (gFormSuppress);
|
||||
FreePool (gProtocolNotFound);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Entry and initialization module for the browser.
|
||||
|
||||
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -32,6 +32,7 @@ SETUP_DRIVER_PRIVATE_DATA mPrivateData = {
|
|||
EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
|
||||
EFI_HII_STRING_PROTOCOL *mHiiString;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
|
||||
EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;
|
||||
|
||||
UINTN gBrowserContextCount = 0;
|
||||
LIST_ENTRY gBrowserContextList = INITIALIZE_LIST_HEAD_VARIABLE (gBrowserContextList);
|
||||
|
@ -84,6 +85,7 @@ CHAR16 *gAdjustNumber;
|
|||
CHAR16 *gSaveChanges;
|
||||
CHAR16 *gOptionMismatch;
|
||||
CHAR16 *gFormSuppress;
|
||||
CHAR16 *gProtocolNotFound;
|
||||
|
||||
CHAR16 *mUnknownString = L"!";
|
||||
|
||||
|
@ -662,6 +664,12 @@ InitializeSetup (
|
|||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDevicePathFromTextProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mPathFromText
|
||||
);
|
||||
|
||||
//
|
||||
// Publish our HII data
|
||||
//
|
||||
|
@ -4184,6 +4192,7 @@ RestoreBrowserContext (
|
|||
gHelpBlockWidth = Context->HelpBlockWidth;
|
||||
gOldFormSet = Context->OldFormSet;
|
||||
gMenuRefreshHead = Context->MenuRefreshHead;
|
||||
gProtocolNotFound = Context->ProtocolNotFound;
|
||||
|
||||
CopyMem (&gScreenDimensions, &Context->ScreenDimensions, sizeof (gScreenDimensions));
|
||||
CopyMem (&gMenuOption, &Context->MenuOption, sizeof (gMenuOption));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Private MACRO, structure and function definitions for Setup Browser module.
|
||||
|
||||
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/HiiString.h>
|
||||
#include <Protocol/UserManager.h>
|
||||
#include <Protocol/DevicePathFromText.h>
|
||||
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
#include <Guid/HiiPlatformSetupFormset.h>
|
||||
|
@ -546,6 +547,7 @@ typedef struct {
|
|||
CHAR16 *SaveChanges;
|
||||
CHAR16 *OptionMismatch;
|
||||
CHAR16 *FormSuppress;
|
||||
CHAR16 *ProtocolNotFound;
|
||||
CHAR16 PromptBlockWidth;
|
||||
CHAR16 OptionBlockWidth;
|
||||
CHAR16 HelpBlockWidth;
|
||||
|
@ -597,6 +599,7 @@ typedef enum {
|
|||
extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
|
||||
extern EFI_HII_STRING_PROTOCOL *mHiiString;
|
||||
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
|
||||
extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;
|
||||
|
||||
extern BANNER_DATA *gBannerData;
|
||||
extern EFI_HII_HANDLE gFrontPageHandle;
|
||||
|
@ -647,6 +650,7 @@ extern CHAR16 *gAdjustNumber;
|
|||
extern CHAR16 *gSaveChanges;
|
||||
extern CHAR16 *gOptionMismatch;
|
||||
extern CHAR16 *gFormSuppress;
|
||||
extern CHAR16 *gProtocolNotFound;
|
||||
|
||||
extern CHAR16 gPromptBlockWidth;
|
||||
extern CHAR16 gOptionBlockWidth;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# The DXE driver produces FORM BROWSER protocols defined in UEFI HII 2.1 specificatin.
|
||||
#
|
||||
# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
|
@ -75,6 +75,7 @@
|
|||
gEfiHiiDatabaseProtocolGuid ## CONSUMES
|
||||
gEfiUnicodeCollation2ProtocolGuid ## CONSUMES
|
||||
gEfiUserManagerProtocolGuid ## SOMETIMES_CONSUMES
|
||||
gEfiDevicePathFromTextProtocolGuid ## SOMETIMES_CONSUMES
|
||||
|
||||
[FeaturePcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Utility functions for User Interface functions.
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -1970,55 +1970,6 @@ FormSetGuidToHiiHandle (
|
|||
return HiiHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
Transfer the device path string to binary format.
|
||||
|
||||
@param StringPtr The device path string info.
|
||||
|
||||
@retval Device path binary info.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
ConvertDevicePathFromText (
|
||||
IN CHAR16 *StringPtr
|
||||
)
|
||||
{
|
||||
UINTN BufferSize;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
CHAR16 TemStr[2];
|
||||
UINT8 *DevicePathBuffer;
|
||||
UINTN Index;
|
||||
UINT8 DigitUint8;
|
||||
|
||||
ASSERT (StringPtr != NULL);
|
||||
|
||||
BufferSize = StrLen (StringPtr) / 2;
|
||||
DevicePath = AllocatePool (BufferSize);
|
||||
ASSERT (DevicePath != NULL);
|
||||
|
||||
//
|
||||
// Convert from Device Path String to DevicePath Buffer in the reverse order.
|
||||
//
|
||||
DevicePathBuffer = (UINT8 *) DevicePath;
|
||||
for (Index = 0; StringPtr[Index] != L'\0'; Index ++) {
|
||||
TemStr[0] = StringPtr[Index];
|
||||
DigitUint8 = (UINT8) StrHexToUint64 (TemStr);
|
||||
if (DigitUint8 == 0 && TemStr[0] != L'0') {
|
||||
//
|
||||
// Invalid Hex Char as the tail.
|
||||
//
|
||||
break;
|
||||
}
|
||||
if ((Index & 1) == 0) {
|
||||
DevicePathBuffer [Index/2] = DigitUint8;
|
||||
} else {
|
||||
DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);
|
||||
}
|
||||
}
|
||||
|
||||
return DevicePath;
|
||||
}
|
||||
|
||||
/**
|
||||
Process the goto op code, update the info in the selection structure.
|
||||
|
||||
|
@ -2064,16 +2015,32 @@ ProcessGotoOpCode (
|
|||
if (Selection->Form->ModalForm) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Goto another Hii Package list
|
||||
//
|
||||
if (mPathFromText != NULL) {
|
||||
DevicePath = mPathFromText->ConvertTextToDevicePath(StringPtr);
|
||||
if (DevicePath != NULL) {
|
||||
Selection->Handle = DevicePathToHiiHandle (DevicePath);
|
||||
FreePool (DevicePath);
|
||||
}
|
||||
FreePool (StringPtr);
|
||||
} else {
|
||||
//
|
||||
// Not found the EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL protocol.
|
||||
//
|
||||
do {
|
||||
CreateDialog (4, TRUE, 0, NULL, &Key, gEmptyString, gProtocolNotFound, gPressEnter, gEmptyString);
|
||||
} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
|
||||
if (Repaint != NULL) {
|
||||
*Repaint = TRUE;
|
||||
}
|
||||
FreePool (StringPtr);
|
||||
return Status;
|
||||
}
|
||||
|
||||
Selection->Action = UI_ACTION_REFRESH_FORMSET;
|
||||
DevicePath = ConvertDevicePathFromText (StringPtr);
|
||||
|
||||
Selection->Handle = DevicePathToHiiHandle (DevicePath);
|
||||
FreePool (DevicePath);
|
||||
FreePool (StringPtr);
|
||||
|
||||
if (Selection->Handle == NULL) {
|
||||
//
|
||||
// If target Hii Handle not found, exit
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Private structure, MACRO and function definitions for User Interface related functionalities.
|
||||
|
||||
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -1048,17 +1048,4 @@ EvaluateExpressionList (
|
|||
IN FORM_BROWSER_FORM *Form OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Transfer the device path string to binary format.
|
||||
|
||||
@param StringPtr The device path string info.
|
||||
|
||||
@retval Device path binary info.
|
||||
|
||||
**/
|
||||
EFI_DEVICE_PATH_PROTOCOL *
|
||||
ConvertDevicePathFromText (
|
||||
IN CHAR16 *StringPtr
|
||||
);
|
||||
|
||||
#endif // _UI_H
|
||||
|
|
Loading…
Reference in New Issue