summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Sven Schnelle <svens@stackframe.org>2018-11-28 09:47:11 +0100
committer Vas Crabb <cuavas@users.noreply.github.com>2018-11-28 20:09:02 +1100
commit2d576738457f13e4c14bf7e829be436778520750 (patch)
tree8d246c7ab41f4817de687ecd25180fccf0d4092c
parentb4207e7b357b96c8e489ebcc7d82fc8026967bee (diff)
nscsi: fix sense data if not cdrom in drive (nw)
We reported Medium error, which makes at least the HP9000/382 complain about bad hardware during system search, and netbsd didn't like it either and reported it during boot up. Change it to report 'Not ready, medium not present.' This is what my Toshiba XM-5401B reports.
-rw-r--r--src/devices/machine/nscsi_bus.h24
-rw-r--r--src/devices/machine/nscsi_cd.cpp4
2 files changed, 26 insertions, 2 deletions
diff --git a/src/devices/machine/nscsi_bus.h b/src/devices/machine/nscsi_bus.h
index fc724984e56..af975050868 100644
--- a/src/devices/machine/nscsi_bus.h
+++ b/src/devices/machine/nscsi_bus.h
@@ -119,6 +119,30 @@ protected:
SS_QUEUE_FULL = 0x28
};
+ // SCSI sense keys
+ enum {
+ SK_NO_SENSE = 0x00,
+ SK_RECOVERED_ERROR = 0x01,
+ SK_NOT_READY = 0x02,
+ SK_MEDIUM_ERROR = 0x03,
+ SK_HARDWARE_ERROR = 0x04,
+ SK_ILLEGAL_REQUEST = 0x05,
+ SK_UNIT_ATTENTION = 0x06,
+ SK_DATA_PROTECT = 0x07,
+ SK_BLANK_CHECK = 0x08,
+ SK_VENDOR_SPECIFIC = 0x09,
+ SK_COPY_ABORTED = 0x0a,
+ SK_ABORTED_COMMAND = 0x0b,
+ SK_VOLUME_OVERFLOW = 0x0d,
+ SK_MISCOMPARE = 0x0e,
+ SK_COMPLETED = 0x0f
+ };
+
+ // SCSI addtional sense code qualifiers
+ enum {
+ SK_ASC_MEDIUM_NOT_PRESENT = 0x3a
+ };
+
// SCSI commands
static const char *const command_names[256];
enum {
diff --git a/src/devices/machine/nscsi_cd.cpp b/src/devices/machine/nscsi_cd.cpp
index f1e42854a56..fc1898eecd5 100644
--- a/src/devices/machine/nscsi_cd.cpp
+++ b/src/devices/machine/nscsi_cd.cpp
@@ -126,7 +126,7 @@ void nscsi_cdrom_device::scsi_put_data(int id, int pos, uint8_t data)
void nscsi_cdrom_device::return_no_cd()
{
- sense(false, 3);
+ sense(false, SK_NOT_READY, SK_ASC_MEDIUM_NOT_PRESENT);
scsi_status_complete(SS_CHECK_CONDITION);
}
@@ -142,7 +142,7 @@ void nscsi_cdrom_device::scsi_command()
cur_sector = -1;
// report unit attention condition
- sense(false, 6);
+ sense(false, SK_UNIT_ATTENTION);
scsi_status_complete(SS_CHECK_CONDITION);
return;
}