From d88f86f154ddbe39355fcf0aca03438f219b2660 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Fri, 20 May 2011 01:33:42 +0000 Subject: [PATCH] Refine all R9 call back function to return EFI_UNSUPPORTED for all unsupported call back type. Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11681 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/BdsDxe/BootMaint/BootMaint.c | 574 +++++++++--------- .../Universal/BdsDxe/BootMaint/FileExplorer.c | 117 ++-- .../Universal/BdsDxe/BootMngr/BootManager.c | 60 +- .../BdsDxe/DeviceMngr/DeviceManager.c | 69 ++- .../Universal/BdsDxe/FrontPage.c | 188 +++--- 5 files changed, 503 insertions(+), 505 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c index 2cddb519df..ed2564998f 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c @@ -296,348 +296,348 @@ BootMaintCallback ( UINT8 *NewLegacyDev; UINT8 *DisMap; EFI_FORM_ID FormId; - - if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) { - // - // Do nothing for UEFI OPEN/CLOSE Action - // - return EFI_SUCCESS; - } + Status = EFI_SUCCESS; - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; - } + if (Action == EFI_BROWSER_ACTION_CHANGING) { + 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; + 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); + Private = BMM_CALLBACK_DATA_FROM_THIS (This); + UpdatePageId (Private, QuestionId); - // - // Retrive uncommitted data from Form Browser - // - CurrentFakeNVMap = &Private->BmmFakeNvData; - HiiGetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap); + // + // 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; - } + // + // 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; + } - switch (FormId) { - case FORM_SET_FD_ORDER_ID: - Number = (UINT16) LegacyFDMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD; - NewLegacyDev = CurrentFakeNVMap->LegacyFD; - break; + switch (FormId) { + case FORM_SET_FD_ORDER_ID: + Number = (UINT16) LegacyFDMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyFD; + NewLegacyDev = CurrentFakeNVMap->LegacyFD; + break; - case FORM_SET_HD_ORDER_ID: - Number = (UINT16) LegacyHDMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD; - NewLegacyDev = CurrentFakeNVMap->LegacyHD; - break; + case FORM_SET_HD_ORDER_ID: + Number = (UINT16) LegacyHDMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyHD; + NewLegacyDev = CurrentFakeNVMap->LegacyHD; + break; - case FORM_SET_CD_ORDER_ID: - Number = (UINT16) LegacyCDMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD; - NewLegacyDev = CurrentFakeNVMap->LegacyCD; - break; + case FORM_SET_CD_ORDER_ID: + Number = (UINT16) LegacyCDMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyCD; + NewLegacyDev = CurrentFakeNVMap->LegacyCD; + break; - case FORM_SET_NET_ORDER_ID: - Number = (UINT16) LegacyNETMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET; - NewLegacyDev = CurrentFakeNVMap->LegacyNET; - break; + case FORM_SET_NET_ORDER_ID: + Number = (UINT16) LegacyNETMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyNET; + NewLegacyDev = CurrentFakeNVMap->LegacyNET; + break; - case FORM_SET_BEV_ORDER_ID: - Number = (UINT16) LegacyBEVMenu.MenuNumber; - OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV; - NewLegacyDev = CurrentFakeNVMap->LegacyBEV; - break; + case FORM_SET_BEV_ORDER_ID: + Number = (UINT16) LegacyBEVMenu.MenuNumber; + OldLegacyDev = Private->BmmOldFakeNVData.LegacyBEV; + NewLegacyDev = CurrentFakeNVMap->LegacyBEV; + 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]; + default: break; } - } - - if (Index != Number) { // - // 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; + if (QuestionId < FILE_OPTION_OFFSET) { + if (QuestionId < CONFIG_OPTION_OFFSET) { + switch (QuestionId) { + case KEY_VALUE_BOOT_FROM_FILE: + Private->FeCurrentState = FileExplorerStateBootFromFile; - 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_RESET: - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - return EFI_UNSUPPORTED; - - 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; + // + // Exit Bmm main formset to send File Explorer formset. + // + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + break; - case FORM_CON_COM_ID: - CleanUpPage (FORM_CON_COM_ID, Private); - UpdateConCOMPage (Private); - break; + case FORM_BOOT_ADD_ID: + Private->FeCurrentState = FileExplorerStateAddBootOption; - 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; + // + // Exit Bmm main formset to send File Explorer formset. + // + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + break; - case KEY_VALUE_SAVE_AND_EXIT: - case KEY_VALUE_NO_SAVE_AND_EXIT: + case FORM_DRV_ADD_FILE_ID: + Private->FeCurrentState = FileExplorerStateAddDriverOptionState; - if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) { - Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId); - if (EFI_ERROR (Status)) { - return Status; + // + // 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; + + case FORM_TIME_OUT_ID: + CleanUpPage (FORM_TIME_OUT_ID, Private); + UpdateTimeOutPage (Private); + break; + + case FORM_RESET: + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + return EFI_UNSUPPORTED; + + 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; + + 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; + } + } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { + DiscardChangeHandler (Private, CurrentFakeNVMap); } - } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { - DiscardChangeHandler (Private, CurrentFakeNVMap); - } - // - // Tell browser not to ask for confirmation of changes, - // since we have already applied or discarded. - // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; - break; + // + // 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 >= TERMINAL_OPTION_OFFSET) && (QuestionId < CONSOLE_OPTION_OFFSET)) { - Index2 = (UINT16) (QuestionId - TERMINAL_OPTION_OFFSET); - Private->CurrentTerminal = Index2; + default: + break; + } + } 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); + CleanUpPage (FORM_CON_COM_SETUP_ID, Private); + UpdateTerminalPage (Private); - } else if (QuestionId >= HANDLE_OPTION_OFFSET) { - Index2 = (UINT16) (QuestionId - HANDLE_OPTION_OFFSET); + } 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; + NewMenuEntry = BOpt_GetMenuEntry (&DriverMenu, Index2); + ASSERT (NewMenuEntry != NULL); + Private->HandleContext = (BM_HANDLE_CONTEXT *) NewMenuEntry->VariableContext; - CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private); + CleanUpPage (FORM_DRV_ADD_HANDLE_DESC_ID, Private); - Private->MenuEntry = NewMenuEntry; - Private->LoadContext->FilePathList = Private->HandleContext->DevicePath; + Private->MenuEntry = NewMenuEntry; + Private->LoadContext->FilePathList = Private->HandleContext->DevicePath; - UpdateDriverAddHandleDescPage (Private); + UpdateDriverAddHandleDescPage (Private); + } } + + // + // Pass changed uncommitted data back to Form Browser + // + Status = HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL); + return Status; } // - // Pass changed uncommitted data back to Form Browser + // All other action return unsupported. // - Status = HiiSetBrowserData (&mBootMaintGuid, mBootMaintStorageName, sizeof (BMM_FAKE_NV_DATA), (UINT8 *) CurrentFakeNVMap, NULL); - - return Status; + return EFI_UNSUPPORTED; } /** diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c index 34b9f956ba..e078a722d8 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c @@ -1,7 +1,7 @@ /** @file File explorer related functions. -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 @@ -249,73 +249,72 @@ FileExplorerCallback ( FILE_EXPLORER_NV_DATA *NvRamMap; EFI_STATUS Status; - if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) { + if (Action == EFI_BROWSER_ACTION_CHANGING) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } + + Status = EFI_SUCCESS; + Private = FE_CALLBACK_DATA_FROM_THIS (This); + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE; + // - // Do nothing for UEFI OPEN/CLOSE Action + // Retrieve uncommitted data from Form Browser // - return EFI_SUCCESS; - } + NvRamMap = &Private->FeFakeNvData; + HiiGetBrowserData (&mFileExplorerGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap); - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; - } - - Status = EFI_SUCCESS; - Private = FE_CALLBACK_DATA_FROM_THIS (This); - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE; + if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) { + // + // Apply changes and exit formset + // + if (FileExplorerStateAddBootOption == Private->FeCurrentState) { + Status = Var_UpdateBootOption (Private, NvRamMap); + if (EFI_ERROR (Status)) { + return Status; + } - // - // Retrieve uncommitted data from Form Browser - // - NvRamMap = &Private->FeFakeNvData; - HiiGetBrowserData (&mFileExplorerGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap); + BOpt_GetBootOptions (Private); + CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu); + } else if (FileExplorerStateAddDriverOptionState == Private->FeCurrentState) { + Status = Var_UpdateDriverOption ( + Private, + Private->FeHiiHandle, + NvRamMap->DescriptionData, + NvRamMap->OptionalData, + NvRamMap->ForceReconnect + ); + if (EFI_ERROR (Status)) { + return Status; + } - if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) { - // - // Apply changes and exit formset - // - if (FileExplorerStateAddBootOption == Private->FeCurrentState) { - Status = Var_UpdateBootOption (Private, NvRamMap); - if (EFI_ERROR (Status)) { - return Status; + BOpt_GetDriverOptions (Private); + CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu); } - BOpt_GetBootOptions (Private); - CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu); - } else if (FileExplorerStateAddDriverOptionState == Private->FeCurrentState) { - Status = Var_UpdateDriverOption ( - Private, - Private->FeHiiHandle, - NvRamMap->DescriptionData, - NvRamMap->OptionalData, - NvRamMap->ForceReconnect - ); - if (EFI_ERROR (Status)) { - return Status; + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) { + // + // Discard changes and exit formset + // + NvRamMap->OptionalData[0] = 0x0000; + NvRamMap->DescriptionData[0] = 0x0000; + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + } else if (QuestionId < FILE_OPTION_OFFSET) { + // + // Exit File Explorer formset + // + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + } else { + if (UpdateFileExplorer (Private, QuestionId)) { + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; } - - BOpt_GetDriverOptions (Private); - CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu); } - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) { - // - // Discard changes and exit formset - // - NvRamMap->OptionalData[0] = 0x0000; - NvRamMap->DescriptionData[0] = 0x0000; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - } else if (QuestionId < FILE_OPTION_OFFSET) { - // - // Exit File Explorer formset - // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - } else { - if (UpdateFileExplorer (Private, QuestionId)) { - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - } + return Status; } - - return Status; + // + // All other action return unsupported. + // + return EFI_UNSUPPORTED; } diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c index bf65ea092b..eddb189900 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c @@ -99,47 +99,47 @@ BootManagerCallback ( LIST_ENTRY *Link; UINT16 KeyCount; - if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) { + if (Action == EFI_BROWSER_ACTION_CHANGING) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } + // - // Do nothing for UEFI OPEN/CLOSE Action + // Initialize the key count // - return EFI_SUCCESS; - } - - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; - } + KeyCount = 0; - // - // Initialize the key count - // - KeyCount = 0; - - for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) { - Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE); + for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) { + Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE); - KeyCount++; + KeyCount++; - gOption = Option; - - // - // Is this device the one chosen? - // - if (KeyCount == QuestionId) { - // - // Assigning the returned Key to a global allows the original routine to know what was chosen - // - mKeyInput = QuestionId; + gOption = Option; // - // Request to exit SendForm(), so that we could boot the selected option + // Is this device the one chosen? // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - break; + if (KeyCount == QuestionId) { + // + // Assigning the returned Key to a global allows the original routine to know what was chosen + // + mKeyInput = QuestionId; + + // + // Request to exit SendForm(), so that we could boot the selected option + // + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + break; + } } + + return EFI_SUCCESS; } - return EFI_SUCCESS; + // + // All other action return unsupported. + // + return EFI_UNSUPPORTED; } /** diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c index 40d93c5ae0..1857ffa0a1 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c @@ -141,37 +141,36 @@ DeviceManagerCallback ( ) { UINTN CurIndex; + + if (Action == EFI_BROWSER_ACTION_CHANGING) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } + + gCallbackKey = QuestionId; + 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); + } + } + } - if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) { // - // Do nothing for UEFI OPEN/CLOSE Action + // Request to exit SendForm(), so as to switch to selected form // - return EFI_SUCCESS; - } + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; + return EFI_SUCCESS; } - gCallbackKey = QuestionId; - - 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); - } - } - } - // - // Request to exit SendForm(), so as to switch to selected form + // All other action return unsupported. // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - - return EFI_SUCCESS; + return EFI_UNSUPPORTED; } /** @@ -1109,25 +1108,25 @@ DriverHealthCallback ( OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest ) { - if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) { + if (Action == EFI_BROWSER_ACTION_CHANGING) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } + + gCallbackKey = QuestionId; + // - // Do nothing for UEFI OPEN/CLOSE Action + // Request to exit SendForm(), so as to switch to selected form // - return EFI_SUCCESS; - } + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; + return EFI_SUCCESS; } - gCallbackKey = QuestionId; - // - // Request to exit SendForm(), so as to switch to selected form + // All other action return unsupported. // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - - return EFI_SUCCESS; + return EFI_UNSUPPORTED; } /** diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 05aed2b5a2..e8532ece06 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -174,118 +174,118 @@ FrontPageCallback ( CHAR8 *PlatformSupportedLanguages; CHAR8 *BestLanguage; - if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) { - // - // Do nothing for UEFI OPEN/CLOSE Action - // - return EFI_SUCCESS; - } - - if ((Value == NULL) || (ActionRequest == NULL)) { - return EFI_INVALID_PARAMETER; - } + if (Action == EFI_BROWSER_ACTION_CHANGING) { + if ((Value == NULL) || (ActionRequest == NULL)) { + return EFI_INVALID_PARAMETER; + } - gCallbackKey = QuestionId; + gCallbackKey = QuestionId; - // - // 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_CONTINUE: // - // This is the continue - clear the screen and return an error to get out of FrontPage loop + // 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) // - break; + switch (QuestionId) { + case FRONT_PAGE_KEY_CONTINUE: + // + // This is the continue - clear the screen and return an error to get out of FrontPage loop + // + break; - case FRONT_PAGE_KEY_LANGUAGE: - // - // Collect the languages from what our current Language support is based on our VFR - // - LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle); - ASSERT (LanguageString != NULL); - // - // Allocate working buffer for RFC 4646 language in supported LanguageString. - // - Lang = AllocatePool (AsciiStrSize (LanguageString)); - ASSERT (Lang != NULL); + case FRONT_PAGE_KEY_LANGUAGE: + // + // Collect the languages from what our current Language support is based on our VFR + // + LanguageString = HiiGetSupportedLanguages (gFrontPagePrivate.HiiHandle); + ASSERT (LanguageString != NULL); + // + // Allocate working buffer for RFC 4646 language in supported LanguageString. + // + Lang = AllocatePool (AsciiStrSize (LanguageString)); + ASSERT (Lang != NULL); - Index = 0; - LangCode = LanguageString; - while (*LangCode != 0) { - GetNextLanguage (&LangCode, Lang); + Index = 0; + LangCode = LanguageString; + while (*LangCode != 0) { + GetNextLanguage (&LangCode, Lang); - if (Index == Value->u8) { - break; + if (Index == Value->u8) { + break; + } + + Index++; } - Index++; - } + PlatformSupportedLanguages = GetEfiGlobalVariable (L"PlatformLangCodes"); + if (PlatformSupportedLanguages == NULL) { + PlatformSupportedLanguages = AllocateCopyPool ( + AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)), + (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes) + ); + ASSERT (PlatformSupportedLanguages != NULL); + } - PlatformSupportedLanguages = GetEfiGlobalVariable (L"PlatformLangCodes"); - if (PlatformSupportedLanguages == NULL) { - PlatformSupportedLanguages = AllocateCopyPool ( - AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)), - (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes) - ); - ASSERT (PlatformSupportedLanguages != NULL); - } + // + // Select the best language in platform supported Language. + // + BestLanguage = GetBestLanguage ( + PlatformSupportedLanguages, + FALSE, + Lang, + NULL + ); + if (BestLanguage != NULL) { + Status = gRT->SetVariable ( + L"PlatformLang", + &gEfiGlobalVariableGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, + AsciiStrSize (BestLanguage), + Lang + ); + ASSERT_EFI_ERROR(Status); + FreePool (BestLanguage); + } else { + ASSERT (FALSE); + } - // - // Select the best language in platform supported Language. - // - BestLanguage = GetBestLanguage ( - PlatformSupportedLanguages, - FALSE, - Lang, - NULL - ); - if (BestLanguage != NULL) { - Status = gRT->SetVariable ( - L"PlatformLang", - &gEfiGlobalVariableGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, - AsciiStrSize (BestLanguage), - Lang - ); - ASSERT_EFI_ERROR(Status); - FreePool (BestLanguage); - } else { - ASSERT (FALSE); - } + FreePool (PlatformSupportedLanguages); + FreePool (Lang); + FreePool (LanguageString); + break; - FreePool (PlatformSupportedLanguages); - FreePool (Lang); - FreePool (LanguageString); - break; + case FRONT_PAGE_KEY_BOOT_MANAGER: + // + // Boot Manager + // + break; - case FRONT_PAGE_KEY_BOOT_MANAGER: - // - // Boot Manager - // - break; + case FRONT_PAGE_KEY_DEVICE_MANAGER: + // + // Device Manager + // + break; - case FRONT_PAGE_KEY_DEVICE_MANAGER: - // - // Device Manager - // - break; + case FRONT_PAGE_KEY_BOOT_MAINTAIN: + // + // Boot Maintenance Manager + // + break; - case FRONT_PAGE_KEY_BOOT_MAINTAIN: - // - // Boot Maintenance Manager - // - break; + default: + gCallbackKey = 0; + break; + } - default: - gCallbackKey = 0; - break; - } + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + return EFI_SUCCESS; + } - return EFI_SUCCESS; + // + // All other action return unsupported. + // + return EFI_UNSUPPORTED; } /** -- 2.39.2