SCSI disk driver that layers on every SCSI IO protocol in the system.\r
\r
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
}\r
}\r
\r
+/**\r
+ Remove trailing spaces from the string.\r
+\r
+ @param String The ASCII string to remove the trailing spaces.\r
+\r
+ @retval the new length of the string.\r
+**/\r
+UINTN\r
+RemoveTrailingSpaces (\r
+ IN OUT CHAR8 *String\r
+ )\r
+{\r
+ UINTN Length;\r
+\r
+ Length = AsciiStrLen (String);\r
+ if (Length == 0) {\r
+ return 0;\r
+ }\r
+\r
+ while ((Length > 0) && (String[Length-1] == ' ')) {\r
+ Length--;\r
+ }\r
+\r
+ String[Length] = '\0';\r
+ return Length;\r
+}\r
+\r
/**\r
The user Entry Point for module ScsiDisk.\r
\r
UINT8 MaxRetry;\r
BOOLEAN NeedRetry;\r
BOOLEAN MustReadCapacity;\r
+ CHAR8 VendorStr[VENDOR_IDENTIFICATION_LENGTH + 1];\r
+ CHAR8 ProductStr[PRODUCT_IDENTIFICATION_LENGTH + 1];\r
+ CHAR16 DeviceStr[VENDOR_IDENTIFICATION_LENGTH + PRODUCT_IDENTIFICATION_LENGTH + 2];\r
\r
MustReadCapacity = TRUE;\r
\r
}\r
}\r
\r
+ CopyMem (\r
+ VendorStr,\r
+ &ScsiDiskDevice->InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION_OFFSET],\r
+ VENDOR_IDENTIFICATION_LENGTH\r
+ );\r
+ VendorStr[VENDOR_IDENTIFICATION_LENGTH] = 0;\r
+ RemoveTrailingSpaces (VendorStr);\r
+\r
+ CopyMem (\r
+ ProductStr,\r
+ &ScsiDiskDevice->InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATION_OFFSET],\r
+ PRODUCT_IDENTIFICATION_LENGTH\r
+ );\r
+ ProductStr[PRODUCT_IDENTIFICATION_LENGTH] = 0;\r
+ RemoveTrailingSpaces (ProductStr);\r
+\r
+ UnicodeSPrint (DeviceStr, sizeof (DeviceStr), L"%a %a", VendorStr, ProductStr);\r
+\r
ScsiDiskDevice->ControllerNameTable = NULL;\r
AddUnicodeString2 (\r
"eng",\r
gScsiDiskComponentName.SupportedLanguages,\r
&ScsiDiskDevice->ControllerNameTable,\r
- L"SCSI Disk Device",\r
+ DeviceStr,\r
TRUE\r
);\r
AddUnicodeString2 (\r
"en",\r
gScsiDiskComponentName2.SupportedLanguages,\r
&ScsiDiskDevice->ControllerNameTable,\r
- L"SCSI Disk Device",\r
+ DeviceStr,\r
FALSE\r
);\r
return EFI_SUCCESS;\r
Header file for SCSI Disk Driver.\r
\r
Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
#include <Library/UefiScsiLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/DevicePathLib.h>\r
+#include <Library/PrintLib.h>\r
\r
#include <IndustryStandard/Scsi.h>\r
#include <IndustryStandard/Atapi.h>\r
#define SCSI_COMMAND_VERSION_2 0x02\r
#define SCSI_COMMAND_VERSION_3 0x03\r
\r
+// Per SCSI spec, EFI_SCSI_INQUIRY_DATA.Reserved_5_95[3 - 10] has the Vendor identification\r
+// EFI_SCSI_INQUIRY_DATA.Reserved_5_95[11 - 26] has the product identification\r
+#define VENDOR_IDENTIFICATION_OFFSET 3\r
+#define VENDOR_IDENTIFICATION_LENGTH 8\r
+#define PRODUCT_IDENTIFICATION_OFFSET 11\r
+#define PRODUCT_IDENTIFICATION_LENGTH 16\r
+\r
//\r
// SCSI Disk Timeout Experience Value\r
//\r