[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/20] scsi-disk: allow MODE SELECT block descriptor to set the bl
From: |
Paolo Bonzini |
Subject: |
[PULL 17/20] scsi-disk: allow MODE SELECT block descriptor to set the block size |
Date: |
Thu, 14 Jul 2022 11:02:08 +0200 |
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
The MODE SELECT command can contain an optional block descriptor that can be
used
to set the device block size. If the block descriptor is present then update the
block size on the SCSI device accordingly.
This allows CDROMs to be used with A/UX which requires a CDROM drive which is
capable of switching from a 2048 byte sector size to a 512 byte sector size.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220622105314.802852-13-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/scsi-disk.c | 6 ++++++
hw/scsi/trace-events | 1 +
2 files changed, 7 insertions(+)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index db27e834da..f5cdb9ad4b 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1616,6 +1616,12 @@ static void scsi_disk_emulate_mode_select(SCSIDiskReq
*r, uint8_t *inbuf)
goto invalid_param;
}
+ /* Allow changing the block size */
+ if (bd_len && p[6] != (s->qdev.blocksize >> 8)) {
+ s->qdev.blocksize = p[6] << 8;
+ trace_scsi_disk_mode_select_set_blocksize(s->qdev.blocksize);
+ }
+
len -= bd_len;
p += bd_len;
diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events
index 8e927ff62d..ab238293f0 100644
--- a/hw/scsi/trace-events
+++ b/hw/scsi/trace-events
@@ -340,6 +340,7 @@ scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba,
int len) "Write %s(se
scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Command:
lun=%d tag=0x%x data=%s"
scsi_disk_aio_sgio_command(uint32_t tag, uint8_t cmd, uint64_t lba, int len,
uint32_t timeout) "disk aio sgio: tag=0x%x cmd=0x%x (sector %" PRId64 ", count
%d) timeout=%u"
scsi_disk_mode_select_page_truncated(int page, int len, int page_len) "page %d
expected length %d but received length %d"
+scsi_disk_mode_select_set_blocksize(int blocksize) "set block size to %d"
# scsi-generic.c
scsi_generic_command_complete_noio(void *req, uint32_t tag, int statuc)
"Command complete %p tag=0x%x status=%d"
--
2.36.1
- [PULL 10/20] q800: implement compat_props to enable quirk_mode_sense_rom_use_dbd for scsi-cd devices, (continued)
- [PULL 10/20] q800: implement compat_props to enable quirk_mode_sense_rom_use_dbd for scsi-cd devices, Paolo Bonzini, 2022/07/14
- [PULL 07/20] scsi-disk: add MODE_PAGE_APPLE_VENDOR quirk for Macintosh, Paolo Bonzini, 2022/07/14
- [PULL 14/20] scsi-disk: add SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED quirk for Macintosh, Paolo Bonzini, 2022/07/14
- [PULL 15/20] q800: implement compat_props to enable quirk_mode_page_truncated for scsi-cd devices, Paolo Bonzini, 2022/07/14
- [PULL 12/20] q800: implement compat_props to enable quirk_mode_page_vendor_specific_apple for scsi devices, Paolo Bonzini, 2022/07/14
- [PULL 09/20] scsi-disk: add SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD quirk for Macintosh, Paolo Bonzini, 2022/07/14
- [PULL 06/20] scsi-disk: add new quirks bitmap to SCSIDiskState, Paolo Bonzini, 2022/07/14
- [PULL 03/20] datadir: Use bundle mechanism, Paolo Bonzini, 2022/07/14
- [PULL 08/20] q800: implement compat_props to enable quirk_mode_page_apple_vendor for scsi-cd devices, Paolo Bonzini, 2022/07/14
- [PULL 16/20] scsi-disk: allow the MODE_PAGE_R_W_ERROR AWRE bit to be changeable for CDROM drives, Paolo Bonzini, 2022/07/14
- [PULL 17/20] scsi-disk: allow MODE SELECT block descriptor to set the block size,
Paolo Bonzini <=
- [PULL 18/20] q800: add default vendor and product information for scsi-hd devices, Paolo Bonzini, 2022/07/14
- [PULL 19/20] q800: add default vendor and product information for scsi-cd devices, Paolo Bonzini, 2022/07/14
- [PULL 20/20] pc-bios/s390-ccw: add -Wno-array-bounds, Paolo Bonzini, 2022/07/14
- Re: [PULL 00/20] SCSI, build system patches for 2022-07-13, Peter Maydell, 2022/07/15