33#define PRINTABLE_LANGUAGE_NAME_STRING_ID 0x0001
35#define UI_HII_DRIVER_LIST_SIZE 0x8
37#define FRONT_PAGE_KEY_CONTINUE 0x1000
38#define FRONT_PAGE_KEY_RESET 0x1001
39#define FRONT_PAGE_KEY_LANGUAGE 0x1002
40#define FRONT_PAGE_KEY_DRIVER 0x2000
43 EFI_STRING_ID PromptId;
45 EFI_STRING_ID DevicePathId;
47 BOOLEAN EmptyLineAfter;
50CHAR8 *gLanguageString;
51EFI_STRING_ID *gLanguageToken;
54UINT8 gCurrentLanguageIndex;
70 IN OUT CHAR8 **LangCode,
77 ASSERT (LangCode !=
NULL);
78 ASSERT (*LangCode !=
NULL);
79 ASSERT (Lang !=
NULL);
82 StringPtr = *LangCode;
83 while (StringPtr[Index] != 0 && StringPtr[Index] !=
';') {
87 CopyMem (Lang, StringPtr, Index);
90 if (StringPtr[Index] ==
';') {
94 *LangCode = StringPtr + Index;
121 ASSERT (Lang !=
NULL);
124 LangCode = gLanguageString;
125 while (*LangCode != 0) {
128 if (Index == Value->u8) {
129 gCurrentLanguageIndex = Value->u8;
136 if (Index == Value->u8) {
137 Status =
gRT->SetVariable (
139 &gEfiGlobalVariableGuid,
144 if (EFI_ERROR (Status)) {
146 return EFI_DEVICE_ERROR;
177 IN EFI_BROWSER_ACTION Action,
178 IN EFI_QUESTION_ID QuestionId,
181 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest,
185 if ((QuestionId != FRONT_PAGE_KEY_CONTINUE) &&
186 (QuestionId != FRONT_PAGE_KEY_RESET) &&
187 (QuestionId != FRONT_PAGE_KEY_LANGUAGE))
192 if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
193 if (QuestionId == FRONT_PAGE_KEY_LANGUAGE) {
194 Value->u8 = gCurrentLanguageIndex;
197 *Status = EFI_UNSUPPORTED;
203 if (Action != EFI_BROWSER_ACTION_CHANGED) {
207 *Status = EFI_UNSUPPORTED;
211 if (Action == EFI_BROWSER_ACTION_CHANGED) {
212 if ((Value ==
NULL) || (ActionRequest ==
NULL)) {
213 *Status = EFI_INVALID_PARAMETER;
218 switch (QuestionId) {
219 case FRONT_PAGE_KEY_CONTINUE:
223 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
226 case FRONT_PAGE_KEY_LANGUAGE:
230 case FRONT_PAGE_KEY_RESET:
235 *Status = EFI_UNSUPPORTED;
255 IN VOID *StartOpCodeHandle
263 CHAR16 *StringBuffer;
264 VOID *OptionsOpCodeHandle;
276 ASSERT (OptionsOpCodeHandle !=
NULL);
284 if (gLanguageString ==
NULL) {
287 (CHAR8 *)
PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)
289 ASSERT (gLanguageString !=
NULL);
292 if (gLanguageToken ==
NULL) {
296 LangCode = gLanguageString;
298 ASSERT (Lang !=
NULL);
301 while (*LangCode != 0) {
309 gLanguageToken =
AllocateZeroPool ((OptionCount + 1) *
sizeof (EFI_STRING_ID));
310 ASSERT (gLanguageToken !=
NULL);
312 Status =
gBS->LocateProtocol (&gEfiHiiStringProtocolGuid,
NULL, (VOID **)&HiiString);
315 LangCode = gLanguageString;
317 while (*LangCode != 0) {
321 Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize,
NULL);
322 if (Status == EFI_BUFFER_TOO_SMALL) {
324 ASSERT (StringBuffer !=
NULL);
325 Status = HiiString->GetString (HiiString, Lang, HiiHandle, PRINTABLE_LANGUAGE_NAME_STRING_ID, StringBuffer, &StringSize,
NULL);
329 if (EFI_ERROR (Status)) {
331 StringBuffer =
AllocatePool (LangSize *
sizeof (CHAR16));
332 ASSERT (StringBuffer !=
NULL);
336 ASSERT (StringBuffer !=
NULL);
337 gLanguageToken[OptionCount] =
HiiSetString (HiiHandle, 0, StringBuffer,
NULL);
344 ASSERT (gLanguageToken !=
NULL);
345 LangCode = gLanguageString;
349 ASSERT (Lang !=
NULL);
352 while (*LangCode != 0) {
358 gLanguageToken[OptionCount],
359 EFI_IFR_OPTION_DEFAULT,
360 EFI_IFR_NUMERIC_SIZE_1,
363 gCurrentLanguageIndex = (UINT8)OptionCount;
367 gLanguageToken[OptionCount],
369 EFI_IFR_NUMERIC_SIZE_1,
377 if (CurrentLang !=
NULL) {
385 FRONT_PAGE_KEY_LANGUAGE,
390 EFI_IFR_FLAG_CALLBACK,
391 EFI_IFR_NUMERIC_SIZE_1,
407 IN VOID *StartOpCodeHandle
412 FRONT_PAGE_KEY_CONTINUE,
415 EFI_IFR_FLAG_CALLBACK,
430 IN VOID *StartOpCodeHandle
446 IN VOID *StartOpCodeHandle
451 FRONT_PAGE_KEY_RESET,
454 EFI_IFR_FLAG_CALLBACK,
476 ASSERT (Handle !=
NULL);
478 if (Handle ==
NULL) {
483 if (EFI_ERROR (Status)) {
506 OUT EFI_STRING_ID *PromptId,
507 OUT EFI_STRING_ID *HelpId,
508 OUT VOID *FormsetGuid
521 if (EFI_ERROR (Status)) {
527 Ptr = (UINT8 *)Buffer;
528 while (TempSize < BufferSize) {
538 while (ClassGuidNum-- > 0) {
573 IN VOID *StartOpCodeHandle
579 EFI_STRING_ID TokenHelp;
581 CHAR16 *DevicePathStr;
586 BOOLEAN EmptyLineAfter;
588 if (gHiiDriverList !=
NULL) {
593 ASSERT (HiiHandles !=
NULL);
596 ASSERT (gHiiDriverList !=
NULL);
597 DriverListPtr = gHiiDriverList;
598 CurrentSize = UI_HII_DRIVER_LIST_SIZE;
600 for (Index = 0, Count = 0; HiiHandles[Index] !=
NULL; Index++) {
601 if (!
RequiredDriver (HiiHandles[Index], ClassGuid, &Token, &TokenHelp, &gHiiDriverList[Count].FormSetGuid)) {
606 if (String ==
NULL) {
608 ASSERT (String !=
NULL);
609 }
else if (SpecialHandlerFn !=
NULL) {
613 EmptyLineAfter =
FALSE;
614 if (SpecialHandlerFn (String, &NewName, &EmptyLineAfter)) {
617 DriverListPtr[Count].EmptyLineAfter = EmptyLineAfter;
625 if (String ==
NULL) {
627 ASSERT (String !=
NULL);
634 if (DevicePathStr !=
NULL) {
635 DriverListPtr[Count].DevicePathId =
HiiSetString (HiiHandle, 0, DevicePathStr,
NULL);
638 DriverListPtr[Count].DevicePathId = 0;
642 if (Count >= CurrentSize) {
645 (Count + UI_HII_DRIVER_LIST_SIZE)
649 ASSERT (DriverListPtr !=
NULL);
650 gHiiDriverList = DriverListPtr;
651 CurrentSize += UI_HII_DRIVER_LIST_SIZE;
658 while (gHiiDriverList[Index].PromptId != 0) {
662 gHiiDriverList[Index].PromptId,
663 gHiiDriverList[Index].HelpId,
665 (EFI_QUESTION_ID)(Index + FRONT_PAGE_KEY_DRIVER),
667 &gHiiDriverList[Index].FormSetGuid,
668 gHiiDriverList[Index].DevicePathId
671 if (gHiiDriverList[Index].EmptyLineAfter) {
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
RETURN_STATUS EFIAPI AsciiStrToUnicodeStrS(IN CONST CHAR8 *Source, OUT CHAR16 *Destination, IN UINTN DestMax)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
CHAR16 * ExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle)
VOID GetNextLanguage(IN OUT CHAR8 **LangCode, OUT CHAR8 *Lang)
EFI_STATUS LanguageChangeHandler(IN EFI_IFR_TYPE_VALUE *Value)
EFI_STATUS UiListThirdPartyDrivers(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *ClassGuid, IN DRIVER_SPECIAL_HANDLER SpecialHandlerFn, IN VOID *StartOpCodeHandle)
VOID UiCreateResetMenu(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
VOID UiCreateEmptyLine(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
VOID UiCreateLanguageMenu(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
BOOLEAN RequiredDriver(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *Guid, OUT EFI_STRING_ID *PromptId, OUT EFI_STRING_ID *HelpId, OUT VOID *FormsetGuid)
BOOLEAN UiSupportLibCallbackHandler(IN EFI_HII_HANDLE HiiHandle, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest, OUT EFI_STATUS *Status)
VOID UiCreateContinueMenu(IN EFI_HII_HANDLE HiiHandle, IN VOID *StartOpCodeHandle)
BOOLEAN(EFIAPI * DRIVER_SPECIAL_HANDLER)(IN CHAR16 *DriverName, OUT CHAR16 **NewName, OUT BOOLEAN *EmptyLineAfter)
UINT8 *EFIAPI HiiCreateSubTitleOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 Flags, IN UINT8 Scope)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
EFI_HII_HANDLE *EFIAPI HiiGetHiiHandles(IN CONST EFI_GUID *PackageListGuid OPTIONAL)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
UINT8 *EFIAPI HiiCreateOneOfOptionOpCode(IN VOID *OpCodeHandle, IN UINT16 StringId, IN UINT8 Flags, IN UINT8 Type, IN UINT64 Value)
UINT8 *EFIAPI HiiCreateOneOfOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 OneOfFlags, IN VOID *OptionsOpCodeHandle, IN VOID *DefaultsOpCodeHandle OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
UINT8 *EFIAPI HiiCreateGotoExOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID RefFormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId, IN EFI_QUESTION_ID RefQuestionId, IN EFI_GUID *RefFormSetId OPTIONAL, IN EFI_STRING_ID RefDevicePath)
UINT8 *EFIAPI HiiCreateActionOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_STRING_ID QuestionConfig)
EFI_STATUS EFIAPI HiiGetFormSetFromHiiHandle(IN EFI_HII_HANDLE Handle, OUT EFI_IFR_FORM_SET **Buffer, OUT UINTN *BufferSize)
EFI_RUNTIME_SERVICES * gRT
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_HII_DATABASE_PROTOCOL * gHiiDatabase
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
#define EFI_VARIABLE_NON_VOLATILE