/** Create dynamic code for BMM and initialize all of BMM configuration data in BmmFakeNvData and BmmOldFakeNVData member in BMM context data. @param CallbackData The BMM context data. **/ VOID InitializeBmmConfig ( IN BMM_CALLBACK_DATA *CallbackData ) { BM_MENU_ENTRY *NewMenuEntry; BM_LOAD_CONTEXT *NewLoadContext; UINT16 Index; ASSERT (CallbackData != NULL); // // Initialize data which located in BMM main page // CallbackData->BmmFakeNvData.BootNext = NONE_BOOTNEXT_VALUE; for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index); NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; if (NewLoadContext->IsBootNext) { CallbackData->BmmFakeNvData.BootNext = Index; break; } } CallbackData->BmmFakeNvData.BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut); // // Initialize data which located in Boot Options Menu // GetBootOrder (CallbackData); // // Initialize data which located in Driver Options Menu // GetDriverOrder (CallbackData); // // Initialize data which located in Console Options Menu // GetConsoleOutMode (CallbackData); GetConsoleInCheck (CallbackData); GetConsoleOutCheck (CallbackData); GetConsoleErrCheck (CallbackData); GetTerminalAttribute (CallbackData); CallbackData->BmmFakeNvData.ForceReconnect = TRUE; // // Update the menus. // CustomizeMenus (); // // Backup Initialize BMM configuartion data to BmmOldFakeNVData // CopyMem (&CallbackData->BmmOldFakeNVData, &CallbackData->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA)); }
/** Update the page's NV Map if user has changed the order a list. This list can be Boot Order or Driver Order. @param UpdatePageId The form ID to be updated. @param OptionMenu The new list. @param CallbackData The BMM context data. **/ VOID UpdateOrderPage ( IN UINT16 UpdatePageId, IN BM_MENU_OPTION *OptionMenu, IN BMM_CALLBACK_DATA *CallbackData ) { BM_MENU_ENTRY *NewMenuEntry; UINT16 Index; UINT16 OptionIndex; VOID *OptionsOpCodeHandle; BM_LOAD_CONTEXT *NewLoadContext; BOOLEAN BootOptionFound; UINT32 *OptionOrder; EFI_QUESTION_ID QuestionId; UINT16 VarOffset; UpdatePageStart (CallbackData); CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu); OptionOrder = NULL; QuestionId = 0; VarOffset = 0; switch (UpdatePageId) { case FORM_BOOT_CHG_ID: GetBootOrder (CallbackData); OptionOrder = CallbackData->BmmFakeNvData.BootOptionOrder; QuestionId = BOOT_OPTION_ORDER_QUESTION_ID; VarOffset = BOOT_OPTION_ORDER_VAR_OFFSET; break; case FORM_DRV_CHG_ID: GetDriverOrder (CallbackData); OptionOrder = CallbackData->BmmFakeNvData.DriverOptionOrder; QuestionId = DRIVER_OPTION_ORDER_QUESTION_ID; VarOffset = DRIVER_OPTION_ORDER_VAR_OFFSET; break; } ASSERT (OptionOrder != NULL); OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (OptionsOpCodeHandle != NULL); NewMenuEntry = NULL; for (OptionIndex = 0; (OptionOrder[OptionIndex] != 0 && OptionIndex < MAX_MENU_NUMBER); OptionIndex++) { BootOptionFound = FALSE; for (Index = 0; Index < OptionMenu->MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index); NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; if ((UINT32) (NewMenuEntry->OptionNumber + 1) == OptionOrder[OptionIndex]) { BootOptionFound = TRUE; break; } } if (BootOptionFound) { HiiCreateOneOfOptionOpCode ( OptionsOpCodeHandle, NewMenuEntry->DisplayStringToken, 0, EFI_IFR_TYPE_NUM_SIZE_32, OptionOrder[OptionIndex] ); } } if (OptionMenu->MenuNumber > 0) { HiiCreateOrderedListOpCode ( mStartOpCodeHandle, // Container for dynamic created opcodes QuestionId, // Question ID VARSTORE_ID_BOOT_MAINT, // VarStore ID VarOffset, // Offset in Buffer Storage STRING_TOKEN (STR_CHANGE_ORDER), // Question prompt text STRING_TOKEN (STR_CHANGE_ORDER), // Question help text 0, // Question flag 0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question value 100, // Maximum container OptionsOpCodeHandle, // Option Opcode list NULL // Default Opcode is NULL ); } HiiFreeOpCodeHandle (OptionsOpCodeHandle); UpdatePageEnd (CallbackData); }
/** Update the page's NV Map if user has changed the order a list. This list can be Boot Order or Driver Order. @param UpdatePageId The form ID to be updated. @param OptionMenu The new list. @param CallbackData The BMM context data. **/ VOID UpdateOrderPage ( IN UINT16 UpdatePageId, IN BM_MENU_OPTION *OptionMenu, IN BMM_CALLBACK_DATA *CallbackData ) { BM_MENU_ENTRY *NewMenuEntry; UINT16 Index; UINT16 OptionIndex; VOID *OptionsOpCodeHandle; BOOLEAN BootOptionFound; UINT32 *OptionOrder; EFI_QUESTION_ID QuestionId; UINT16 VarOffset; CallbackData->BmmAskSaveOrNot = TRUE; UpdatePageStart (CallbackData); OptionOrder = NULL; QuestionId = 0; VarOffset = 0; switch (UpdatePageId) { case FORM_BOOT_CHG_ID: // // If the BootOptionOrder in the BmmFakeNvData are same with the date in the BmmOldFakeNVData, // means all Boot Options has been save in BootOptionMenu, we can get the date from the menu. // else means browser maintains some uncommitted date which are not saved in BootOptionMenu, // so we should not get the data from BootOptionMenu to show it. // if (CompareMem (CallbackData->BmmFakeNvData.BootOptionOrder, CallbackData->BmmOldFakeNVData.BootOptionOrder, sizeof (CallbackData->BmmFakeNvData.BootOptionOrder)) == 0) { GetBootOrder (CallbackData); } OptionOrder = CallbackData->BmmFakeNvData.BootOptionOrder; QuestionId = BOOT_OPTION_ORDER_QUESTION_ID; VarOffset = BOOT_OPTION_ORDER_VAR_OFFSET; break; case FORM_DRV_CHG_ID: // // If the DriverOptionOrder in the BmmFakeNvData are same with the date in the BmmOldFakeNVData, // means all Driver Options has been save in DriverOptionMenu, we can get the DriverOptionOrder from the menu. // else means browser maintains some uncommitted date which are not saved in DriverOptionMenu, // so we should not get the data from DriverOptionMenu to show it. // if (CompareMem (CallbackData->BmmFakeNvData.DriverOptionOrder, CallbackData->BmmOldFakeNVData.DriverOptionOrder, sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder)) == 0) { GetDriverOrder (CallbackData); } OptionOrder = CallbackData->BmmFakeNvData.DriverOptionOrder; QuestionId = DRIVER_OPTION_ORDER_QUESTION_ID; VarOffset = DRIVER_OPTION_ORDER_VAR_OFFSET; break; } ASSERT (OptionOrder != NULL); OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); ASSERT (OptionsOpCodeHandle != NULL); NewMenuEntry = NULL; for (OptionIndex = 0; (OptionOrder[OptionIndex] != 0 && OptionIndex < MAX_MENU_NUMBER); OptionIndex++) { BootOptionFound = FALSE; for (Index = 0; Index < OptionMenu->MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index); if ((UINT32) (NewMenuEntry->OptionNumber + 1) == OptionOrder[OptionIndex]) { BootOptionFound = TRUE; break; } } if (BootOptionFound) { HiiCreateOneOfOptionOpCode ( OptionsOpCodeHandle, NewMenuEntry->DisplayStringToken, 0, EFI_IFR_TYPE_NUM_SIZE_32, OptionOrder[OptionIndex] ); } } if (OptionMenu->MenuNumber > 0) { HiiCreateOrderedListOpCode ( mStartOpCodeHandle, // Container for dynamic created opcodes QuestionId, // Question ID VARSTORE_ID_BOOT_MAINT, // VarStore ID VarOffset, // Offset in Buffer Storage STRING_TOKEN (STR_CHANGE_ORDER), // Question prompt text STRING_TOKEN (STR_CHANGE_ORDER), // Question help text 0, // Question flag 0, // Ordered list flag, e.g. EFI_IFR_UNIQUE_SET EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question value 100, // Maximum container OptionsOpCodeHandle, // Option Opcode list NULL // Default Opcode is NULL ); } HiiFreeOpCodeHandle (OptionsOpCodeHandle); UpdatePageEnd (CallbackData); }