Fixed the NCR 53c825A/53c875 RAM PCI BAR operation.
This commit is contained in:
@@ -808,6 +808,21 @@ ncr53c8xx_do_status(ncr53c8xx_t *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_WDTR
|
||||||
|
static void
|
||||||
|
ncr53c8xx_do_wdtr(ncr53c8xx_t *dev, int exponent)
|
||||||
|
{
|
||||||
|
ncr53c8xx_log("Target-initiated WDTR (%08X)\n", dev);
|
||||||
|
ncr53c8xx_set_phase(dev, PHASE_MI);
|
||||||
|
dev->msg_action = 4;
|
||||||
|
ncr53c8xx_add_msg_byte(dev, 0x01); /* EXTENDED MESSAGE */
|
||||||
|
ncr53c8xx_add_msg_byte(dev, 0x02); /* EXTENDED MESSAGE LENGTH */
|
||||||
|
ncr53c8xx_add_msg_byte(dev, 0x03); /* WIDE DATA TRANSFER REQUEST */
|
||||||
|
ncr53c8xx_add_msg_byte(dev, exponent); /* TRANSFER WIDTH EXPONENT (16-bit) */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ncr53c8xx_do_msgin(ncr53c8xx_t *dev)
|
ncr53c8xx_do_msgin(ncr53c8xx_t *dev)
|
||||||
{
|
{
|
||||||
@@ -839,6 +854,9 @@ ncr53c8xx_do_msgin(ncr53c8xx_t *dev)
|
|||||||
case 3:
|
case 3:
|
||||||
ncr53c8xx_set_phase(dev, PHASE_DI);
|
ncr53c8xx_set_phase(dev, PHASE_DI);
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
ncr53c8xx_set_phase(dev, PHASE_MO);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@@ -881,15 +899,15 @@ static void
|
|||||||
ncr53c8xx_do_msgout(ncr53c8xx_t *dev, uint8_t id)
|
ncr53c8xx_do_msgout(ncr53c8xx_t *dev, uint8_t id)
|
||||||
{
|
{
|
||||||
uint8_t msg;
|
uint8_t msg;
|
||||||
int len;
|
int len, arg;
|
||||||
#ifdef ENABLE_NCR53C8xx_LOG
|
#ifdef ENABLE_NCR53C8XX_LOG
|
||||||
uint32_t current_tag;
|
uint32_t current_tag;
|
||||||
#endif
|
#endif
|
||||||
scsi_device_t *sd;
|
scsi_device_t *sd;
|
||||||
|
|
||||||
sd = &scsi_devices[id];
|
sd = &scsi_devices[id];
|
||||||
|
|
||||||
#ifdef ENABLE_NCR53C8xx_LOG
|
#ifdef ENABLE_NCR53C8XX_LOG
|
||||||
current_tag = id;
|
current_tag = id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -910,20 +928,27 @@ ncr53c8xx_do_msgout(ncr53c8xx_t *dev, uint8_t id)
|
|||||||
case 0x01:
|
case 0x01:
|
||||||
len = ncr53c8xx_get_msgbyte(dev);
|
len = ncr53c8xx_get_msgbyte(dev);
|
||||||
msg = ncr53c8xx_get_msgbyte(dev);
|
msg = ncr53c8xx_get_msgbyte(dev);
|
||||||
|
arg = ncr53c8xx_get_msgbyte(dev);
|
||||||
(void) len; /* avoid a warning about unused variable*/
|
(void) len; /* avoid a warning about unused variable*/
|
||||||
ncr53c8xx_log("Extended message 0x%x (len %d)\n", msg, len);
|
ncr53c8xx_log("Extended message 0x%x (len %d)\n", msg, len);
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case 1:
|
case 1:
|
||||||
ncr53c8xx_log("SDTR (ignored)\n");
|
ncr53c8xx_log("SDTR (ignored)\n");
|
||||||
ncr53c8xx_skip_msgbytes(dev, 2);
|
ncr53c8xx_skip_msgbytes(dev, 1);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ncr53c8xx_log("WDTR (ignored)\n");
|
ncr53c8xx_log("WDTR (ignored)\n");
|
||||||
ncr53c8xx_skip_msgbytes(dev, 1);
|
if (arg > 0x01) {
|
||||||
|
ncr53c8xx_bad_message(dev, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#ifdef USE_WDTR
|
||||||
|
ncr53c8xx_set_phase(dev, PHASE_CMD);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ncr53c8xx_log("PPR (ignored)\n");
|
ncr53c8xx_log("PPR (ignored)\n");
|
||||||
ncr53c8xx_skip_msgbytes(dev, 5);
|
ncr53c8xx_skip_msgbytes(dev, 4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ncr53c8xx_bad_message(dev, msg);
|
ncr53c8xx_bad_message(dev, msg);
|
||||||
@@ -964,7 +989,11 @@ ncr53c8xx_do_msgout(ncr53c8xx_t *dev, uint8_t id)
|
|||||||
ncr53c8xx_log("MSG: Identify\n");
|
ncr53c8xx_log("MSG: Identify\n");
|
||||||
dev->current_lun = msg & 7;
|
dev->current_lun = msg & 7;
|
||||||
ncr53c8xx_log("Select LUN %d\n", dev->current_lun);
|
ncr53c8xx_log("Select LUN %d\n", dev->current_lun);
|
||||||
|
#ifdef USE_WDTR
|
||||||
|
ncr53c8xx_do_wdtr(dev, 0x01);
|
||||||
|
#else
|
||||||
ncr53c8xx_set_phase(dev, PHASE_CMD);
|
ncr53c8xx_set_phase(dev, PHASE_CMD);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -997,7 +1026,7 @@ ncr53c8xx_process_script(ncr53c8xx_t *dev)
|
|||||||
int opcode, insn_processed = 0, reg, operator, cond, jmp, n, i, c;
|
int opcode, insn_processed = 0, reg, operator, cond, jmp, n, i, c;
|
||||||
int32_t offset;
|
int32_t offset;
|
||||||
uint8_t op0, op1, data8, mask, data[7];
|
uint8_t op0, op1, data8, mask, data[7];
|
||||||
#ifdef ENABLE_NCR53C8xx_LOG
|
#ifdef ENABLE_NCR53C8XX_LOG
|
||||||
uint8_t *pp;
|
uint8_t *pp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1324,7 +1353,7 @@ again:
|
|||||||
dev->dsp += 4;
|
dev->dsp += 4;
|
||||||
ncr53c8xx_memcpy(dev, dest, addr, insn & 0xffffff);
|
ncr53c8xx_memcpy(dev, dest, addr, insn & 0xffffff);
|
||||||
} else {
|
} else {
|
||||||
#ifdef ENABLE_NCR53C8xx_LOG
|
#ifdef ENABLE_NCR53C8XX_LOG
|
||||||
pp = data;
|
pp = data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2496,6 +2525,11 @@ ncr53c8xx_pci_write(int func, int addr, uint8_t val, void *p)
|
|||||||
ncr53c8xx_mem_disable(dev);
|
ncr53c8xx_mem_disable(dev);
|
||||||
if ((dev->MMIOBase != 0) && (val & PCI_COMMAND_MEM))
|
if ((dev->MMIOBase != 0) && (val & PCI_COMMAND_MEM))
|
||||||
ncr53c8xx_mem_set_addr(dev, dev->MMIOBase);
|
ncr53c8xx_mem_set_addr(dev, dev->MMIOBase);
|
||||||
|
if (dev->chip >= CHIP_825) {
|
||||||
|
ncr53c8xx_ram_disable(dev);
|
||||||
|
if ((dev->RAMBase != 0) && (val & PCI_COMMAND_MEM))
|
||||||
|
ncr53c8xx_ram_set_addr(dev, dev->RAMBase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ncr53c8xx_pci_regs[addr] = val & 0x57;
|
ncr53c8xx_pci_regs[addr] = val & 0x57;
|
||||||
break;
|
break;
|
||||||
@@ -2541,9 +2575,8 @@ ncr53c8xx_pci_write(int func, int addr, uint8_t val, void *p)
|
|||||||
ncr53c8xx_log("NCR53c8xx: New MMIO base is %08X\n" , dev->MMIOBase);
|
ncr53c8xx_log("NCR53c8xx: New MMIO base is %08X\n" , dev->MMIOBase);
|
||||||
/* We're done, so get out of the here. */
|
/* We're done, so get out of the here. */
|
||||||
if (ncr53c8xx_pci_regs[4] & PCI_COMMAND_MEM) {
|
if (ncr53c8xx_pci_regs[4] & PCI_COMMAND_MEM) {
|
||||||
if (dev->MMIOBase != 0) {
|
if (dev->MMIOBase != 0)
|
||||||
ncr53c8xx_mem_set_addr(dev, dev->MMIOBase);
|
ncr53c8xx_mem_set_addr(dev, dev->MMIOBase);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2561,8 +2594,10 @@ ncr53c8xx_pci_write(int func, int addr, uint8_t val, void *p)
|
|||||||
/* Log the new base. */
|
/* Log the new base. */
|
||||||
ncr53c8xx_log("NCR53c8xx: New RAM base is %08X\n" , dev->RAMBase);
|
ncr53c8xx_log("NCR53c8xx: New RAM base is %08X\n" , dev->RAMBase);
|
||||||
/* We're done, so get out of the here. */
|
/* We're done, so get out of the here. */
|
||||||
if (dev->RAMBase != 0)
|
if (ncr53c8xx_pci_regs[4] & PCI_COMMAND_MEM) {
|
||||||
ncr53c8xx_ram_set_addr(dev, dev->RAMBase);
|
if (dev->RAMBase != 0)
|
||||||
|
ncr53c8xx_ram_set_addr(dev, dev->RAMBase);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef USE_BIOS_BAR
|
#ifdef USE_BIOS_BAR
|
||||||
|
Reference in New Issue
Block a user