1
1

scsiprint.cpp, scsicmds.h/.cpp: do some preliminary work to fetch the Zoned block device characteristics VPD page

git-svn-id: http://svn.code.sf.net/p/smartmontools/code/trunk@5300 4ea69e1a-61f1-4043-bf83-b5c94c648137
Этот коммит содержится в:
dpgilbert 2022-01-09 05:35:27 +00:00
родитель b29c690dad
Коммит 0d8ee20af1
4 изменённых файлов: 31 добавлений и 4 удалений

Просмотреть файл

@ -1,5 +1,11 @@
$Id$
2022-01-09 Douglas Gilbert <dgilbert@interlog.com>
scsiprint.cpp, scsicmds.h/.cpp: do some preliminary
work to fetch the Zoned block device characteristics
VPD page if it is present
2022-01-08 Douglas Gilbert <dgilbert@interlog.com>
scsiprint.cpp: adjust json::str2key() calls as requested

Просмотреть файл

@ -2577,7 +2577,10 @@ scsiFetchControlGLTSD(scsi_device * device, int modese_len, int current)
/* Returns a negative value on error, 0 if unknown and 1 if SSD,
* otherwise the positive returned value is the speed in rpm. First checks
* the Block Device Characteristics VPD page and if that fails it tries the
* RIGID_DISK_DRIVE_GEOMETRY_PAGE mode page. */
* RIGID_DISK_DRIVE_GEOMETRY_PAGE mode page.
* In SBC-4 the 2 bit ZONED field in this VPD page is written to *haw_zbcp
* if haw_zbcp is non-NULL. In SBC-5 the ZONED field is now obsolete,
* the Zoned block device characteristics VPD page should be used instead. */
int
scsiGetRPM(scsi_device * device, int modese_len, int * form_factorp,
@ -2595,7 +2598,7 @@ scsiGetRPM(scsi_device * device, int modese_len, int * form_factorp,
if (form_factorp)
*form_factorp = buff[7] & 0xf;
if (haw_zbcp)
*haw_zbcp = !!(0x10 & buff[8]);
*haw_zbcp = (buff[8] >> 4) & 0x3;
return speed;
}
if (form_factorp)

Просмотреть файл

@ -291,6 +291,7 @@ Documentation, see http://www.storage.ibm.com/techsup/hddtech/prodspecs.htm */
#define SCSI_VPD_BLOCK_LIMITS 0xb0
#define SCSI_VPD_BLOCK_DEVICE_CHARACTERISTICS 0xb1
#define SCSI_VPD_LOGICAL_BLOCK_PROVISIONING 0xb2
#define SCSI_VPD_ZONED_BLOCK_DEV_CHAR 0xb6
/* defines for useful SCSI Status codes */
#define SCSI_STATUS_CHECK_CONDITION 0x2

Просмотреть файл

@ -2068,6 +2068,7 @@ scsiGetDriveInfo(scsi_device * device, uint8_t * peripheral_type, bool all)
int form_factor = 0;
int haw_zbc = 0;
int protect = 0;
const char * q;
memset(gBuf, 0, 96);
req_len = 36;
@ -2298,8 +2299,24 @@ scsiGetDriveInfo(scsi_device * device, uint8_t * peripheral_type, bool all)
jglb["form_factor"]["name"] = strprintf("%s inches", cp);
}
}
if (haw_zbc > 0)
jout("Host aware zoned block capable\n");
if (haw_zbc == 1) {
q = "Host aware zoned block capable";
jout("%s\n", q);
jglb[std::string("scsi_") + q] = true;
} else if (haw_zbc == 2) {
q = "Device managed zoned block capable";
jout("%s\n", q);
jglb[std::string("scsi_") + q] = true;
} else {
supported_vpd_pages * s_vpd_pp = supported_vpd_pages_p;
if (s_vpd_pp &&
s_vpd_pp->is_supported(SCSI_VPD_ZONED_BLOCK_DEV_CHAR)) {
// TODO: need to read that VPD page and look at the
// 'Zoned block device extension' field
}
}
}
/* Do this here to try and detect badly conforming devices (some USB