mirror of https://github.com/acidanthera/audk.git
Retire description string macro for boot device type which are not defined in UEFI specification.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8926 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
33801c0c8e
commit
429cac9c17
|
@ -786,24 +786,6 @@ SetupResetReminder (
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Define the boot option default description
|
|
||||||
///
|
|
||||||
#define DESCRIPTION_FLOPPY L"EFI Floppy"
|
|
||||||
#define DESCRIPTION_FLOPPY_NUM L"EFI Floppy %d"
|
|
||||||
#define DESCRIPTION_DVD L"EFI DVD/CDROM"
|
|
||||||
#define DESCRIPTION_DVD_NUM L"EFI DVD/CDROM %d"
|
|
||||||
#define DESCRIPTION_USB L"EFI USB Device"
|
|
||||||
#define DESCRIPTION_USB_NUM L"EFI USB Device %d"
|
|
||||||
#define DESCRIPTION_SCSI L"EFI SCSI Device"
|
|
||||||
#define DESCRIPTION_SCSI_NUM L"EFI SCSI Device %d"
|
|
||||||
#define DESCRIPTION_MISC L"EFI Misc Device"
|
|
||||||
#define DESCRIPTION_MISC_NUM L"EFI Misc Device %d"
|
|
||||||
#define DESCRIPTION_NETWORK L"EFI Network"
|
|
||||||
#define DESCRIPTION_NETWORK_NUM L"EFI Network %d"
|
|
||||||
#define DESCRIPTION_NON_BLOCK L"EFI Non-Block Boot Device"
|
|
||||||
#define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d"
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Define the boot type which to classify the boot option type
|
/// Define the boot type which to classify the boot option type
|
||||||
/// Different boot option type could have different boot behavior
|
/// Different boot option type could have different boot behavior
|
||||||
|
@ -822,8 +804,10 @@ SetupResetReminder (
|
||||||
#define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01
|
#define BDS_EFI_MESSAGE_ATAPI_BOOT 0x0301 // Type 03; Sub-Type 01
|
||||||
#define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02
|
#define BDS_EFI_MESSAGE_SCSI_BOOT 0x0302 // Type 03; Sub-Type 02
|
||||||
#define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05
|
#define BDS_EFI_MESSAGE_USB_DEVICE_BOOT 0x0305 // Type 03; Sub-Type 05
|
||||||
#define BDS_EFI_MESSAGE_SATA_BOOT 0x0318 // Type 03; Sub-Type 18
|
#define BDS_EFI_MESSAGE_SATA_BOOT 0x0312 // Type 03; Sub-Type 18
|
||||||
|
#define BDS_EFI_MESSAGE_MAC_BOOT 0x030b // Type 03; Sub-Type 11
|
||||||
#define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF
|
#define BDS_EFI_MESSAGE_MISC_BOOT 0x03FF
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Media boot type
|
/// Media boot type
|
||||||
/// If a device path of boot option contain a media node, the boot option is media boot type
|
/// If a device path of boot option contain a media node, the boot option is media boot type
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ BdsLibEnumerateAllBootOption (
|
||||||
|
|
||||||
switch (DevicePathType) {
|
switch (DevicePathType) {
|
||||||
case BDS_EFI_ACPI_FLOPPY_BOOT:
|
case BDS_EFI_ACPI_FLOPPY_BOOT:
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", FloppyNumber);
|
||||||
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
||||||
FloppyNumber++;
|
FloppyNumber++;
|
||||||
break;
|
break;
|
||||||
|
@ -1018,25 +1018,25 @@ BdsLibEnumerateAllBootOption (
|
||||||
//
|
//
|
||||||
case BDS_EFI_MESSAGE_ATAPI_BOOT:
|
case BDS_EFI_MESSAGE_ATAPI_BOOT:
|
||||||
case BDS_EFI_MESSAGE_SATA_BOOT:
|
case BDS_EFI_MESSAGE_SATA_BOOT:
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", CdromNumber);
|
||||||
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
||||||
CdromNumber++;
|
CdromNumber++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:
|
case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", UsbNumber);
|
||||||
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
||||||
UsbNumber++;
|
UsbNumber++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BDS_EFI_MESSAGE_SCSI_BOOT:
|
case BDS_EFI_MESSAGE_SCSI_BOOT:
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, ScsiNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", ScsiNumber);
|
||||||
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
||||||
ScsiNumber++;
|
ScsiNumber++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BDS_EFI_MESSAGE_MISC_BOOT:
|
case BDS_EFI_MESSAGE_MISC_BOOT:
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", MiscNumber);
|
||||||
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
|
||||||
MiscNumber++;
|
MiscNumber++;
|
||||||
break;
|
break;
|
||||||
|
@ -1098,7 +1098,7 @@ BdsLibEnumerateAllBootOption (
|
||||||
//
|
//
|
||||||
BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);
|
BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);
|
||||||
} else {
|
} else {
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"EFI Non-Block Boot Device %d", NonBlockNumber);
|
||||||
BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList, Buffer);
|
||||||
NonBlockNumber++;
|
NonBlockNumber++;
|
||||||
}
|
}
|
||||||
|
@ -1120,7 +1120,7 @@ BdsLibEnumerateAllBootOption (
|
||||||
);
|
);
|
||||||
|
|
||||||
for (Index = 0; Index < NumberSimpleNetworkHandles; Index++) {
|
for (Index = 0; Index < NumberSimpleNetworkHandles; Index++) {
|
||||||
UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);
|
UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", Index);
|
||||||
BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer);
|
BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1610,6 +1610,8 @@ BdsGetBootTypeFromDevicePath (
|
||||||
return BDS_EFI_MESSAGE_SCSI_BOOT;
|
return BDS_EFI_MESSAGE_SCSI_BOOT;
|
||||||
} else if (DevicePathSubType(TempDevicePath) == MSG_SATA_DP) {
|
} else if (DevicePathSubType(TempDevicePath) == MSG_SATA_DP) {
|
||||||
return BDS_EFI_MESSAGE_SATA_BOOT;
|
return BDS_EFI_MESSAGE_SATA_BOOT;
|
||||||
|
} else if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) {
|
||||||
|
return BDS_EFI_MESSAGE_MAC_BOOT;
|
||||||
}
|
}
|
||||||
return BDS_EFI_MESSAGE_MISC_BOOT;
|
return BDS_EFI_MESSAGE_MISC_BOOT;
|
||||||
default:
|
default:
|
||||||
|
@ -1621,41 +1623,6 @@ BdsGetBootTypeFromDevicePath (
|
||||||
return BDS_EFI_UNSUPPORT;
|
return BDS_EFI_UNSUPPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Check whether the descriptionis is conflict with the description reserved for
|
|
||||||
auto-created boot options.
|
|
||||||
|
|
||||||
@param Description The Description in a boot option
|
|
||||||
|
|
||||||
@retval TRUE The description is conflict with the description reserved for
|
|
||||||
auto-created boot options.
|
|
||||||
@retval FALSE The description is not conflict with the description reserved.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
EFIAPI
|
|
||||||
CheckDescritptionConflict (
|
|
||||||
IN CHAR16 *Description
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (Description == NULL) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ((CompareMem (Description, DESCRIPTION_FLOPPY, StrLen (DESCRIPTION_FLOPPY) * sizeof (CHAR16)) == 0) ||
|
|
||||||
(CompareMem (Description, DESCRIPTION_DVD, StrLen (DESCRIPTION_DVD) * sizeof (CHAR16)) == 0) ||
|
|
||||||
(CompareMem (Description, DESCRIPTION_USB, StrLen (DESCRIPTION_USB) * sizeof (CHAR16)) == 0) ||
|
|
||||||
(CompareMem (Description, DESCRIPTION_SCSI, StrLen (DESCRIPTION_SCSI) * sizeof (CHAR16)) == 0) ||
|
|
||||||
(CompareMem (Description, DESCRIPTION_MISC, StrLen (DESCRIPTION_MISC) * sizeof (CHAR16)) == 0) ||
|
|
||||||
(CompareMem (Description, DESCRIPTION_NETWORK, StrLen (DESCRIPTION_NETWORK) * sizeof (CHAR16)) == 0)||
|
|
||||||
(CompareMem (Description, DESCRIPTION_NON_BLOCK, StrLen (DESCRIPTION_NON_BLOCK) * sizeof (CHAR16)) == 0)) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check whether the Device path in a boot option point to a valid bootable device,
|
Check whether the Device path in a boot option point to a valid bootable device,
|
||||||
And if CheckMedia is true, check the device is ready to boot now.
|
And if CheckMedia is true, check the device is ready to boot now.
|
||||||
|
@ -1801,20 +1768,6 @@ BdsLibIsValidEFIBootOptDevicePathExt (
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
|
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
if (!BlockIo->Media->RemovableMedia) {
|
|
||||||
//
|
|
||||||
// For the Fixed block devices, check its description whether conflict
|
|
||||||
// with other auto-created boot options. BDS permit a boot option point to
|
|
||||||
// Fixed block device, but not permit it use the description reserved for
|
|
||||||
// auto-created boot options.
|
|
||||||
// The check is to cover the bug, that replace a removable BlockIo device
|
|
||||||
// with a fixed BlockIo device at the same port, but the removable device's
|
|
||||||
// boot option can not be automatically deleted.
|
|
||||||
//
|
|
||||||
if (CheckDescritptionConflict (Description)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CheckMedia) {
|
if (CheckMedia) {
|
||||||
//
|
//
|
||||||
// Test if it is ready to boot now
|
// Test if it is ready to boot now
|
||||||
|
|
|
@ -111,21 +111,4 @@ BdsLibGetImageHeader (
|
||||||
OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
|
OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Check whether the descriptionis is conflict with the description reserved for
|
|
||||||
auto-created boot options.
|
|
||||||
|
|
||||||
@param Description The Description in a boot option
|
|
||||||
|
|
||||||
@retval TRUE The description is conflict with the description reserved for
|
|
||||||
auto-created boot options.
|
|
||||||
@retval FALSE The description is not conflict with the description reserved.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
EFIAPI
|
|
||||||
CheckDescritptionConflict (
|
|
||||||
IN CHAR16 *Description
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif // _BDS_LIB_H_
|
#endif // _BDS_LIB_H_
|
||||||
|
|
|
@ -202,6 +202,7 @@ CallBootManager (
|
||||||
EFI_IFR_GUID_LABEL *StartLabel;
|
EFI_IFR_GUID_LABEL *StartLabel;
|
||||||
EFI_IFR_GUID_LABEL *EndLabel;
|
EFI_IFR_GUID_LABEL *EndLabel;
|
||||||
CHAR16 *BootStringNumber;
|
CHAR16 *BootStringNumber;
|
||||||
|
UINTN DevicePathType;
|
||||||
|
|
||||||
gOption = NULL;
|
gOption = NULL;
|
||||||
InitializeListHead (&BdsBootOptionList);
|
InitializeListHead (&BdsBootOptionList);
|
||||||
|
@ -267,41 +268,49 @@ CallBootManager (
|
||||||
//
|
//
|
||||||
// Replace description string with UNI file string.
|
// Replace description string with UNI file string.
|
||||||
//
|
//
|
||||||
BootStringNumber = AllocateZeroPool (StrSize (Option->Description));
|
BootStringNumber = NULL;
|
||||||
ASSERT (BootStringNumber != NULL);
|
|
||||||
|
|
||||||
if (StrStr (Option->Description, DESCRIPTION_FLOPPY) != NULL) {
|
DevicePathType = BdsGetBootTypeFromDevicePath (Option->DevicePath);
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_FLOPPY) + 1;
|
|
||||||
|
//
|
||||||
|
// store number string of boot option temporary.
|
||||||
|
//
|
||||||
|
|
||||||
|
switch (DevicePathType) {
|
||||||
|
case BDS_EFI_ACPI_FLOPPY_BOOT:
|
||||||
|
BootStringNumber = Option->Description;
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
|
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
|
||||||
} else if (StrStr (Option->Description, DESCRIPTION_DVD) != NULL) {
|
break;
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_DVD) + 1;
|
case BDS_EFI_MEDIA_CDROM_BOOT:
|
||||||
|
BootStringNumber = Option->Description;
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
|
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
|
||||||
|
break;
|
||||||
} else if (StrStr (Option->Description, DESCRIPTION_USB) != NULL) {
|
case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_USB) + 1;
|
BootStringNumber = Option->Description;
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));
|
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));
|
||||||
|
break;
|
||||||
} else if (StrStr (Option->Description, DESCRIPTION_SCSI) != NULL) {
|
case BDS_EFI_MESSAGE_SCSI_BOOT:
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_SCSI) + 1;
|
BootStringNumber = Option->Description;
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));
|
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));
|
||||||
|
break;
|
||||||
} else if (StrStr (Option->Description, DESCRIPTION_MISC) != NULL) {
|
case BDS_EFI_MESSAGE_MISC_BOOT:
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_MISC) + 1;
|
BootStringNumber = Option->Description;
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));
|
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));
|
||||||
|
break;
|
||||||
} else if (StrStr (Option->Description, DESCRIPTION_NETWORK) != NULL) {
|
case BDS_EFI_MESSAGE_MAC_BOOT:
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_NETWORK) + 1;
|
BootStringNumber = Option->Description;
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));
|
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));
|
||||||
|
break;
|
||||||
} else if (StrStr (Option->Description, DESCRIPTION_NON_BLOCK) != NULL) {
|
|
||||||
BootStringNumber = Option->Description + StrLen (DESCRIPTION_NON_BLOCK) + 1;
|
|
||||||
Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NON_BLOCK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Option->Description != NULL);
|
ASSERT (Option->Description != NULL);
|
||||||
if (StrnCmp (BootStringNumber, L"0", 1) != 0) {
|
if (BootStringNumber != NULL) {
|
||||||
StrCat (Option->Description, L" ");
|
if (StrnCmp (BootStringNumber, L"0", 1) != 0) {
|
||||||
StrCat (Option->Description, BootStringNumber);
|
StrCat (Option->Description, L" ");
|
||||||
|
StrCat (Option->Description, BootStringNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreePool (BootStringNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);
|
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);
|
||||||
|
|
Loading…
Reference in New Issue