/** This function is invoked if user selected a interactive opcode from Device Manager's Formset. If user set VBIOS, the new value is saved to EFI variable. @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. @param Action Specifies the type of action taken by the browser. @param QuestionId A unique value which is sent to the original exporting driver so that it can identify the type of data to expect. @param Type The type of value for the question. @param Value A pointer to the data being sent to the original exporting driver. @param ActionRequest On return, points to the action requested by the callback function. @retval EFI_SUCCESS The callback successfully handled the action. @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters. **/ EFI_STATUS EFIAPI DeviceManagerCallback ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 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 ) { UINTN CurIndex; if (Action != EFI_BROWSER_ACTION_CHANGING) { // // Do nothing for other UEFI Action. Only do call back when data is changed. // return EFI_UNSUPPORTED; } if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } if ((QuestionId < MAX_KEY_SECTION_LEN + NETWORK_DEVICE_LIST_KEY_OFFSET) && (QuestionId >= NETWORK_DEVICE_LIST_KEY_OFFSET)) { // // If user select the mac address, need to record mac address string to support next form show. // for (CurIndex = 0; CurIndex < mMacDeviceList.CurListLen; CurIndex ++) { if (mMacDeviceList.NodeList[CurIndex].QuestionId == QuestionId) { mSelectedMacAddrString = HiiGetString (gDeviceManagerPrivate.HiiHandle, mMacDeviceList.NodeList[CurIndex].PromptId, NULL); } } CreateDeviceManagerForm(NETWORK_DEVICE_FORM_ID); } else if(QuestionId == QUESTION_NETWORK_DEVICE_ID){ CreateDeviceManagerForm(NETWORK_DEVICE_LIST_FORM_ID); } return EFI_SUCCESS; }
/** Install Boot Manager Menu driver. @param ImageHandle The image handle. @param SystemTable The system table. @retval EFI_SUCEESS Install Boot manager menu success. @retval Other Return error status. **/ EFI_STATUS EFIAPI DeviceManagerUiLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; gDeviceManagerPrivate.DriverHandle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &gDeviceManagerPrivate.DriverHandle, &gEfiDevicePathProtocolGuid, &mDeviceManagerHiiVendorDevicePath, &gEfiHiiConfigAccessProtocolGuid, &gDeviceManagerPrivate.ConfigAccess, NULL ); ASSERT_EFI_ERROR (Status); // // Publish our HII data. // gDeviceManagerPrivate.HiiHandle = HiiAddPackages ( &mDeviceManagerGuid, gDeviceManagerPrivate.DriverHandle, DeviceManagerVfrBin, DeviceManagerUiLibStrings, NULL ); ASSERT (gDeviceManagerPrivate.HiiHandle != NULL); // // Update boot manager page // CreateDeviceManagerForm (DEVICE_MANAGER_FORM_ID); return EFI_SUCCESS; }
/** This function processes the results of changes in configuration. @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. @param Action Specifies the type of action taken by the browser. @param QuestionId A unique value which is sent to the original exporting driver so that it can identify the type of data to expect. @param Type The type of value for the question. @param Value A pointer to the data being sent to the original exporting driver. @param ActionRequest On return, points to the action requested by the callback function. @retval EFI_SUCCESS The callback successfully handled the action. @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. @retval EFI_DEVICE_ERROR The variable could not be saved. @retval EFI_UNSUPPORTED The specified Action is not supported by the callback. **/ EFI_STATUS EFIAPI FrontPageCallback ( IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, 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 ) { CHAR8 *LangCode; CHAR8 *Lang; UINTN Index; EFI_STATUS Status; // //Chech whether exit from BMM and reenter frontpage,if yes,reclaim string depositories // if (Action == EFI_BROWSER_ACTION_FORM_OPEN){ if (mEnterBmm){ ReclaimStringDepository(); mEnterBmm = FALSE; } } if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) { // // Do nothing for other UEFI Action. Only do call back when data is changed. // return EFI_UNSUPPORTED; } if (Action == EFI_BROWSER_ACTION_CHANGED) { if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } switch (QuestionId) { case FRONT_PAGE_KEY_CONTINUE: // // This is the continue - clear the screen and return an error to get out of FrontPage loop // *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; break; case FRONT_PAGE_KEY_LANGUAGE: // // Allocate working buffer for RFC 4646 language in supported LanguageString. // Lang = AllocatePool (AsciiStrSize (mLanguageString)); ASSERT (Lang != NULL); Index = 0; LangCode = mLanguageString; while (*LangCode != 0) { GetNextLanguage (&LangCode, Lang); if (Index == Value->u8) { break; } Index++; } if (Index == Value->u8) { Status = gRT->SetVariable ( L"PlatformLang", &gEfiGlobalVariableGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, AsciiStrSize (Lang), Lang ); ASSERT_EFI_ERROR(Status); } else { ASSERT (FALSE); } FreePool (Lang); // //Current language of platform is changed,recreate oneof options for language. // InitializeLanguage(); break; default: break; } } else if (Action == EFI_BROWSER_ACTION_CHANGING) { if (Value == NULL) { return EFI_INVALID_PARAMETER; } // // The first 4 entries in the Front Page are to be GUARANTEED to remain constant so IHV's can // describe to their customers in documentation how to find their setup information (namely // under the device manager and specific buckets) // switch (QuestionId) { case FRONT_PAGE_KEY_BOOT_MANAGER: // // Boot Manager // EnumerateBootOptions (); break; case FRONT_PAGE_KEY_DEVICE_MANAGER: // // Device Manager // CreateDeviceManagerForm(DEVICE_MANAGER_FORM_ID); break; case FRONT_PAGE_KEY_BOOT_MAINTAIN: // // Boot Maintenance Manager // InitializeBM (); mEnterBmm = TRUE; break; default: break; } } return EFI_SUCCESS; }