Applied upstream patches (adds IBM PS/2 M70.)

Fixed two small bugs.
Moved the MRTHOR back to mainline.
Fixed a bug in the Tosh 1000.
This commit is contained in:
waltje
2018-03-13 00:34:07 -05:00
parent 18634284a6
commit 916f210d46
27 changed files with 1666 additions and 1075 deletions

View File

@@ -10,7 +10,7 @@
* NCR and later Symbios and LSI. This controller was designed
* for the PCI bus.
*
* Version: @(#)scsi_ncr53c810.c 1.0.3 2018/03/08
* Version: @(#)scsi_ncr53c810.c 1.0.4 2018/03/12
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -675,12 +675,13 @@ ncr53c810_add_msg_byte(ncr53c810_t *dev, uint8_t data)
}
static void
static int
ncr53c810_do_command(ncr53c810_t *dev, uint8_t id)
{
scsi_device_t *sd;
uint8_t buf[12];
double period;
int64_t p;
memset(buf, 0, 12);
DMAPageRead(dev->dnad, buf, MIN(12, dev->dbc));
@@ -695,9 +696,9 @@ ncr53c810_do_command(ncr53c810_t *dev, uint8_t id)
if (((id == 0xff) || !scsi_device_present(id, dev->current_lun))) {
ncr53c810_log("(ID=%02i LUN=%02i) SCSI Command 0x%02x: Bad Selection\n", id, dev->current_lun, buf[0]);
ncr53c810_bad_selection(dev, id);
return;
return(0);
}
dev->current = (ncr53c810_request*)malloc(sizeof(ncr53c810_request));
dev->current->tag = id;
@@ -722,21 +723,27 @@ ncr53c810_do_command(ncr53c810_t *dev, uint8_t id)
if ((sd->Phase == SCSI_PHASE_DATA_IN) && (sd->BufferLength > 0)) {
ncr53c810_log("(ID=%02i LUN=%02i) SCSI Command 0x%02x: PHASE_DI\n", id, dev->current_lun, buf[0]);
ncr53c810_set_phase(dev, PHASE_DI);
dev->timer_period = scsi_device_get_callback(dev->current->tag, dev->current_lun);
if (dev->timer_period <= 0LL) {
period = ((double) sd->BufferLength) * 0.2 * ((double) TIMER_USEC); /* Fast SCSI: 10000000 bytes per second */
dev->timer_period = (int64_t) period;
}
p = scsi_device_get_callback(dev->current->tag, dev->current_lun);
if (p <= 0LL) {
period = ((double) sd->BufferLength) * 0.1 * ((double) TIMER_USEC); /* Fast SCSI: 10000000 bytes per second */
dev->timer_period += (int64_t) period;
} else
dev->timer_period += p;
return(1);
} else if ((sd->Phase == SCSI_PHASE_DATA_OUT) && (sd->BufferLength > 0)) {
ncr53c810_log("(ID=%02i LUN=%02i) SCSI Command 0x%02x: PHASE_DO\n", id, dev->current_lun, buf[0]);
ncr53c810_set_phase(dev, PHASE_DO);
dev->timer_period = scsi_device_get_callback(dev->current->tag, dev->current_lun);
if (dev->timer_period <= 0LL) {
period = ((double) sd->BufferLength) * 0.2 * ((double) TIMER_USEC); /* Fast SCSI: 10000000 bytes per second */
dev->timer_period = (int64_t) period;
}
} else
ncr53c810_command_complete(dev, sd->Status);
p = scsi_device_get_callback(dev->current->tag, dev->current_lun);
if (p <= 0LL) {
period = ((double) sd->BufferLength) * 0.1 * ((double) TIMER_USEC); /* Fast SCSI: 10000000 bytes per second */
dev->timer_period += (int64_t) period;
} else
dev->timer_period += p;
return(1);
} else {
ncr53c810_command_complete(dev, sd->Status);
return(0);
}
}
@@ -952,7 +959,7 @@ static void
ncr53c810_process_script(ncr53c810_t *dev)
{
uint32_t insn, addr, id, buf[2], dest;
int opcode, insn_processed = 0, reg, operator, cond, jmp, n, i;
int opcode, insn_processed = 0, reg, operator, cond, jmp, n, i, c;
int32_t offset;
uint8_t op0, op1, data8, mask, data[7], *pp;
@@ -964,7 +971,11 @@ again:
/* If we receive an empty opcode increment the DSP by 4 bytes
instead of 8 and execute the next opcode at that location */
dev->dsp += 4;
goto again;
dev->timer_period += (10LL * TIMER_USEC);
if (insn_processed < 100)
goto again;
else
return;
}
addr = read_dword(dev, dev->dsp + 4);
ncr53c810_log("SCRIPTS dsp=%08x opcode %08x arg %08x\n", dev->dsp, insn, addr);
@@ -976,9 +987,8 @@ again:
case 0: /* Block move. */
ncr53c810_log("00: Block move\n");
if (dev->sist1 & NCR_SIST1_STO) {
ncr53c810_log("Delayed select timeout\n");
ncr53c810_log("Delayed select timeout\n");
dev->sstop = 1;
dev->timer_period = dev->timer_enabled = 0;
break;
}
ncr53c810_log("Block Move DBC=%d\n", dev->dbc);
@@ -1023,9 +1033,18 @@ again:
break;
case PHASE_CMD:
ncr53c810_log("Command Phase\n");
ncr53c810_do_command(dev, dev->sdid);
c = ncr53c810_do_command(dev, dev->sdid);
if (!c || dev->sstop || dev->waiting || ((dev->sstat1 & 0x7) == PHASE_ST))
break;
dev->dfifo = dev->dbc & 0xff;
dev->ctest5 = (dev->ctest5 & 0xfc) | ((dev->dbc >> 8) & 3);
dev->timer_period += (40LL * TIMER_USEC);
if (dev->dcntl & NCR_DCNTL_SSM)
ncr53c810_script_dma_interrupt(dev, NCR_DSTAT_SSI);
return;
case PHASE_ST:
ncr53c810_log("Status Phase\n");
@@ -1198,7 +1217,6 @@ again:
if (dev->sist1 & NCR_SIST1_STO) {
ncr53c810_log("Delayed select timeout\n");
dev->sstop = 1;
dev->timer_period = dev->timer_enabled = 0;
break;
}
cond = jmp = (insn & (1 << 19)) != 0;
@@ -1290,6 +1308,8 @@ again:
ncr53c810_log("%02X: Unknown command\n", (uint8_t) (insn >> 30));
}
dev->timer_period += (40LL * TIMER_USEC);
ncr53c810_log("instructions processed %i\n", insn_processed);
if (insn_processed > 10000 && !dev->waiting) {
/* Some windows drivers make the device spin waiting for a memory
@@ -1325,7 +1345,8 @@ again:
static void
ncr53c810_execute_script(ncr53c810_t *dev)
{
dev->timer_period = 10LL * TIMER_USEC;
dev->sstop = 0;
dev->timer_period = 40LL * TIMER_USEC;
dev->timer_enabled = 1;
}
@@ -1336,18 +1357,18 @@ ncr53c810_callback(void *p)
ncr53c810_t *dev = (ncr53c810_t *) p;
dev->timer_period = 0;
if (!dev->waiting)
ncr53c810_process_script(dev);
if (!dev->sstop) {
if (dev->waiting)
dev->timer_period = 40LL * TIMER_USEC;
else
ncr53c810_process_script(dev);
}
if (dev->sstop) {
dev->timer_period = 0;
dev->timer_enabled = 0;
return;
dev->timer_period = 0;
} else
dev->timer_enabled = 1;
if (dev->timer_period == 0)
dev->timer_period = 50LL * TIMER_USEC;
}

View File

@@ -12,7 +12,7 @@
*
* These controllers were designed for various buses.
*
* Version: @(#)scsi_x54x.c 1.0.6 2018/03/08
* Version: @(#)scsi_x54x.c 1.0.7 2018/03/12
*
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
* Miran Grca, <mgrca8@gmail.com>
@@ -1083,6 +1083,7 @@ x54x_req_setup(x54x_t *dev, uint32_t CCBPointer, Mailbox32_t *Mailbox32)
/* Fetch data from the Command Control Block. */
DMAPageRead(CCBPointer, (uint8_t *)&req->CmdBlock, sizeof(CCB32));
x54x_add_to_period(sizeof(CCB32));
req->Is24bit = dev->Mbx24bit;
req->CCBPointer = CCBPointer;