From 7119d96a6fdd28b2e215b20f97996193ca871a57 Mon Sep 17 00:00:00 2001 From: xdu2 Date: Thu, 22 Jul 2010 09:46:41 +0000 Subject: Fix bug that cursor position will change when enter newly registered HII Form after ConnectAll() in DeviceManager. Root cause is that in old code, reinstall of HII handle for DeviceManager will cause inconsistent HII handle index for newly installed HII packages by ConnectAll(), thus cause inconsistent QuestionId. FormBrowser will record QuestionId of a Form ever visited, so the cursor position is changed. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10682 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/BdsDxe/DeviceMngr/DeviceManager.c | 106 +++++++++------------ 1 file changed, 43 insertions(+), 63 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c index 6965615df3..2e3d355a6d 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c @@ -181,38 +181,6 @@ InitializeDeviceManager ( ); ASSERT_EFI_ERROR (Status); - // - // Publish our HII data - // - gDeviceManagerPrivate.HiiHandle = HiiAddPackages ( - &mDeviceManagerGuid, - gDeviceManagerPrivate.DriverHandle, - DeviceManagerVfrBin, - BdsDxeStrings, - NULL - ); - if (gDeviceManagerPrivate.HiiHandle == NULL) { - return EFI_OUT_OF_RESOURCES; - } else { - Status = EFI_SUCCESS; - } - - // - // Publish Driver Health HII data - // - gDeviceManagerPrivate.DriverHealthHiiHandle = HiiAddPackages ( - &mDeviceManagerGuid, - gDeviceManagerPrivate.DriverHealthHandle, - DriverHealthVfrBin, - BdsDxeStrings, - NULL - ); - if (gDeviceManagerPrivate.DriverHealthHiiHandle == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = EFI_SUCCESS; - } - return Status; } @@ -389,6 +357,26 @@ CallDeviceManager ( BdsLibConnectAllDriversToAllControllers (); gConnectAllHappened = TRUE; } + + HiiHandle = gDeviceManagerPrivate.HiiHandle; + if (HiiHandle == NULL) { + // + // Publish our HII data. + // + HiiHandle = HiiAddPackages ( + &mDeviceManagerGuid, + gDeviceManagerPrivate.DriverHandle, + DeviceManagerVfrBin, + BdsDxeStrings, + NULL + ); + if (HiiHandle == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + gDeviceManagerPrivate.HiiHandle = HiiHandle; + } + // // Create Subtitle OpCodes // @@ -423,8 +411,6 @@ CallDeviceManager ( HiiHandles = HiiGetHiiHandles (NULL); ASSERT (HiiHandles != NULL); - HiiHandle = gDeviceManagerPrivate.HiiHandle; - // // Search for formset of each class type // @@ -565,22 +551,10 @@ CallDeviceManager ( } // - // Cleanup dynamic created strings in HII database by reinstall the packagelist + // Remove our packagelist from HII database. // HiiRemovePackages (HiiHandle); - - gDeviceManagerPrivate.HiiHandle = HiiAddPackages ( - &mDeviceManagerGuid, - gDeviceManagerPrivate.DriverHandle, - DeviceManagerVfrBin, - BdsDxeStrings, - NULL - ); - if (gDeviceManagerPrivate.HiiHandle == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = EFI_SUCCESS; - } + gDeviceManagerPrivate.HiiHandle = NULL; HiiFreeOpCodeHandle (StartOpCodeHandle); HiiFreeOpCodeHandle (EndOpCodeHandle); @@ -676,13 +650,31 @@ CallDriverHealth ( EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; UINTN Length; - HiiHandle = gDeviceManagerPrivate.DriverHealthHiiHandle; Index = 0; Length = 0; DriverHealthInfo = NULL; DriverDevicePath = NULL; InitializeListHead (&DriverHealthList); + HiiHandle = gDeviceManagerPrivate.DriverHealthHiiHandle; + if (HiiHandle == NULL) { + // + // Publish Driver Health HII data. + // + HiiHandle = HiiAddPackages ( + &mDeviceManagerGuid, + gDeviceManagerPrivate.DriverHealthHandle, + DriverHealthVfrBin, + BdsDxeStrings, + NULL + ); + if (HiiHandle == NULL) { + return; + } + + gDeviceManagerPrivate.DriverHealthHiiHandle = HiiHandle; + } + // // Allocate space for creation of UpdateData Buffer // @@ -964,23 +956,11 @@ CallDriverHealth ( } // - // Cleanup dynamic created strings in HII database by reinstall the packagelist + // Remove driver health packagelist from HII database. // - HiiRemovePackages (HiiHandle); + gDeviceManagerPrivate.DriverHealthHiiHandle = NULL; - gDeviceManagerPrivate.DriverHealthHiiHandle = HiiAddPackages ( - &mDriverHealthGuid, - gDeviceManagerPrivate.DriverHealthHandle, - DriverHealthVfrBin, - BdsDxeStrings, - NULL - ); - if (gDeviceManagerPrivate.DriverHealthHiiHandle == NULL) { - Status = EFI_OUT_OF_RESOURCES; - } else { - Status = EFI_SUCCESS; - } // // Free driver health info list // -- cgit v1.2.3