From 5da955ae0bfd505ca8ce460fb6ef240750acd9fc Mon Sep 17 00:00:00 2001 From: arbee Date: Fri, 29 Nov 2024 22:08:02 -0500 Subject: [PATCH] machine/nscsi_bus.cpp/.h: Add some more framework for future support of later SCSI command sets. [R. Belmont] nscsi/hd.cpp: Support SYNCHRONIZE CACHE command, fix off-by-1 MODE SENSE size reporting. [R. Belmont] --- src/devices/bus/nscsi/hd.cpp | 9 +++++++-- src/devices/machine/nscsi_bus.cpp | 16 +++++++++------- src/devices/machine/nscsi_bus.h | 8 ++++++++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/devices/bus/nscsi/hd.cpp b/src/devices/bus/nscsi/hd.cpp index 8e210e22d10..fe5fc45127b 100644 --- a/src/devices/bus/nscsi/hd.cpp +++ b/src/devices/bus/nscsi/hd.cpp @@ -245,7 +245,7 @@ void nscsi_harddisk_device::scsi_command() case 0x01: // read-write error recovery page scsi_cmdbuf[pos++] = 0x01; // !PS, page id scsi_cmdbuf[pos++] = 0x0a; // page length - scsi_cmdbuf[pos++] = 0; // various bits + scsi_cmdbuf[pos++] = 0x26; // various bits scsi_cmdbuf[pos++] = 0; // read retry count scsi_cmdbuf[pos++] = 0; // correction span scsi_cmdbuf[pos++] = 0; // head offset count @@ -384,7 +384,7 @@ void nscsi_harddisk_device::scsi_command() } if (!fail) { - scsi_cmdbuf[0] = pos; + scsi_cmdbuf[0] = pos - 1; if (pos > size) pos = size; @@ -444,6 +444,11 @@ void nscsi_harddisk_device::scsi_command() break; } + case SC_SYNCHRONIZE_CACHE: + LOG("command SYNCHRONIZE CACHE (10)\n"); + scsi_status_complete(SS_GOOD); + break; + case SC_READ_CAPACITY: { LOG("command READ CAPACITY\n"); diff --git a/src/devices/machine/nscsi_bus.cpp b/src/devices/machine/nscsi_bus.cpp index 1f95b670c44..f9b73ec5540 100644 --- a/src/devices/machine/nscsi_bus.cpp +++ b/src/devices/machine/nscsi_bus.cpp @@ -14,8 +14,8 @@ #define LOG_DATA (1U << 4) #define LOG_DATA_SENT (1U << 5) -//#define VERBOSE (LOG_GENERAL | LOG_STATE | LOG_CONTROL | LOG_DATA) #define VERBOSE (LOG_UNSUPPORTED) +#define LOG_OUTPUT_FUNC osd_printf_info #include "logmacro.h" @@ -217,13 +217,13 @@ const char *const nscsi_full_device::command_names[256] = { /* 50 */ "XDWRITE", "READ_DISC_INFORMATION/XPWRITE", "READ_TRACK_INFORMATION/XDREAD", "RESERVE_TRACK", "SEND_OPC_INFORMATION", "MODE_SELECT_10", "RESERVE_10", "RELEASE_10", /* 58 */ "REPAIR_TRACK", "READ_MASTER_CUE", "MODE_SENSE_10", "CLOSE_TRACK_SESSION", "READ_BUFFER_CAPACITY", "SEND_CUE_SHEET", "PERSISTENT_RESERVE_IN", "PERSISTENT_RESERVE_OUT", /* 80 */ "XDWRITE_EXTENDED", "REBUILD", "REGENERATE", "EXTENDED_COPY", "RECEIVE_COPY_RESULTS", "?", "?", "?", - /* 88 */ "?", "?", "?", "?", "?", "?", "?", "?", - /* 90 */ "?", "?", "?", "?", "?", "?", "?", "?", - /* 98 */ "?", "?", "?", "?", "?", "?", "?", "?", + /* 88 */ "?", "?", "WRITE_16", "?", "?", "?", "?", "?", + /* 90 */ "?", "SYNCHRONIZE_CACHE_16", "?", "WRITE_SAME_16", "?", "?", "?", "?", + /* 98 */ "?", "?", "?", "?", "?", "?", "READ_CAPACITY_166/READ_LONG_16", "WRITE_LONG_16", /* a0 */ "REPORT_LUNS", "BLANK", "SEND_EVENT", "REPORT_DEVICE_IDENTIFIER/SEND_KEY", "SET_DEVICE_IDENTIFIER/REPORT_KEY", "PLAY_AUDIO_12", "LOAD_UNLOAD_MEDIUM", "MOVE_MEDIUM_ATTACHED/SET_READ_AHEAD", /* a8 */ "READ_12", "PLAY_RELATIVE_12", "WRITE_12", "?", "ERASE_12/GET_PERFORMANCE", "READ_DVD_STRUCTURE", "WRITE_AND_VERIFY_12", "VERIFY_12", /* b0 */ "SEARCH_DATA_HIGH_12", "SEARCH_DATA_EQUAL_12", "SEARCH_DATA_LOW_12", "SET_LIMITS_12", "READ_ELEMENT_STATUS_ATTACHED", "?", "SET_STREAMING", "READ_DEFECT_DATA_12", - /* b8 */ "?", "READ_CD_MSF", "SCAN_MMC", "SET_CD_SPEED", "PLAY_CD", "MECHANISM_STATUS", "READ_CD", "SEND_DVD_STRUCTURE", + /* b8 */ "?", "READ_CD_MSF", "SCAN_MMC", "SET_CD_SPEED", "PLAY_CD/SPARE_IN", "MECHANISM_STATUS/SPARE_OUT", "READ_CD", "SEND_DVD_STRUCTURE", /* c0 */ "?", "?", "?", "?", "?", "?", "?", "?", /* c8 */ "?", "?", "?", "?", "?", "?", "?", "?", /* d0 */ "?", "?", "?", "?", "?", "?", "?", "?", @@ -532,7 +532,7 @@ void nscsi_full_device::scsi_put_data(int id, int pos, uint8_t data) scsi_sense_buffer[pos] = data; break; default: - fatalerror("nscsi_full_device::scsi_put_data - unknown id\n"); + fatalerror("nscsi_full_device::scsi_put_data - unknown id %d\n", id); } } @@ -553,7 +553,9 @@ bool nscsi_full_device::scsi_command_done(uint8_t command, uint8_t length) case 4: return true; case 5: return length == 12; case 6: return true; - case 7: return true; + case 7: return length == 32; + case 8: return length == 16; + case 9: return length == 16; } return true; } diff --git a/src/devices/machine/nscsi_bus.h b/src/devices/machine/nscsi_bus.h index 9eaa4c4c5d9..764832ae840 100644 --- a/src/devices/machine/nscsi_bus.h +++ b/src/devices/machine/nscsi_bus.h @@ -603,6 +603,12 @@ class nscsi_full_device : public nscsi_device, public nscsi_slot_card_interface SC_REGENERATE = 0x82, SC_EXTENDED_COPY = 0x83, SC_RECEIVE_COPY_RESULTS = 0x84, + SC_WRITE_16 = 0x8a, + SC_SYNCHRONIZE_CACHE_16 = 0x91, + SC_WRITE_SAME_16 = 0x93, + SC_READ_CAPACITY_16 = 0x9e, + SC_READ_LONG_16 = 0x9e, + SC_WRITE_LONG_16 = 0x9f, SC_REPORT_LUNS = 0xa0, SC_BLANK = 0xa1, SC_SEND_EVENT = 0xa2, @@ -633,7 +639,9 @@ class nscsi_full_device : public nscsi_device, public nscsi_slot_card_interface SC_SCAN_MMC = 0xba, SC_SET_CD_SPEED = 0xbb, SC_PLAY_CD = 0xbc, + SC_SPARE_IN = 0xbc, SC_MECHANISM_STATUS = 0xbd, + SC_SPARE_OUT = 0xbd, SC_READ_CD = 0xbe, SC_SEND_DVD_STRUCTURE = 0xbf };