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
This commit is contained in:
xdu2 2010-07-22 09:46:41 +00:00
parent 6a60f8cb11
commit 7119d96a6f
1 changed files with 43 additions and 63 deletions

View File

@ -181,38 +181,6 @@ InitializeDeviceManager (
); );
ASSERT_EFI_ERROR (Status); 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; return Status;
} }
@ -389,6 +357,26 @@ CallDeviceManager (
BdsLibConnectAllDriversToAllControllers (); BdsLibConnectAllDriversToAllControllers ();
gConnectAllHappened = TRUE; 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 // Create Subtitle OpCodes
// //
@ -423,8 +411,6 @@ CallDeviceManager (
HiiHandles = HiiGetHiiHandles (NULL); HiiHandles = HiiGetHiiHandles (NULL);
ASSERT (HiiHandles != NULL); ASSERT (HiiHandles != NULL);
HiiHandle = gDeviceManagerPrivate.HiiHandle;
// //
// Search for formset of each class type // 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); HiiRemovePackages (HiiHandle);
gDeviceManagerPrivate.HiiHandle = NULL;
gDeviceManagerPrivate.HiiHandle = HiiAddPackages (
&mDeviceManagerGuid,
gDeviceManagerPrivate.DriverHandle,
DeviceManagerVfrBin,
BdsDxeStrings,
NULL
);
if (gDeviceManagerPrivate.HiiHandle == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
Status = EFI_SUCCESS;
}
HiiFreeOpCodeHandle (StartOpCodeHandle); HiiFreeOpCodeHandle (StartOpCodeHandle);
HiiFreeOpCodeHandle (EndOpCodeHandle); HiiFreeOpCodeHandle (EndOpCodeHandle);
@ -676,13 +650,31 @@ CallDriverHealth (
EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath; EFI_DEVICE_PATH_PROTOCOL *DriverDevicePath;
UINTN Length; UINTN Length;
HiiHandle = gDeviceManagerPrivate.DriverHealthHiiHandle;
Index = 0; Index = 0;
Length = 0; Length = 0;
DriverHealthInfo = NULL; DriverHealthInfo = NULL;
DriverDevicePath = NULL; DriverDevicePath = NULL;
InitializeListHead (&DriverHealthList); 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 // 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); 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 // Free driver health info list
// //