};\r
\r
BOOLEAN mInputError;\r
+BOOLEAN GetLineByWidthFinished = FALSE;\r
\r
\r
/**\r
Selection->FormId = UiMenuList->FormId;\r
Selection->QuestionId = UiMenuList->QuestionId;\r
RemoveEntryList (&UiMenuList->MenuLink);\r
- gBS->FreePool (UiMenuList);\r
+ FreePool (UiMenuList);\r
}\r
}\r
\r
while (!IsListEmpty (&gMenuList)) {\r
UiMenuList = CR (gMenuList.ForwardLink, UI_MENU_LIST, MenuLink, UI_MENU_LIST_SIGNATURE);\r
RemoveEntryList (&UiMenuList->MenuLink);\r
- gBS->FreePool (UiMenuList);\r
+ FreePool (UiMenuList);\r
}\r
}\r
\r
// Data format : [01/02/2004] [11:22:33]\r
// Line number : 0 0 1 0 0 1\r
//\r
- gBS->FreePool (MenuOption->Description);\r
+ FreePool (MenuOption->Description);\r
}\r
- gBS->FreePool (MenuOption);\r
+ FreePool (MenuOption);\r
}\r
}\r
\r
\r
while (gMenuRefreshHead != NULL) {\r
OldMenuRefreshEntry = gMenuRefreshHead->Next;\r
- gBS->FreePool (gMenuRefreshHead);\r
+ FreePool (gMenuRefreshHead);\r
gMenuRefreshHead = OldMenuRefreshEntry;\r
}\r
\r
;\r
\r
PrintStringAt (MenuRefreshEntry->CurrentColumn, MenuRefreshEntry->CurrentRow, &OptionString[Index]);\r
- gBS->FreePool (OptionString);\r
+ FreePool (OptionString);\r
}\r
\r
//\r
// Question value may be changed, need invoke its Callback()\r
//\r
ConfigAccess = Selection->FormSet->ConfigAccess;\r
- if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) && (ConfigAccess != NULL)) {\r
+ if (((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) && (ConfigAccess != NULL)) {\r
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
\r
HiiValue = &Question->HiiValue;\r
case CHAR_NULL:\r
switch (Key.ScanCode) {\r
case SCAN_ESC:\r
- gBS->FreePool (TempString);\r
- gBS->FreePool (BufferedString);\r
+ FreePool (TempString);\r
+ FreePool (BufferedString);\r
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);\r
gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
return EFI_DEVICE_ERROR;\r
\r
case CHAR_CARRIAGE_RETURN:\r
SelectionComplete = TRUE;\r
- gBS->FreePool (TempString);\r
- gBS->FreePool (BufferedString);\r
+ FreePool (TempString);\r
+ FreePool (BufferedString);\r
gST->ConOut->SetAttribute (gST->ConOut, CurrentAttribute);\r
gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
return EFI_SUCCESS;\r
break;\r
}\r
\r
- gBS->FreePool (InputErrorMessage);\r
- gBS->FreePool (NvUpdateMessage);\r
+ FreePool (InputErrorMessage);\r
+ FreePool (NvUpdateMessage);\r
return ;\r
}\r
\r
if ((Statement->Operand == EFI_IFR_TEXT_OP) && (Statement->TextTwo != 0)) {\r
String = GetToken (Statement->TextTwo, Handle);\r
Size = StrLen (String);\r
- gBS->FreePool (String);\r
+ FreePool (String);\r
}\r
\r
if ((Statement->Operand == EFI_IFR_SUBTITLE_OP) ||\r
return Width;\r
}\r
\r
-\r
-BOOLEAN GetLineByWidthFinished = FALSE;\r
-\r
/**\r
Will copy LineWidth amount of a string in the OutputString buffer and return the\r
number of CHAR16 characters that were copied into the OutputString buffer.\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&OptionString[Index])) {\r
+ if (StrLen (&OptionString[Index]) != 0) {\r
if (SkipValue == 0) {\r
Row++;\r
//\r
}\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
if (SkipValue != 0) {\r
SkipValue--;\r
}\r
return PadLineNumber;\r
}\r
\r
+/**\r
+ Find HII Handle in the HII database associated with given Device Path.\r
+\r
+ If DevicePath is NULL, then ASSERT.\r
+\r
+ @param DevicePath Device Path associated with the HII package list\r
+ handle.\r
+\r
+ @retval Handle HII package list Handle associated with the Device\r
+ Path.\r
+ @retval NULL Hii Package list handle is not found.\r
+\r
+**/\r
+EFI_HII_HANDLE\r
+EFIAPI\r
+DevicePathToHiiHandle (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_DEVICE_PATH_PROTOCOL *TmpDevicePath;\r
+ UINTN BufferSize;\r
+ UINTN HandleCount;\r
+ UINTN Index;\r
+ EFI_HANDLE Handle;\r
+ EFI_HANDLE DriverHandle;\r
+ EFI_HII_HANDLE *HiiHandles;\r
+ EFI_HII_HANDLE HiiHandle;\r
+\r
+ ASSERT (DevicePath != NULL);\r
+\r
+ TmpDevicePath = DevicePath;\r
+ //\r
+ // Locate Device Path Protocol handle buffer\r
+ //\r
+ Status = gBS->LocateDevicePath (\r
+ &gEfiDevicePathProtocolGuid,\r
+ &TmpDevicePath,\r
+ &DriverHandle\r
+ );\r
+ if (EFI_ERROR (Status) || !IsDevicePathEnd (TmpDevicePath)) {\r
+ return NULL;\r
+ }\r
+\r
+ //\r
+ // Retrieve all HII Handles from HII database\r
+ //\r
+ BufferSize = 0x1000;\r
+ HiiHandles = AllocatePool (BufferSize);\r
+ ASSERT (HiiHandles != NULL);\r
+ Status = mHiiDatabase->ListPackageLists (\r
+ mHiiDatabase,\r
+ EFI_HII_PACKAGE_TYPE_ALL,\r
+ NULL,\r
+ &BufferSize,\r
+ HiiHandles\r
+ );\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ FreePool (HiiHandles);\r
+ HiiHandles = AllocatePool (BufferSize);\r
+ ASSERT (HiiHandles != NULL);\r
+\r
+ Status = mHiiDatabase->ListPackageLists (\r
+ mHiiDatabase,\r
+ EFI_HII_PACKAGE_TYPE_ALL,\r
+ NULL,\r
+ &BufferSize,\r
+ HiiHandles\r
+ );\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool (HiiHandles);\r
+ return NULL;\r
+ }\r
+\r
+ //\r
+ // Search Hii Handle by Driver Handle\r
+ //\r
+ HiiHandle = NULL;\r
+ HandleCount = BufferSize / sizeof (EFI_HII_HANDLE);\r
+ for (Index = 0; Index < HandleCount; Index++) {\r
+ Status = mHiiDatabase->GetPackageListHandle (\r
+ mHiiDatabase,\r
+ HiiHandles[Index],\r
+ &Handle\r
+ );\r
+ if (!EFI_ERROR (Status) && (Handle == DriverHandle)) {\r
+ HiiHandle = HiiHandles[Index];\r
+ break;\r
+ }\r
+ }\r
+\r
+ FreePool (HiiHandles);\r
+ return HiiHandle;\r
+}\r
\r
/**\r
Display menu and wait for user to select one menu option, then return it.\r
UINT16 DefaultId;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
FORM_BROWSER_STATEMENT *Statement;\r
+ CHAR16 TemStr[2];\r
+ UINT8 *DevicePathBuffer;\r
+ UINT8 DigitUint8;\r
\r
CopyMem (&LocalScreen, &gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));\r
\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&MenuOption->Description[Index])) {\r
+ if (StrLen (&MenuOption->Description[Index]) != 0) {\r
if (Temp == 0) {\r
Row++;\r
}\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
if (Temp != 0) {\r
Temp--;\r
}\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&OptionString[Index])) {\r
+ if (StrLen (&OptionString[Index]) != 0) {\r
if (Temp2 == 0) {\r
Row++;\r
//\r
}\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
if (Temp2 != 0) {\r
Temp2--;\r
}\r
Temp2 = 0;\r
Row = OriginalRow;\r
\r
- gBS->FreePool (OptionString);\r
+ FreePool (OptionString);\r
}\r
//\r
// If this is a text op with secondary text information\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&StringPtr[Index])) {\r
+ if (StrLen (&StringPtr[Index]) != 0) {\r
if (Temp2 == 0) {\r
Row++;\r
//\r
}\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
if (Temp2 != 0) {\r
Temp2--;\r
}\r
}\r
\r
Row = OriginalRow;\r
- gBS->FreePool (StringPtr);\r
+ FreePool (StringPtr);\r
}\r
\r
//\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&OptionString[Index])) {\r
+ if (StrLen (&OptionString[Index]) != 0) {\r
MenuOption->Row++;\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
}\r
\r
MenuOption->Row = OriginalRow;\r
\r
- gBS->FreePool (OptionString);\r
+ FreePool (OptionString);\r
} else {\r
if (NewLine) {\r
if (MenuOption->GrayOut) {\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&MenuOption->Description[Index])) {\r
+ if (StrLen (&MenuOption->Description[Index]) != 0) {\r
MenuOption->Row++;\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
}\r
\r
MenuOption->Row = OriginalRow;\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&OptionString[Index])) {\r
+ if (StrLen (&OptionString[Index]) != 0) {\r
MenuOption->Row++;\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
}\r
\r
MenuOption->Row = OriginalRow;\r
\r
- gBS->FreePool (OptionString);\r
+ FreePool (OptionString);\r
} else {\r
if (NewLine) {\r
OriginalRow = MenuOption->Row;\r
//\r
// If there is more string to process print on the next row and increment the Skip value\r
//\r
- if (StrLen (&MenuOption->Description[Index])) {\r
+ if (StrLen (&MenuOption->Description[Index]) != 0) {\r
MenuOption->Row++;\r
}\r
\r
- gBS->FreePool (OutputString);\r
+ FreePool (OutputString);\r
}\r
\r
MenuOption->Row = OriginalRow;\r
}\r
BufferSize = StrLen (StringPtr) / 2;\r
DevicePath = AllocatePool (BufferSize);\r
+ \r
+ //\r
+ // Convert from Device Path String to DevicePath Buffer in the reverse order.\r
+ //\r
+ DevicePathBuffer = (UINT8 *) DevicePath;\r
+ for (Index = 0; StringPtr[Index] != L'\0'; Index ++) {\r
+ TemStr[0] = StringPtr[Index];\r
+ DigitUint8 = (UINT8) StrHexToUint64 (TemStr);\r
+ if (DigitUint8 == 0 && TemStr[0] != L'0') {\r
+ //\r
+ // Invalid Hex Char as the tail.\r
+ //\r
+ break;\r
+ }\r
+ if ((Index & 1) == 0) {\r
+ DevicePathBuffer [Index/2] = DigitUint8;\r
+ } else {\r
+ DevicePathBuffer [Index/2] = (UINT8) ((DevicePathBuffer [Index/2] << 4) + DigitUint8);\r
+ }\r
+ }\r
\r
- HexStringToBufInReverseOrder ((UINT8 *) DevicePath, &BufferSize, StringPtr);\r
- Selection->Handle = HiiLibDevicePathToHiiHandle (DevicePath);\r
+ Selection->Handle = DevicePathToHiiHandle (DevicePath);\r
if (Selection->Handle == NULL) {\r
//\r
// If target Hii Handle not found, exit\r
break;\r
}\r
\r
- gBS->FreePool (StringPtr);\r
- gBS->FreePool (DevicePath);\r
+ FreePool (StringPtr);\r
+ FreePool (DevicePath);\r
\r
CopyMem (&Selection->FormSetGuid, &Statement->RefFormSetId, sizeof (EFI_GUID));\r
Selection->FormId = Statement->RefFormId;\r