X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelFrameworkModulePkg%2FUniversal%2FBdsDxe%2FBootMaint%2FBootMaint.c;h=d3215a3c866a5a892127bcb292b3614db27e3e4b;hp=e37370d3337b3f7be0ff738db5b1782af3fa2095;hb=847240774030f9da79140a9d515a64ec817eb6eb;hpb=180a5a35cb49699bd249dee19e41cee34c856a58 diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c index e37370d333..d3215a3c86 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c @@ -1,7 +1,7 @@ /** @file The functions for Boot Maintainence Main menu. -Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
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 @@ -38,10 +38,7 @@ HII_VENDOR_DEVICE_PATH mBmmHiiVendorDevicePath = { (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) } }, - // - // {165A028F-0BB2-4b5f-8747-77592E3F6499} - // - { 0x165a028f, 0xbb2, 0x4b5f, { 0x87, 0x47, 0x77, 0x59, 0x2e, 0x3f, 0x64, 0x99 } } + BOOT_MAINT_FORMSET_GUID }, { END_DEVICE_PATH_TYPE, @@ -63,10 +60,7 @@ HII_VENDOR_DEVICE_PATH mFeHiiVendorDevicePath = { (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) } }, - // - // {91DB4238-B0C8-472e-BBCF-F3A6541010F4} - // - { 0x91db4238, 0xb0c8, 0x472e, { 0xbb, 0xcf, 0xf3, 0xa6, 0x54, 0x10, 0x10, 0xf4 } } + FILE_EXPLORE_FORMSET_GUID }, { END_DEVICE_PATH_TYPE, @@ -78,10 +72,6 @@ HII_VENDOR_DEVICE_PATH mFeHiiVendorDevicePath = { } }; -EFI_GUID EfiLegacyDevOrderGuid = EFI_LEGACY_DEV_ORDER_VARIABLE_GUID; -EFI_GUID mBootMaintGuid = BOOT_MAINT_FORMSET_GUID; -EFI_GUID mFileExplorerGuid = FILE_EXPLORE_FORMSET_GUID; - CHAR16 mBootMaintStorageName[] = L"BmmData"; CHAR16 mFileExplorerStorageName[] = L"FeData"; @@ -194,7 +184,7 @@ BootMaintExtractConfig ( } *Progress = Request; - if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &mBootMaintGuid, mBootMaintStorageName)) { + if ((Request != NULL) && !HiiIsConfigHdrMatch (Request, &gBootMaintFormSetGuid, mBootMaintStorageName)) { return EFI_NOT_FOUND; } @@ -215,7 +205,7 @@ BootMaintExtractConfig ( // Allocate and fill a buffer large enough to hold the template // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator // - ConfigRequestHdr = HiiConstructConfigHdr (&mBootMaintGuid, mBootMaintStorageName, Private->BmmDriverHandle); + ConfigRequestHdr = HiiConstructConfigHdr (&gBootMaintFormSetGuid, mBootMaintStorageName, Private->BmmDriverHandle); Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16); ConfigRequest = AllocateZeroPool (Size); ASSERT (ConfigRequest != NULL); @@ -296,341 +286,341 @@ BootMaintCallback ( UINT8 *NewLegacyDev; UINT8 *DisMap; EFI_FORM_ID FormId; - - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; - } - - OldValue = 0; - NewValue = 0; - Number = 0; - OldLegacyDev = NULL; - NewLegacyDev = NULL; - NewValuePos = 0; - DisMap = NULL; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE; - - Private = BMM_CALLBACK_DATA_FROM_THIS (This); - UpdatePageId (Private, QuestionId); + if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) { + // + // All other action return unsupported. + // + return EFI_UNSUPPORTED; + } + + Status = EFI_SUCCESS; + OldValue = 0; + NewValue = 0; + Number = 0; + OldLegacyDev = NULL; + NewLegacyDev = NULL; + NewValuePos = 0; + DisMap = NULL; + + Private = BMM_CALLBACK_DATA_FROM_THIS (This); // // Retrive uncommitted data from Form Browser // CurrentFakeNVMap = &Private->BmmFakeNvData; - HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap); - - // - // need to be subtituded. - // - // Update Select FD/HD/CD/NET/BEV Order Form - // - if (FORM_SET_FD_ORDER_ID == Private->BmmPreviousPageId || - FORM_SET_HD_ORDER_ID == Private->BmmPreviousPageId || - FORM_SET_CD_ORDER_ID == Private->BmmPreviousPageId || - FORM_SET_NET_ORDER_ID == Private->BmmPreviousPageId || - FORM_SET_BEV_ORDER_ID == Private->BmmPreviousPageId || - ((FORM_BOOT_SETUP_ID == Private->BmmPreviousPageId) && - (QuestionId >= LEGACY_FD_QUESTION_ID) && - (QuestionId < (LEGACY_BEV_QUESTION_ID + 100)) ) - ) { - - DisMap = Private->BmmOldFakeNVData.DisableMap; - - FormId = Private->BmmPreviousPageId; - if (FormId == FORM_BOOT_SETUP_ID) { - FormId = Private->BmmCurrentPageId; + HiiGetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap); + if (Action == EFI_BROWSER_ACTION_CHANGING) { + if (Value == NULL) { + return EFI_INVALID_PARAMETER; } + + UpdatePageId (Private, QuestionId); - switch (FormId) { - case FORM_SET_FD_ORDER_ID: - Number = (UINT16) LegacyFDMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD; - NewLegacyDev = CurrentFakeNVMap->LegacyFD; - break; + // + // need to be subtituded. + // + // Update Select FD/HD/CD/NET/BEV Order Form + // + if (FORM_SET_FD_ORDER_ID == Private->BmmPreviousPageId || + FORM_SET_HD_ORDER_ID == Private->BmmPreviousPageId || + FORM_SET_CD_ORDER_ID == Private->BmmPreviousPageId || + FORM_SET_NET_ORDER_ID == Private->BmmPreviousPageId || + FORM_SET_BEV_ORDER_ID == Private->BmmPreviousPageId || + ((FORM_BOOT_SETUP_ID == Private->BmmPreviousPageId) && + (QuestionId >= LEGACY_FD_QUESTION_ID) && + (QuestionId < (LEGACY_BEV_QUESTION_ID + 100)) ) + ) { + + DisMap = Private->BmmOldFakeNVData.DisableMap; + + FormId = Private->BmmPreviousPageId; + if (FormId == FORM_BOOT_SETUP_ID) { + FormId = Private->BmmCurrentPageId; + } - case FORM_SET_HD_ORDER_ID: - Number = (UINT16) LegacyHDMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD; - NewLegacyDev = CurrentFakeNVMap->LegacyHD; - break; + switch (FormId) { + case FORM_SET_FD_ORDER_ID: + Number = (UINT16) LegacyFDMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD; + NewLegacyDev = CurrentFakeNVMap->LegacyFD; + break; - case FORM_SET_CD_ORDER_ID: - Number = (UINT16) LegacyCDMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD; - NewLegacyDev = CurrentFakeNVMap->LegacyCD; - break; + case FORM_SET_HD_ORDER_ID: + Number = (UINT16) LegacyHDMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD; + NewLegacyDev = CurrentFakeNVMap->LegacyHD; + break; - case FORM_SET_NET_ORDER_ID: - Number = (UINT16) LegacyNETMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET; - NewLegacyDev = CurrentFakeNVMap->LegacyNET; - break; + case FORM_SET_CD_ORDER_ID: + Number = (UINT16) LegacyCDMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD; + NewLegacyDev = CurrentFakeNVMap->LegacyCD; + break; - case FORM_SET_BEV_ORDER_ID: - Number = (UINT16) LegacyBEVMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV; - NewLegacyDev = CurrentFakeNVMap->LegacyBEV; - break; + case FORM_SET_NET_ORDER_ID: + Number = (UINT16) LegacyNETMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET; + NewLegacyDev = CurrentFakeNVMap->LegacyNET; + break; - default: - break; - } - // - // First, find the different position - // if there is change, it should be only one - // - for (Index = 0; Index < Number; Index++) { - if (OldLegacyDev[Index] != NewLegacyDev[Index]) { - OldValue = OldLegacyDev[Index]; - NewValue = NewLegacyDev[Index]; + case FORM_SET_BEV_ORDER_ID: + Number = (UINT16) LegacyBEVMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV; + NewLegacyDev = CurrentFakeNVMap->LegacyBEV; break; - } - } - if (Index != Number) { + default: + break; + } // - // there is change, now process + // First, find the different position + // if there is change, it should be only one // - if (0xFF == NewValue) { + for (Index = 0; Index < Number; Index++) { + if (OldLegacyDev[Index] != NewLegacyDev[Index]) { + OldValue = OldLegacyDev[Index]; + NewValue = NewLegacyDev[Index]; + break; + } + } + + if (Index != Number) { // - // This item will be disable - // Just move the items behind this forward to overlap it + // there is change, now process // - Pos = OldValue / 8; - Bit = 7 - (OldValue % 8); - DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit)); - for (Index2 = Index; Index2 < Number - 1; Index2++) { - NewLegacyDev[Index2] = NewLegacyDev[Index2 + 1]; - } + if (0xFF == NewValue) { + // + // This item will be disable + // Just move the items behind this forward to overlap it + // + Pos = OldValue / 8; + Bit = 7 - (OldValue % 8); + DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit)); + for (Index2 = Index; Index2 < Number - 1; Index2++) { + NewLegacyDev[Index2] = NewLegacyDev[Index2 + 1]; + } - NewLegacyDev[Index2] = 0xFF; - } else { - for (Index2 = 0; Index2 < Number; Index2++) { - if (Index2 == Index) { - continue; + NewLegacyDev[Index2] = 0xFF; + } else { + for (Index2 = 0; Index2 < Number; Index2++) { + if (Index2 == Index) { + continue; + } + + if (OldLegacyDev[Index2] == NewValue) { + // + // If NewValue is in OldLegacyDev array + // remember its old position + // + NewValuePos = Index2; + break; + } } - if (OldLegacyDev[Index2] == NewValue) { + if (Index2 != Number) { // - // If NewValue is in OldLegacyDev array - // remember its old position + // We will change current item to an existing item + // (It's hard to describe here, please read code, it's like a cycle-moving) // - NewValuePos = Index2; - break; - } - } - - if (Index2 != Number) { - // - // We will change current item to an existing item - // (It's hard to describe here, please read code, it's like a cycle-moving) - // - for (Index2 = NewValuePos; Index2 != Index;) { - if (NewValuePos < Index) { - NewLegacyDev[Index2] = OldLegacyDev[Index2 + 1]; - Index2++; - } else { - NewLegacyDev[Index2] = OldLegacyDev[Index2 - 1]; - Index2--; + for (Index2 = NewValuePos; Index2 != Index;) { + if (NewValuePos < Index) { + NewLegacyDev[Index2] = OldLegacyDev[Index2 + 1]; + Index2++; + } else { + NewLegacyDev[Index2] = OldLegacyDev[Index2 - 1]; + Index2--; + } } - } - } else { - // - // If NewValue is not in OldlegacyDev array, we are changing to a disabled item - // so we should modify DisMap to reflect the change - // - Pos = NewValue / 8; - Bit = 7 - (NewValue % 8); - DisMap[Pos] = (UINT8) (DisMap[Pos] & (~ (UINT8) (1 << Bit))); - if (0xFF != OldValue) { + } else { // - // Because NewValue is a item that was disabled before - // so after changing the OldValue should be disabled - // actually we are doing a swap of enable-disable states of two items + // If NewValue is not in OldlegacyDev array, we are changing to a disabled item + // so we should modify DisMap to reflect the change // - Pos = OldValue / 8; - Bit = 7 - (OldValue % 8); - DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit)); + Pos = NewValue / 8; + Bit = 7 - (NewValue % 8); + DisMap[Pos] = (UINT8) (DisMap[Pos] & (~ (UINT8) (1 << Bit))); + if (0xFF != OldValue) { + // + // Because NewValue is a item that was disabled before + // so after changing the OldValue should be disabled + // actually we are doing a swap of enable-disable states of two items + // + Pos = OldValue / 8; + Bit = 7 - (OldValue % 8); + DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit)); + } } } - } - // - // To prevent DISABLE appears in the middle of the list - // we should perform a re-ordering - // - Index = 0; - while (Index < Number) { - if (0xFF != NewLegacyDev[Index]) { - Index++; - continue; - } - - Index2 = Index; - Index2++; - while (Index2 < Number) { - if (0xFF != NewLegacyDev[Index2]) { - break; + // + // To prevent DISABLE appears in the middle of the list + // we should perform a re-ordering + // + Index = 0; + while (Index < Number) { + if (0xFF != NewLegacyDev[Index]) { + Index++; + continue; } + Index2 = Index; Index2++; - } + while (Index2 < Number) { + if (0xFF != NewLegacyDev[Index2]) { + break; + } - if (Index2 < Number) { - NewLegacyDev[Index] = NewLegacyDev[Index2]; - NewLegacyDev[Index2] = 0xFF; + Index2++; + } + + if (Index2 < Number) { + NewLegacyDev[Index] = NewLegacyDev[Index2]; + NewLegacyDev[Index2] = 0xFF; + } + + Index++; } - Index++; + CopyMem ( + OldLegacyDev, + NewLegacyDev, + Number + ); } - - CopyMem ( - OldLegacyDev, - NewLegacyDev, - Number - ); } - } - - if (QuestionId < FILE_OPTION_OFFSET) { - if (QuestionId < CONFIG_OPTION_OFFSET) { - switch (QuestionId) { - case KEY_VALUE_BOOT_FROM_FILE: - Private->FeCurrentState = FileExplorerStateBootFromFile; - - // - // Exit Bmm main formset to send File Explorer formset. - // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - break; - - case FORM_BOOT_ADD_ID: - Private->FeCurrentState = FileExplorerStateAddBootOption; - - // - // Exit Bmm main formset to send File Explorer formset. - // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - break; - - case FORM_DRV_ADD_FILE_ID: - Private->FeCurrentState = FileExplorerStateAddDriverOptionState; - - // - // Exit Bmm main formset to send File Explorer formset. - // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - break; - - case FORM_DRV_ADD_HANDLE_ID: - CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private); - UpdateDrvAddHandlePage (Private); - break; - - case FORM_BOOT_DEL_ID: - CleanUpPage (FORM_BOOT_DEL_ID, Private); - UpdateBootDelPage (Private); - break; - - case FORM_BOOT_CHG_ID: - case FORM_DRV_CHG_ID: - UpdatePageBody (QuestionId, Private); - break; - - case FORM_DRV_DEL_ID: - CleanUpPage (FORM_DRV_DEL_ID, Private); - UpdateDrvDelPage (Private); - break; - case FORM_BOOT_NEXT_ID: - CleanUpPage (FORM_BOOT_NEXT_ID, Private); - UpdateBootNextPage (Private); - break; + if (QuestionId < FILE_OPTION_OFFSET) { + if (QuestionId < CONFIG_OPTION_OFFSET) { + switch (QuestionId) { + case KEY_VALUE_BOOT_FROM_FILE: + Private->FeCurrentState = FileExplorerStateBootFromFile; + break; + + case FORM_BOOT_ADD_ID: + Private->FeCurrentState = FileExplorerStateAddBootOption; + break; + + case FORM_DRV_ADD_FILE_ID: + Private->FeCurrentState = FileExplorerStateAddDriverOptionState; + break; + + case FORM_DRV_ADD_HANDLE_ID: + CleanUpPage (FORM_DRV_ADD_HANDLE_ID, Private); + UpdateDrvAddHandlePage (Private); + break; + + case FORM_BOOT_DEL_ID: + CleanUpPage (FORM_BOOT_DEL_ID, Private); + UpdateBootDelPage (Private); + break; + + case FORM_BOOT_CHG_ID: + case FORM_DRV_CHG_ID: + UpdatePageBody (QuestionId, Private); + break; + + case FORM_DRV_DEL_ID: + CleanUpPage (FORM_DRV_DEL_ID, Private); + UpdateDrvDelPage (Private); + break; + + case FORM_BOOT_NEXT_ID: + CleanUpPage (FORM_BOOT_NEXT_ID, Private); + UpdateBootNextPage (Private); + break; + + case FORM_TIME_OUT_ID: + CleanUpPage (FORM_TIME_OUT_ID, Private); + UpdateTimeOutPage (Private); + break; + + case FORM_CON_IN_ID: + case FORM_CON_OUT_ID: + case FORM_CON_ERR_ID: + UpdatePageBody (QuestionId, Private); + break; + + case FORM_CON_MODE_ID: + CleanUpPage (FORM_CON_MODE_ID, Private); + UpdateConModePage (Private); + break; + + case FORM_CON_COM_ID: + CleanUpPage (FORM_CON_COM_ID, Private); + UpdateConCOMPage (Private); + break; + + case FORM_SET_FD_ORDER_ID: + case FORM_SET_HD_ORDER_ID: + case FORM_SET_CD_ORDER_ID: + case FORM_SET_NET_ORDER_ID: + case FORM_SET_BEV_ORDER_ID: + CleanUpPage (QuestionId, Private); + UpdateSetLegacyDeviceOrderPage (QuestionId, Private); + break; + + default: + break; + } + } else if ((QuestionId >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) { + Index2 = (UINT16) (QuestionId - TERMINAL_OPTION_OFFSET); + Private->CurrentTerminal = Index2; - case FORM_TIME_OUT_ID: - CleanUpPage (FORM_TIME_OUT_ID, Private); - UpdateTimeOutPage (Private); - break; + CleanUpPage (FORM_CON_COM_SETUP_ID, Private); + UpdateTerminalPage (Private); - case FORM_RESET: - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - return EFI_UNSUPPORTED; + } else if (QuestionId >= HANDLE_OPTION_OFFSET) { + Index2 = (UINT16) (QuestionId - HANDLE_OPTION_OFFSET); - case FORM_CON_IN_ID: - case FORM_CON_OUT_ID: - case FORM_CON_ERR_ID: - UpdatePageBody (QuestionId, Private); - break; + NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index2); + ASSERT (NewMenuEntry != NULL); + Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext; - case FORM_CON_MODE_ID: - CleanUpPage (FORM_CON_MODE_ID, Private); - UpdateConModePage (Private); - break; - - case FORM_CON_COM_ID: - CleanUpPage (FORM_CON_COM_ID, Private); - UpdateConCOMPage (Private); - break; - - case FORM_SET_FD_ORDER_ID: - case FORM_SET_HD_ORDER_ID: - case FORM_SET_CD_ORDER_ID: - case FORM_SET_NET_ORDER_ID: - case FORM_SET_BEV_ORDER_ID: - CleanUpPage (QuestionId, Private); - UpdateSetLegacyDeviceOrderPage (QuestionId, Private); - break; + CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private); - case KEY_VALUE_SAVE_AND_EXIT: - case KEY_VALUE_NO_SAVE_AND_EXIT: + Private->MenuEntry = NewMenuEntry; + Private->LoadContext->FilePathList = Private->HandleContext->DevicePath; - if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) { - Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId); - if (EFI_ERROR (Status)) { - return Status; - } - } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { - DiscardChangeHandler (Private, CurrentFakeNVMap); + UpdateDriverAddHandleDescPage (Private); + } + } + } else if (Action == EFI_BROWSER_ACTION_CHANGED) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } + + switch (QuestionId) { + case KEY_VALUE_SAVE_AND_EXIT: + case KEY_VALUE_NO_SAVE_AND_EXIT: + if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) { + Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId); + if (EFI_ERROR (Status)) { + return Status; } - - // - // Tell browser not to ask for confirmation of changes, - // since we have already applied or discarded. - // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; - break; - - default: - break; + } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { + DiscardChangeHandler (Private, CurrentFakeNVMap); } - } else if ((QuestionId >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) { - Index2 = (UINT16) (QuestionId - TERMINAL_OPTION_OFFSET); - Private->CurrentTerminal = Index2; - - CleanUpPage (FORM_CON_COM_SETUP_ID, Private); - UpdateTerminalPage (Private); - } else if (QuestionId >= HANDLE_OPTION_OFFSET) { - Index2 = (UINT16) (QuestionId - HANDLE_OPTION_OFFSET); - - NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index2); - ASSERT (NewMenuEntry != NULL); - Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext; - - CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private); + // + // Tell browser not to ask for confirmation of changes, + // since we have already applied or discarded. + // + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; + break; - Private->MenuEntry = NewMenuEntry; - Private->LoadContext->FilePathList = Private->HandleContext->DevicePath; + case FORM_RESET: + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + return EFI_UNSUPPORTED; - UpdateDriverAddHandleDescPage (Private); + default: + break; } } // // Pass changed uncommitted data back to Form Browser // - Status = HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL); - - return Status; + HiiSetBrowserData (&gBootMaintFormSetGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL); + return EFI_SUCCESS; } /** @@ -671,11 +661,11 @@ ApplyChangeHandler ( case FORM_BOOT_DEL_ID: for (Index = 0; - ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (UINT8)))); + ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])))); Index ++) { NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index); NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; - NewLoadContext->Deleted = CurrentFakeNVMap->BootOptionDel[Index]; + NewLoadContext->Deleted = CurrentFakeNVMap->OptionDel[Index]; } Var_DelBootOption (); @@ -683,11 +673,11 @@ ApplyChangeHandler ( case FORM_DRV_DEL_ID: for (Index = 0; - ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (UINT8)))); + ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])))); Index++) { NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index); NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; - NewLoadContext->Deleted = CurrentFakeNVMap->DriverOptionDel[Index]; + NewLoadContext->Deleted = CurrentFakeNVMap->OptionDel[Index]; } Var_DelDriverOption (); @@ -735,9 +725,10 @@ ApplyChangeHandler ( ASSERT (CurrentFakeNVMap->COMParity < (sizeof (ParityList) / sizeof (ParityList[0]))); NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value; NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType; + NewTerminalContext->FlowControl = CurrentFakeNVMap->COMFlowControl; ChangeTerminalDevicePath ( - NewTerminalContext->DevicePath, + &(NewTerminalContext->DevicePath), FALSE ); @@ -750,14 +741,14 @@ ApplyChangeHandler ( for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index); NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; - ASSERT (Index < MAX_MENU_NUMBER); + ASSERT (Index < MAX_MENU_NUMBER); NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index]; } for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index); NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; - ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER); + ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER); NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber]; } @@ -768,14 +759,14 @@ ApplyChangeHandler ( for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index); NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; - ASSERT (Index < MAX_MENU_NUMBER); + ASSERT (Index < MAX_MENU_NUMBER); NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index]; } for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index); NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; - ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER); + ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER); NewTerminalContext->IsConOut = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber]; } @@ -786,14 +777,14 @@ ApplyChangeHandler ( for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index); NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; - ASSERT (Index < MAX_MENU_NUMBER); + ASSERT (Index < MAX_MENU_NUMBER); NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index]; } for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) { NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index); NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; - ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER); + ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER); NewTerminalContext->IsStdErr = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber]; } @@ -843,20 +834,20 @@ DiscardChangeHandler ( switch (Private->BmmPreviousPageId) { case FORM_BOOT_CHG_ID: case FORM_DRV_CHG_ID: - CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, 100); + CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, sizeof (CurrentFakeNVMap->OptionOrder)); break; case FORM_BOOT_DEL_ID: - ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0]))); + ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0]))); for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { - CurrentFakeNVMap->BootOptionDel[Index] = 0x00; + CurrentFakeNVMap->OptionDel[Index] = FALSE; } break; case FORM_DRV_DEL_ID: - ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0]))); + ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0]))); for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) { - CurrentFakeNVMap->DriverOptionDel[Index] = 0x00; + CurrentFakeNVMap->OptionDel[Index] = FALSE; } break; @@ -977,7 +968,7 @@ InitializeBM ( // Post our Boot Maint VFR binary to the HII database. // BmmCallbackInfo->BmmHiiHandle = HiiAddPackages ( - &mBootMaintGuid, + &gBootMaintFormSetGuid, BmmCallbackInfo->BmmDriverHandle, BmBin, BdsDxeStrings, @@ -989,7 +980,7 @@ InitializeBM ( // Post our File Explorer VFR binary to the HII database. // BmmCallbackInfo->FeHiiHandle = HiiAddPackages ( - &mFileExplorerGuid, + &gFileExploreFormSetGuid, BmmCallbackInfo->FeDriverHandle, FEBin, BdsDxeStrings, @@ -1101,7 +1092,7 @@ InitializeBM ( HiiUpdateForm ( BmmCallbackInfo->BmmHiiHandle, - &mBootMaintGuid, + &gBootMaintFormSetGuid, FORM_BOOT_SETUP_ID, mStartOpCodeHandle, // Label FORM_BOOT_LEGACY_DEVICE_ID mEndOpCodeHandle // LABEL_END @@ -1391,7 +1382,7 @@ FormSetDispatcher ( gFormBrowser2, &CallbackData->BmmHiiHandle, 1, - &mBootMaintGuid, + &gBootMaintFormSetGuid, 0, NULL, &ActionRequest @@ -1413,7 +1404,7 @@ FormSetDispatcher ( gFormBrowser2, &CallbackData->FeHiiHandle, 1, - &mFileExplorerGuid, + &gFileExploreFormSetGuid, 0, NULL, &ActionRequest