Here are the next set of patches from my ongoing work to allow the q800
machine to boot MacOS related to SCSI devices.
Patch 1 adds a new quirks bitmap to SCSIDiskState to allow buggy and/or
legacy features to enabled on an individual device basis. Once the quirks
bitmap has been added, patch 2 uses the quirks feature to implement an
Apple-specific mode page which is required to allow the disk to be recognised
and used by Apple HD SC Setup.
Patch 3 adds compat_props to the q800 machine which enable the new
MODE_PAGE_APPLE_VENDOR quirk for all scsi-cd devices attached to the machine.
Patch 4 adds a new quirk to force SCSI CDROMs to always honour the block
descriptor for a MODE SENSE command which is expected by A/UX, whilst patch 5
enables the quirk for all scsi-cd devices on the q800 machine.
Patches 6 and 7 implement a new MODE_PAGE_VENDOR_SPECIFIC_APPLE quirk to
allow PF=0 MODE SELECT requests which are used by both MacOS and A/UX, along
with a MODE_PAGE_VENDOR_SPECIFIC (0x0) mode page compatible with MacOS. Once
again this quirk is only enabled for SCSI devices on the q800 machine.
Patch 8 implements a dummy FORMAT UNIT command which is used by the Apple HD SC
Setup program when preparing an empty disk to install MacOS.
Patches 9 and 10 add support for allowing truncated MODE SELECT requests which
are
sent by A/UX when enumerating a SCSI CDROM device. Allowing these broken
requests
is protected by a new MODE_PAGE_TRUNCATED quirk which is only enabled for SCSI
CDROM devices attached to the q800 machine.
Patch 11 allows the MODE_PAGE_R_W_ERROR AWRE bit to be changeable since the A/UX
MODE SELECT request sets this bit to 0 rather than the QEMU default which is 1.
Patch 12 adds support for setting the SCSI block size via a MODE SELECT request
which is most commonly used by older CDROMs to allow the block size to be
changed
from the default of 2048 bytes to 512 bytes for compatibility purposes. This is
used by A/UX which otherwise fails with SCSI errors if the block size is not set
to 512 bytes when accessing CDROMs.
Finally patches 13 and 14 augment the compat_props to set the default vendor,
product and version information for all scsi-hd and scsi-cd devices attached
to the q800 machine, taken from real drives. This is because MacOS will only
allow a known set of SCSI devices to be detected and initialised during the
installation process.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
v3:
[Note from v2: this series has changed in structure and functionality based upon
bug reports from Howard off-list regarding detection/changing of CDROM media in
both A/UX and MacOS]
- Rearrange order to aid bisecting differences between CDROM and DISK quirks
- Add R-B tags from Laurent and Phil
- Replace %zd with %zu in trace-events in patch 8
- Add a new SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED quirk to handle truncated MODE
SELECT
requests
- Rename SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD quirk to
SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD since due to additional changes in
this series
the DBD bit can be honoured rather than forced off
- Add support for PF=0 MODE SELECT commands a and new MODE_PAGE_VENDOR_SPECIFIC
(0x0) page
with a suitable implementation for MacOS protected by a new
SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE quirk (this fixes detection
of CDROM
media in some cases)
- Allow the SCSI block size to be set for both CDROMs and DISKs as requested by
Paolo
v2:
- Change patchset title from "scsi: add support for FORMAT UNIT command and
quirks"
to "scsi: add quirks and features to support m68k Macs"
- Fix missing shift in patch 2 as pointed out by Fam
- Rename MODE_PAGE_APPLE to MODE_PAGE_APPLE_VENDOR
- Add SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD quirk
- Add support for truncated MODE SELECT requests
- Allow MODE_PAGE_R_W_ERROR AWRE bit to be changeable for CDROM devices
- Allow the MODE SELECT block descriptor to set the CDROM block size
Mark Cave-Ayland (14):
scsi-disk: add new quirks bitmap to SCSIDiskState
scsi-disk: add MODE_PAGE_APPLE_VENDOR quirk for Macintosh
q800: implement compat_props to enable quirk_mode_page_apple_vendor
for scsi-cd devices
scsi-disk: add SCSI_DISK_QUIRK_MODE_SENSE_ROM_USE_DBD quirk for
Macintosh
q800: implement compat_props to enable quirk_mode_sense_rom_use_dbd
for scsi-cd devices
scsi-disk: add SCSI_DISK_QUIRK_MODE_PAGE_VENDOR_SPECIFIC_APPLE quirk
for Macintosh
q800: implement compat_props to enable
quirk_mode_page_vendor_specific_apple for scsi devices
scsi-disk: add FORMAT UNIT command
scsi-disk: add SCSI_DISK_QUIRK_MODE_PAGE_TRUNCATED quirk for Macintosh
q800: implement compat_props to enable quirk_mode_page_truncated for
scsi-cd devices
scsi-disk: allow the MODE_PAGE_R_W_ERROR AWRE bit to be changeable for
CDROM drives
scsi-disk: allow MODE SELECT block descriptor to set the block size
q800: add default vendor and product information for scsi-hd devices
q800: add default vendor and product information for scsi-cd devices
hw/m68k/q800.c | 16 +++++++
hw/scsi/scsi-disk.c | 96 +++++++++++++++++++++++++++++++++++++---
hw/scsi/trace-events | 3 ++
include/hw/scsi/scsi.h | 6 +++
include/scsi/constants.h | 2 +
5 files changed, 116 insertions(+), 7 deletions(-)