Message ID | 20170506124314.23354-2-aurelien@aurel32.net |
---|---|
State | New |
Headers | show |
On 05/06/2017 09:43 AM, Aurelien Jarno wrote: > Export the rotational qdev property to the block device characteristics > VPD page. > > Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > hw/scsi/scsi-disk.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c > index a53f058621..21b7e21a23 100644 > --- a/hw/scsi/scsi-disk.c > +++ b/hw/scsi/scsi-disk.c > @@ -597,6 +597,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) > outbuf[buflen++] = 0x83; // device identification > if (s->qdev.type == TYPE_DISK) { > outbuf[buflen++] = 0xb0; // block limits > + outbuf[buflen++] = 0xb1; /* block device characteristics */ > outbuf[buflen++] = 0xb2; // thin provisioning > } > break; > @@ -739,6 +740,19 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) > outbuf[43] = max_io_sectors & 0xff; > break; > } > + case 0xb1: /* block device characteristics */ > + { > + buflen = 0x40; > + memset(outbuf + 4, 0, buflen - 4); > + > + /* medium rotation rate: 0 = not reported, 1 = non-rotating */ > + outbuf[4] = 0; > + outbuf[5] = s->qdev.conf.rotational ? 0 : 1; > + > + /* nominal form factor */ > + outbuf[7] = 0; /* not reported */ > + break; > + } > case 0xb2: /* thin provisioning */ > { > buflen = 8; >
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index a53f058621..21b7e21a23 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -597,6 +597,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) outbuf[buflen++] = 0x83; // device identification if (s->qdev.type == TYPE_DISK) { outbuf[buflen++] = 0xb0; // block limits + outbuf[buflen++] = 0xb1; /* block device characteristics */ outbuf[buflen++] = 0xb2; // thin provisioning } break; @@ -739,6 +740,19 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) outbuf[43] = max_io_sectors & 0xff; break; } + case 0xb1: /* block device characteristics */ + { + buflen = 0x40; + memset(outbuf + 4, 0, buflen - 4); + + /* medium rotation rate: 0 = not reported, 1 = non-rotating */ + outbuf[4] = 0; + outbuf[5] = s->qdev.conf.rotational ? 0 : 1; + + /* nominal form factor */ + outbuf[7] = 0; /* not reported */ + break; + } case 0xb2: /* thin provisioning */ { buflen = 8;
Export the rotational qdev property to the block device characteristics VPD page. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> --- hw/scsi/scsi-disk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)