diff options
author | 2019-03-25 23:13:40 +0100 | |
---|---|---|
committer | 2019-03-25 23:13:40 +0100 | |
commit | b380514764cf857469bae61c11143a19f79a74c5 (patch) | |
tree | 63c8012e262618f08a332da31dd714281aa2c5ed /src/devices/machine/nscsi_bus.cpp | |
parent | c24473ddff715ecec2e258a6eb38960cf8c8e98e (diff) |
Revert "conflict resolution (nw)"
This reverts commit c24473ddff715ecec2e258a6eb38960cf8c8e98e, reversing
changes made to 009cba4fb8102102168ef32870892438327f3705.
Diffstat (limited to 'src/devices/machine/nscsi_bus.cpp')
-rw-r--r-- | src/devices/machine/nscsi_bus.cpp | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/src/devices/machine/nscsi_bus.cpp b/src/devices/machine/nscsi_bus.cpp index ef3c0dd9f9a..328dd7239bd 100644 --- a/src/devices/machine/nscsi_bus.cpp +++ b/src/devices/machine/nscsi_bus.cpp @@ -3,15 +3,13 @@ #include "emu.h" #include "nscsi_bus.h" -#define LOG_GENERAL (1U << 0) -#define LOG_UNSUPPORTED (1U << 1) -#define LOG_STATE (1U << 2) -#define LOG_CONTROL (1U << 3) -#define LOG_DATA (1U << 4) -#define LOG_DATA_SENT (1U << 5) +#define LOG_GENERAL (1U << 0) +#define LOG_STATE (1U << 1) +#define LOG_CONTROL (1U << 2) +#define LOG_DATA (1U << 3) //#define VERBOSE (LOG_GENERAL | LOG_STATE | LOG_CONTROL | LOG_DATA) -#define VERBOSE (LOG_UNSUPPORTED | LOG_DATA_SENT) +#define VERBOSE 0 #include "logmacro.h" @@ -442,7 +440,7 @@ void nscsi_full_device::step(bool timeout) break; } - if(scsi_command_done(scsi_cmdbuf[0], data_buffer_pos)) { + if(command_done()) { scsi_cmdsize = data_buffer_pos; scsi_bus->ctrl_wait(scsi_refid, 0, S_ACK); scsi_command(); @@ -509,17 +507,18 @@ void nscsi_full_device::target_send_buffer_byte() target_send_byte(scsi_get_data(data_buffer_id, data_buffer_pos++)); } -bool nscsi_full_device::scsi_command_done(uint8_t command, uint8_t length) +bool nscsi_full_device::command_done() { - if(!length) + if(!data_buffer_pos) return false; - switch(command >> 5) { - case 0: return length == 6; - case 1: return length == 10; - case 2: return length == 10; + uint8_t h = scsi_cmdbuf[0]; + switch(h >> 5) { + case 0: return data_buffer_pos == 6; + case 1: return data_buffer_pos == 10; + case 2: return data_buffer_pos == 10; case 3: return true; case 4: return true; - case 5: return length == 12; + case 5: return data_buffer_pos == 12; case 6: return true; case 7: return true; } @@ -563,17 +562,6 @@ void nscsi_full_device::scsi_status_complete(uint8_t st) void nscsi_full_device::scsi_data_in(int buf, int size) { - if((VERBOSE & LOG_DATA_SENT) && buf == 0) { - std::string dt = ""; - int sz = size; - if(sz > 50) - sz = 50; - for(int i=0; i<sz; i++) - dt += util::string_format(" %02x", scsi_cmdbuf[i]); - if(size > sz) - dt += " ..."; - LOGMASKED(LOG_DATA_SENT, "Sending data (%d)%s\n", size, dt); - } control *c; c = buf_control_push(); c->action = BC_DATA_IN; @@ -595,28 +583,31 @@ void nscsi_full_device::sense(bool deferred, uint8_t key, uint8_t asc, uint8_t a memset(scsi_sense_buffer, 0, sizeof(scsi_sense_buffer)); scsi_sense_buffer[0] = deferred ? 0x71 : 0x70; scsi_sense_buffer[2] = key; - scsi_sense_buffer[7] = sizeof(scsi_sense_buffer) - 8; scsi_sense_buffer[12] = asc; scsi_sense_buffer[13] = ascq; } void nscsi_full_device::scsi_unknown_command() { - std::string txt = util::string_format("Unhandled command %s (%d):", command_names[scsi_cmdbuf[0]], scsi_cmdsize); + LOG("Unhandled command %s", command_names[scsi_cmdbuf[0]]); for(int i=0; i != scsi_cmdsize; i++) - txt += util::string_format(" %02x", scsi_cmdbuf[i]); - LOGMASKED(LOG_UNSUPPORTED, "%s\n", txt); + logerror(" %02x", scsi_cmdbuf[i]); + logerror("\n"); scsi_status_complete(SS_CHECK_CONDITION); - sense(false, SK_ILLEGAL_REQUEST); + sense(false, 5); } void nscsi_full_device::scsi_command() { switch(scsi_cmdbuf[0]) { case SC_REQUEST_SENSE: - LOG("command REQUEST SENSE alloc=%d\n", scsi_cmdbuf[4]); - scsi_data_in(SBUF_SENSE, scsi_cmdbuf[4] ? std::min(scsi_cmdbuf[4], u8(sizeof(scsi_sense_buffer))) : 4); + LOG("command REQUEST SENSE\n"); + /* + * Targets shall be capable of returning eighteen bytes of data in + * response to a REQUEST SENSE command. + */ + scsi_data_in(SBUF_SENSE, 18); scsi_status_complete(SS_GOOD); break; default: @@ -632,10 +623,10 @@ void nscsi_full_device::scsi_message() return; } - std::string txt = "Unknown message"; + LOG("Unknown message"); for(int i=0; i != scsi_cmdsize; i++) - txt += util::string_format(" %02x", scsi_cmdbuf[i]); - LOGMASKED(LOG_UNSUPPORTED, "%s\n", txt); + logerror(" %02x", scsi_cmdbuf[i]); + logerror("\n"); } int nscsi_full_device::get_lun(int def) @@ -649,7 +640,9 @@ int nscsi_full_device::get_lun(int def) void nscsi_full_device::bad_lun() { scsi_status_complete(SS_CHECK_CONDITION); - sense(false, SK_ILLEGAL_REQUEST, SK_ASC_LOGICAL_UNIT_NOT_SUPPORTED); + + // key:illegal request, asc:logical unit not supported + sense(false, 5, 0x25); } // Arbitration delay (2.4us) |