Commit 30f7395a authored by Doug Ledford's avatar Doug Ledford Committed by Linus Torvalds

[PATCH] redo of scsi.h changes

Start removing items from scsi.h that are driver specific and provide a
patch to NCR53C9x.? that switches to driver private storage instead as
an example of how drivers should do private struct storage
parent 3a756e7a
...@@ -869,17 +869,19 @@ static int esp_host_info(struct NCR_ESP *esp, char *ptr, off_t offset, int len) ...@@ -869,17 +869,19 @@ static int esp_host_info(struct NCR_ESP *esp, char *ptr, off_t offset, int len)
for(i = 0; i < 15; i++) { for(i = 0; i < 15; i++) {
if(esp->targets_present & (1 << i)) { if(esp->targets_present & (1 << i)) {
Scsi_Device *SDptr = esp->ehost->host_queue; Scsi_Device *SDptr = esp->ehost->host_queue;
struct ESP_device *esp_dev;
while((SDptr->host != esp->ehost) && while((SDptr->host != esp->ehost) &&
(SDptr->id != i) && (SDptr->id != i) &&
(SDptr->next)) (SDptr->next))
SDptr = SDptr->next; SDptr = SDptr->next;
esp_dev = SDptr->hostdata;
copy_info(&info, "%d\t\t", i); copy_info(&info, "%d\t\t", i);
copy_info(&info, "%08lx\t", esp->config3[i]); copy_info(&info, "%08lx\t", esp->config3[i]);
copy_info(&info, "[%02lx,%02lx]\t\t\t", SDptr->sync_max_offset, copy_info(&info, "[%02lx,%02lx]\t\t\t", esp_dev->sync_max_offset,
SDptr->sync_min_period); esp_dev->sync_min_period);
copy_info(&info, "%s\n", SDptr->disconnect ? "yes" : "no"); copy_info(&info, "%s\n", esp_dev->disconnect ? "yes" : "no");
} }
} }
...@@ -1012,6 +1014,7 @@ static inline void build_sync_nego_msg(struct NCR_ESP *esp, int period, int offs ...@@ -1012,6 +1014,7 @@ static inline void build_sync_nego_msg(struct NCR_ESP *esp, int period, int offs
static void esp_exec_cmd(struct NCR_ESP *esp) static void esp_exec_cmd(struct NCR_ESP *esp)
{ {
struct ESP_regs *eregs = esp->eregs; struct ESP_regs *eregs = esp->eregs;
struct ESP_device *esp_dev;
Scsi_Cmnd *SCptr; Scsi_Cmnd *SCptr;
Scsi_Device *SDptr; Scsi_Device *SDptr;
volatile unchar *cmdp = esp->esp_command; volatile unchar *cmdp = esp->esp_command;
...@@ -1033,9 +1036,29 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1033,9 +1036,29 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
panic("esp: esp_exec_cmd and issue queue is NULL"); panic("esp: esp_exec_cmd and issue queue is NULL");
SDptr = SCptr->device; SDptr = SCptr->device;
esp_dev = SDptr->hostdata;
lun = SCptr->lun; lun = SCptr->lun;
target = SCptr->target; target = SCptr->target;
/*
* If esp_dev == NULL then we need to allocate a struct for our data
*/
if(esp_dev == NULL) {
esp_dev = kmalloc(sizeof(struct ESP_device), GFP_ATOMIC);
if(esp_dev == NULL) {
/* We're SOL. Print a message and bail */
printk(KERN_WARNING "esp: no mem for ESP_device %d/%d\n",
target, lun);
esp->current_SC = NULL;
SCptr->result = DID_ERROR << 16;
SCptr->done(SCptr);
return;
}
memset(esp_dev, 0, sizeof(struct ESP_device));
SDptr->hostdata = esp_dev;
}
esp->snip = 0; esp->snip = 0;
esp->msgout_len = 0; esp->msgout_len = 0;
...@@ -1071,12 +1094,12 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1071,12 +1094,12 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
* selections should not confuse SCSI-1 we hope. * selections should not confuse SCSI-1 we hope.
*/ */
if(SDptr->sync) { if(esp_dev->sync) {
/* this targets sync is known */ /* this targets sync is known */
#ifdef CONFIG_SCSI_MAC_ESP #ifdef CONFIG_SCSI_MAC_ESP
do_sync_known: do_sync_known:
#endif #endif
if(SDptr->disconnect) if(esp_dev->disconnect)
*cmdp++ = IDENTIFY(1, lun); *cmdp++ = IDENTIFY(1, lun);
else else
*cmdp++ = IDENTIFY(0, lun); *cmdp++ = IDENTIFY(0, lun);
...@@ -1088,7 +1111,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1088,7 +1111,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
the_esp_command = (ESP_CMD_SELA | ESP_CMD_DMA); the_esp_command = (ESP_CMD_SELA | ESP_CMD_DMA);
esp_advance_phase(SCptr, in_slct_norm); esp_advance_phase(SCptr, in_slct_norm);
} }
} else if(!(esp->targets_present & (1<<target)) || !(SDptr->disconnect)) { } else if(!(esp->targets_present & (1<<target)) || !(esp_dev->disconnect)) {
/* After the bootup SCSI code sends both the /* After the bootup SCSI code sends both the
* TEST_UNIT_READY and INQUIRY commands we want * TEST_UNIT_READY and INQUIRY commands we want
* to at least attempt allowing the device to * to at least attempt allowing the device to
...@@ -1096,8 +1119,8 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1096,8 +1119,8 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
*/ */
ESPMISC(("esp: Selecting device for first time. target=%d " ESPMISC(("esp: Selecting device for first time. target=%d "
"lun=%d\n", target, SCptr->lun)); "lun=%d\n", target, SCptr->lun));
if(!SDptr->borken && !SDptr->disconnect) if(!SDptr->borken && !esp_dev->disconnect)
SDptr->disconnect = 1; esp_dev->disconnect = 1;
*cmdp++ = IDENTIFY(0, lun); *cmdp++ = IDENTIFY(0, lun);
esp->prevmsgout = NOP; esp->prevmsgout = NOP;
...@@ -1105,8 +1128,8 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1105,8 +1128,8 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
the_esp_command = (ESP_CMD_SELA | ESP_CMD_DMA); the_esp_command = (ESP_CMD_SELA | ESP_CMD_DMA);
/* Take no chances... */ /* Take no chances... */
SDptr->sync_max_offset = 0; esp_dev->sync_max_offset = 0;
SDptr->sync_min_period = 0; esp_dev->sync_min_period = 0;
} else { } else {
int toshiba_cdrom_hwbug_wkaround = 0; int toshiba_cdrom_hwbug_wkaround = 0;
...@@ -1115,10 +1138,10 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1115,10 +1138,10 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
* Macintosh. Well, maybe later when we figured out how to * Macintosh. Well, maybe later when we figured out how to
* do DMA on the machines that support it ... * do DMA on the machines that support it ...
*/ */
SDptr->disconnect = 1; esp_dev->disconnect = 1;
SDptr->sync_max_offset = 0; esp_dev->sync_max_offset = 0;
SDptr->sync_min_period = 0; esp_dev->sync_min_period = 0;
SDptr->sync = 1; esp_dev->sync = 1;
esp->snip = 0; esp->snip = 0;
goto do_sync_known; goto do_sync_known;
#endif #endif
...@@ -1140,7 +1163,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1140,7 +1163,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
} else { } else {
build_sync_nego_msg(esp, 0, 0); build_sync_nego_msg(esp, 0, 0);
} }
SDptr->sync = 1; esp_dev->sync = 1;
esp->snip = 1; esp->snip = 1;
/* A fix for broken SCSI1 targets, when they disconnect /* A fix for broken SCSI1 targets, when they disconnect
...@@ -1170,7 +1193,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1170,7 +1193,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
toshiba_cdrom_hwbug_wkaround || SDptr->borken) { toshiba_cdrom_hwbug_wkaround || SDptr->borken) {
ESPMISC((KERN_INFO "esp%d: Disabling DISCONNECT for target %d " ESPMISC((KERN_INFO "esp%d: Disabling DISCONNECT for target %d "
"lun %d\n", esp->esp_id, SCptr->target, SCptr->lun)); "lun %d\n", esp->esp_id, SCptr->target, SCptr->lun));
SDptr->disconnect = 0; esp_dev->disconnect = 0;
*cmdp++ = IDENTIFY(0, lun); *cmdp++ = IDENTIFY(0, lun);
} else { } else {
*cmdp++ = IDENTIFY(1, lun); *cmdp++ = IDENTIFY(1, lun);
...@@ -1192,13 +1215,13 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1192,13 +1215,13 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
*cmdp++ = SCptr->cmnd[i]; *cmdp++ = SCptr->cmnd[i];
esp_write(eregs->esp_busid, (target & 7)); esp_write(eregs->esp_busid, (target & 7));
if (esp->prev_soff != SDptr->sync_max_offset || if (esp->prev_soff != esp_dev->sync_max_offset ||
esp->prev_stp != SDptr->sync_min_period || esp->prev_stp != esp_dev->sync_min_period ||
(esp->erev > esp100a && (esp->erev > esp100a &&
esp->prev_cfg3 != esp->config3[target])) { esp->prev_cfg3 != esp->config3[target])) {
esp->prev_soff = SDptr->sync_max_offset; esp->prev_soff = esp_dev->sync_max_offset;
esp_write(eregs->esp_soff, esp->prev_soff); esp_write(eregs->esp_soff, esp->prev_soff);
esp->prev_stp = SDptr->sync_min_period; esp->prev_stp = esp_dev->sync_min_period;
esp_write(eregs->esp_stp, esp->prev_stp); esp_write(eregs->esp_stp, esp->prev_stp);
if(esp->erev > esp100a) { if(esp->erev > esp100a) {
esp->prev_cfg3 = esp->config3[target]; esp->prev_cfg3 = esp->config3[target];
...@@ -1697,14 +1720,15 @@ static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs, ...@@ -1697,14 +1720,15 @@ static inline void esp_connect(struct NCR_ESP *esp, struct ESP_regs *eregs,
Scsi_Cmnd *sp) Scsi_Cmnd *sp)
{ {
Scsi_Device *dp = sp->device; Scsi_Device *dp = sp->device;
struct ESP_device *esp_dev = dp->hostdata;
if(esp->prev_soff != dp->sync_max_offset || if(esp->prev_soff != esp_dev->sync_max_offset ||
esp->prev_stp != dp->sync_min_period || esp->prev_stp != esp_dev->sync_min_period ||
(esp->erev > esp100a && (esp->erev > esp100a &&
esp->prev_cfg3 != esp->config3[sp->target])) { esp->prev_cfg3 != esp->config3[sp->target])) {
esp->prev_soff = dp->sync_max_offset; esp->prev_soff = esp_dev->sync_max_offset;
esp_write(eregs->esp_soff, esp->prev_soff); esp_write(eregs->esp_soff, esp->prev_soff);
esp->prev_stp = dp->sync_min_period; esp->prev_stp = esp_dev->sync_min_period;
esp_write(eregs->esp_stp, esp->prev_stp); esp_write(eregs->esp_stp, esp->prev_stp);
if(esp->erev > esp100a) { if(esp->erev > esp100a) {
esp->prev_cfg3 = esp->config3[sp->target]; esp->prev_cfg3 = esp->config3[sp->target];
...@@ -1837,8 +1861,8 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -1837,8 +1861,8 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
else else
ESPDATA(( /*"\n"*/ "\r")); ESPDATA(( /*"\n"*/ "\r"));
#endif #endif
save_flags(flags);
#if 0 #if 0
save_flags(flags);
cli(); cli();
#endif #endif
if(thisphase == in_datain) { if(thisphase == in_datain) {
...@@ -1929,7 +1953,9 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -1929,7 +1953,9 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
if (hmuch == 0) if (hmuch == 0)
ESPDATA(("done! \n")); ESPDATA(("done! \n"));
#if 0
restore_flags(flags); restore_flags(flags);
#endif
/* check new bus phase */ /* check new bus phase */
if (newphase != oldphase && i < esp->current_transfer_size) { if (newphase != oldphase && i < esp->current_transfer_size) {
...@@ -1981,6 +2007,7 @@ static int esp_do_data_finale(struct NCR_ESP *esp, ...@@ -1981,6 +2007,7 @@ static int esp_do_data_finale(struct NCR_ESP *esp,
struct ESP_regs *eregs) struct ESP_regs *eregs)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; Scsi_Cmnd *SCptr = esp->current_SC;
struct ESP_device *esp_dev = SCptr->device->hostdata;
int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0; int bogus_data = 0, bytes_sent = 0, fifocnt, ecount = 0;
if(esp->dma_led_off) if(esp->dma_led_off)
...@@ -2031,7 +2058,7 @@ static int esp_do_data_finale(struct NCR_ESP *esp, ...@@ -2031,7 +2058,7 @@ static int esp_do_data_finale(struct NCR_ESP *esp,
ecount, fifocnt)); ecount, fifocnt));
/* If we were in synchronous mode, check for peculiarities. */ /* If we were in synchronous mode, check for peculiarities. */
if(SCptr->device->sync_max_offset) if(esp_dev->sync_max_offset)
bogus_data = esp100_sync_hwbug(esp, eregs, SCptr, fifocnt); bogus_data = esp100_sync_hwbug(esp, eregs, SCptr, fifocnt);
else else
esp_cmd(esp, eregs, ESP_CMD_FLUSH); esp_cmd(esp, eregs, ESP_CMD_FLUSH);
...@@ -2102,7 +2129,7 @@ static int esp_do_data_finale(struct NCR_ESP *esp, ...@@ -2102,7 +2129,7 @@ static int esp_do_data_finale(struct NCR_ESP *esp,
ESPLOG(("esp%d: Forcing async for target %d\n", esp->esp_id, ESPLOG(("esp%d: Forcing async for target %d\n", esp->esp_id,
SCptr->target)); SCptr->target));
SCptr->device->borken = 1; SCptr->device->borken = 1;
SCptr->device->sync = 0; esp_dev->sync = 0;
bytes_sent = 0; bytes_sent = 0;
} }
...@@ -2201,6 +2228,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2201,6 +2228,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)
esp->msgout_len = 0; esp->msgout_len = 0;
esp->prevmsgout = NOP; esp->prevmsgout = NOP;
if(esp->prevmsgin == COMMAND_COMPLETE) { if(esp->prevmsgin == COMMAND_COMPLETE) {
struct ESP_device *esp_dev = SCptr->device->hostdata;
/* Normal end of nexus. */ /* Normal end of nexus. */
if(esp->disconnected_SC) if(esp->disconnected_SC)
esp_cmd(esp, eregs, ESP_CMD_ESEL); esp_cmd(esp, eregs, ESP_CMD_ESEL);
...@@ -2208,8 +2236,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2208,8 +2236,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)
if(SCptr->SCp.Status != GOOD && if(SCptr->SCp.Status != GOOD &&
SCptr->SCp.Status != CONDITION_GOOD && SCptr->SCp.Status != CONDITION_GOOD &&
((1<<SCptr->target) & esp->targets_present) && ((1<<SCptr->target) & esp->targets_present) &&
SCptr->device->sync && esp_dev->sync && esp_dev->sync_max_offset) {
SCptr->device->sync_max_offset) {
/* SCSI standard says that the synchronous capabilities /* SCSI standard says that the synchronous capabilities
* should be renegotiated at this point. Most likely * should be renegotiated at this point. Most likely
* we are about to request sense from this target * we are about to request sense from this target
...@@ -2227,7 +2254,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2227,7 +2254,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)
* loading up a tape. * loading up a tape.
*/ */
if(esp_should_clear_sync(SCptr) != 0) if(esp_should_clear_sync(SCptr) != 0)
SCptr->device->sync = 0; esp_dev->sync = 0;
} }
ESPDISC(("F<%02x,%02x>", SCptr->target, SCptr->lun)); ESPDISC(("F<%02x,%02x>", SCptr->target, SCptr->lun));
esp_done(esp, ((SCptr->SCp.Status & 0xff) | esp_done(esp, ((SCptr->SCp.Status & 0xff) |
...@@ -2476,7 +2503,7 @@ static int esp_disconnect_amidst_phases(struct NCR_ESP *esp, ...@@ -2476,7 +2503,7 @@ static int esp_disconnect_amidst_phases(struct NCR_ESP *esp,
struct ESP_regs *eregs) struct ESP_regs *eregs)
{ {
Scsi_Cmnd *sp = esp->current_SC; Scsi_Cmnd *sp = esp->current_SC;
Scsi_Device *dp = sp->device; struct ESP_device *esp_dev = sp->device->hostdata;
/* This means real problems if we see this /* This means real problems if we see this
* here. Unless we were actually trying * here. Unless we were actually trying
...@@ -2500,9 +2527,9 @@ static int esp_disconnect_amidst_phases(struct NCR_ESP *esp, ...@@ -2500,9 +2527,9 @@ static int esp_disconnect_amidst_phases(struct NCR_ESP *esp,
case BUS_DEVICE_RESET: case BUS_DEVICE_RESET:
ESPLOG(("device reset successful\n")); ESPLOG(("device reset successful\n"));
dp->sync_max_offset = 0; esp_dev->sync_max_offset = 0;
dp->sync_min_period = 0; esp_dev->sync_min_period = 0;
dp->sync = 0; esp_dev->sync = 0;
esp_advance_phase(sp, in_resetdev); esp_advance_phase(sp, in_resetdev);
esp_done(esp, (DID_RESET << 16)); esp_done(esp, (DID_RESET << 16));
break; break;
...@@ -2575,7 +2602,7 @@ static int esp_do_phase_determine(struct NCR_ESP *esp, ...@@ -2575,7 +2602,7 @@ static int esp_do_phase_determine(struct NCR_ESP *esp,
static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs) static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; Scsi_Cmnd *SCptr = esp->current_SC;
Scsi_Device *SDptr = SCptr->device; struct ESP_device *esp_dev = SCptr->device->hostdata;
int cmd_bytes_sent, fcnt; int cmd_bytes_sent, fcnt;
fcnt = (esp_read(eregs->esp_fflags) & ESP_FF_FBYTES); fcnt = (esp_read(eregs->esp_fflags) & ESP_FF_FBYTES);
...@@ -2604,7 +2631,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2604,7 +2631,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
/* What if the target ignores the sdtr? */ /* What if the target ignores the sdtr? */
if(esp->snip) if(esp->snip)
SDptr->sync = 1; esp_dev->sync = 1;
/* See how far, if at all, we got in getting /* See how far, if at all, we got in getting
* the information out to the target. * the information out to the target.
...@@ -2693,7 +2720,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2693,7 +2720,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
*/ */
if(!fcnt && /* Fifo is empty and... */ if(!fcnt && /* Fifo is empty and... */
/* either we are not doing synchronous transfers or... */ /* either we are not doing synchronous transfers or... */
(!SDptr->sync_max_offset || (!esp_dev->sync_max_offset ||
/* We are not going into data in phase. */ /* We are not going into data in phase. */
((esp->sreg & ESP_STAT_PMASK) != ESP_DIP))) ((esp->sreg & ESP_STAT_PMASK) != ESP_DIP)))
esp_cmd(esp, eregs, ESP_CMD_FLUSH); /* flush is safe */ esp_cmd(esp, eregs, ESP_CMD_FLUSH); /* flush is safe */
...@@ -2754,9 +2781,9 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2754,9 +2781,9 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
esp->snip = 0; esp->snip = 0;
ESPLOG(("esp%d: Failed synchronous negotiation for target %d " ESPLOG(("esp%d: Failed synchronous negotiation for target %d "
"lun %d\n", esp->esp_id, SCptr->target, SCptr->lun)); "lun %d\n", esp->esp_id, SCptr->target, SCptr->lun));
SDptr->sync_max_offset = 0; esp_dev->sync_max_offset = 0;
SDptr->sync_min_period = 0; esp_dev->sync_min_period = 0;
SDptr->sync = 1; /* so we don't negotiate again */ esp_dev->sync = 1; /* so we don't negotiate again */
/* Run the command again, this time though we /* Run the command again, this time though we
* won't try to negotiate for synchronous transfers. * won't try to negotiate for synchronous transfers.
...@@ -2904,16 +2931,16 @@ static int check_singlebyte_msg(struct NCR_ESP *esp, ...@@ -2904,16 +2931,16 @@ static int check_singlebyte_msg(struct NCR_ESP *esp,
case MESSAGE_REJECT: case MESSAGE_REJECT:
ESPMISC(("msg reject, ")); ESPMISC(("msg reject, "));
if(esp->prevmsgout == EXTENDED_MESSAGE) { if(esp->prevmsgout == EXTENDED_MESSAGE) {
Scsi_Device *SDptr = esp->current_SC->device; struct ESP_device *esp_dev = esp->current_SC->device->hostdata;
/* Doesn't look like this target can /* Doesn't look like this target can
* do synchronous or WIDE transfers. * do synchronous or WIDE transfers.
*/ */
ESPSDTR(("got reject, was trying nego, clearing sync/WIDE\n")); ESPSDTR(("got reject, was trying nego, clearing sync/WIDE\n"));
SDptr->sync = 1; esp_dev->sync = 1;
SDptr->wide = 1; esp_dev->wide = 1;
SDptr->sync_min_period = 0; esp_dev->sync_min_period = 0;
SDptr->sync_max_offset = 0; esp_dev->sync_max_offset = 0;
return 0; return 0;
} else { } else {
ESPMISC(("not sync nego, sending ABORT\n")); ESPMISC(("not sync nego, sending ABORT\n"));
...@@ -2929,13 +2956,13 @@ static int check_singlebyte_msg(struct NCR_ESP *esp, ...@@ -2929,13 +2956,13 @@ static int check_singlebyte_msg(struct NCR_ESP *esp,
*/ */
static int target_with_ants_in_pants(struct NCR_ESP *esp, static int target_with_ants_in_pants(struct NCR_ESP *esp,
Scsi_Cmnd *SCptr, Scsi_Cmnd *SCptr,
Scsi_Device *SDptr) struct ESP_device *esp_dev)
{ {
if(SDptr->sync || SDptr->borken) { if(esp_dev->sync || SCptr->device->borken) {
/* sorry, no can do */ /* sorry, no can do */
ESPSDTR(("forcing to async, ")); ESPSDTR(("forcing to async, "));
build_sync_nego_msg(esp, 0, 0); build_sync_nego_msg(esp, 0, 0);
SDptr->sync = 1; esp_dev->sync = 1;
esp->snip = 1; esp->snip = 1;
ESPLOG(("esp%d: hoping for msgout\n", esp->esp_id)); ESPLOG(("esp%d: hoping for msgout\n", esp->esp_id));
esp_advance_phase(SCptr, in_the_dark); esp_advance_phase(SCptr, in_the_dark);
...@@ -2984,7 +3011,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp, ...@@ -2984,7 +3011,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
struct ESP_regs *eregs) struct ESP_regs *eregs)
{ {
Scsi_Cmnd *SCptr = esp->current_SC; Scsi_Cmnd *SCptr = esp->current_SC;
Scsi_Device *SDptr = SCptr->device; struct ESP_device *esp_dev = SCptr->device->hostdata;
unchar regval = 0; unchar regval = 0;
int message_out = 0; int message_out = 0;
...@@ -3000,7 +3027,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp, ...@@ -3000,7 +3027,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
/* Target negotiates first! */ /* Target negotiates first! */
ESPSDTR(("target jumps the gun, ")); ESPSDTR(("target jumps the gun, "));
message_out = EXTENDED_MESSAGE; /* we must respond */ message_out = EXTENDED_MESSAGE; /* we must respond */
rval = target_with_ants_in_pants(esp, SCptr, SDptr); rval = target_with_ants_in_pants(esp, SCptr, esp_dev);
if(rval) if(rval)
return rval; return rval;
} }
...@@ -3045,8 +3072,8 @@ static int check_multibyte_msg(struct NCR_ESP *esp, ...@@ -3045,8 +3072,8 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
if(offset) { if(offset) {
unchar bit; unchar bit;
SDptr->sync_min_period = (regval & 0x1f); esp_dev->sync_min_period = (regval & 0x1f);
SDptr->sync_max_offset = (offset | esp->radelay); esp_dev->sync_max_offset = (offset | esp->radelay);
if(esp->erev > esp236) { if(esp->erev > esp236) {
if(esp->erev == fas100a) if(esp->erev == fas100a)
bit = ESP_CONFIG3_FAST; bit = ESP_CONFIG3_FAST;
...@@ -3059,24 +3086,24 @@ static int check_multibyte_msg(struct NCR_ESP *esp, ...@@ -3059,24 +3086,24 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
esp->prev_cfg3 = esp->config3[SCptr->target]; esp->prev_cfg3 = esp->config3[SCptr->target];
esp_write(eregs->esp_cfg3, esp->prev_cfg3); esp_write(eregs->esp_cfg3, esp->prev_cfg3);
} }
esp->prev_soff = SDptr->sync_min_period; esp->prev_soff = esp_dev->sync_min_period;
esp_write(eregs->esp_soff, esp->prev_soff); esp_write(eregs->esp_soff, esp->prev_soff);
esp->prev_stp = SDptr->sync_max_offset; esp->prev_stp = esp_dev->sync_max_offset;
esp_write(eregs->esp_stp, esp->prev_stp); esp_write(eregs->esp_stp, esp->prev_stp);
ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n", ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n",
SDptr->sync_max_offset, esp_dev->sync_max_offset,
SDptr->sync_min_period, esp_dev->sync_min_period,
esp->config3[SCptr->target])); esp->config3[SCptr->target]));
esp->snip = 0; esp->snip = 0;
} else if(SDptr->sync_max_offset) { } else if(esp_dev->sync_max_offset) {
unchar bit; unchar bit;
/* back to async mode */ /* back to async mode */
ESPSDTR(("unaccaptable sync nego, forcing async\n")); ESPSDTR(("unaccaptable sync nego, forcing async\n"));
SDptr->sync_max_offset = 0; esp_dev->sync_max_offset = 0;
SDptr->sync_min_period = 0; esp_dev->sync_min_period = 0;
esp->prev_soff = 0; esp->prev_soff = 0;
esp_write(eregs->esp_soff, 0); esp_write(eregs->esp_soff, 0);
esp->prev_stp = 0; esp->prev_stp = 0;
...@@ -3095,7 +3122,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp, ...@@ -3095,7 +3122,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
sync_report(esp); sync_report(esp);
ESPSDTR(("chk multibyte msg: sync is known, ")); ESPSDTR(("chk multibyte msg: sync is known, "));
SDptr->sync = 1; esp_dev->sync = 1;
if(message_out) { if(message_out) {
ESPLOG(("esp%d: sending sdtr back, hoping for msgout\n", ESPLOG(("esp%d: sending sdtr back, hoping for msgout\n",
...@@ -3318,7 +3345,7 @@ static int esp_do_msgoutdone(struct NCR_ESP *esp, ...@@ -3318,7 +3345,7 @@ static int esp_do_msgoutdone(struct NCR_ESP *esp,
default: default:
if(!fcount(esp, eregs) && if(!fcount(esp, eregs) &&
!(esp->current_SC->device->sync_max_offset)) !(((struct ESP_device *)esp->current_SC->device->hostdata)->sync_max_offset))
esp_cmd(esp, eregs, ESP_CMD_FLUSH); esp_cmd(esp, eregs, ESP_CMD_FLUSH);
break; break;
......
...@@ -283,6 +283,17 @@ enum esp_rev { ...@@ -283,6 +283,17 @@ enum esp_rev {
espunknown = 0x09 espunknown = 0x09
}; };
/* We allocate one of these for each scsi device and attach it to
* SDptr->hostdata for use in the driver
*/
struct ESP_device {
unsigned char sync_min_period;
unsigned char sync_max_offset;
unsigned sync:1;
unsigned wide:1;
unsigned disconnect:1;
};
/* We get one of these for each ESP probed. */ /* We get one of these for each ESP probed. */
struct NCR_ESP { struct NCR_ESP {
struct NCR_ESP *next; /* Next ESP on probed or NULL */ struct NCR_ESP *next; /* Next ESP on probed or NULL */
......
...@@ -587,8 +587,8 @@ struct scsi_device { ...@@ -587,8 +587,8 @@ struct scsi_device {
char * model; /* ... after scan; point to static string */ char * model; /* ... after scan; point to static string */
char * rev; /* ... "nullnullnullnull" before scan */ char * rev; /* ... "nullnullnullnull" before scan */
unsigned char current_tag; /* current tag */ unsigned char current_tag; /* current tag */
unsigned char sync_min_period; /* Not less than this period */ // unsigned char sync_min_period; /* Not less than this period */
unsigned char sync_max_offset; /* Not greater than this offset */ // unsigned char sync_max_offset; /* Not greater than this offset */
unsigned online:1; unsigned online:1;
unsigned writeable:1; unsigned writeable:1;
...@@ -599,7 +599,7 @@ struct scsi_device { ...@@ -599,7 +599,7 @@ struct scsi_device {
unsigned lockable:1; /* Able to prevent media removal */ unsigned lockable:1; /* Able to prevent media removal */
unsigned borken:1; /* Tell the Seagate driver to be unsigned borken:1; /* Tell the Seagate driver to be
* painfully slow on this device */ * painfully slow on this device */
unsigned disconnect:1; /* can disconnect */ // unsigned disconnect:1; /* can disconnect */
unsigned soft_reset:1; /* Uses soft reset option */ unsigned soft_reset:1; /* Uses soft reset option */
unsigned sdtr:1; /* Device supports SDTR messages */ unsigned sdtr:1; /* Device supports SDTR messages */
unsigned wdtr:1; /* Device supports WDTR messages */ unsigned wdtr:1; /* Device supports WDTR messages */
...@@ -619,8 +619,8 @@ struct scsi_device { ...@@ -619,8 +619,8 @@ struct scsi_device {
unsigned remap:1; /* support remapping */ unsigned remap:1; /* support remapping */
unsigned starved:1; /* unable to process commands because unsigned starved:1; /* unable to process commands because
host busy */ host busy */
unsigned sync:1; /* Sync transfer state, managed by host */ // unsigned sync:1; /* Sync transfer state, managed by host */
unsigned wide:1; /* WIDE transfer state, managed by host */ // unsigned wide:1; /* WIDE transfer state, managed by host */
unsigned int device_blocked; /* Device returned QUEUE_FULL. */ unsigned int device_blocked; /* Device returned QUEUE_FULL. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment