X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FUniversal%2FBdsDxe%2FDeviceMngr%2FDeviceManager.c;h=14e71e3e52b803fb6913a7c992aa2457c27c0783;hb=59ec2b00f98ffdd2f92306d23ec22ab05e1b199b;hp=1857ffa0a1c93789eb3120db9f983e3a30e01f5e;hpb=d88f86f154ddbe39355fcf0aca03438f219b2660;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c index 1857ffa0a1..14e71e3e52 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c @@ -1,7 +1,7 @@ /** @file The platform device manager reference implementation -Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 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 @@ -34,9 +34,6 @@ DEVICE_MANAGER_CALLBACK_DATA gDeviceManagerPrivate = { #define MAX_MAC_ADDRESS_NODE_LIST_LEN 10 -EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID; -EFI_GUID mDriverHealthGuid = DRIVER_HEALTH_FORMSET_GUID; - // // Which Mac Address string is select // it will decide what menu need to show in the NETWORK_DEVICE_FORM_ID form. @@ -72,10 +69,7 @@ HII_VENDOR_DEVICE_PATH mDeviceManagerHiiVendorDevicePath = { (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) } }, - // - // {102579A0-3686-466e-ACD8-80C087044F4A} - // - { 0x102579a0, 0x3686, 0x466e, { 0xac, 0xd8, 0x80, 0xc0, 0x87, 0x4, 0x4f, 0x4a } } + DEVICE_MANAGER_FORMSET_GUID }, { END_DEVICE_PATH_TYPE, @@ -97,10 +91,7 @@ HII_VENDOR_DEVICE_PATH mDriverHealthHiiVendorDevicePath = { (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) } }, - // - // {D8F76651-1675-4986-BED4-3824B2F1F4C8} - // - { 0xd8f76651, 0x1675, 0x4986, { 0xbe, 0xd4, 0x38, 0x24, 0xb2, 0xf1, 0xf4, 0xc8 } } + DRIVER_HEALTH_FORMSET_GUID }, { END_DEVICE_PATH_TYPE, @@ -142,35 +133,30 @@ 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_CHANGING) { // - // Request to exit SendForm(), so as to switch to selected form + // All other action return unsupported. // - *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; + return EFI_UNSUPPORTED; + } - return EFI_SUCCESS; + if (Value == NULL) { + return EFI_INVALID_PARAMETER; } - // - // All other action return unsupported. - // - return EFI_UNSUPPORTED; + 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); + } + } + } + + return EFI_SUCCESS; } /** @@ -588,7 +574,6 @@ IsNeedAddNetworkMenu ( EFI_STATUS Status; UINTN EntryCount; UINTN Index; - EFI_HII_HANDLE HiiDeviceManagerHandle; EFI_HANDLE DriverHandle; EFI_HANDLE ControllerHandle; EFI_DEVICE_PATH_PROTOCOL *DevicePath; @@ -597,7 +582,6 @@ IsNeedAddNetworkMenu ( EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *OpenInfoBuffer; BOOLEAN IsNeedAdd; - HiiDeviceManagerHandle = gDeviceManagerPrivate.HiiHandle; IsNeedAdd = FALSE; OpenInfoBuffer = NULL; if ((Handle == NULL) || (ItemCount == NULL)) { @@ -775,7 +759,7 @@ CallDeviceManager ( // Publish our HII data. // HiiHandle = HiiAddPackages ( - &mDeviceManagerGuid, + &gDeviceManagerFormSetGuid, gDeviceManagerPrivate.DriverHandle, DeviceManagerVfrBin, BdsDxeStrings, @@ -884,7 +868,7 @@ CallDeviceManager ( AddNetworkMenu = TRUE; HiiCreateGotoOpCode ( StartOpCodeHandle, - DEVICE_MANAGER_FORM_ID, + INVALID_FORM_ID, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_TITLE), STRING_TOKEN (STR_FORM_NETWORK_DEVICE_LIST_HELP), EFI_IFR_FLAG_CALLBACK, @@ -898,7 +882,7 @@ CallDeviceManager ( while (AddItemCount > 0) { HiiCreateGotoOpCode ( StartOpCodeHandle, - NETWORK_DEVICE_LIST_FORM_ID, + INVALID_FORM_ID, mMacDeviceList.NodeList[mMacDeviceList.CurListLen - AddItemCount].PromptId, STRING_TOKEN (STR_NETWORK_DEVICE_HELP), EFI_IFR_FLAG_CALLBACK, @@ -912,7 +896,7 @@ CallDeviceManager ( // HiiCreateGotoOpCode ( StartOpCodeHandle, - NETWORK_DEVICE_FORM_ID, + INVALID_FORM_ID, Token, TokenHelp, EFI_IFR_FLAG_CALLBACK, @@ -927,7 +911,7 @@ CallDeviceManager ( if (mNextShowFormId == DEVICE_MANAGER_FORM_ID) { HiiCreateGotoOpCode ( StartOpCodeHandle, - DEVICE_MANAGER_FORM_ID, + INVALID_FORM_ID, Token, TokenHelp, EFI_IFR_FLAG_CALLBACK, @@ -980,7 +964,7 @@ CallDeviceManager ( HiiUpdateForm ( HiiHandle, - &mDeviceManagerGuid, + &gDeviceManagerFormSetGuid, mNextShowFormId, StartOpCodeHandle, EndOpCodeHandle @@ -991,7 +975,7 @@ CallDeviceManager ( gFormBrowser2, &HiiHandle, 1, - &mDeviceManagerGuid, + &gDeviceManagerFormSetGuid, mNextShowFormId, NULL, &ActionRequest @@ -1108,7 +1092,7 @@ DriverHealthCallback ( OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest ) { - if (Action == EFI_BROWSER_ACTION_CHANGING) { + if (Action == EFI_BROWSER_ACTION_CHANGED) { if ((Value == NULL) || (ActionRequest == NULL)) { return EFI_INVALID_PARAMETER; } @@ -1166,11 +1150,9 @@ CallDriverHealth ( DRIVER_HEALTH_INFO *DriverHealthInfo; LIST_ENTRY *Link; EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; - UINTN Length; BOOLEAN RebootRequired; Index = 0; - Length = 0; DriverHealthInfo = NULL; DriverDevicePath = NULL; InitializeListHead (&DriverHealthList); @@ -1181,7 +1163,7 @@ CallDriverHealth ( // Publish Driver Health HII data. // HiiHandle = HiiAddPackages ( - &mDeviceManagerGuid, + &gDeviceManagerFormSetGuid, gDeviceManagerPrivate.DriverHealthHandle, DriverHealthVfrBin, BdsDxeStrings, @@ -1379,7 +1361,7 @@ CallDriverHealth ( Status = HiiUpdateForm ( HiiHandle, - &mDriverHealthGuid, + &gDriverHealthFormSetGuid, DRIVER_HEALTH_FORM_ID, StartOpCodeHandle, EndOpCodeHandle @@ -1389,7 +1371,7 @@ CallDriverHealth ( Status = HiiUpdateForm ( HiiHandle, - &mDriverHealthGuid, + &gDriverHealthFormSetGuid, DRIVER_HEALTH_FORM_ID, StartOpCodeHandleRepair, EndOpCodeHandleRepair @@ -1402,7 +1384,7 @@ CallDriverHealth ( gFormBrowser2, &HiiHandle, 1, - &mDriverHealthGuid, + &gDriverHealthFormSetGuid, DRIVER_HEALTH_FORM_ID, NULL, &ActionRequest @@ -1961,7 +1943,7 @@ ProcessSingleControllerHealth ( DriverHealth, ControllerHandle, ChildHandle, - (EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY) RepairNotify + RepairNotify ); } // @@ -2037,24 +2019,20 @@ ProcessSingleControllerHealth ( /** - Platform specific notification function for controller repair operations. - - If the driver for a controller support the Driver Health Protocol and the - current state of the controller is EfiDriverHealthStatusRepairRequired then - when the Repair() service of the Driver Health Protocol is called, this - platform specific notification function can display the progress of the repair - operation. Some platforms may choose to not display anything, other may choose - to show the percentage complete on text consoles, and other may choose to render - a progress bar on text and graphical consoles. - - This function displays the percentage of the repair operation that has been - completed on text consoles. The percentage is Value / Limit * 100%. - - @param Value Value in the range 0..Limit the the repair has completed.. - @param Limit The maximum value of Value + Reports the progress of a repair operation. + + @param[in] Value A value between 0 and Limit that identifies the current + progress of the repair operation. + + @param[in] Limit The maximum value of Value for the current repair operation. + For example, a driver that wants to specify progress in + percent would use a Limit value of 100. + + @retval EFI_SUCCESS The progress of a repair operation is reported successfully. **/ -VOID +EFI_STATUS +EFIAPI RepairNotify ( IN UINTN Value, IN UINTN Limit @@ -2068,6 +2046,7 @@ RepairNotify ( Percent = Value * 100 / Limit; Print(L"Repair Progress = %3d%%\n\r", Percent); } + return EFI_SUCCESS; } /** @@ -2185,7 +2164,7 @@ DriverHealthSelectBestLanguage ( CHAR8 *LanguageVariable; CHAR8 *BestLanguage; - LanguageVariable = GetEfiGlobalVariable (Iso639Language ? L"Lang" : L"PlatformLang"); + GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", (VOID**)&LanguageVariable, NULL); BestLanguage = GetBestLanguage( SupportedLanguages,