The NCR5380 now supports 12-byte CDB's correctly (and no longer returns with the return value being undefined), and ignores excess writes to the CDB.

This commit is contained in:
OBattler
2018-10-08 02:24:42 +02:00
parent 4d2918276b
commit a310beaed7

View File

@@ -9,7 +9,7 @@
* Implementation of the NCR 5380 series of SCSI Host Adapters
* made by NCR. These controllers were designed for the ISA bus.
*
* Version: @(#)scsi_ncr5380.c 1.0.18 2018/10/05
* Version: @(#)scsi_ncr5380.c 1.0.19 2018/10/08
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* TheCollector1995, <mariogplayer@gmail.com>
@@ -210,13 +210,15 @@ get_dev_id(uint8_t data)
static int
get_cmd_len(int cbyte)
{
int len;
int len = 12;
int group;
group = (cbyte >> 5) & 7;
if (group == 0) len = 6;
if (group == 1 || group == 2) len = 10;
if (group == 0)
len = 6;
if ((group == 1) || (group == 2))
len = 10;
return(len);
}
@@ -915,6 +917,7 @@ ncr_callback(void *priv)
ncr_t *ncr = &ncr_dev->ncr;
scsi_device_t *dev = &SCSIDevices[ncr->target_id];
int c = 0;
int64_t p;
ncr_log("DMA mode=%d\n", ncr->dma_mode);
@@ -969,13 +972,12 @@ ncr_callback(void *priv)
}
else if (ncr->state == STATE_COMMAND)
{
int64_t p;
/*Command phase, make sure the ICR ACK bit is set to keep on,
because the device must be acknowledged by ICR*/
ncr_log("NCR ICR for Command=%02x\n", ncr->bus_host & BUS_ACK);
if (ncr->bus_host & BUS_ACK)
{
if (get_cmd_len(ncr->command[0]) < ncr->command_pos) {
/*Write command byte to the output data register*/
ncr->command[ncr->command_pos++] = BUS_GETDATA(ncr->bus_host);
@@ -1039,15 +1041,14 @@ ncr_callback(void *priv)
ncr->new_phase = dev->Phase;
if (ncr->new_phase == SCSI_PHASE_DATA_IN)
{
scsi_device_command_phase1(ncr->target_id);
}
ncr->wait_data = 4;
}
}
}
}
}
else if (ncr->state == STATE_DATAIN)
{
dev = &SCSIDevices[ncr->target_id];