Commit 334e9d00 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k SCSI driver updates

M68k SCSI drivers: update for the changes in 2.5.60:
  o Replace `->lun'    by `->device->lun'
  o Replace `->target' by `->device->id'
  o Replace `->host'   by `->device->host'
parent 55a248c7
...@@ -1759,7 +1759,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1759,7 +1759,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
static void static void
NCR53c7xx_dsa_fixup (struct NCR53c7x0_cmd *cmd) { NCR53c7xx_dsa_fixup (struct NCR53c7x0_cmd *cmd) {
Scsi_Cmnd *c = cmd->cmd; Scsi_Cmnd *c = cmd->cmd;
struct Scsi_Host *host = c->host; struct Scsi_Host *host = c->device->host;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata[0]; host->hostdata[0];
int i; int i;
...@@ -1784,18 +1784,18 @@ NCR53c7xx_dsa_fixup (struct NCR53c7x0_cmd *cmd) { ...@@ -1784,18 +1784,18 @@ NCR53c7xx_dsa_fixup (struct NCR53c7x0_cmd *cmd) {
*/ */
patch_abs_tci_data (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_tci_data (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_lun, c->lun); dsa_temp_lun, c->device->lun);
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_addr_next, virt_to_bus(&cmd->dsa_next_addr)); dsa_temp_addr_next, virt_to_bus(&cmd->dsa_next_addr));
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_next, virt_to_bus(cmd->dsa) + Ent_dsa_zero - dsa_temp_next, virt_to_bus(cmd->dsa) + Ent_dsa_zero -
Ent_dsa_code_template + A_dsa_next); Ent_dsa_code_template + A_dsa_next);
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_sync, virt_to_bus((void *)hostdata->sync[c->target].script)); dsa_temp_sync, virt_to_bus((void *)hostdata->sync[c->device->id].script));
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_sscf_710, virt_to_bus((void *)&hostdata->sync[c->target].sscf_710)); dsa_sscf_710, virt_to_bus((void *)&hostdata->sync[c->device->id].sscf_710));
patch_abs_tci_data (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_tci_data (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_target, 1 << c->target); dsa_temp_target, 1 << c->device->id);
/* XXX - new pointer stuff */ /* XXX - new pointer stuff */
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32), patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_addr_saved_pointer, virt_to_bus(&cmd->saved_data_pointer)); dsa_temp_addr_saved_pointer, virt_to_bus(&cmd->saved_data_pointer));
...@@ -1856,7 +1856,7 @@ run_process_issue_queue(void) { ...@@ -1856,7 +1856,7 @@ run_process_issue_queue(void) {
static void static void
abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) { abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) {
Scsi_Cmnd *c = cmd->cmd; Scsi_Cmnd *c = cmd->cmd;
struct Scsi_Host *host = c->host; struct Scsi_Host *host = c->device->host;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata[0]; host->hostdata[0];
unsigned long flags; unsigned long flags;
...@@ -1940,7 +1940,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) { ...@@ -1940,7 +1940,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) {
host->host_no, c->pid); host->host_no, c->pid);
else if (linux_search) { else if (linux_search) {
*linux_prev = linux_search->next; *linux_prev = linux_search->next;
--hostdata->busy[c->target][c->lun]; --hostdata->busy[c->device->id][c->device->lun];
} }
/* Return the NCR command structure to the free list */ /* Return the NCR command structure to the free list */
...@@ -2287,9 +2287,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2287,9 +2287,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
hostdata->dsp_changed = 1; hostdata->dsp_changed = 1;
if (cmd && (cmd->flags & CMD_FLAG_SDTR)) { if (cmd && (cmd->flags & CMD_FLAG_SDTR)) {
printk ("scsi%d : target %d rejected SDTR\n", host->host_no, printk ("scsi%d : target %d rejected SDTR\n", host->host_no,
c->target); c->device->id);
cmd->flags &= ~CMD_FLAG_SDTR; cmd->flags &= ~CMD_FLAG_SDTR;
asynchronous (host, c->target); asynchronous (host, c->device->id);
print = 0; print = 0;
} }
break; break;
...@@ -2311,7 +2311,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2311,7 +2311,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (print) { if (print) {
printk ("scsi%d : received message", host->host_no); printk ("scsi%d : received message", host->host_no);
if (c) if (c)
printk (" from target %d lun %d ", c->target, c->lun); printk (" from target %d lun %d ", c->device->id, c->device->lun);
print_msg ((unsigned char *) hostdata->msg_buf); print_msg ((unsigned char *) hostdata->msg_buf);
printk("\n"); printk("\n");
} }
...@@ -2331,7 +2331,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2331,7 +2331,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (cmd) { if (cmd) {
char buf[80]; char buf[80];
sprintf (buf, "scsi%d : target %d %s ", host->host_no, c->target, sprintf (buf, "scsi%d : target %d %s ", host->host_no, c->device->id,
(cmd->flags & CMD_FLAG_SDTR) ? "accepting" : "requesting"); (cmd->flags & CMD_FLAG_SDTR) ? "accepting" : "requesting");
print_synchronous (buf, (unsigned char *) hostdata->msg_buf); print_synchronous (buf, (unsigned char *) hostdata->msg_buf);
...@@ -2346,10 +2346,10 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2346,10 +2346,10 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (cmd->flags & CMD_FLAG_SDTR) { if (cmd->flags & CMD_FLAG_SDTR) {
cmd->flags &= ~CMD_FLAG_SDTR; cmd->flags &= ~CMD_FLAG_SDTR;
if (hostdata->msg_buf[4]) if (hostdata->msg_buf[4])
synchronous (host, c->target, (unsigned char *) synchronous (host, c->device->id, (unsigned char *)
hostdata->msg_buf); hostdata->msg_buf);
else else
asynchronous (host, c->target); asynchronous (host, c->device->id);
hostdata->dsp = hostdata->script + hostdata->E_accept_message / hostdata->dsp = hostdata->script + hostdata->E_accept_message /
sizeof(u32); sizeof(u32);
hostdata->dsp_changed = 1; hostdata->dsp_changed = 1;
...@@ -2357,11 +2357,11 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2357,11 +2357,11 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
} else { } else {
if (hostdata->options & OPTION_SYNCHRONOUS) { if (hostdata->options & OPTION_SYNCHRONOUS) {
cmd->flags |= CMD_FLAG_DID_SDTR; cmd->flags |= CMD_FLAG_DID_SDTR;
synchronous (host, c->target, (unsigned char *) synchronous (host, c->device->id, (unsigned char *)
hostdata->msg_buf); hostdata->msg_buf);
} else { } else {
hostdata->msg_buf[4] = 0; /* 0 offset = async */ hostdata->msg_buf[4] = 0; /* 0 offset = async */
asynchronous (host, c->target); asynchronous (host, c->device->id);
} }
patch_dsa_32 (cmd->dsa, dsa_msgout_other, 0, 5); patch_dsa_32 (cmd->dsa, dsa_msgout_other, 0, 5);
patch_dsa_32 (cmd->dsa, dsa_msgout_other, 1, (u32) patch_dsa_32 (cmd->dsa, dsa_msgout_other, 1, (u32)
...@@ -2545,9 +2545,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2545,9 +2545,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
host->host_no, NCR53c7x0_read8(SXFER_REG)); host->host_no, NCR53c7x0_read8(SXFER_REG));
if (c) { if (c) {
print_insn (host, (u32 *) print_insn (host, (u32 *)
hostdata->sync[c->target].script, "", 1); hostdata->sync[c->device->id].script, "", 1);
print_insn (host, (u32 *) print_insn (host, (u32 *)
hostdata->sync[c->target].script + 2, "", 1); hostdata->sync[c->device->id].script + 2, "", 1);
} }
} }
return SPECIFIC_INT_RESTART; return SPECIFIC_INT_RESTART;
...@@ -2658,7 +2658,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2658,7 +2658,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (hostdata->options & (OPTION_DEBUG_SCRIPT|OPTION_DEBUG_INTR)) { if (hostdata->options & (OPTION_DEBUG_SCRIPT|OPTION_DEBUG_INTR)) {
if (c) if (c)
printk("scsi%d : target %d lun %d disconnecting\n", printk("scsi%d : target %d lun %d disconnecting\n",
host->host_no, c->target, c->lun); host->host_no, c->device->id, c->device->lun);
else else
printk("scsi%d : unknown target disconnecting\n", printk("scsi%d : unknown target disconnecting\n",
host->host_no); host->host_no);
...@@ -2680,9 +2680,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2680,9 +2680,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
#endif #endif
if (c) { if (c) {
print_insn (host, (u32 *) print_insn (host, (u32 *)
hostdata->sync[c->target].script, "", 1); hostdata->sync[c->device->id].script, "", 1);
print_insn (host, (u32 *) print_insn (host, (u32 *)
hostdata->sync[c->target].script + 2, "", 1); hostdata->sync[c->device->id].script + 2, "", 1);
} }
} }
return SPECIFIC_INT_RESTART; return SPECIFIC_INT_RESTART;
...@@ -2734,8 +2734,8 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2734,8 +2734,8 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
if ((hostdata->chip / 100) == 8) { if ((hostdata->chip / 100) == 8) {
scntl3 = NCR53c7x0_read8 (SCNTL3_REG_800); scntl3 = NCR53c7x0_read8 (SCNTL3_REG_800);
if (c) { if (c) {
if (sxfer != hostdata->sync[c->target].sxfer_sanity || if (sxfer != hostdata->sync[c->device->id].sxfer_sanity ||
scntl3 != hostdata->sync[c->target].scntl3_sanity) { scntl3 != hostdata->sync[c->device->id].scntl3_sanity) {
printk ("scsi%d : sync sanity check failed sxfer=0x%x, scntl3=0x%x", printk ("scsi%d : sync sanity check failed sxfer=0x%x, scntl3=0x%x",
host->host_no, sxfer, scntl3); host->host_no, sxfer, scntl3);
NCR53c7x0_write8 (SXFER_REG, sxfer); NCR53c7x0_write8 (SXFER_REG, sxfer);
...@@ -2746,12 +2746,12 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2746,12 +2746,12 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
host->host_no, (int) sxfer, (int) scntl3); host->host_no, (int) sxfer, (int) scntl3);
} else { } else {
if (c) { if (c) {
if (sxfer != hostdata->sync[c->target].sxfer_sanity) { if (sxfer != hostdata->sync[c->device->id].sxfer_sanity) {
printk ("scsi%d : sync sanity check failed sxfer=0x%x", printk ("scsi%d : sync sanity check failed sxfer=0x%x",
host->host_no, sxfer); host->host_no, sxfer);
NCR53c7x0_write8 (SXFER_REG, sxfer); NCR53c7x0_write8 (SXFER_REG, sxfer);
NCR53c7x0_write8 (SBCL_REG, NCR53c7x0_write8 (SBCL_REG,
hostdata->sync[c->target].sscf_710); hostdata->sync[c->device->id].sscf_710);
} }
} else } else
printk ("scsi%d : unknown command sxfer=0x%x\n", printk ("scsi%d : unknown command sxfer=0x%x\n",
...@@ -2807,9 +2807,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2807,9 +2807,9 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
(DCMD_REG)) == hostdata->script + (DCMD_REG)) == hostdata->script +
Ent_select_check_dsa / sizeof(u32) ? Ent_select_check_dsa / sizeof(u32) ?
"selection" : "reselection"; "selection" : "reselection";
if (c && sdid != c->target) { if (c && sdid != c->device->id) {
printk ("scsi%d : SDID target %d != DSA target %d at %s\n", printk ("scsi%d : SDID target %d != DSA target %d at %s\n",
host->host_no, sdid, c->target, where); host->host_no, sdid, c->device->id, where);
print_lots(host); print_lots(host);
dump_events (host, 20); dump_events (host, 20);
return SPECIFIC_INT_PANIC; return SPECIFIC_INT_PANIC;
...@@ -2855,7 +2855,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct ...@@ -2855,7 +2855,7 @@ NCR53c7x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (event->event == EVENT_RESELECT) if (event->event == EVENT_RESELECT)
event->lun = hostdata->reselected_identify & 0xf; event->lun = hostdata->reselected_identify & 0xf;
else if (c) else if (c)
event->lun = c->lun; event->lun = c->device->lun;
else else
event->lun = 255; event->lun = 255;
do_gettimeofday(&(event->time)); do_gettimeofday(&(event->time));
...@@ -3049,7 +3049,7 @@ my_free_page (void *addr, int dummy) ...@@ -3049,7 +3049,7 @@ my_free_page (void *addr, int dummy)
static struct NCR53c7x0_cmd * static struct NCR53c7x0_cmd *
allocate_cmd (Scsi_Cmnd *cmd) { allocate_cmd (Scsi_Cmnd *cmd) {
struct Scsi_Host *host = cmd->host; struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) host->hostdata[0]; (struct NCR53c7x0_hostdata *) host->hostdata[0];
u32 real; /* Real address */ u32 real; /* Real address */
...@@ -3061,8 +3061,8 @@ allocate_cmd (Scsi_Cmnd *cmd) { ...@@ -3061,8 +3061,8 @@ allocate_cmd (Scsi_Cmnd *cmd) {
printk ("scsi%d : num_cmds = %d, can_queue = %d\n" printk ("scsi%d : num_cmds = %d, can_queue = %d\n"
" target = %d, lun = %d, %s\n", " target = %d, lun = %d, %s\n",
host->host_no, hostdata->num_cmds, host->can_queue, host->host_no, hostdata->num_cmds, host->can_queue,
cmd->target, cmd->lun, (hostdata->cmd_allocated[cmd->target] & cmd->device->id, cmd->device->lun, (hostdata->cmd_allocated[cmd->device->id] &
(1 << cmd->lun)) ? "already allocated" : "not allocated"); (1 << cmd->device->lun)) ? "already allocated" : "not allocated");
/* /*
* If we have not yet reserved commands for this I_T_L nexus, and * If we have not yet reserved commands for this I_T_L nexus, and
...@@ -3070,11 +3070,11 @@ allocate_cmd (Scsi_Cmnd *cmd) { ...@@ -3070,11 +3070,11 @@ allocate_cmd (Scsi_Cmnd *cmd) {
* being allocated under 1.3.x, or being outside of scan_scsis in * being allocated under 1.3.x, or being outside of scan_scsis in
* 1.2.x), do so now. * 1.2.x), do so now.
*/ */
if (!(hostdata->cmd_allocated[cmd->target] & (1 << cmd->lun)) && if (!(hostdata->cmd_allocated[cmd->device->id] & (1 << cmd->device->lun)) &&
cmd->device && cmd->device->has_cmdblocks) { cmd->device && cmd->device->has_cmdblocks) {
if ((hostdata->extra_allocate + hostdata->num_cmds) < host->can_queue) if ((hostdata->extra_allocate + hostdata->num_cmds) < host->can_queue)
hostdata->extra_allocate += host->cmd_per_lun; hostdata->extra_allocate += host->cmd_per_lun;
hostdata->cmd_allocated[cmd->target] |= (1 << cmd->lun); hostdata->cmd_allocated[cmd->device->id] |= (1 << cmd->device->lun);
} }
for (; hostdata->extra_allocate > 0 ; --hostdata->extra_allocate, for (; hostdata->extra_allocate > 0 ; --hostdata->extra_allocate,
...@@ -3130,7 +3130,7 @@ allocate_cmd (Scsi_Cmnd *cmd) { ...@@ -3130,7 +3130,7 @@ allocate_cmd (Scsi_Cmnd *cmd) {
local_irq_restore(flags); local_irq_restore(flags);
if (!tmp) if (!tmp)
printk ("scsi%d : can't allocate command for target %d lun %d\n", printk ("scsi%d : can't allocate command for target %d lun %d\n",
host->host_no, cmd->target, cmd->lun); host->host_no, cmd->device->id, cmd->device->lun);
return tmp; return tmp;
} }
...@@ -3150,7 +3150,7 @@ allocate_cmd (Scsi_Cmnd *cmd) { ...@@ -3150,7 +3150,7 @@ allocate_cmd (Scsi_Cmnd *cmd) {
static struct NCR53c7x0_cmd * static struct NCR53c7x0_cmd *
create_cmd (Scsi_Cmnd *cmd) { create_cmd (Scsi_Cmnd *cmd) {
NCR53c7x0_local_declare(); NCR53c7x0_local_declare();
struct Scsi_Host *host = cmd->host; struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata[0]; host->hostdata[0];
struct NCR53c7x0_cmd *tmp; /* NCR53c7x0_cmd structure for this command */ struct NCR53c7x0_cmd *tmp; /* NCR53c7x0_cmd structure for this command */
...@@ -3166,7 +3166,7 @@ create_cmd (Scsi_Cmnd *cmd) { ...@@ -3166,7 +3166,7 @@ create_cmd (Scsi_Cmnd *cmd) {
#endif #endif
unsigned long flags; unsigned long flags;
u32 exp_select_indirect; /* Used in sanity check */ u32 exp_select_indirect; /* Used in sanity check */
NCR53c7x0_local_setup(cmd->host); NCR53c7x0_local_setup(cmd->device->host);
if (!(tmp = allocate_cmd (cmd))) if (!(tmp = allocate_cmd (cmd)))
return NULL; return NULL;
...@@ -3322,45 +3322,45 @@ create_cmd (Scsi_Cmnd *cmd) { ...@@ -3322,45 +3322,45 @@ create_cmd (Scsi_Cmnd *cmd) {
if (hostdata->options & OPTION_DEBUG_SYNCHRONOUS) { if (hostdata->options & OPTION_DEBUG_SYNCHRONOUS) {
exp_select_indirect = ((1 << cmd->target) << 16) | exp_select_indirect = ((1 << cmd->device->id) << 16) |
(hostdata->sync[cmd->target].sxfer_sanity << 8); (hostdata->sync[cmd->device->id].sxfer_sanity << 8);
if (hostdata->sync[cmd->target].select_indirect != if (hostdata->sync[cmd->device->id].select_indirect !=
exp_select_indirect) { exp_select_indirect) {
printk ("scsi%d : sanity check failed select_indirect=0x%x\n", printk ("scsi%d : sanity check failed select_indirect=0x%x\n",
host->host_no, hostdata->sync[cmd->target].select_indirect); host->host_no, hostdata->sync[cmd->device->id].select_indirect);
FATAL(host); FATAL(host);
} }
} }
patch_dsa_32(tmp->dsa, dsa_select, 0, patch_dsa_32(tmp->dsa, dsa_select, 0,
hostdata->sync[cmd->target].select_indirect); hostdata->sync[cmd->device->id].select_indirect);
/* /*
* Right now, we'll do the WIDE and SYNCHRONOUS negotiations on * Right now, we'll do the WIDE and SYNCHRONOUS negotiations on
* different commands; although it should be trivial to do them * different commands; although it should be trivial to do them
* both at the same time. * both at the same time.
*/ */
if (hostdata->initiate_wdtr & (1 << cmd->target)) { if (hostdata->initiate_wdtr & (1 << cmd->device->id)) {
memcpy ((void *) (tmp->select + 1), (void *) wdtr_message, memcpy ((void *) (tmp->select + 1), (void *) wdtr_message,
sizeof(wdtr_message)); sizeof(wdtr_message));
patch_dsa_32(tmp->dsa, dsa_msgout, 0, 1 + sizeof(wdtr_message)); patch_dsa_32(tmp->dsa, dsa_msgout, 0, 1 + sizeof(wdtr_message));
local_irq_save(flags); local_irq_save(flags);
hostdata->initiate_wdtr &= ~(1 << cmd->target); hostdata->initiate_wdtr &= ~(1 << cmd->device->id);
local_irq_restore(flags); local_irq_restore(flags);
} else if (hostdata->initiate_sdtr & (1 << cmd->target)) { } else if (hostdata->initiate_sdtr & (1 << cmd->device->id)) {
memcpy ((void *) (tmp->select + 1), (void *) sdtr_message, memcpy ((void *) (tmp->select + 1), (void *) sdtr_message,
sizeof(sdtr_message)); sizeof(sdtr_message));
patch_dsa_32(tmp->dsa, dsa_msgout, 0, 1 + sizeof(sdtr_message)); patch_dsa_32(tmp->dsa, dsa_msgout, 0, 1 + sizeof(sdtr_message));
tmp->flags |= CMD_FLAG_SDTR; tmp->flags |= CMD_FLAG_SDTR;
local_irq_save(flags); local_irq_save(flags);
hostdata->initiate_sdtr &= ~(1 << cmd->target); hostdata->initiate_sdtr &= ~(1 << cmd->device->id);
local_irq_restore(flags); local_irq_restore(flags);
} }
#if 1 #if 1
else if (!(hostdata->talked_to & (1 << cmd->target)) && else if (!(hostdata->talked_to & (1 << cmd->device->id)) &&
!(hostdata->options & OPTION_NO_ASYNC)) { !(hostdata->options & OPTION_NO_ASYNC)) {
memcpy ((void *) (tmp->select + 1), (void *) async_message, memcpy ((void *) (tmp->select + 1), (void *) async_message,
...@@ -3372,9 +3372,9 @@ create_cmd (Scsi_Cmnd *cmd) { ...@@ -3372,9 +3372,9 @@ create_cmd (Scsi_Cmnd *cmd) {
else else
patch_dsa_32(tmp->dsa, dsa_msgout, 0, 1); patch_dsa_32(tmp->dsa, dsa_msgout, 0, 1);
hostdata->talked_to |= (1 << cmd->target); hostdata->talked_to |= (1 << cmd->device->id);
tmp->select[0] = (hostdata->options & OPTION_DISCONNECT) ? tmp->select[0] = (hostdata->options & OPTION_DISCONNECT) ?
IDENTIFY (1, cmd->lun) : IDENTIFY (0, cmd->lun); IDENTIFY (1, cmd->device->lun) : IDENTIFY (0, cmd->device->lun);
patch_dsa_32(tmp->dsa, dsa_msgout, 1, virt_to_bus(tmp->select)); patch_dsa_32(tmp->dsa, dsa_msgout, 1, virt_to_bus(tmp->select));
patch_dsa_32(tmp->dsa, dsa_cmdout, 0, cmd->cmd_len); patch_dsa_32(tmp->dsa, dsa_cmdout, 0, cmd->cmd_len);
patch_dsa_32(tmp->dsa, dsa_cmdout, 1, virt_to_bus(tmp->cmnd)); patch_dsa_32(tmp->dsa, dsa_cmdout, 1, virt_to_bus(tmp->cmnd));
...@@ -3591,7 +3591,7 @@ create_cmd (Scsi_Cmnd *cmd) { ...@@ -3591,7 +3591,7 @@ create_cmd (Scsi_Cmnd *cmd) {
int int
NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
struct Scsi_Host *host = cmd->host; struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) host->hostdata[0]; (struct NCR53c7x0_hostdata *) host->hostdata[0];
unsigned long flags; unsigned long flags;
...@@ -3604,9 +3604,9 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3604,9 +3604,9 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
#ifdef VALID_IDS #ifdef VALID_IDS
/* Ignore commands on invalid IDs */ /* Ignore commands on invalid IDs */
if (!hostdata->valid_ids[cmd->target]) { if (!hostdata->valid_ids[cmd->device->id]) {
printk("scsi%d : ignoring target %d lun %d\n", host->host_no, printk("scsi%d : ignoring target %d lun %d\n", host->host_no,
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
cmd->result = (DID_BAD_TARGET << 16); cmd->result = (DID_BAD_TARGET << 16);
done(cmd); done(cmd);
return 0; return 0;
...@@ -3616,16 +3616,16 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3616,16 +3616,16 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
local_irq_save(flags); local_irq_save(flags);
if ((hostdata->options & (OPTION_DEBUG_INIT_ONLY|OPTION_DEBUG_PROBE_ONLY)) if ((hostdata->options & (OPTION_DEBUG_INIT_ONLY|OPTION_DEBUG_PROBE_ONLY))
|| ((hostdata->options & OPTION_DEBUG_TARGET_LIMIT) && || ((hostdata->options & OPTION_DEBUG_TARGET_LIMIT) &&
!(hostdata->debug_lun_limit[cmd->target] & (1 << cmd->lun))) !(hostdata->debug_lun_limit[cmd->device->id] & (1 << cmd->device->lun)))
#ifdef LINUX_1_2 #ifdef LINUX_1_2
|| cmd->target > 7 || cmd->device->id > 7
#else #else
|| cmd->target > host->max_id || cmd->device->id > host->max_id
#endif #endif
|| cmd->target == host->this_id || cmd->device->id == host->this_id
|| hostdata->state == STATE_DISABLED) { || hostdata->state == STATE_DISABLED) {
printk("scsi%d : disabled or bad target %d lun %d\n", host->host_no, printk("scsi%d : disabled or bad target %d lun %d\n", host->host_no,
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
cmd->result = (DID_BAD_TARGET << 16); cmd->result = (DID_BAD_TARGET << 16);
done(cmd); done(cmd);
local_irq_restore(flags); local_irq_restore(flags);
...@@ -3738,7 +3738,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, ...@@ -3738,7 +3738,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
--i, ncrcurrent += 2 /* JUMP instructions are two words */); --i, ncrcurrent += 2 /* JUMP instructions are two words */);
if (i > 0) { if (i > 0) {
++hostdata->busy[tmp->target][tmp->lun]; ++hostdata->busy[tmp->device->id][tmp->device->lun];
cmd->next = hostdata->running_list; cmd->next = hostdata->running_list;
hostdata->running_list = cmd; hostdata->running_list = cmd;
...@@ -3799,7 +3799,7 @@ busyp (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, ...@@ -3799,7 +3799,7 @@ busyp (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
/* FIXME : in the future, this needs to accommodate SCSI-II tagged /* FIXME : in the future, this needs to accommodate SCSI-II tagged
queuing, and we may be able to play with fairness here a bit. queuing, and we may be able to play with fairness here a bit.
*/ */
return hostdata->busy[cmd->target][cmd->lun]; return hostdata->busy[cmd->device->id][cmd->device->lun];
} }
/* /*
...@@ -3873,7 +3873,7 @@ process_issue_queue (unsigned long flags) { ...@@ -3873,7 +3873,7 @@ process_issue_queue (unsigned long flags) {
if (tmp->host_scribble) { if (tmp->host_scribble) {
if (hostdata->options & OPTION_DEBUG_QUEUES) if (hostdata->options & OPTION_DEBUG_QUEUES)
printk ("scsi%d : moving command for target %d lun %d to start list\n", printk ("scsi%d : moving command for target %d lun %d to start list\n",
host->host_no, tmp->target, tmp->lun); host->host_no, tmp->device->id, tmp->device->lun);
to_schedule_list (host, hostdata, to_schedule_list (host, hostdata,
...@@ -3937,7 +3937,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) { ...@@ -3937,7 +3937,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
printk ("scsi%d : Selection Timeout\n", host->host_no); printk ("scsi%d : Selection Timeout\n", host->host_no);
if (cmd) { if (cmd) {
printk("scsi%d : target %d, lun %d, command ", printk("scsi%d : target %d, lun %d, command ",
host->host_no, cmd->cmd->target, cmd->cmd->lun); host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
print_command (cmd->cmd->cmnd); print_command (cmd->cmd->cmnd);
printk("scsi%d : dsp = 0x%x (virt 0x%p)\n", host->host_no, printk("scsi%d : dsp = 0x%x (virt 0x%p)\n", host->host_no,
NCR53c7x0_read32(DSP_REG), NCR53c7x0_read32(DSP_REG),
...@@ -3975,7 +3975,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) { ...@@ -3975,7 +3975,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
fatal = 1; fatal = 1;
if (cmd) { if (cmd) {
printk("scsi%d : target %d lun %d unexpected disconnect\n", printk("scsi%d : target %d lun %d unexpected disconnect\n",
host->host_no, cmd->cmd->target, cmd->cmd->lun); host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
print_lots (host); print_lots (host);
abnormal_finished(cmd, DID_ERROR << 16); abnormal_finished(cmd, DID_ERROR << 16);
} else } else
...@@ -3991,7 +3991,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) { ...@@ -3991,7 +3991,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
fatal = 1; fatal = 1;
if (cmd && cmd->cmd) { if (cmd && cmd->cmd) {
printk("scsi%d : target %d lun %d parity error.\n", printk("scsi%d : target %d lun %d parity error.\n",
host->host_no, cmd->cmd->target, cmd->cmd->lun); host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
abnormal_finished (cmd, DID_PARITY << 16); abnormal_finished (cmd, DID_PARITY << 16);
} else } else
printk("scsi%d : parity error\n", host->host_no); printk("scsi%d : parity error\n", host->host_no);
...@@ -4199,7 +4199,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host) ...@@ -4199,7 +4199,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host)
if (cmd_prev_ptr) if (cmd_prev_ptr)
*cmd_prev_ptr = (struct NCR53c7x0_cmd *) cmd->next; *cmd_prev_ptr = (struct NCR53c7x0_cmd *) cmd->next;
--hostdata->busy[tmp->target][tmp->lun]; --hostdata->busy[tmp->device->id][tmp->device->lun];
cmd->next = hostdata->free; cmd->next = hostdata->free;
hostdata->free = cmd; hostdata->free = cmd;
...@@ -4207,7 +4207,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host) ...@@ -4207,7 +4207,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host)
if (hostdata->options & OPTION_DEBUG_INTR) { if (hostdata->options & OPTION_DEBUG_INTR) {
printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x ", printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x ",
host->host_no, tmp->pid, tmp->target, tmp->lun, tmp->result); host->host_no, tmp->pid, tmp->device->id, tmp->device->lun, tmp->result);
print_command (tmp->cmnd); print_command (tmp->cmnd);
} }
...@@ -4292,8 +4292,8 @@ NCR53c7x0_intr (int irq, void *dev_id, struct pt_regs * regs) { ...@@ -4292,8 +4292,8 @@ NCR53c7x0_intr (int irq, void *dev_id, struct pt_regs * regs) {
if (hostdata->options & OPTION_DEBUG_INTR) { if (hostdata->options & OPTION_DEBUG_INTR) {
if (cmd) { if (cmd) {
printk("scsi%d : interrupt for pid %lu, id %d, lun %d ", printk("scsi%d : interrupt for pid %lu, id %d, lun %d ",
host->host_no, cmd->cmd->pid, (int) cmd->cmd->target, host->host_no, cmd->cmd->pid, (int) cmd->cmd->device->id,
(int) cmd->cmd->lun); (int) cmd->cmd->device->lun);
print_command (cmd->cmd->cmnd); print_command (cmd->cmd->cmnd);
} else { } else {
printk("scsi%d : no active command\n", host->host_no); printk("scsi%d : no active command\n", host->host_no);
...@@ -4671,7 +4671,7 @@ intr_phase_mismatch (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) { ...@@ -4671,7 +4671,7 @@ intr_phase_mismatch (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
hostdata->dsp = dsp + 2 /* two _words_ */; hostdata->dsp = dsp + 2 /* two _words_ */;
hostdata->dsp_changed = 1; hostdata->dsp_changed = 1;
printk ("scsi%d : target %d ignored SDTR and went into COMMAND OUT\n", printk ("scsi%d : target %d ignored SDTR and went into COMMAND OUT\n",
host->host_no, cmd->cmd->target); host->host_no, cmd->cmd->device->id);
cmd->flags &= ~CMD_FLAG_SDTR; cmd->flags &= ~CMD_FLAG_SDTR;
action = ACTION_CONTINUE; action = ACTION_CONTINUE;
break; break;
...@@ -5136,7 +5136,7 @@ print_insn (struct Scsi_Host *host, const u32 *insn, ...@@ -5136,7 +5136,7 @@ print_insn (struct Scsi_Host *host, const u32 *insn,
int int
NCR53c7xx_abort (Scsi_Cmnd *cmd) { NCR53c7xx_abort (Scsi_Cmnd *cmd) {
NCR53c7x0_local_declare(); NCR53c7x0_local_declare();
struct Scsi_Host *host = cmd->host; struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = host ? (struct NCR53c7x0_hostdata *) struct NCR53c7x0_hostdata *hostdata = host ? (struct NCR53c7x0_hostdata *)
host->hostdata[0] : NULL; host->hostdata[0] : NULL;
unsigned long flags; unsigned long flags;
...@@ -5242,7 +5242,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) { ...@@ -5242,7 +5242,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
return SCSI_ABORT_NOT_RUNNING; return SCSI_ABORT_NOT_RUNNING;
} else { } else {
printk ("scsi%d : DANGER : command running, can not abort.\n", printk ("scsi%d : DANGER : command running, can not abort.\n",
cmd->host->host_no); cmd->device->host->host_no);
local_irq_restore(flags); local_irq_restore(flags);
return SCSI_ABORT_BUSY; return SCSI_ABORT_BUSY;
} }
...@@ -5273,7 +5273,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) { ...@@ -5273,7 +5273,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
* command was ever counted as BUSY, so if we end up here we can * command was ever counted as BUSY, so if we end up here we can
* decrement the busy count if and only if it is necessary. * decrement the busy count if and only if it is necessary.
*/ */
--hostdata->busy[cmd->target][cmd->lun]; --hostdata->busy[cmd->device->id][cmd->device->lun];
} }
local_irq_restore(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
...@@ -5318,7 +5318,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) { ...@@ -5318,7 +5318,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) {
* each command. * each command.
*/ */
Scsi_Cmnd *nuke_list = NULL; Scsi_Cmnd *nuke_list = NULL;
struct Scsi_Host *host = cmd->host; struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) host->hostdata[0]; (struct NCR53c7x0_hostdata *) host->hostdata[0];
...@@ -5388,7 +5388,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) { ...@@ -5388,7 +5388,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) {
static int static int
insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) { insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) {
struct NCR53c7x0_hostdata *hostdata = struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) cmd->host->hostdata[0]; (struct NCR53c7x0_hostdata *) cmd->device->host->hostdata[0];
struct NCR53c7x0_cmd *ncmd = struct NCR53c7x0_cmd *ncmd =
(struct NCR53c7x0_cmd *) cmd->host_scribble; (struct NCR53c7x0_cmd *) cmd->host_scribble;
int offset = 0, buffers; int offset = 0, buffers;
...@@ -5418,7 +5418,7 @@ insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) { ...@@ -5418,7 +5418,7 @@ insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) {
--buffers, offset += segment->length, ++segment) --buffers, offset += segment->length, ++segment)
#if 0 #if 0
printk("scsi%d: comparing 0x%p to 0x%p\n", printk("scsi%d: comparing 0x%p to 0x%p\n",
cmd->host->host_no, saved, page_address(segment->page+segment->offset); cmd->device->host->host_no, saved, page_address(segment->page+segment->offset);
#else #else
; ;
#endif #endif
...@@ -5456,7 +5456,7 @@ print_progress (Scsi_Cmnd *cmd) { ...@@ -5456,7 +5456,7 @@ print_progress (Scsi_Cmnd *cmd) {
int offset, i; int offset, i;
char *where; char *where;
u32 *ptr; u32 *ptr;
NCR53c7x0_local_setup (cmd->host); NCR53c7x0_local_setup (cmd->device->host);
if (check_address ((unsigned long) ncmd,sizeof (struct NCR53c7x0_cmd)) == 0) if (check_address ((unsigned long) ncmd,sizeof (struct NCR53c7x0_cmd)) == 0)
{ {
...@@ -5484,15 +5484,15 @@ print_progress (Scsi_Cmnd *cmd) { ...@@ -5484,15 +5484,15 @@ print_progress (Scsi_Cmnd *cmd) {
if (offset != -1) if (offset != -1)
printk ("scsi%d : %s data pointer at offset %d\n", printk ("scsi%d : %s data pointer at offset %d\n",
cmd->host->host_no, where, offset); cmd->device->host->host_no, where, offset);
else { else {
int size; int size;
printk ("scsi%d : can't determine %s data pointer offset\n", printk ("scsi%d : can't determine %s data pointer offset\n",
cmd->host->host_no, where); cmd->device->host->host_no, where);
if (ncmd) { if (ncmd) {
size = print_insn (cmd->host, size = print_insn (cmd->device->host,
bus_to_virt(ncmd->saved_data_pointer), "", 1); bus_to_virt(ncmd->saved_data_pointer), "", 1);
print_insn (cmd->host, print_insn (cmd->device->host,
bus_to_virt(ncmd->saved_data_pointer) + size * sizeof(u32), bus_to_virt(ncmd->saved_data_pointer) + size * sizeof(u32),
"", 1); "", 1);
} }
...@@ -5549,7 +5549,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) { ...@@ -5549,7 +5549,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
/* XXX Maybe we should access cmd->host_scribble->result here. RGH */ /* XXX Maybe we should access cmd->host_scribble->result here. RGH */
if (cmd) { if (cmd) {
printk(" result = 0x%x, target = %d, lun = %d, cmd = ", printk(" result = 0x%x, target = %d, lun = %d, cmd = ",
cmd->result, cmd->target, cmd->lun); cmd->result, cmd->device->id, cmd->device->lun);
print_command(cmd->cmnd); print_command(cmd->cmnd);
} else } else
printk("\n"); printk("\n");
...@@ -5558,11 +5558,11 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) { ...@@ -5558,11 +5558,11 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
if (cmd) { if (cmd) {
printk("scsi%d target %d : sxfer_sanity = 0x%x, scntl3_sanity = 0x%x\n" printk("scsi%d target %d : sxfer_sanity = 0x%x, scntl3_sanity = 0x%x\n"
" script : ", " script : ",
host->host_no, cmd->target, host->host_no, cmd->device->id,
hostdata->sync[cmd->target].sxfer_sanity, hostdata->sync[cmd->device->id].sxfer_sanity,
hostdata->sync[cmd->target].scntl3_sanity); hostdata->sync[cmd->device->id].scntl3_sanity);
for (i = 0; i < (sizeof(hostdata->sync[cmd->target].script) / 4); ++i) for (i = 0; i < (sizeof(hostdata->sync[cmd->device->id].script) / 4); ++i)
printk ("0x%x ", hostdata->sync[cmd->target].script[i]); printk ("0x%x ", hostdata->sync[cmd->device->id].script[i]);
printk ("\n"); printk ("\n");
print_progress (cmd); print_progress (cmd);
} }
...@@ -5604,7 +5604,7 @@ print_queues (struct Scsi_Host *host) { ...@@ -5604,7 +5604,7 @@ print_queues (struct Scsi_Host *host) {
-> dsa, ""); -> dsa, "");
} else } else
printk ("scsi%d : scsi pid %ld for target %d lun %d has no NCR53c7x0_cmd\n", printk ("scsi%d : scsi pid %ld for target %d lun %d has no NCR53c7x0_cmd\n",
host->host_no, cmd->pid, cmd->target, cmd->lun); host->host_no, cmd->pid, cmd->device->id, cmd->device->lun);
local_irq_restore(flags); local_irq_restore(flags);
} }
......
...@@ -1099,7 +1099,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1099,7 +1099,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
* disconnect. * disconnect.
*/ */
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->device->lun));
if(!SDptr->borken && !esp_dev->disconnect) if(!SDptr->borken && !esp_dev->disconnect)
esp_dev->disconnect = 1; esp_dev->disconnect = 1;
...@@ -1173,7 +1173,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp) ...@@ -1173,7 +1173,7 @@ static void esp_exec_cmd(struct NCR_ESP *esp)
if(((SDptr->scsi_level < 3) && (SDptr->type != TYPE_TAPE)) || if(((SDptr->scsi_level < 3) && (SDptr->type != TYPE_TAPE)) ||
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->device->id, SCptr->device->lun));
esp_dev->disconnect = 0; esp_dev->disconnect = 0;
*cmdp++ = IDENTIFY(0, lun); *cmdp++ = IDENTIFY(0, lun);
} else { } else {
...@@ -1255,8 +1255,8 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -1255,8 +1255,8 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
esp->dma_led_on(esp); esp->dma_led_on(esp);
/* We use the scratch area. */ /* We use the scratch area. */
ESPQUEUE(("esp_queue: target=%d lun=%d ", SCpnt->target, SCpnt->lun)); ESPQUEUE(("esp_queue: target=%d lun=%d ", SCpnt->device->id, SCpnt->lun));
ESPDISC(("N<%02x,%02x>", SCpnt->target, SCpnt->lun)); ESPDISC(("N<%02x,%02x>", SCpnt->device->id, SCpnt->lun));
esp_get_dmabufs(esp, SCpnt); esp_get_dmabufs(esp, SCpnt);
esp_save_pointers(esp, SCpnt); /* FIXME for tag queueing */ esp_save_pointers(esp, SCpnt); /* FIXME for tag queueing */
...@@ -2235,7 +2235,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2235,7 +2235,7 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)
* state. * state.
*/ */
ESPMISC(("esp: Status <%d> for target %d lun %d\n", ESPMISC(("esp: Status <%d> for target %d lun %d\n",
SCptr->SCp.Status, SCptr->target, SCptr->lun)); SCptr->SCp.Status, SCptr->device->id, SCptr->device->lun));
/* But don't do this when spinning up a disk at /* But don't do this when spinning up a disk at
* boot time while we poll for completion as it * boot time while we poll for completion as it
...@@ -2246,14 +2246,14 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2246,14 +2246,14 @@ static int esp_do_freebus(struct NCR_ESP *esp, struct ESP_regs *eregs)
if(esp_should_clear_sync(SCptr) != 0) if(esp_should_clear_sync(SCptr) != 0)
esp_dev->sync = 0; esp_dev->sync = 0;
} }
ESPDISC(("F<%02x,%02x>", SCptr->target, SCptr->lun)); ESPDISC(("F<%02x,%02x>", SCptr->device->id, SCptr->device->lun));
esp_done(esp, ((SCptr->SCp.Status & 0xff) | esp_done(esp, ((SCptr->SCp.Status & 0xff) |
((SCptr->SCp.Message & 0xff)<<8) | ((SCptr->SCp.Message & 0xff)<<8) |
(DID_OK << 16))); (DID_OK << 16)));
} else if(esp->prevmsgin == DISCONNECT) { } else if(esp->prevmsgin == DISCONNECT) {
/* Normal disconnect. */ /* Normal disconnect. */
esp_cmd(esp, eregs, ESP_CMD_ESEL); esp_cmd(esp, eregs, ESP_CMD_ESEL);
ESPDISC(("D<%02x,%02x>", SCptr->target, SCptr->lun)); ESPDISC(("D<%02x,%02x>", SCptr->device->id, SCptr->device->lun));
append_SC(&esp->disconnected_SC, SCptr); append_SC(&esp->disconnected_SC, SCptr);
esp->current_SC = NULL; esp->current_SC = NULL;
if(esp->issue_SC) if(esp->issue_SC)
...@@ -2811,7 +2811,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -2811,7 +2811,7 @@ static int esp_select_complete(struct NCR_ESP *esp, struct ESP_regs *eregs)
/* Else, there really isn't anyone there. */ /* Else, there really isn't anyone there. */
ESPMISC(("esp: selection failure, maybe nobody there?\n")); ESPMISC(("esp: selection failure, maybe nobody there?\n"));
ESPMISC(("esp: target %d lun %d\n", ESPMISC(("esp: target %d lun %d\n",
SCptr->target, SCptr->lun)); SCptr->device->id, SCptr->device->lun));
esp_done(esp, (DID_BAD_TARGET << 16)); esp_done(esp, (DID_BAD_TARGET << 16));
} }
return do_intr_end; return do_intr_end;
...@@ -3084,7 +3084,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp, ...@@ -3084,7 +3084,7 @@ static int check_multibyte_msg(struct NCR_ESP *esp,
ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n", ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n",
esp_dev->sync_max_offset, esp_dev->sync_max_offset,
esp_dev->sync_min_period, esp_dev->sync_min_period,
esp->config3[SCptr->target])); esp->config3[SCptr->device->id]));
esp->snip = 0; esp->snip = 0;
} else if(esp_dev->sync_max_offset) { } else if(esp_dev->sync_max_offset) {
......
...@@ -52,7 +52,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) ...@@ -52,7 +52,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
{ {
unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
unsigned long addr = virt_to_bus(cmd->SCp.ptr); unsigned long addr = virt_to_bus(cmd->SCp.ptr);
struct Scsi_Host *instance = cmd->host; struct Scsi_Host *instance = cmd->device->host;
/* don't allow DMA if the physical address is bad */ /* don't allow DMA if the physical address is bad */
if (addr & A2091_XFER_MASK || if (addr & A2091_XFER_MASK ||
...@@ -102,12 +102,12 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) ...@@ -102,12 +102,12 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
cntr |= CNTR_DDIR; cntr |= CNTR_DDIR;
/* remember direction */ /* remember direction */
HDATA(cmd->host)->dma_dir = dir_in; HDATA(cmd->device->host)->dma_dir = dir_in;
DMA(cmd->host)->CNTR = cntr; DMA(cmd->device->host)->CNTR = cntr;
/* setup DMA *physical* address */ /* setup DMA *physical* address */
DMA(cmd->host)->ACR = addr; DMA(cmd->device->host)->ACR = addr;
if (dir_in){ if (dir_in){
/* invalidate any cache */ /* invalidate any cache */
...@@ -117,7 +117,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) ...@@ -117,7 +117,7 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
cache_push (addr, cmd->SCp.this_residual); cache_push (addr, cmd->SCp.this_residual);
} }
/* start DMA */ /* start DMA */
DMA(cmd->host)->ST_DMA = 1; DMA(cmd->device->host)->ST_DMA = 1;
/* return success */ /* return success */
return 0; return 0;
......
...@@ -266,7 +266,7 @@ static Scsi_Host_Template *the_template = NULL; ...@@ -266,7 +266,7 @@ static Scsi_Host_Template *the_template = NULL;
#define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) #define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble))
#define HOSTNO instance->host_no #define HOSTNO instance->host_no
#define H_NO(cmd) (cmd)->host->host_no #define H_NO(cmd) (cmd)->device->host->host_no
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
...@@ -350,17 +350,17 @@ static void __init init_tags( void ) ...@@ -350,17 +350,17 @@ static void __init init_tags( void )
static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
if (hostdata->busy[cmd->target] & (1 << cmd->lun)) if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))
return( 1 ); return( 1 );
if (!should_be_tagged || if (!should_be_tagged ||
!setup_use_tagged_queuing || !cmd->device->tagged_supported) !setup_use_tagged_queuing || !cmd->device->tagged_supported)
return( 0 ); return( 0 );
if (TagAlloc[cmd->target][cmd->lun].nr_allocated >= if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
TagAlloc[cmd->target][cmd->lun].queue_size ) { TagAlloc[cmd->device->id][cmd->device->lun].queue_size ) {
TAG_PRINTK( "scsi%d: target %d lun %d: no free tags\n", TAG_PRINTK( "scsi%d: target %d lun %d: no free tags\n",
H_NO(cmd), cmd->target, cmd->lun ); H_NO(cmd), cmd->device->id, cmd->device->lun );
return( 1 ); return( 1 );
} }
return( 0 ); return( 0 );
...@@ -374,7 +374,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) ...@@ -374,7 +374,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
/* If we or the target don't support tagged queuing, allocate the LUN for /* If we or the target don't support tagged queuing, allocate the LUN for
* an untagged command. * an untagged command.
...@@ -382,19 +382,19 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) ...@@ -382,19 +382,19 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
if (!should_be_tagged || if (!should_be_tagged ||
!setup_use_tagged_queuing || !cmd->device->tagged_supported) { !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
cmd->tag = TAG_NONE; cmd->tag = TAG_NONE;
hostdata->busy[cmd->target] |= (1 << cmd->lun); hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
TAG_PRINTK( "scsi%d: target %d lun %d now allocated by untagged " TAG_PRINTK( "scsi%d: target %d lun %d now allocated by untagged "
"command\n", H_NO(cmd), cmd->target, cmd->lun ); "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun );
} }
else { else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun]; TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
cmd->tag = find_first_zero_bit( ta->allocated, MAX_TAGS ); cmd->tag = find_first_zero_bit( ta->allocated, MAX_TAGS );
set_bit( cmd->tag, ta->allocated ); set_bit( cmd->tag, ta->allocated );
ta->nr_allocated++; ta->nr_allocated++;
TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d " TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d "
"(now %d tags in use)\n", "(now %d tags in use)\n",
H_NO(cmd), cmd->tag, cmd->target, cmd->lun, H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun,
ta->nr_allocated ); ta->nr_allocated );
} }
} }
...@@ -406,23 +406,23 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) ...@@ -406,23 +406,23 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
static void cmd_free_tag( Scsi_Cmnd *cmd ) static void cmd_free_tag( Scsi_Cmnd *cmd )
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
if (cmd->tag == TAG_NONE) { if (cmd->tag == TAG_NONE) {
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
TAG_PRINTK( "scsi%d: target %d lun %d untagged cmd finished\n", TAG_PRINTK( "scsi%d: target %d lun %d untagged cmd finished\n",
H_NO(cmd), cmd->target, cmd->lun ); H_NO(cmd), cmd->device->id, cmd->device->lun );
} }
else if (cmd->tag >= MAX_TAGS) { else if (cmd->tag >= MAX_TAGS) {
printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n", printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
H_NO(cmd), cmd->tag ); H_NO(cmd), cmd->tag );
} }
else { else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun]; TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
clear_bit( cmd->tag, ta->allocated ); clear_bit( cmd->tag, ta->allocated );
ta->nr_allocated--; ta->nr_allocated--;
TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n", TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n",
H_NO(cmd), cmd->tag, cmd->target, cmd->lun ); H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun );
} }
} }
...@@ -811,7 +811,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length) ...@@ -811,7 +811,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
int i, s; int i, s;
unsigned char *command; unsigned char *command;
SPRINTF("scsi%d: destination target %d, lun %d\n", SPRINTF("scsi%d: destination target %d, lun %d\n",
H_NO(cmd), cmd->target, cmd->lun); H_NO(cmd), cmd->device->id, cmd->device->lun);
SPRINTF(" command = "); SPRINTF(" command = ");
command = cmd->cmnd; command = cmd->cmnd;
SPRINTF("%2d (0x%02x)", command[0], command[0]); SPRINTF("%2d (0x%02x)", command[0], command[0]);
...@@ -903,7 +903,7 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags) ...@@ -903,7 +903,7 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags)
static static
int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
Scsi_Cmnd *tmp; Scsi_Cmnd *tmp;
int oldto; int oldto;
unsigned long flags; unsigned long flags;
...@@ -937,15 +937,15 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -937,15 +937,15 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
case WRITE: case WRITE:
case WRITE_6: case WRITE_6:
case WRITE_10: case WRITE_10:
hostdata->time_write[cmd->target] -= (jiffies - hostdata->timebase); hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
hostdata->bytes_write[cmd->target] += cmd->request_bufflen; hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
hostdata->pendingw++; hostdata->pendingw++;
break; break;
case READ: case READ:
case READ_6: case READ_6:
case READ_10: case READ_10:
hostdata->time_read[cmd->target] -= (jiffies - hostdata->timebase); hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
hostdata->bytes_read[cmd->target] += cmd->request_bufflen; hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
hostdata->pendingr++; hostdata->pendingr++;
break; break;
} }
...@@ -1086,8 +1086,8 @@ static void NCR5380_main (void *bl) ...@@ -1086,8 +1086,8 @@ static void NCR5380_main (void *bl)
#if (NDEBUG & NDEBUG_LISTS) #if (NDEBUG & NDEBUG_LISTS)
if (prev != tmp) if (prev != tmp)
printk("MAIN tmp=%p target=%d busy=%d lun=%d\n", printk("MAIN tmp=%p target=%d busy=%d lun=%d\n",
tmp, tmp->target, hostdata->busy[tmp->target], tmp, tmp->device->id, hostdata->busy[tmp->device->id],
tmp->lun); tmp->device->lun);
#endif #endif
/* When we find one, remove it from the issue queue. */ /* When we find one, remove it from the issue queue. */
/* ++guenther: possible race with Falcon locking */ /* ++guenther: possible race with Falcon locking */
...@@ -1095,7 +1095,7 @@ static void NCR5380_main (void *bl) ...@@ -1095,7 +1095,7 @@ static void NCR5380_main (void *bl)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
!is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE) !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE)
#else #else
!(hostdata->busy[tmp->target] & (1 << tmp->lun)) !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun))
#endif #endif
) { ) {
/* ++guenther: just to be sure, this must be atomic */ /* ++guenther: just to be sure, this must be atomic */
...@@ -1121,7 +1121,7 @@ static void NCR5380_main (void *bl) ...@@ -1121,7 +1121,7 @@ static void NCR5380_main (void *bl)
*/ */
MAIN_PRINTK("scsi%d: main(): command for target %d " MAIN_PRINTK("scsi%d: main(): command for target %d "
"lun %d removed from issue_queue\n", "lun %d removed from issue_queue\n",
HOSTNO, tmp->target, tmp->lun); HOSTNO, tmp->device->id, tmp->device->lun);
/* /*
* REQUEST SENSE commands are issued without tagged * REQUEST SENSE commands are issued without tagged
* queueing, even on SCSI-II devices because the * queueing, even on SCSI-II devices because the
...@@ -1355,15 +1355,15 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) ...@@ -1355,15 +1355,15 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd)
case WRITE: case WRITE:
case WRITE_6: case WRITE_6:
case WRITE_10: case WRITE_10:
hostdata->time_write[cmd->target] += (jiffies - hostdata->timebase); hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
/*hostdata->bytes_write[cmd->target] += cmd->request_bufflen;*/ /*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/
hostdata->pendingw--; hostdata->pendingw--;
break; break;
case READ: case READ:
case READ_6: case READ_6:
case READ_10: case READ_10:
hostdata->time_read[cmd->target] += (jiffies - hostdata->timebase); hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
/*hostdata->bytes_read[cmd->target] += cmd->request_bufflen;*/ /*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/
hostdata->pendingr--; hostdata->pendingr--;
break; break;
} }
...@@ -1524,7 +1524,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1524,7 +1524,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
* the host and target ID's on the SCSI bus. * the host and target ID's on the SCSI bus.
*/ */
NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->target))); NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
/* /*
* Raise ATN while SEL is true before BSY goes false from arbitration, * Raise ATN while SEL is true before BSY goes false from arbitration,
...@@ -1577,7 +1577,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1577,7 +1577,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
udelay(1); udelay(1);
SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->target); SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
/* /*
* The SCSI specification calls for a 250 ms timeout for the actual * The SCSI specification calls for a 250 ms timeout for the actual
...@@ -1628,7 +1628,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1628,7 +1628,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
if (!(NCR5380_read(STATUS_REG) & SR_BSY)) { if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
if (hostdata->targets_present & (1 << cmd->target)) { if (hostdata->targets_present & (1 << cmd->device->id)) {
printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO); printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO);
if (hostdata->restart_select) if (hostdata->restart_select)
printk(KERN_NOTICE "\trestart select\n"); printk(KERN_NOTICE "\trestart select\n");
...@@ -1650,7 +1650,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1650,7 +1650,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
return 0; return 0;
} }
hostdata->targets_present |= (1 << cmd->target); hostdata->targets_present |= (1 << cmd->device->id);
/* /*
* Since we followed the SCSI spec, and raised ATN while SEL * Since we followed the SCSI spec, and raised ATN while SEL
...@@ -1671,8 +1671,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1671,8 +1671,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
while (!(NCR5380_read(STATUS_REG) & SR_REQ)); while (!(NCR5380_read(STATUS_REG) & SR_REQ));
SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n", SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
HOSTNO, cmd->target); HOSTNO, cmd->device->id);
tmp[0] = IDENTIFY(1, cmd->lun); tmp[0] = IDENTIFY(1, cmd->device->lun);
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
if (cmd->tag != TAG_NONE) { if (cmd->tag != TAG_NONE) {
...@@ -1694,7 +1694,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1694,7 +1694,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
/* XXX need to handle errors here */ /* XXX need to handle errors here */
hostdata->connected = cmd; hostdata->connected = cmd;
#ifndef SUPPORT_TAGS #ifndef SUPPORT_TAGS
hostdata->busy[cmd->target] |= (1 << cmd->lun); hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
#endif #endif
initialize_SCp(cmd); initialize_SCp(cmd);
...@@ -2084,7 +2084,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2084,7 +2084,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
* polled-IO. */ * polled-IO. */
printk(KERN_NOTICE "scsi%d: switching target %d " printk(KERN_NOTICE "scsi%d: switching target %d "
"lun %d to slow handshake\n", HOSTNO, "lun %d to slow handshake\n", HOSTNO,
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
cmd->device->borken = 1; cmd->device->borken = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
ICR_ASSERT_ATN); ICR_ASSERT_ATN);
...@@ -2136,7 +2136,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2136,7 +2136,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
LNK_PRINTK("scsi%d: target %d lun %d linked command " LNK_PRINTK("scsi%d: target %d lun %d linked command "
"complete.\n", HOSTNO, cmd->target, cmd->lun); "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
/* Enable reselect interrupts */ /* Enable reselect interrupts */
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
...@@ -2149,7 +2149,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2149,7 +2149,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
if (!cmd->next_link) { if (!cmd->next_link) {
printk(KERN_NOTICE "scsi%d: target %d lun %d " printk(KERN_NOTICE "scsi%d: target %d lun %d "
"linked command complete, no next_link\n", "linked command complete, no next_link\n",
HOSTNO, cmd->target, cmd->lun); HOSTNO, cmd->device->id, cmd->device->lun);
sink = 1; sink = 1;
do_abort (instance); do_abort (instance);
return; return;
...@@ -2162,7 +2162,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2162,7 +2162,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
LNK_PRINTK("scsi%d: target %d lun %d linked request " LNK_PRINTK("scsi%d: target %d lun %d linked request "
"done, calling scsi_done().\n", "done, calling scsi_done().\n",
HOSTNO, cmd->target, cmd->lun); HOSTNO, cmd->device->id, cmd->device->lun);
#ifdef NCR5380_STATS #ifdef NCR5380_STATS
collect_stats(hostdata, cmd); collect_stats(hostdata, cmd);
#endif #endif
...@@ -2178,7 +2178,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2178,7 +2178,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
falcon_dont_release++; falcon_dont_release++;
hostdata->connected = NULL; hostdata->connected = NULL;
QU_PRINTK("scsi%d: command for target %d, lun %d " QU_PRINTK("scsi%d: command for target %d, lun %d "
"completed\n", HOSTNO, cmd->target, cmd->lun); "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( cmd ); cmd_free_tag( cmd );
if (status_byte(cmd->SCp.Status) == QUEUE_FULL) { if (status_byte(cmd->SCp.Status) == QUEUE_FULL) {
...@@ -2190,16 +2190,16 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2190,16 +2190,16 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
*/ */
/* ++Andreas: the mid level code knows about /* ++Andreas: the mid level code knows about
QUEUE_FULL now. */ QUEUE_FULL now. */
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun]; TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
TAG_PRINTK("scsi%d: target %d lun %d returned " TAG_PRINTK("scsi%d: target %d lun %d returned "
"QUEUE_FULL after %d commands\n", "QUEUE_FULL after %d commands\n",
HOSTNO, cmd->target, cmd->lun, HOSTNO, cmd->device->id, cmd->device->lun,
ta->nr_allocated); ta->nr_allocated);
if (ta->queue_size > ta->nr_allocated) if (ta->queue_size > ta->nr_allocated)
ta->nr_allocated = ta->queue_size; ta->nr_allocated = ta->queue_size;
} }
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
/* Enable reselect interrupts */ /* Enable reselect interrupts */
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
...@@ -2295,12 +2295,12 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2295,12 +2295,12 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
* the command is treated as untagged further on. * the command is treated as untagged further on.
*/ */
cmd->device->tagged_supported = 0; cmd->device->tagged_supported = 0;
hostdata->busy[cmd->target] |= (1 << cmd->lun); hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
cmd->tag = TAG_NONE; cmd->tag = TAG_NONE;
TAG_PRINTK("scsi%d: target %d lun %d rejected " TAG_PRINTK("scsi%d: target %d lun %d rejected "
"QUEUE_TAG message; tagged queuing " "QUEUE_TAG message; tagged queuing "
"disabled\n", "disabled\n",
HOSTNO, cmd->target, cmd->lun); HOSTNO, cmd->device->id, cmd->device->lun);
break; break;
} }
break; break;
...@@ -2317,7 +2317,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2317,7 +2317,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
QU_PRINTK("scsi%d: command for target %d lun %d was " QU_PRINTK("scsi%d: command for target %d lun %d was "
"moved from connected to the " "moved from connected to the "
"disconnected_queue\n", HOSTNO, "disconnected_queue\n", HOSTNO,
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
/* /*
* Restore phase bits to 0 so an interrupted selection, * Restore phase bits to 0 so an interrupted selection,
* arbitration can resume. * arbitration can resume.
...@@ -2416,13 +2416,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2416,13 +2416,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
} else if (tmp != EXTENDED_MESSAGE) } else if (tmp != EXTENDED_MESSAGE)
printk(KERN_DEBUG "scsi%d: rejecting unknown " printk(KERN_DEBUG "scsi%d: rejecting unknown "
"message %02x from target %d, lun %d\n", "message %02x from target %d, lun %d\n",
HOSTNO, tmp, cmd->target, cmd->lun); HOSTNO, tmp, cmd->device->id, cmd->device->lun);
else else
printk(KERN_DEBUG "scsi%d: rejecting unknown " printk(KERN_DEBUG "scsi%d: rejecting unknown "
"extended message " "extended message "
"code %02x, length %d from target %d, lun %d\n", "code %02x, length %d from target %d, lun %d\n",
HOSTNO, extended_msg[1], extended_msg[0], HOSTNO, extended_msg[1], extended_msg[0],
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
msgout = MESSAGE_REJECT; msgout = MESSAGE_REJECT;
...@@ -2440,7 +2440,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2440,7 +2440,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( cmd ); cmd_free_tag( cmd );
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
hostdata->connected = NULL; hostdata->connected = NULL;
cmd->result = DID_ERROR << 16; cmd->result = DID_ERROR << 16;
...@@ -2576,7 +2576,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) ...@@ -2576,7 +2576,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL;
tmp; prev = tmp, tmp = NEXT(tmp) ) { tmp; prev = tmp, tmp = NEXT(tmp) ) {
if ((target_mask == (1 << tmp->target)) && (lun == tmp->lun) if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
&& (tag == tmp->tag) && (tag == tmp->tag)
#endif #endif
...@@ -2619,7 +2619,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) ...@@ -2619,7 +2619,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
hostdata->connected = tmp; hostdata->connected = tmp;
RSL_PRINTK("scsi%d: nexus established, target = %d, lun = %d, tag = %d\n", RSL_PRINTK("scsi%d: nexus established, target = %d, lun = %d, tag = %d\n",
HOSTNO, tmp->target, tmp->lun, tmp->tag); HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag);
falcon_dont_release--; falcon_dont_release--;
} }
...@@ -2644,7 +2644,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) ...@@ -2644,7 +2644,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
static static
int NCR5380_abort (Scsi_Cmnd *cmd) int NCR5380_abort (Scsi_Cmnd *cmd)
{ {
struct Scsi_Host *instance = cmd->host; struct Scsi_Host *instance = cmd->device->host;
SETUP_HOSTDATA(instance); SETUP_HOSTDATA(instance);
Scsi_Cmnd *tmp, **prev; Scsi_Cmnd *tmp, **prev;
unsigned long flags; unsigned long flags;
...@@ -2698,7 +2698,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2698,7 +2698,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( cmd ); cmd_free_tag( cmd );
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
local_irq_restore(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
...@@ -2805,7 +2805,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2805,7 +2805,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( tmp ); cmd_free_tag( tmp );
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
local_irq_restore(flags); local_irq_restore(flags);
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
...@@ -2849,7 +2849,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2849,7 +2849,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
static int NCR5380_bus_reset( Scsi_Cmnd *cmd) static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
int i; int i;
unsigned long flags; unsigned long flags;
#if 1 #if 1
...@@ -2860,7 +2860,7 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd) ...@@ -2860,7 +2860,7 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_reset\n", printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_reset\n",
H_NO(cmd) ); H_NO(cmd) );
NCR5380_print_status (cmd->host); NCR5380_print_status (cmd->device->host);
/* get in phase */ /* get in phase */
NCR5380_write( TARGET_COMMAND_REG, NCR5380_write( TARGET_COMMAND_REG,
......
...@@ -823,7 +823,7 @@ int atari_scsi_bus_reset(Scsi_Cmnd *cmd) ...@@ -823,7 +823,7 @@ int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
{ {
int rv; int rv;
struct NCR5380_hostdata *hostdata = struct NCR5380_hostdata *hostdata =
(struct NCR5380_hostdata *)cmd->host->hostdata; (struct NCR5380_hostdata *)cmd->device->host->hostdata;
/* For doing the reset, SCSI interrupts must be disabled first, /* For doing the reset, SCSI interrupts must be disabled first,
* since the 5380 raises its IRQ line while _RST is active and we * since the 5380 raises its IRQ line while _RST is active and we
......
...@@ -62,61 +62,62 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) ...@@ -62,61 +62,62 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
static int scsi_alloc_out_of_range = 0; static int scsi_alloc_out_of_range = 0;
/* use bounce buffer if the physical address is bad */ /* use bounce buffer if the physical address is bad */
if (addr & HDATA(cmd->host)->dma_xfer_mask || if (addr & HDATA(cmd->device->host)->dma_xfer_mask ||
(!dir_in && mm_end_of_chunk (addr, cmd->SCp.this_residual))) (!dir_in && mm_end_of_chunk (addr, cmd->SCp.this_residual)))
{ {
HDATA(cmd->host)->dma_bounce_len = (cmd->SCp.this_residual + 511) HDATA(cmd->device->host)->dma_bounce_len = (cmd->SCp.this_residual + 511)
& ~0x1ff; & ~0x1ff;
if( !scsi_alloc_out_of_range ) { if( !scsi_alloc_out_of_range ) {
HDATA(cmd->host)->dma_bounce_buffer = HDATA(cmd->device->host)->dma_bounce_buffer =
kmalloc (HDATA(cmd->host)->dma_bounce_len, GFP_KERNEL); kmalloc (HDATA(cmd->device->host)->dma_bounce_len, GFP_KERNEL);
HDATA(cmd->host)->dma_buffer_pool = BUF_SCSI_ALLOCED; HDATA(cmd->device->host)->dma_buffer_pool = BUF_SCSI_ALLOCED;
} }
if ( scsi_alloc_out_of_range || !HDATA(cmd->host)->dma_bounce_buffer) { if (scsi_alloc_out_of_range ||
HDATA(cmd->host)->dma_bounce_buffer = !HDATA(cmd->device->host)->dma_bounce_buffer) {
amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len, HDATA(cmd->device->host)->dma_bounce_buffer =
amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len,
"GVP II SCSI Bounce Buffer"); "GVP II SCSI Bounce Buffer");
if(!HDATA(cmd->host)->dma_bounce_buffer) if(!HDATA(cmd->device->host)->dma_bounce_buffer)
{ {
HDATA(cmd->host)->dma_bounce_len = 0; HDATA(cmd->device->host)->dma_bounce_len = 0;
return 1; return 1;
} }
HDATA(cmd->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED;
} }
/* check if the address of the bounce buffer is OK */ /* check if the address of the bounce buffer is OK */
addr = virt_to_bus(HDATA(cmd->host)->dma_bounce_buffer); addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer);
if (addr & HDATA(cmd->host)->dma_xfer_mask) { if (addr & HDATA(cmd->device->host)->dma_xfer_mask) {
/* fall back to Chip RAM if address out of range */ /* fall back to Chip RAM if address out of range */
if( HDATA(cmd->host)->dma_buffer_pool == BUF_SCSI_ALLOCED) { if( HDATA(cmd->device->host)->dma_buffer_pool == BUF_SCSI_ALLOCED) {
kfree (HDATA(cmd->host)->dma_bounce_buffer); kfree (HDATA(cmd->device->host)->dma_bounce_buffer);
scsi_alloc_out_of_range = 1; scsi_alloc_out_of_range = 1;
} else { } else {
amiga_chip_free (HDATA(cmd->host)->dma_bounce_buffer); amiga_chip_free (HDATA(cmd->device->host)->dma_bounce_buffer);
} }
HDATA(cmd->host)->dma_bounce_buffer = HDATA(cmd->device->host)->dma_bounce_buffer =
amiga_chip_alloc(HDATA(cmd->host)->dma_bounce_len, amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len,
"GVP II SCSI Bounce Buffer"); "GVP II SCSI Bounce Buffer");
if(!HDATA(cmd->host)->dma_bounce_buffer) if(!HDATA(cmd->device->host)->dma_bounce_buffer)
{ {
HDATA(cmd->host)->dma_bounce_len = 0; HDATA(cmd->device->host)->dma_bounce_len = 0;
return 1; return 1;
} }
addr = virt_to_bus(HDATA(cmd->host)->dma_bounce_buffer); addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer);
HDATA(cmd->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED;
} }
if (!dir_in) { if (!dir_in) {
/* copy to bounce buffer for a write */ /* copy to bounce buffer for a write */
memcpy (HDATA(cmd->host)->dma_bounce_buffer, memcpy (HDATA(cmd->device->host)->dma_bounce_buffer,
cmd->SCp.ptr, cmd->SCp.this_residual); cmd->SCp.ptr, cmd->SCp.this_residual);
} }
} }
...@@ -125,11 +126,11 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) ...@@ -125,11 +126,11 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
if (!dir_in) if (!dir_in)
cntr |= GVP11_DMAC_DIR_WRITE; cntr |= GVP11_DMAC_DIR_WRITE;
HDATA(cmd->host)->dma_dir = dir_in; HDATA(cmd->device->host)->dma_dir = dir_in;
DMA(cmd->host)->CNTR = cntr; DMA(cmd->device->host)->CNTR = cntr;
/* setup DMA *physical* address */ /* setup DMA *physical* address */
DMA(cmd->host)->ACR = addr; DMA(cmd->device->host)->ACR = addr;
if (dir_in) if (dir_in)
/* invalidate any cache */ /* invalidate any cache */
...@@ -138,11 +139,11 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in) ...@@ -138,11 +139,11 @@ static int dma_setup (Scsi_Cmnd *cmd, int dir_in)
/* push any dirty cache */ /* push any dirty cache */
cache_push (addr, cmd->SCp.this_residual); cache_push (addr, cmd->SCp.this_residual);
if ((bank_mask = (~HDATA(cmd->host)->dma_xfer_mask >> 18) & 0x01c0)) if ((bank_mask = (~HDATA(cmd->device->host)->dma_xfer_mask >> 18) & 0x01c0))
DMA(cmd->host)->BANK = bank_mask & (addr >> 18); DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18);
/* start DMA */ /* start DMA */
DMA(cmd->host)->ST_DMA = 1; DMA(cmd->device->host)->ST_DMA = 1;
/* return success */ /* return success */
return 0; return 0;
......
...@@ -268,7 +268,7 @@ static Scsi_Host_Template *the_template = NULL; ...@@ -268,7 +268,7 @@ static Scsi_Host_Template *the_template = NULL;
#define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble)) #define NEXTADDR(cmd) ((Scsi_Cmnd **)&((cmd)->host_scribble))
#define HOSTNO instance->host_no #define HOSTNO instance->host_no
#define H_NO(cmd) (cmd)->host->host_no #define H_NO(cmd) (cmd)->device->host->host_no
#define SGADDR(buffer) (void *)(((unsigned long)page_address((buffer)->page)) + \ #define SGADDR(buffer) (void *)(((unsigned long)page_address((buffer)->page)) + \
(buffer)->offset) (buffer)->offset)
...@@ -360,17 +360,17 @@ static void __init init_tags( void ) ...@@ -360,17 +360,17 @@ static void __init init_tags( void )
static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
if (hostdata->busy[cmd->target] & (1 << cmd->lun)) if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))
return( 1 ); return( 1 );
if (!should_be_tagged || if (!should_be_tagged ||
!setup_use_tagged_queuing || !cmd->device->tagged_supported) !setup_use_tagged_queuing || !cmd->device->tagged_supported)
return( 0 ); return( 0 );
if (TagAlloc[cmd->target][cmd->lun].nr_allocated >= if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
TagAlloc[cmd->target][cmd->lun].queue_size ) { TagAlloc[cmd->device->id][cmd->device->lun].queue_size ) {
TAG_PRINTK( "scsi%d: target %d lun %d: no free tags\n", TAG_PRINTK( "scsi%d: target %d lun %d: no free tags\n",
H_NO(cmd), cmd->target, cmd->lun ); H_NO(cmd), cmd->device->id, cmd->device->lun );
return( 1 ); return( 1 );
} }
return( 0 ); return( 0 );
...@@ -384,7 +384,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged ) ...@@ -384,7 +384,7 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
/* If we or the target don't support tagged queuing, allocate the LUN for /* If we or the target don't support tagged queuing, allocate the LUN for
* an untagged command. * an untagged command.
...@@ -392,19 +392,19 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) ...@@ -392,19 +392,19 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
if (!should_be_tagged || if (!should_be_tagged ||
!setup_use_tagged_queuing || !cmd->device->tagged_supported) { !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
cmd->tag = TAG_NONE; cmd->tag = TAG_NONE;
hostdata->busy[cmd->target] |= (1 << cmd->lun); hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
TAG_PRINTK( "scsi%d: target %d lun %d now allocated by untagged " TAG_PRINTK( "scsi%d: target %d lun %d now allocated by untagged "
"command\n", H_NO(cmd), cmd->target, cmd->lun ); "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun );
} }
else { else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun]; TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS ); cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS );
set_bit( cmd->tag, &ta->allocated ); set_bit( cmd->tag, &ta->allocated );
ta->nr_allocated++; ta->nr_allocated++;
TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d " TAG_PRINTK( "scsi%d: using tag %d for target %d lun %d "
"(now %d tags in use)\n", "(now %d tags in use)\n",
H_NO(cmd), cmd->tag, cmd->target, cmd->lun, H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun,
ta->nr_allocated ); ta->nr_allocated );
} }
} }
...@@ -416,23 +416,23 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged ) ...@@ -416,23 +416,23 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
static void cmd_free_tag( Scsi_Cmnd *cmd ) static void cmd_free_tag( Scsi_Cmnd *cmd )
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
if (cmd->tag == TAG_NONE) { if (cmd->tag == TAG_NONE) {
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
TAG_PRINTK( "scsi%d: target %d lun %d untagged cmd finished\n", TAG_PRINTK( "scsi%d: target %d lun %d untagged cmd finished\n",
H_NO(cmd), cmd->target, cmd->lun ); H_NO(cmd), cmd->device->id, cmd->device->lun );
} }
else if (cmd->tag >= MAX_TAGS) { else if (cmd->tag >= MAX_TAGS) {
printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n", printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
H_NO(cmd), cmd->tag ); H_NO(cmd), cmd->tag );
} }
else { else {
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun]; TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
clear_bit( cmd->tag, &ta->allocated ); clear_bit( cmd->tag, &ta->allocated );
ta->nr_allocated--; ta->nr_allocated--;
TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n", TAG_PRINTK( "scsi%d: freed tag %d for target %d lun %d\n",
H_NO(cmd), cmd->tag, cmd->target, cmd->lun ); H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun );
} }
} }
...@@ -819,7 +819,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length) ...@@ -819,7 +819,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
int i, s; int i, s;
unsigned char *command; unsigned char *command;
SPRINTF("scsi%d: destination target %d, lun %d\n", SPRINTF("scsi%d: destination target %d, lun %d\n",
H_NO(cmd), cmd->target, cmd->lun); H_NO(cmd), cmd->device->id, cmd->device->lun);
SPRINTF(" command = "); SPRINTF(" command = ");
command = cmd->cmnd; command = cmd->cmnd;
SPRINTF("%2d (0x%02x)", command[0], command[0]); SPRINTF("%2d (0x%02x)", command[0], command[0]);
...@@ -911,7 +911,7 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags) ...@@ -911,7 +911,7 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags)
/* Only make static if a wrapper function is used */ /* Only make static if a wrapper function is used */
static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
Scsi_Cmnd *tmp; Scsi_Cmnd *tmp;
unsigned long flags; unsigned long flags;
...@@ -943,15 +943,15 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -943,15 +943,15 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
case WRITE: case WRITE:
case WRITE_6: case WRITE_6:
case WRITE_10: case WRITE_10:
hostdata->time_write[cmd->target] -= (jiffies - hostdata->timebase); hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
hostdata->bytes_write[cmd->target] += cmd->request_bufflen; hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
hostdata->pendingw++; hostdata->pendingw++;
break; break;
case READ: case READ:
case READ_6: case READ_6:
case READ_10: case READ_10:
hostdata->time_read[cmd->target] -= (jiffies - hostdata->timebase); hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
hostdata->bytes_read[cmd->target] += cmd->request_bufflen; hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
hostdata->pendingr++; hostdata->pendingr++;
break; break;
} }
...@@ -1096,7 +1096,7 @@ static void NCR5380_main (void *bl) ...@@ -1096,7 +1096,7 @@ static void NCR5380_main (void *bl)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
!is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE) !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE)
#else #else
!(hostdata->busy[tmp->target] & (1 << tmp->lun)) !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun))
#endif #endif
) { ) {
/* ++guenther: just to be sure, this must be atomic */ /* ++guenther: just to be sure, this must be atomic */
...@@ -1350,15 +1350,15 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd) ...@@ -1350,15 +1350,15 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd)
case WRITE: case WRITE:
case WRITE_6: case WRITE_6:
case WRITE_10: case WRITE_10:
hostdata->time_write[cmd->target] += (jiffies - hostdata->timebase); hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
/*hostdata->bytes_write[cmd->target] += cmd->request_bufflen;*/ /*hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;*/
hostdata->pendingw--; hostdata->pendingw--;
break; break;
case READ: case READ:
case READ_6: case READ_6:
case READ_10: case READ_10:
hostdata->time_read[cmd->target] += (jiffies - hostdata->timebase); hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
/*hostdata->bytes_read[cmd->target] += cmd->request_bufflen;*/ /*hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;*/
hostdata->pendingr--; hostdata->pendingr--;
break; break;
} }
...@@ -1519,7 +1519,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1519,7 +1519,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
* the host and target ID's on the SCSI bus. * the host and target ID's on the SCSI bus.
*/ */
NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->target))); NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
/* /*
* Raise ATN while SEL is true before BSY goes false from arbitration, * Raise ATN while SEL is true before BSY goes false from arbitration,
...@@ -1572,7 +1572,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1572,7 +1572,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
udelay(1); udelay(1);
SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->target); SEL_PRINTK("scsi%d: selecting target %d\n", HOSTNO, cmd->device->id);
/* /*
* The SCSI specification calls for a 250 ms timeout for the actual * The SCSI specification calls for a 250 ms timeout for the actual
...@@ -1623,7 +1623,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1623,7 +1623,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
if (!(NCR5380_read(STATUS_REG) & SR_BSY)) { if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
if (hostdata->targets_present & (1 << cmd->target)) { if (hostdata->targets_present & (1 << cmd->device->id)) {
printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO); printk(KERN_ERR "scsi%d: weirdness\n", HOSTNO);
if (hostdata->restart_select) if (hostdata->restart_select)
printk(KERN_NOTICE "\trestart select\n"); printk(KERN_NOTICE "\trestart select\n");
...@@ -1645,7 +1645,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1645,7 +1645,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
return 0; return 0;
} }
hostdata->targets_present |= (1 << cmd->target); hostdata->targets_present |= (1 << cmd->device->id);
/* /*
* Since we followed the SCSI spec, and raised ATN while SEL * Since we followed the SCSI spec, and raised ATN while SEL
...@@ -1666,8 +1666,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1666,8 +1666,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
while (!(NCR5380_read(STATUS_REG) & SR_REQ)); while (!(NCR5380_read(STATUS_REG) & SR_REQ));
SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n", SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
HOSTNO, cmd->target); HOSTNO, cmd->device->id);
tmp[0] = IDENTIFY(1, cmd->lun); tmp[0] = IDENTIFY(1, cmd->device->lun);
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
if (cmd->tag != TAG_NONE) { if (cmd->tag != TAG_NONE) {
...@@ -1689,7 +1689,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1689,7 +1689,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
/* XXX need to handle errors here */ /* XXX need to handle errors here */
hostdata->connected = cmd; hostdata->connected = cmd;
#ifndef SUPPORT_TAGS #ifndef SUPPORT_TAGS
hostdata->busy[cmd->target] |= (1 << cmd->lun); hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
#endif #endif
#ifdef SUN3_SCSI_VME #ifdef SUN3_SCSI_VME
dregs->csr |= CSR_INTR; dregs->csr |= CSR_INTR;
...@@ -2104,7 +2104,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2104,7 +2104,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
* polled-IO. */ * polled-IO. */
printk(KERN_NOTICE "scsi%d: switching target %d " printk(KERN_NOTICE "scsi%d: switching target %d "
"lun %d to slow handshake\n", HOSTNO, "lun %d to slow handshake\n", HOSTNO,
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
cmd->device->borken = 1; cmd->device->borken = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
ICR_ASSERT_ATN); ICR_ASSERT_ATN);
...@@ -2162,7 +2162,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2162,7 +2162,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
LNK_PRINTK("scsi%d: target %d lun %d linked command " LNK_PRINTK("scsi%d: target %d lun %d linked command "
"complete.\n", HOSTNO, cmd->target, cmd->lun); "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
/* Enable reselect interrupts */ /* Enable reselect interrupts */
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
...@@ -2175,7 +2175,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2175,7 +2175,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
if (!cmd->next_link) { if (!cmd->next_link) {
printk(KERN_NOTICE "scsi%d: target %d lun %d " printk(KERN_NOTICE "scsi%d: target %d lun %d "
"linked command complete, no next_link\n", "linked command complete, no next_link\n",
HOSTNO, cmd->target, cmd->lun); HOSTNO, cmd->device->id, cmd->device->lun);
sink = 1; sink = 1;
do_abort (instance); do_abort (instance);
return; return;
...@@ -2188,7 +2188,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2188,7 +2188,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
LNK_PRINTK("scsi%d: target %d lun %d linked request " LNK_PRINTK("scsi%d: target %d lun %d linked request "
"done, calling scsi_done().\n", "done, calling scsi_done().\n",
HOSTNO, cmd->target, cmd->lun); HOSTNO, cmd->device->id, cmd->device->lun);
#ifdef NCR5380_STATS #ifdef NCR5380_STATS
collect_stats(hostdata, cmd); collect_stats(hostdata, cmd);
#endif #endif
...@@ -2202,7 +2202,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2202,7 +2202,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
hostdata->connected = NULL; hostdata->connected = NULL;
QU_PRINTK("scsi%d: command for target %d, lun %d " QU_PRINTK("scsi%d: command for target %d, lun %d "
"completed\n", HOSTNO, cmd->target, cmd->lun); "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( cmd ); cmd_free_tag( cmd );
if (status_byte(cmd->SCp.Status) == QUEUE_FULL) { if (status_byte(cmd->SCp.Status) == QUEUE_FULL) {
...@@ -2214,16 +2214,16 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2214,16 +2214,16 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
*/ */
/* ++Andreas: the mid level code knows about /* ++Andreas: the mid level code knows about
QUEUE_FULL now. */ QUEUE_FULL now. */
TAG_ALLOC *ta = &TagAlloc[cmd->target][cmd->lun]; TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
TAG_PRINTK("scsi%d: target %d lun %d returned " TAG_PRINTK("scsi%d: target %d lun %d returned "
"QUEUE_FULL after %d commands\n", "QUEUE_FULL after %d commands\n",
HOSTNO, cmd->target, cmd->lun, HOSTNO, cmd->device->id, cmd->device->lun,
ta->nr_allocated); ta->nr_allocated);
if (ta->queue_size > ta->nr_allocated) if (ta->queue_size > ta->nr_allocated)
ta->nr_allocated = ta->queue_size; ta->nr_allocated = ta->queue_size;
} }
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
/* Enable reselect interrupts */ /* Enable reselect interrupts */
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask); NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
...@@ -2313,12 +2313,12 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2313,12 +2313,12 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
* the command is treated as untagged further on. * the command is treated as untagged further on.
*/ */
cmd->device->tagged_supported = 0; cmd->device->tagged_supported = 0;
hostdata->busy[cmd->target] |= (1 << cmd->lun); hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
cmd->tag = TAG_NONE; cmd->tag = TAG_NONE;
TAG_PRINTK("scsi%d: target %d lun %d rejected " TAG_PRINTK("scsi%d: target %d lun %d rejected "
"QUEUE_TAG message; tagged queuing " "QUEUE_TAG message; tagged queuing "
"disabled\n", "disabled\n",
HOSTNO, cmd->target, cmd->lun); HOSTNO, cmd->device->id, cmd->device->lun);
break; break;
} }
break; break;
...@@ -2335,7 +2335,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2335,7 +2335,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
QU_PRINTK("scsi%d: command for target %d lun %d was " QU_PRINTK("scsi%d: command for target %d lun %d was "
"moved from connected to the " "moved from connected to the "
"disconnected_queue\n", HOSTNO, "disconnected_queue\n", HOSTNO,
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
/* /*
* Restore phase bits to 0 so an interrupted selection, * Restore phase bits to 0 so an interrupted selection,
* arbitration can resume. * arbitration can resume.
...@@ -2437,13 +2437,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2437,13 +2437,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
} else if (tmp != EXTENDED_MESSAGE) } else if (tmp != EXTENDED_MESSAGE)
printk(KERN_DEBUG "scsi%d: rejecting unknown " printk(KERN_DEBUG "scsi%d: rejecting unknown "
"message %02x from target %d, lun %d\n", "message %02x from target %d, lun %d\n",
HOSTNO, tmp, cmd->target, cmd->lun); HOSTNO, tmp, cmd->device->id, cmd->device->lun);
else else
printk(KERN_DEBUG "scsi%d: rejecting unknown " printk(KERN_DEBUG "scsi%d: rejecting unknown "
"extended message " "extended message "
"code %02x, length %d from target %d, lun %d\n", "code %02x, length %d from target %d, lun %d\n",
HOSTNO, extended_msg[1], extended_msg[0], HOSTNO, extended_msg[1], extended_msg[0],
cmd->target, cmd->lun); cmd->device->id, cmd->device->lun);
msgout = MESSAGE_REJECT; msgout = MESSAGE_REJECT;
...@@ -2461,7 +2461,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2461,7 +2461,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( cmd ); cmd_free_tag( cmd );
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
hostdata->connected = NULL; hostdata->connected = NULL;
cmd->result = DID_ERROR << 16; cmd->result = DID_ERROR << 16;
...@@ -2580,7 +2580,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) ...@@ -2580,7 +2580,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL;
tmp; prev = tmp, tmp = NEXT(tmp) ) { tmp; prev = tmp, tmp = NEXT(tmp) ) {
if ((target_mask == (1 << tmp->target)) && (lun == tmp->lun) if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
&& (tag == tmp->tag) && (tag == tmp->tag)
#endif #endif
...@@ -2687,7 +2687,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance) ...@@ -2687,7 +2687,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
static int NCR5380_abort (Scsi_Cmnd *cmd) static int NCR5380_abort (Scsi_Cmnd *cmd)
{ {
struct Scsi_Host *instance = cmd->host; struct Scsi_Host *instance = cmd->device->host;
SETUP_HOSTDATA(instance); SETUP_HOSTDATA(instance);
Scsi_Cmnd *tmp, **prev; Scsi_Cmnd *tmp, **prev;
unsigned long flags; unsigned long flags;
...@@ -2737,7 +2737,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2737,7 +2737,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( cmd ); cmd_free_tag( cmd );
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
local_irq_restore(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
...@@ -2842,7 +2842,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2842,7 +2842,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( tmp ); cmd_free_tag( tmp );
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
#endif #endif
local_irq_restore(flags); local_irq_restore(flags);
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
...@@ -2879,7 +2879,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2879,7 +2879,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
static int NCR5380_bus_reset( Scsi_Cmnd *cmd) static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
{ {
SETUP_HOSTDATA(cmd->host); SETUP_HOSTDATA(cmd->device->host);
int i; int i;
unsigned long flags; unsigned long flags;
#if 1 #if 1
...@@ -2887,7 +2887,7 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd) ...@@ -2887,7 +2887,7 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
#endif #endif
NCR5380_print_status (cmd->host); NCR5380_print_status (cmd->device->host);
/* get in phase */ /* get in phase */
NCR5380_write( TARGET_COMMAND_REG, NCR5380_write( TARGET_COMMAND_REG,
......
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