From a1a23add718137b43519394121336c187e6e6020 Mon Sep 17 00:00:00 2001 From: Patrick Mackinlay Date: Tue, 2 Oct 2018 13:59:39 +0700 Subject: [PATCH] ncr5390: various fixes (nw) Several important fixes that help Sun4 (can now boot Solaris 2.3 from CD-ROM) and Jazz work better. * Fix stupid virtual/override errors preventing ncr53c90a+ from working properly. * Start DMA after arbitration/selection is completed for "select with..." commands. * Trigger an interrupt on SCSI bus reset (if enabled). --- src/devices/machine/ncr5390.cpp | 16 +++++++++++++--- src/devices/machine/ncr5390.h | 18 +++++++++--------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/devices/machine/ncr5390.cpp b/src/devices/machine/ncr5390.cpp index 135bcdb9705..62c62a038b6 100644 --- a/src/devices/machine/ncr5390.cpp +++ b/src/devices/machine/ncr5390.cpp @@ -407,10 +407,15 @@ void ncr5390_device::step(bool timeout) case DISC_SEL_ARBITRATION_INIT: // wait until a command is in the fifo - if (!fifo_pos && dma_command && !(status & S_TC0)) + if (!fifo_pos && dma_command && !(status & S_TC0)) { + // dma starts after bus arbitration/selection is complete + dma_set(DMA_OUT); + step(false); break; + } - command_length = derive_msg_size(fifo[0]); + // "with atn" variants have a message byte before the command descriptor + command_length = (c == CD_SELECT) ? derive_msg_size(fifo[0]) : 1; state = DISC_SEL_ARBITRATION; step(false); break; @@ -850,6 +855,12 @@ void ncr5390_device::start_command() case CM_RESET_BUS: LOGMASKED(LOG_COMMAND, "Reset SCSI bus\n"); reset_soft(); + // FIXME: this interrupt should be generated when the reset is reflected + // back into the device, and not when the device starts the scsi reset + if (!(config & 0x40)) { + istatus = I_SCSI_RESET; + check_irq(); + } break; case CD_RESELECT: @@ -867,7 +878,6 @@ void ncr5390_device::start_command() "Select with ATN and stop sequence\n"); seq = 0; state = DISC_SEL_ARBITRATION_INIT; - dma_set(dma_command ? DMA_OUT : DMA_NONE); arbitrate(); break; diff --git a/src/devices/machine/ncr5390.h b/src/devices/machine/ncr5390.h index d39b352ddb7..bf301bed266 100644 --- a/src/devices/machine/ncr5390.h +++ b/src/devices/machine/ncr5390.h @@ -35,7 +35,7 @@ public: DECLARE_WRITE8_MEMBER(fifo_w); DECLARE_READ8_MEMBER(command_r); DECLARE_WRITE8_MEMBER(command_w); - DECLARE_READ8_MEMBER(status_r); + virtual DECLARE_READ8_MEMBER(status_r); DECLARE_WRITE8_MEMBER(bus_id_w); DECLARE_READ8_MEMBER(istatus_r); DECLARE_WRITE8_MEMBER(timeout_w); @@ -236,7 +236,7 @@ protected: void check_irq(); protected: - void reset_soft(); + virtual void reset_soft(); private: void reset_disconnect(); @@ -262,19 +262,19 @@ public: virtual void map(address_map &map) override; - DECLARE_READ8_MEMBER(status_r); + virtual DECLARE_READ8_MEMBER(status_r) override; DECLARE_READ8_MEMBER(conf2_r) { return config2; }; DECLARE_WRITE8_MEMBER(conf2_w) { config2 = data; }; - DECLARE_READ8_MEMBER(read) override; - DECLARE_WRITE8_MEMBER(write) override; + virtual DECLARE_READ8_MEMBER(read) override; + virtual DECLARE_WRITE8_MEMBER(write) override; protected: ncr53c90a_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); virtual void device_start() override; - void reset_soft(); + virtual void reset_soft() override; virtual bool check_valid_command(uint8_t cmd) override; @@ -298,12 +298,12 @@ public: DECLARE_WRITE8_MEMBER(conf3_w) { config3 = data; }; DECLARE_WRITE8_MEMBER(fifo_align_w) { fifo_align = data; }; - DECLARE_READ8_MEMBER(read) override; - DECLARE_WRITE8_MEMBER(write) override; + virtual DECLARE_READ8_MEMBER(read) override; + virtual DECLARE_WRITE8_MEMBER(write) override; protected: virtual void device_start() override; - void reset_soft(); + virtual void reset_soft() override; private: u8 config3;