summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-16 06:54:41 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-07-16 06:54:41 +0000
commit5caec787e13503450030036e3cc725e87a031ac8 (patch)
treef63bb27e78e3780e80d0efc86800f7304fd69ede
parente6d4b9d5a311df9e65afba3f92cd203475589397 (diff)
downloadedk2-platforms-5caec787e13503450030036e3cc725e87a031ac8.tar.xz
Fix bug that some boot option can *not* be displayed correct in boot manager and boot maintain manager.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8956 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c63
-rw-r--r--IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c48
2 files changed, 84 insertions, 27 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
index 7929f5cbfd..97e808c60a 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c
@@ -875,7 +875,9 @@ BOpt_GetBootOptions (
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN MenuCount;
UINT8 *Ptr;
-
+ UINTN DevicePathType;
+ CHAR16 *HiiString;
+
MenuCount = 0;
BootOrderListSize = 0;
BootNextSize = 0;
@@ -1010,15 +1012,58 @@ BOpt_GetBootOptions (
NewLoadContext->FilePathListLength = *(UINT16 *) LoadOptionPtr;
LoadOptionPtr += sizeof (UINT16);
-
- StringSize = StrSize ((UINT16 *) LoadOptionPtr);
- NewLoadContext->Description = AllocateZeroPool (StringSize);
+
+ StringSize = StrSize((UINT16*)LoadOptionPtr);
+ //
+ // Get Hii description string according to device path type
+ //
+ HiiString = NULL;
+ DevicePathType = BdsGetBootTypeFromDevicePath (DevicePath);
+ switch (DevicePathType) {
+ case BDS_EFI_ACPI_FLOPPY_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
+ break;
+ case BDS_EFI_MESSAGE_SATA_BOOT:
+ case BDS_EFI_MESSAGE_ATAPI_BOOT:
+ case BDS_EFI_MEDIA_CDROM_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
+ break;
+ case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));
+ break;
+ case BDS_EFI_MESSAGE_SCSI_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));
+ break;
+ case BDS_EFI_MESSAGE_MISC_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));
+ break;
+ case BDS_EFI_MESSAGE_MAC_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));
+ break;
+ case BBS_DEVICE_PATH:
+ //
+ // Do nothing for legacy boot option.
+ //
+ break;
+ default:
+ DEBUG((EFI_D_INFO, "Can not find HiiString for given device path type 0x%x\n", DevicePathType));
+ }
+
+ if (HiiString != NULL) {
+ NewLoadContext->Description = AllocateZeroPool(StrSize((UINT16*)LoadOptionPtr) + StrSize(HiiString));
+ StrCpy (NewLoadContext->Description, HiiString);
+ if (StrnCmp ((UINT16*)LoadOptionPtr, L"0", 1) != 0) {
+ StrCat (NewLoadContext->Description, L" ");
+ StrCat (NewLoadContext->Description, (UINT16*)LoadOptionPtr);
+ }
+
+ FreePool (HiiString);
+ } else {
+ NewLoadContext->Description = AllocateZeroPool (StrSize((UINT16*)LoadOptionPtr));
+ StrCpy(NewLoadContext->Description, (UINT16*)LoadOptionPtr);
+ }
+
ASSERT (NewLoadContext->Description != NULL);
- CopyMem (
- NewLoadContext->Description,
- (UINT16 *) LoadOptionPtr,
- StringSize
- );
NewMenuEntry->DisplayString = NewLoadContext->Description;
LoadOptionPtr += StringSize;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
index af54de6926..fcf6c7bb36 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
@@ -201,6 +201,7 @@ CallBootManager (
VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
+ CHAR16 *HiiString;
CHAR16 *BootStringNumber;
UINTN DevicePathType;
@@ -271,48 +272,59 @@ CallBootManager (
BootStringNumber = NULL;
DevicePathType = BdsGetBootTypeFromDevicePath (Option->DevicePath);
-
+
//
// store number string of boot option temporary.
//
-
+ HiiString = NULL;
switch (DevicePathType) {
case BDS_EFI_ACPI_FLOPPY_BOOT:
- BootStringNumber = Option->Description;
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
break;
case BDS_EFI_MEDIA_CDROM_BOOT:
- BootStringNumber = Option->Description;
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
+ case BDS_EFI_MESSAGE_SATA_BOOT:
+ case BDS_EFI_MESSAGE_ATAPI_BOOT:
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
break;
case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:
- BootStringNumber = Option->Description;
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));
break;
case BDS_EFI_MESSAGE_SCSI_BOOT:
- BootStringNumber = Option->Description;
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));
break;
case BDS_EFI_MESSAGE_MISC_BOOT:
- BootStringNumber = Option->Description;
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));
break;
case BDS_EFI_MESSAGE_MAC_BOOT:
- BootStringNumber = Option->Description;
- Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));
+ HiiString = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));
break;
+ case BBS_DEVICE_PATH:
+ //
+ // Do nothing for legacy boot option.
+ //
+ break;
+ default:
+ DEBUG((EFI_D_INFO, "Can not find HiiString for given device path type 0x%x\n", DevicePathType));
}
-
- ASSERT (Option->Description != NULL);
- if (BootStringNumber != NULL) {
+
+ //
+ // If found Hii description string then cat Hii string with original description.
+ //
+ if (HiiString != NULL) {
+ BootStringNumber = Option->Description;
+ Option->Description = AllocateZeroPool(StrSize(BootStringNumber) + StrSize(HiiString));
+ StrCpy (Option->Description, HiiString);
if (StrnCmp (BootStringNumber, L"0", 1) != 0) {
StrCat (Option->Description, L" ");
StrCat (Option->Description, BootStringNumber);
- }
+ }
+ FreePool (HiiString);
FreePool (BootStringNumber);
}
+ ASSERT (Option->Description != NULL);
+
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);
TempStr = DevicePathToStr (Option->DevicePath);