X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FUniversal%2FPlatformDriOverrideDxe%2FPlatDriOverrideDxe.c;h=ab254a0b450e1eb4d558c427ff7a0bafdf4fcdba;hp=20bc43c345aefbaad36204673d2b21dde8cd7d36;hb=863986b3c8e67736d361b68e293d01e6f92f825c;hpb=c8ad2d7a296c851c2a91519f80dab479df0fdf46 diff --git a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c index 20bc43c345..ab254a0b45 100644 --- a/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c +++ b/MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c @@ -13,7 +13,7 @@ 4. It save all the mapping info in NV variables which will be consumed by platform override protocol driver to publish the platform override protocol. -Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2013, 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 @@ -104,45 +104,29 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = { }; /** - Converting a given device to an unicode string. - - This function will dependent on gEfiDevicePathToTextProtocolGuid, if protocol - does not installed, then return unknown device path L"?" directly. - + Converting a given device to an unicode string. + @param DevPath Given device path instance @return Converted string from given device path. - @retval L"?" Can not locate gEfiDevicePathToTextProtocolGuid protocol for converting. + @retval L"?" Converting failed. **/ CHAR16 * DevicePathToStr ( IN EFI_DEVICE_PATH_PROTOCOL *DevPath ) { - EFI_STATUS Status; - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText; - CHAR16 *ToText; - - if (DevPath == NULL) { - return L""; - } - - Status = gBS->LocateProtocol ( - &gEfiDevicePathToTextProtocolGuid, - NULL, - (VOID **) &DevPathToText - ); - if (!EFI_ERROR (Status)) { - ToText = DevPathToText->ConvertDevicePathToText ( - DevPath, - FALSE, - TRUE - ); - ASSERT (ToText != NULL); - return ToText; + CHAR16 *Text; + Text = ConvertDevicePathToText ( + DevPath, + FALSE, + TRUE + ); + if (Text == NULL) { + return AllocateCopyPool (sizeof (L"?"), L"?"); + } else { + return Text; } - - return L"?"; } /** @@ -185,7 +169,7 @@ GetComponentNameWorker ( // // Find the best matching language. // - Language = GetEfiGlobalVariable (VariableName); + GetEfiGlobalVariable2 (VariableName, (VOID**)&Language, NULL); BestLanguage = GetBestLanguage ( ComponentName->SupportedLanguages, (BOOLEAN) (ProtocolGuid == &gEfiComponentNameProtocolGuid), @@ -1334,17 +1318,25 @@ PlatOverMngrCallback ( EFI_INPUT_KEY Key; PLAT_OVER_MNGR_DATA *FakeNvData; + if ((Action != EFI_BROWSER_ACTION_CHANGING) && (Action != EFI_BROWSER_ACTION_CHANGED)) { + // + // All other action return unsupported. + // + return EFI_UNSUPPORTED; + } + + Private = EFI_CALLBACK_INFO_FROM_THIS (This); + FakeNvData = &Private->FakeNvData; + if (!HiiGetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData)) { + return EFI_NOT_FOUND; + } + if (Action == EFI_BROWSER_ACTION_CHANGING) { - Private = EFI_CALLBACK_INFO_FROM_THIS (This); - FakeNvData = &Private->FakeNvData; - if (!HiiGetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData)) { - return EFI_NOT_FOUND; + if (Value == NULL) { + return EFI_INVALID_PARAMETER; } - - if (KeyValue == KEY_VALUE_DEVICE_REFRESH || - KeyValue == KEY_VALUE_DEVICE_FILTER || - KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS - ) { + + if (KeyValue == KEY_VALUE_DRIVER_GOTO_PREVIOUS) { UpdateDeviceSelectPage (Private, KeyValue, FakeNvData); // // Update page title string @@ -1380,15 +1372,6 @@ PlatOverMngrCallback ( } } - if (KeyValue == KEY_VALUE_ORDER_SAVE_AND_EXIT) { - Status = CommintChanges (Private, KeyValue, FakeNvData); - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; - if (EFI_ERROR (Status)) { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Single Override Info too large, Saving Error!", NULL); - return EFI_DEVICE_ERROR; - } - } - if (KeyValue == KEY_VALUE_DEVICE_CLEAR) { // // Deletes all environment variable(s) that contain the override mappings info @@ -1397,18 +1380,40 @@ PlatOverMngrCallback ( Status = SaveOverridesMapping (&mMappingDataBase); UpdateDeviceSelectPage (Private, KeyValue, FakeNvData); } - // - // Pass changed uncommitted data back to Form Browser - // - HiiSetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData, NULL); + } else if (Action == EFI_BROWSER_ACTION_CHANGED) { + switch (KeyValue) { + case KEY_VALUE_DEVICE_REFRESH: + case KEY_VALUE_DEVICE_FILTER: + UpdateDeviceSelectPage (Private, KeyValue, FakeNvData); + // + // Update page title string + // + NewStringToken = STRING_TOKEN (STR_TITLE); + if (HiiSetString (Private->RegisteredHandle, NewStringToken, L"First, Select the controller by device path", NULL) == 0) { + ASSERT (FALSE); + } + break; + + case KEY_VALUE_ORDER_SAVE_AND_EXIT: + Status = CommintChanges (Private, KeyValue, FakeNvData); + *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT; + if (EFI_ERROR (Status)) { + CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Single Override Info too large, Saving Error!", NULL); + return EFI_DEVICE_ERROR; + } + break; - return EFI_SUCCESS; - } + default: + break; + } + } // - // All other action return unsupported. + // Pass changed uncommitted data back to Form Browser // - return EFI_UNSUPPORTED; + HiiSetBrowserData (&gPlatformOverridesManagerGuid, mVariableName, sizeof (PLAT_OVER_MNGR_DATA), (UINT8 *) FakeNvData, NULL); + + return EFI_SUCCESS; } /**