MdeModulePkg/ScsiDiskDxe: Update proper device name for ScsiDisk drive
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4100 ScsiDiskDxe driver updates ControllerNameTable with common string "SCSI Disk Device" for all SCSI disks. Due to this, when multiple SCSI disk devices connected, facing difficulty in identifying correct SCSI disk device. As per SCSI spec, standard Inquiry Data is having the fields to know Vendor and Product information. Updated "ControllerNameTable" with Vendor and Product information. So that, device specific name can be retrieved using ComponentName protocol. Cc: Vasudevan Sambandan <vasudevans@ami.com> Cc: Sundaresan Selvaraj <sundaresans@ami.com> Signed-off-by: Cheripally Gopi <gopic@ami.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
d98efb4682
commit
52199bf532
@@ -2,6 +2,7 @@
|
||||
SCSI disk driver that layers on every SCSI IO protocol in the system.
|
||||
|
||||
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
@@ -67,6 +68,33 @@ FreeAlignedBuffer (
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Remove trailing spaces from the string.
|
||||
|
||||
@param String The ASCII string to remove the trailing spaces.
|
||||
|
||||
@retval the new length of the string.
|
||||
**/
|
||||
UINTN
|
||||
RemoveTrailingSpaces (
|
||||
IN OUT CHAR8 *String
|
||||
)
|
||||
{
|
||||
UINTN Length;
|
||||
|
||||
Length = AsciiStrLen (String);
|
||||
if (Length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((Length > 0) && (String[Length-1] == ' ')) {
|
||||
Length--;
|
||||
}
|
||||
|
||||
String[Length] = '\0';
|
||||
return Length;
|
||||
}
|
||||
|
||||
/**
|
||||
The user Entry Point for module ScsiDisk.
|
||||
|
||||
@@ -203,6 +231,9 @@ ScsiDiskDriverBindingStart (
|
||||
UINT8 MaxRetry;
|
||||
BOOLEAN NeedRetry;
|
||||
BOOLEAN MustReadCapacity;
|
||||
CHAR8 VendorStr[VENDOR_IDENTIFICATION_LENGTH + 1];
|
||||
CHAR8 ProductStr[PRODUCT_IDENTIFICATION_LENGTH + 1];
|
||||
CHAR16 DeviceStr[VENDOR_IDENTIFICATION_LENGTH + PRODUCT_IDENTIFICATION_LENGTH + 2];
|
||||
|
||||
MustReadCapacity = TRUE;
|
||||
|
||||
@@ -354,19 +385,37 @@ ScsiDiskDriverBindingStart (
|
||||
}
|
||||
}
|
||||
|
||||
CopyMem (
|
||||
VendorStr,
|
||||
&ScsiDiskDevice->InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION_OFFSET],
|
||||
VENDOR_IDENTIFICATION_LENGTH
|
||||
);
|
||||
VendorStr[VENDOR_IDENTIFICATION_LENGTH] = 0;
|
||||
RemoveTrailingSpaces (VendorStr);
|
||||
|
||||
CopyMem (
|
||||
ProductStr,
|
||||
&ScsiDiskDevice->InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATION_OFFSET],
|
||||
PRODUCT_IDENTIFICATION_LENGTH
|
||||
);
|
||||
ProductStr[PRODUCT_IDENTIFICATION_LENGTH] = 0;
|
||||
RemoveTrailingSpaces (ProductStr);
|
||||
|
||||
UnicodeSPrint (DeviceStr, sizeof (DeviceStr), L"%a %a", VendorStr, ProductStr);
|
||||
|
||||
ScsiDiskDevice->ControllerNameTable = NULL;
|
||||
AddUnicodeString2 (
|
||||
"eng",
|
||||
gScsiDiskComponentName.SupportedLanguages,
|
||||
&ScsiDiskDevice->ControllerNameTable,
|
||||
L"SCSI Disk Device",
|
||||
DeviceStr,
|
||||
TRUE
|
||||
);
|
||||
AddUnicodeString2 (
|
||||
"en",
|
||||
gScsiDiskComponentName2.SupportedLanguages,
|
||||
&ScsiDiskDevice->ControllerNameTable,
|
||||
L"SCSI Disk Device",
|
||||
DeviceStr,
|
||||
FALSE
|
||||
);
|
||||
return EFI_SUCCESS;
|
||||
|
Reference in New Issue
Block a user