Commit 9380dde2 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k scsi local_irq*() updates

Convert m68k scsi drivers to new local_irq*() framework:
  - 53c7xx SCSI core
  - NCR53C9x ESP SCSI core
  - Atari NCR5380
  - Mac NCR5380
  - Sun-3 OBIO and VME NCR5380
parent 92c91294
...@@ -714,15 +714,14 @@ request_synchronous (int host, int target) { ...@@ -714,15 +714,14 @@ request_synchronous (int host, int target) {
} }
hostdata = (struct NCR53c7x0_hostdata *)h->hostdata[0]; hostdata = (struct NCR53c7x0_hostdata *)h->hostdata[0];
save_flags(flags); local_irq_save(flags);
cli();
if (hostdata->initiate_sdtr & (1 << target)) { if (hostdata->initiate_sdtr & (1 << target)) {
restore_flags(flags); local_irq_restore(flags);
printk (KERN_ALERT "target %d already doing SDTR\n", target); printk (KERN_ALERT "target %d already doing SDTR\n", target);
return -1; return -1;
} }
hostdata->initiate_sdtr |= (1 << target); hostdata->initiate_sdtr |= (1 << target);
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
#endif #endif
...@@ -1589,11 +1588,10 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1589,11 +1588,10 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
/* The NCR chip _must_ be idle to run the test scripts */ /* The NCR chip _must_ be idle to run the test scripts */
save_flags(flags); local_irq_save(flags);
cli();
if (!hostdata->idle) { if (!hostdata->idle) {
printk ("scsi%d : chip not idle, aborting tests\n", host->host_no); printk ("scsi%d : chip not idle, aborting tests\n", host->host_no);
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
...@@ -1617,7 +1615,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1617,7 +1615,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl | DCNTL_SSM | NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl | DCNTL_SSM |
DCNTL_STD); DCNTL_STD);
printk (" started\n"); printk (" started\n");
restore_flags(flags); local_irq_restore(flags);
/* /*
* This is currently a .5 second timeout, since (in theory) no slow * This is currently a .5 second timeout, since (in theory) no slow
...@@ -1656,7 +1654,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1656,7 +1654,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
hostdata->script, start); hostdata->script, start);
printk ("scsi%d : DSPS = 0x%x\n", host->host_no, printk ("scsi%d : DSPS = 0x%x\n", host->host_no,
NCR53c7x0_read32(DSPS_REG)); NCR53c7x0_read32(DSPS_REG));
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
hostdata->test_running = 0; hostdata->test_running = 0;
...@@ -1691,10 +1689,10 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1691,10 +1689,10 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
if (!hostdata->valid_ids[i]) if (!hostdata->valid_ids[i])
continue; continue;
#endif #endif
cli(); local_irq_disable();
if (!hostdata->idle) { if (!hostdata->idle) {
printk ("scsi%d : chip not idle, aborting tests\n", host->host_no); printk ("scsi%d : chip not idle, aborting tests\n", host->host_no);
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
...@@ -1710,7 +1708,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1710,7 +1708,7 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
if (hostdata->options & OPTION_DEBUG_TRACE) if (hostdata->options & OPTION_DEBUG_TRACE)
NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl | NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl |
DCNTL_SSM | DCNTL_STD); DCNTL_SSM | DCNTL_STD);
restore_flags(flags); local_irq_restore(flags);
timeout = jiffies + 5 * HZ; /* arbitrary */ timeout = jiffies + 5 * HZ; /* arbitrary */
while ((hostdata->test_completed == -1) && time_before(jiffies, timeout)) while ((hostdata->test_completed == -1) && time_before(jiffies, timeout))
...@@ -1732,19 +1730,19 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) { ...@@ -1732,19 +1730,19 @@ NCR53c7xx_run_tests (struct Scsi_Host *host) {
host->host_no, i); host->host_no, i);
if (!hostdata->idle) { if (!hostdata->idle) {
printk("scsi%d : not idle\n", host->host_no); printk("scsi%d : not idle\n", host->host_no);
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
} else if (hostdata->test_completed == -1) { } else if (hostdata->test_completed == -1) {
printk ("scsi%d : test 2 timed out\n", host->host_no); printk ("scsi%d : test 2 timed out\n", host->host_no);
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
hostdata->test_running = 0; hostdata->test_running = 0;
} }
} }
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -1827,8 +1825,7 @@ static volatile int process_issue_queue_running = 0; ...@@ -1827,8 +1825,7 @@ static volatile int process_issue_queue_running = 0;
static __inline__ void static __inline__ void
run_process_issue_queue(void) { run_process_issue_queue(void) {
unsigned long flags; unsigned long flags;
save_flags (flags); local_irq_save(flags);
cli();
if (!process_issue_queue_running) { if (!process_issue_queue_running) {
process_issue_queue_running = 1; process_issue_queue_running = 1;
process_issue_queue(flags); process_issue_queue(flags);
...@@ -1838,7 +1835,7 @@ run_process_issue_queue(void) { ...@@ -1838,7 +1835,7 @@ run_process_issue_queue(void) {
* interrupts disabled. * interrupts disabled.
*/ */
} }
restore_flags (flags); local_irq_restore(flags);
} }
/* /*
...@@ -1872,8 +1869,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) { ...@@ -1872,8 +1869,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) {
printk ("scsi%d: abnormal finished\n", host->host_no); printk ("scsi%d: abnormal finished\n", host->host_no);
#endif #endif
save_flags(flags); local_irq_save(flags);
cli();
found = 0; found = 0;
/* /*
* Traverse the NCR issue array until we find a match or run out * Traverse the NCR issue array until we find a match or run out
...@@ -1956,7 +1952,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) { ...@@ -1956,7 +1952,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) {
c->result = result; c->result = result;
c->scsi_done(c); c->scsi_done(c);
restore_flags(flags); local_irq_restore(flags);
run_process_issue_queue(); run_process_issue_queue();
} }
...@@ -1991,8 +1987,7 @@ intr_break (struct Scsi_Host *host, struct ...@@ -1991,8 +1987,7 @@ intr_break (struct Scsi_Host *host, struct
* dump the appropriate debugging information to standard * dump the appropriate debugging information to standard
* output. * output.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
dsp = (u32 *) bus_to_virt(NCR53c7x0_read32(DSP_REG)); dsp = (u32 *) bus_to_virt(NCR53c7x0_read32(DSP_REG));
for (bp = hostdata->breakpoints; bp && bp->address != dsp; for (bp = hostdata->breakpoints; bp && bp->address != dsp;
bp = bp->next); bp = bp->next);
...@@ -2014,7 +2009,7 @@ intr_break (struct Scsi_Host *host, struct ...@@ -2014,7 +2009,7 @@ intr_break (struct Scsi_Host *host, struct
* instruction in bytes. * instruction in bytes.
*/ */
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
* Function : static void print_synchronous (const char *prefix, * Function : static void print_synchronous (const char *prefix,
...@@ -2920,8 +2915,7 @@ NCR53c7x0_soft_reset (struct Scsi_Host *host) { ...@@ -2920,8 +2915,7 @@ NCR53c7x0_soft_reset (struct Scsi_Host *host) {
host->hostdata[0]; host->hostdata[0];
NCR53c7x0_local_setup(host); NCR53c7x0_local_setup(host);
save_flags(flags); local_irq_save(flags);
cli();
/* Disable scsi chip and s/w level 7 ints */ /* Disable scsi chip and s/w level 7 ints */
...@@ -3022,7 +3016,7 @@ NCR53c7x0_soft_reset (struct Scsi_Host *host) { ...@@ -3022,7 +3016,7 @@ NCR53c7x0_soft_reset (struct Scsi_Host *host) {
} }
#endif #endif
/* Anything needed for your hardware? */ /* Anything needed for your hardware? */
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -3123,19 +3117,17 @@ allocate_cmd (Scsi_Cmnd *cmd) { ...@@ -3123,19 +3117,17 @@ allocate_cmd (Scsi_Cmnd *cmd) {
tmp->real = (void *)real; tmp->real = (void *)real;
tmp->size = size; tmp->size = size;
tmp->free = ((void (*)(void *, int)) my_free_page); tmp->free = ((void (*)(void *, int)) my_free_page);
save_flags (flags); local_irq_save(flags);
cli();
tmp->next = hostdata->free; tmp->next = hostdata->free;
hostdata->free = tmp; hostdata->free = tmp;
restore_flags (flags); local_irq_restore(flags);
} }
save_flags(flags); local_irq_save(flags);
cli();
tmp = (struct NCR53c7x0_cmd *) hostdata->free; tmp = (struct NCR53c7x0_cmd *) hostdata->free;
if (tmp) { if (tmp) {
hostdata->free = tmp->next; hostdata->free = tmp->next;
} }
restore_flags(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->target, cmd->lun);
...@@ -3354,19 +3346,17 @@ create_cmd (Scsi_Cmnd *cmd) { ...@@ -3354,19 +3346,17 @@ create_cmd (Scsi_Cmnd *cmd) {
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));
save_flags(flags); local_irq_save(flags);
cli();
hostdata->initiate_wdtr &= ~(1 << cmd->target); hostdata->initiate_wdtr &= ~(1 << cmd->target);
restore_flags(flags); local_irq_restore(flags);
} else if (hostdata->initiate_sdtr & (1 << cmd->target)) { } else if (hostdata->initiate_sdtr & (1 << cmd->target)) {
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;
save_flags(flags); local_irq_save(flags);
cli();
hostdata->initiate_sdtr &= ~(1 << cmd->target); hostdata->initiate_sdtr &= ~(1 << cmd->target);
restore_flags(flags); local_irq_restore(flags);
} }
#if 1 #if 1
...@@ -3623,8 +3613,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3623,8 +3613,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
} }
#endif #endif
save_flags(flags); local_irq_save(flags);
cli();
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->target] & (1 << cmd->lun)))
...@@ -3639,7 +3628,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3639,7 +3628,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
cmd->target, cmd->lun); cmd->target, cmd->lun);
cmd->result = (DID_BAD_TARGET << 16); cmd->result = (DID_BAD_TARGET << 16);
done(cmd); done(cmd);
restore_flags (flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -3648,7 +3637,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3648,7 +3637,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
printk("scsi%d : maximum commands exceeded\n", host->host_no); printk("scsi%d : maximum commands exceeded\n", host->host_no);
cmd->result = (DID_BAD_TARGET << 16); cmd->result = (DID_BAD_TARGET << 16);
done(cmd); done(cmd);
restore_flags (flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -3660,7 +3649,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3660,7 +3649,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
host->host_no); host->host_no);
cmd->result = (DID_BAD_TARGET << 16); cmd->result = (DID_BAD_TARGET << 16);
done(cmd); done(cmd);
restore_flags (flags); local_irq_restore(flags);
return 0; return 0;
} }
} }
...@@ -3687,7 +3676,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) { ...@@ -3687,7 +3676,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
tmp = (Scsi_Cmnd *) tmp->SCp.ptr); tmp = (Scsi_Cmnd *) tmp->SCp.ptr);
tmp->SCp.ptr = (unsigned char *) cmd; tmp->SCp.ptr = (unsigned char *) cmd;
} }
restore_flags (flags); local_irq_restore(flags);
run_process_issue_queue(); run_process_issue_queue();
return 0; return 0;
} }
...@@ -3727,8 +3716,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, ...@@ -3727,8 +3716,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
virt_to_bus(hostdata->dsa), hostdata->dsa); virt_to_bus(hostdata->dsa), hostdata->dsa);
#endif #endif
save_flags(flags); local_irq_save(flags);
cli();
/* /*
* Work around race condition : if an interrupt fired and we * Work around race condition : if an interrupt fired and we
...@@ -3741,7 +3729,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, ...@@ -3741,7 +3729,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
cmd->next = (struct NCR53c7x0_cmd *) hostdata->free; cmd->next = (struct NCR53c7x0_cmd *) hostdata->free;
hostdata->free = cmd; hostdata->free = cmd;
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
restore_flags (flags); local_irq_restore(flags);
return; return;
} }
...@@ -3771,7 +3759,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, ...@@ -3771,7 +3759,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
cmd->next = (struct NCR53c7x0_cmd *) hostdata->free; cmd->next = (struct NCR53c7x0_cmd *) hostdata->free;
hostdata->free = cmd; hostdata->free = cmd;
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
restore_flags (flags); local_irq_restore(flags);
return; return;
} }
...@@ -3792,7 +3780,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata, ...@@ -3792,7 +3780,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
NCR53c7x0_write8(hostdata->istat, ISTAT_10_SIGP); NCR53c7x0_write8(hostdata->istat, ISTAT_10_SIGP);
} }
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -3850,12 +3838,12 @@ process_issue_queue (unsigned long flags) { ...@@ -3850,12 +3838,12 @@ process_issue_queue (unsigned long flags) {
*/ */
do { do {
cli(); /* Freeze request queues */ local_irq_disable(); /* Freeze request queues */
done = 1; done = 1;
for (host = first_host; host && host->hostt == the_template; for (host = first_host; host && host->hostt == the_template;
host = host->next) { host = host->next) {
hostdata = (struct NCR53c7x0_hostdata *) host->hostdata[0]; hostdata = (struct NCR53c7x0_hostdata *) host->hostdata[0];
cli(); local_irq_disable();
if (hostdata->issue_queue) { if (hostdata->issue_queue) {
if (hostdata->state == STATE_DISABLED) { if (hostdata->state == STATE_DISABLED) {
tmp = (Scsi_Cmnd *) hostdata->issue_queue; tmp = (Scsi_Cmnd *) hostdata->issue_queue;
...@@ -3905,7 +3893,7 @@ process_issue_queue (unsigned long flags) { ...@@ -3905,7 +3893,7 @@ process_issue_queue (unsigned long flags) {
} /* if target/lun is not busy */ } /* if target/lun is not busy */
} /* if hostdata->issue_queue */ } /* if hostdata->issue_queue */
if (!done) if (!done)
restore_flags (flags); local_irq_restore(flags);
} /* for host */ } /* for host */
} while (!done); } while (!done);
process_issue_queue_running = 0; process_issue_queue_running = 0;
...@@ -4172,8 +4160,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host) ...@@ -4172,8 +4160,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host)
* completion. * completion.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
restart: restart:
for (cmd_prev_ptr = (struct NCR53c7x0_cmd **)&(hostdata->running_list), for (cmd_prev_ptr = (struct NCR53c7x0_cmd **)&(hostdata->running_list),
cmd = (struct NCR53c7x0_cmd *) hostdata->running_list; cmd ; cmd = (struct NCR53c7x0_cmd *) hostdata->running_list; cmd ;
...@@ -4227,7 +4214,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host) ...@@ -4227,7 +4214,7 @@ NCR53c7x0_intfly (struct Scsi_Host *host)
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
goto restart; goto restart;
} }
restore_flags(flags); local_irq_restore(flags);
if (!search_found) { if (!search_found) {
printk ("scsi%d : WARNING : INTFLY with no completed commands.\n", printk ("scsi%d : WARNING : INTFLY with no completed commands.\n",
...@@ -4907,13 +4894,12 @@ intr_dma (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) { ...@@ -4907,13 +4894,12 @@ intr_dma (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
/* Don't print instr. until we write DSP at end of intr function */ /* Don't print instr. until we write DSP at end of intr function */
} else if (hostdata->options & OPTION_DEBUG_SINGLE) { } else if (hostdata->options & OPTION_DEBUG_SINGLE) {
print_insn (host, dsp, "s ", 0); print_insn (host, dsp, "s ", 0);
save_flags(flags); local_irq_save(flags);
cli();
/* XXX - should we do this, or can we get away with writing dsp? */ /* XXX - should we do this, or can we get away with writing dsp? */
NCR53c7x0_write8 (DCNTL_REG, (NCR53c7x0_read8(DCNTL_REG) & NCR53c7x0_write8 (DCNTL_REG, (NCR53c7x0_read8(DCNTL_REG) &
~DCNTL_SSM) | DCNTL_STD); ~DCNTL_SSM) | DCNTL_STD);
restore_flags(flags); local_irq_restore(flags);
} else { } else {
printk(KERN_ALERT "scsi%d : unexpected single step interrupt at\n" printk(KERN_ALERT "scsi%d : unexpected single step interrupt at\n"
" ", host->host_no); " ", host->host_no);
...@@ -5191,8 +5177,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) { ...@@ -5191,8 +5177,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
return SCSI_ABORT_BUSY; return SCSI_ABORT_BUSY;
} }
save_flags(flags); local_irq_save(flags);
cli();
#if 0 #if 0
if (cache_pid == cmd->pid) if (cache_pid == cmd->pid)
panic ("scsi%d : bloody fetus %d\n", host->host_no, cmd->pid); panic ("scsi%d : bloody fetus %d\n", host->host_no, cmd->pid);
...@@ -5227,7 +5212,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) { ...@@ -5227,7 +5212,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
printk ("scsi%d : found command %ld in Linux issue queue\n", printk ("scsi%d : found command %ld in Linux issue queue\n",
host->host_no, me->pid); host->host_no, me->pid);
restore_flags(flags); local_irq_restore(flags);
run_process_issue_queue(); run_process_issue_queue();
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
} }
...@@ -5253,12 +5238,12 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) { ...@@ -5253,12 +5238,12 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
printk ("scsi%d : found finished command %ld in running list\n", printk ("scsi%d : found finished command %ld in running list\n",
host->host_no, cmd->pid); host->host_no, cmd->pid);
restore_flags(flags); local_irq_restore(flags);
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->host->host_no);
restore_flags(flags); local_irq_restore(flags);
return SCSI_ABORT_BUSY; return SCSI_ABORT_BUSY;
} }
} }
...@@ -5290,7 +5275,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) { ...@@ -5290,7 +5275,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
*/ */
--hostdata->busy[cmd->target][cmd->lun]; --hostdata->busy[cmd->target][cmd->lun];
} }
restore_flags(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
/* /*
...@@ -5338,8 +5323,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) { ...@@ -5338,8 +5323,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) {
(struct NCR53c7x0_hostdata *) host->hostdata[0]; (struct NCR53c7x0_hostdata *) host->hostdata[0];
NCR53c7x0_local_setup(host); NCR53c7x0_local_setup(host);
save_flags(flags); local_irq_save(flags);
cli();
ncr_halt (host); ncr_halt (host);
print_lots (host); print_lots (host);
dump_events (host, 30); dump_events (host, 30);
...@@ -5373,13 +5357,13 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) { ...@@ -5373,13 +5357,13 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) {
disable(host); disable(host);
else if (hostdata->resets != -1) else if (hostdata->resets != -1)
--hostdata->resets; --hostdata->resets;
restore_flags(flags); local_irq_restore(flags);
for (; nuke_list; nuke_list = tmp) { for (; nuke_list; nuke_list = tmp) {
tmp = (Scsi_Cmnd *) nuke_list->SCp.buffer; tmp = (Scsi_Cmnd *) nuke_list->SCp.buffer;
nuke_list->result = DID_RESET << 16; nuke_list->result = DID_RESET << 16;
nuke_list->scsi_done (nuke_list); nuke_list->scsi_done (nuke_list);
} }
restore_flags(flags); local_irq_restore(flags);
return SCSI_RESET_SUCCESS; return SCSI_RESET_SUCCESS;
} }
...@@ -5608,8 +5592,7 @@ print_queues (struct Scsi_Host *host) { ...@@ -5608,8 +5592,7 @@ print_queues (struct Scsi_Host *host) {
left >= 0 && cmd; left >= 0 && cmd;
cmd = next_cmd) { cmd = next_cmd) {
next_cmd = (Scsi_Cmnd *) cmd->SCp.ptr; next_cmd = (Scsi_Cmnd *) cmd->SCp.ptr;
save_flags(flags); local_irq_save(flags);
cli();
if (cmd->host_scribble) { if (cmd->host_scribble) {
if (check_address ((unsigned long) (cmd->host_scribble), if (check_address ((unsigned long) (cmd->host_scribble),
sizeof (cmd->host_scribble)) == -1) sizeof (cmd->host_scribble)) == -1)
...@@ -5622,7 +5605,7 @@ print_queues (struct Scsi_Host *host) { ...@@ -5622,7 +5605,7 @@ print_queues (struct Scsi_Host *host) {
} 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->target, cmd->lun);
restore_flags(flags); local_irq_restore(flags);
} }
if (left <= 0) { if (left <= 0) {
...@@ -5654,8 +5637,7 @@ print_queues (struct Scsi_Host *host) { ...@@ -5654,8 +5637,7 @@ print_queues (struct Scsi_Host *host) {
dsa = bus_to_virt (hostdata->reconnect_dsa_head); dsa = bus_to_virt (hostdata->reconnect_dsa_head);
left >= 0 && dsa; left >= 0 && dsa;
dsa = next_dsa) { dsa = next_dsa) {
save_flags (flags); local_irq_save(flags);
cli();
if (check_address ((unsigned long) dsa, sizeof(dsa)) == -1) { if (check_address ((unsigned long) dsa, sizeof(dsa)) == -1) {
printk ("scsi%d: bad DSA pointer 0x%p", host->host_no, printk ("scsi%d: bad DSA pointer 0x%p", host->host_no,
dsa); dsa);
...@@ -5666,7 +5648,7 @@ print_queues (struct Scsi_Host *host) { ...@@ -5666,7 +5648,7 @@ print_queues (struct Scsi_Host *host) {
next_dsa = bus_to_virt(dsa[hostdata->dsa_next / sizeof(u32)]); next_dsa = bus_to_virt(dsa[hostdata->dsa_next / sizeof(u32)]);
print_dsa (host, dsa, ""); print_dsa (host, dsa, "");
} }
restore_flags(flags); local_irq_restore(flags);
} }
printk ("scsi%d : end reconnect_dsa_head\n", host->host_no); printk ("scsi%d : end reconnect_dsa_head\n", host->host_no);
if (left < 0) if (left < 0)
...@@ -5756,15 +5738,14 @@ shutdown (struct Scsi_Host *host) { ...@@ -5756,15 +5738,14 @@ shutdown (struct Scsi_Host *host) {
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *) struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata[0]; host->hostdata[0];
NCR53c7x0_local_setup(host); NCR53c7x0_local_setup(host);
save_flags (flags); local_irq_save(flags);
cli();
/* Get in a state where we can reset the SCSI bus */ /* Get in a state where we can reset the SCSI bus */
ncr_halt (host); ncr_halt (host);
ncr_scsi_reset (host); ncr_scsi_reset (host);
hostdata->soft_reset(host); hostdata->soft_reset(host);
disable (host); disable (host);
restore_flags (flags); local_irq_restore(flags);
return 0; return 0;
} }
...@@ -5779,12 +5760,11 @@ ncr_scsi_reset (struct Scsi_Host *host) { ...@@ -5779,12 +5760,11 @@ ncr_scsi_reset (struct Scsi_Host *host) {
NCR53c7x0_local_declare(); NCR53c7x0_local_declare();
unsigned long flags; unsigned long flags;
NCR53c7x0_local_setup(host); NCR53c7x0_local_setup(host);
save_flags (flags); local_irq_save(flags);
cli();
NCR53c7x0_write8(SCNTL1_REG, SCNTL1_RST); NCR53c7x0_write8(SCNTL1_REG, SCNTL1_RST);
udelay(25); /* Minimum amount of time to assert RST */ udelay(25); /* Minimum amount of time to assert RST */
NCR53c7x0_write8(SCNTL1_REG, 0); NCR53c7x0_write8(SCNTL1_REG, 0);
restore_flags (flags); local_irq_restore(flags);
} }
/* /*
...@@ -5797,13 +5777,12 @@ hard_reset (struct Scsi_Host *host) { ...@@ -5797,13 +5777,12 @@ hard_reset (struct Scsi_Host *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;
save_flags (flags); local_irq_save(flags);
cli();
ncr_scsi_reset(host); ncr_scsi_reset(host);
NCR53c7x0_driver_init (host); NCR53c7x0_driver_init (host);
if (hostdata->soft_reset) if (hostdata->soft_reset)
hostdata->soft_reset (host); hostdata->soft_reset (host);
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -5899,14 +5878,13 @@ disable (struct Scsi_Host *host) { ...@@ -5899,14 +5878,13 @@ disable (struct Scsi_Host *host) {
host->hostdata[0]; host->hostdata[0];
unsigned long flags; unsigned long flags;
Scsi_Cmnd *nuke_list, *tmp; Scsi_Cmnd *nuke_list, *tmp;
save_flags(flags); local_irq_save(flags);
cli();
if (hostdata->state != STATE_HALTED) if (hostdata->state != STATE_HALTED)
ncr_halt (host); ncr_halt (host);
nuke_list = return_outstanding_commands (host, 1 /* free */, 1 /* issue */); nuke_list = return_outstanding_commands (host, 1 /* free */, 1 /* issue */);
hard_reset (host); hard_reset (host);
hostdata->state = STATE_DISABLED; hostdata->state = STATE_DISABLED;
restore_flags(flags); local_irq_restore(flags);
printk ("scsi%d : nuking commands\n", host->host_no); printk ("scsi%d : nuking commands\n", host->host_no);
for (; nuke_list; nuke_list = tmp) { for (; nuke_list; nuke_list = tmp) {
tmp = (Scsi_Cmnd *) nuke_list->SCp.buffer; tmp = (Scsi_Cmnd *) nuke_list->SCp.buffer;
...@@ -5939,8 +5917,7 @@ ncr_halt (struct Scsi_Host *host) { ...@@ -5939,8 +5917,7 @@ ncr_halt (struct Scsi_Host *host) {
int stage; int stage;
NCR53c7x0_local_setup(host); NCR53c7x0_local_setup(host);
save_flags(flags); local_irq_save(flags);
cli();
/* Stage 0 : eat all interrupts /* Stage 0 : eat all interrupts
Stage 1 : set ABORT Stage 1 : set ABORT
Stage 2 : eat all but abort interrupts Stage 2 : eat all but abort interrupts
...@@ -5975,7 +5952,7 @@ ncr_halt (struct Scsi_Host *host) { ...@@ -5975,7 +5952,7 @@ ncr_halt (struct Scsi_Host *host) {
} }
} }
hostdata->state = STATE_HALTED; hostdata->state = STATE_HALTED;
restore_flags(flags); local_irq_restore(flags);
#if 0 #if 0
print_lots (host); print_lots (host);
#endif #endif
...@@ -6023,14 +6000,13 @@ dump_events (struct Scsi_Host *host, int count) { ...@@ -6023,14 +6000,13 @@ dump_events (struct Scsi_Host *host, int count) {
count = hostdata->event_size; count = hostdata->event_size;
for (i = hostdata->event_index; count > 0; for (i = hostdata->event_index; count > 0;
i = (i ? i - 1 : hostdata->event_size -1), --count) { i = (i ? i - 1 : hostdata->event_size -1), --count) {
save_flags(flags);
/* /*
* By copying the event we're currently examining with interrupts * By copying the event we're currently examining with interrupts
* disabled, we can do multiple printk(), etc. operations and * disabled, we can do multiple printk(), etc. operations and
* still be guaranteed that they're happening on the same * still be guaranteed that they're happening on the same
* event structure. * event structure.
*/ */
cli(); local_irq_save(flags);
#if 0 #if 0
event = hostdata->events[i]; event = hostdata->events[i];
#else #else
...@@ -6038,7 +6014,7 @@ dump_events (struct Scsi_Host *host, int count) { ...@@ -6038,7 +6014,7 @@ dump_events (struct Scsi_Host *host, int count) {
sizeof(event)); sizeof(event));
#endif #endif
restore_flags(flags); local_irq_restore(flags);
printk ("scsi%d : %s event %d at %ld secs %ld usecs target %d lun %d\n", printk ("scsi%d : %s event %d at %ld secs %ld usecs target %d lun %d\n",
host->host_no, event_name (event.event), count, host->host_no, event_name (event.event), count,
(long) event.time.tv_sec, (long) event.time.tv_usec, (long) event.time.tv_sec, (long) event.time.tv_usec,
......
...@@ -1853,8 +1853,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -1853,8 +1853,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
ESPDATA(( /*"\n"*/ "\r")); ESPDATA(( /*"\n"*/ "\r"));
#endif #endif
#if 0 #if 0
save_flags(flags); local_irq_save(flags);
cli();
#endif #endif
if(thisphase == in_datain) { if(thisphase == in_datain) {
/* 'go' ... */ /* 'go' ... */
...@@ -1945,7 +1944,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs) ...@@ -1945,7 +1944,7 @@ static int esp_do_data(struct NCR_ESP *esp, struct ESP_regs *eregs)
ESPDATA(("done! \n")); ESPDATA(("done! \n"));
#if 0 #if 0
restore_flags(flags); local_irq_restore(flags);
#endif #endif
/* check new bus phase */ /* check new bus phase */
......
...@@ -561,14 +561,13 @@ static void NCR5380_print(struct Scsi_Host *instance) { ...@@ -561,14 +561,13 @@ static void NCR5380_print(struct Scsi_Host *instance) {
unsigned char status, data, basr, mr, icr, i; unsigned char status, data, basr, mr, icr, i;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
data = NCR5380_read(CURRENT_SCSI_DATA_REG); data = NCR5380_read(CURRENT_SCSI_DATA_REG);
status = NCR5380_read(STATUS_REG); status = NCR5380_read(STATUS_REG);
mr = NCR5380_read(MODE_REG); mr = NCR5380_read(MODE_REG);
icr = NCR5380_read(INITIATOR_COMMAND_REG); icr = NCR5380_read(INITIATOR_COMMAND_REG);
basr = NCR5380_read(BUS_AND_STATUS_REG); basr = NCR5380_read(BUS_AND_STATUS_REG);
restore_flags(flags); local_irq_restore(flags);
printk("STATUS_REG: %02x ", status); printk("STATUS_REG: %02x ", status);
for (i = 0; signals[i].mask ; ++i) for (i = 0; signals[i].mask ; ++i)
if (status & signals[i].mask) if (status & signals[i].mask)
...@@ -779,8 +778,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset, ...@@ -779,8 +778,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset,
} }
SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
check_offset(); check_offset();
save_flags(flags); local_irq_save(flags);
cli();
SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't"); SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't");
check_offset(); check_offset();
if (!hostdata->connected) if (!hostdata->connected)
...@@ -803,7 +801,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset, ...@@ -803,7 +801,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset,
check_offset(); check_offset();
} }
restore_flags(flags); local_irq_restore(flags);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
if (pos - buffer < offset - begin) if (pos - buffer < offset - begin)
return 0; return 0;
...@@ -977,8 +975,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -977,8 +975,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
* sense data is only guaranteed to be valid while the condition exists. * sense data is only guaranteed to be valid while the condition exists.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
/* ++guenther: now that the issue queue is being set up, we can lock ST-DMA. /* ++guenther: now that the issue queue is being set up, we can lock ST-DMA.
* Otherwise a running NCR5380_main may steal the lock. * Otherwise a running NCR5380_main may steal the lock.
* Lock before actually inserting due to fairness reasons explained in * Lock before actually inserting due to fairness reasons explained in
...@@ -1007,7 +1004,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -1007,7 +1004,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
LIST(cmd, tmp); LIST(cmd, tmp);
NEXT(tmp) = cmd; NEXT(tmp) = cmd;
} }
restore_flags(flags); local_irq_restore(flags);
QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd), QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd),
(cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
...@@ -1071,9 +1068,9 @@ static void NCR5380_main (void) ...@@ -1071,9 +1068,9 @@ static void NCR5380_main (void)
return; return;
main_running = 1; main_running = 1;
save_flags(flags); local_save_flags(flags);
do { do {
cli(); /* Freeze request queues */ local_irq_disable(); /* Freeze request queues */
done = 1; done = 1;
if (!hostdata->connected) { if (!hostdata->connected) {
...@@ -1107,7 +1104,8 @@ static void NCR5380_main (void) ...@@ -1107,7 +1104,8 @@ static void NCR5380_main (void)
!(hostdata->busy[tmp->target] & (1 << tmp->lun)) !(hostdata->busy[tmp->target] & (1 << tmp->lun))
#endif #endif
) { ) {
cli(); /* ++guenther: just to be sure, this must be atomic */ /* ++guenther: just to be sure, this must be atomic */
local_irq_disable();
if (prev) { if (prev) {
REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
NEXT(prev) = NEXT(tmp); NEXT(prev) = NEXT(tmp);
...@@ -1119,7 +1117,7 @@ static void NCR5380_main (void) ...@@ -1119,7 +1117,7 @@ static void NCR5380_main (void)
falcon_dont_release++; falcon_dont_release++;
/* reenable interrupts after finding one */ /* reenable interrupts after finding one */
restore_flags(flags); local_irq_restore(flags);
/* /*
* Attempt to establish an I_T_L nexus here. * Attempt to establish an I_T_L nexus here.
...@@ -1151,7 +1149,7 @@ static void NCR5380_main (void) ...@@ -1151,7 +1149,7 @@ static void NCR5380_main (void)
falcon_release_lock_if_possible( hostdata ); falcon_release_lock_if_possible( hostdata );
break; break;
} else { } else {
cli(); local_irq_disable();
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
NEXT(tmp) = hostdata->issue_queue; NEXT(tmp) = hostdata->issue_queue;
hostdata->issue_queue = tmp; hostdata->issue_queue = tmp;
...@@ -1159,7 +1157,7 @@ static void NCR5380_main (void) ...@@ -1159,7 +1157,7 @@ static void NCR5380_main (void)
cmd_free_tag( tmp ); cmd_free_tag( tmp );
#endif #endif
falcon_dont_release--; falcon_dont_release--;
restore_flags(flags); local_irq_restore(flags);
MAIN_PRINTK("scsi%d: main(): select() failed, " MAIN_PRINTK("scsi%d: main(): select() failed, "
"returned to issue_queue\n", HOSTNO); "returned to issue_queue\n", HOSTNO);
if (hostdata->connected) if (hostdata->connected)
...@@ -1174,7 +1172,7 @@ static void NCR5380_main (void) ...@@ -1174,7 +1172,7 @@ static void NCR5380_main (void)
&& !hostdata->dma_len && !hostdata->dma_len
#endif #endif
) { ) {
restore_flags(flags); local_irq_restore(flags);
MAIN_PRINTK("scsi%d: main: performing information transfer\n", MAIN_PRINTK("scsi%d: main: performing information transfer\n",
HOSTNO); HOSTNO);
NCR5380_information_transfer(instance); NCR5380_information_transfer(instance);
...@@ -1187,7 +1185,7 @@ static void NCR5380_main (void) ...@@ -1187,7 +1185,7 @@ static void NCR5380_main (void)
an interrupt could believe we'll pick up the work it left for an interrupt could believe we'll pick up the work it left for
us, but we won't see it anymore here... */ us, but we won't see it anymore here... */
main_running = 0; main_running = 0;
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -1428,10 +1426,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1428,10 +1426,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
* data bus during SELECTION. * data bus during SELECTION.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
if (hostdata->connected) { if (hostdata->connected) {
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
NCR5380_write(TARGET_COMMAND_REG, 0); NCR5380_write(TARGET_COMMAND_REG, 0);
...@@ -1444,7 +1441,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1444,7 +1441,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask); NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
NCR5380_write(MODE_REG, MR_ARBITRATE); NCR5380_write(MODE_REG, MR_ARBITRATE);
restore_flags(flags); local_irq_restore(flags);
/* Wait for arbitration logic to complete */ /* Wait for arbitration logic to complete */
#if NCR_TIMEOUT #if NCR_TIMEOUT
...@@ -1952,12 +1949,11 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -1952,12 +1949,11 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
/* On the Medusa, it is a must to initialize the DMA before /* On the Medusa, it is a must to initialize the DMA before
* starting the NCR. This is also the cleaner way for the TT. * starting the NCR. This is also the cleaner way for the TT.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
hostdata->dma_len = (p & SR_IO) ? hostdata->dma_len = (p & SR_IO) ?
NCR5380_dma_read_setup(instance, d, c) : NCR5380_dma_read_setup(instance, d, c) :
NCR5380_dma_write_setup(instance, d, c); NCR5380_dma_write_setup(instance, d, c);
restore_flags(flags); local_irq_restore(flags);
} }
if (p & SR_IO) if (p & SR_IO)
...@@ -1971,12 +1967,11 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -1971,12 +1967,11 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
/* On the Falcon, the DMA setup must be done after the last */ /* On the Falcon, the DMA setup must be done after the last */
/* NCR access, else the DMA setup gets trashed! /* NCR access, else the DMA setup gets trashed!
*/ */
save_flags(flags); local_irq_save(flags);
cli();
hostdata->dma_len = (p & SR_IO) ? hostdata->dma_len = (p & SR_IO) ?
NCR5380_dma_read_setup(instance, d, c) : NCR5380_dma_read_setup(instance, d, c) :
NCR5380_dma_write_setup(instance, d, c); NCR5380_dma_write_setup(instance, d, c);
restore_flags(flags); local_irq_restore(flags);
} }
return 0; return 0;
} }
...@@ -2257,12 +2252,11 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2257,12 +2252,11 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
cmd->request_buffer = (char *) cmd->sense_buffer; cmd->request_buffer = (char *) cmd->sense_buffer;
cmd->request_bufflen = sizeof(cmd->sense_buffer); cmd->request_bufflen = sizeof(cmd->sense_buffer);
save_flags(flags); local_irq_save(flags);
cli();
LIST(cmd,hostdata->issue_queue); LIST(cmd,hostdata->issue_queue);
NEXT(cmd) = hostdata->issue_queue; NEXT(cmd) = hostdata->issue_queue;
hostdata->issue_queue = (Scsi_Cmnd *) cmd; hostdata->issue_queue = (Scsi_Cmnd *) cmd;
restore_flags(flags); local_irq_restore(flags);
QU_PRINTK("scsi%d: REQUEST SENSE added to head of " QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
"issue queue\n", H_NO(cmd)); "issue queue\n", H_NO(cmd));
} else } else
...@@ -2319,14 +2313,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2319,14 +2313,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
case DISCONNECT: case DISCONNECT:
/* Accept message by clearing ACK */ /* Accept message by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
save_flags(flags); local_irq_save(flags);
cli();
cmd->device->disconnect = 1; cmd->device->disconnect = 1;
LIST(cmd,hostdata->disconnected_queue); LIST(cmd,hostdata->disconnected_queue);
NEXT(cmd) = hostdata->disconnected_queue; NEXT(cmd) = hostdata->disconnected_queue;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = cmd; hostdata->disconnected_queue = cmd;
restore_flags(flags); local_irq_restore(flags);
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,
...@@ -2669,8 +2662,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2669,8 +2662,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
NCR5380_print_status (instance); NCR5380_print_status (instance);
save_flags(flags); local_irq_save(flags);
cli();
if (!IS_A_TT() && !falcon_got_lock) if (!IS_A_TT() && !falcon_got_lock)
printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_abort\n", printk(KERN_ERR "scsi%d: !!BINGO!! Falcon has no lock in NCR5380_abort\n",
...@@ -2716,12 +2708,12 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2716,12 +2708,12 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
falcon_release_lock_if_possible( hostdata ); falcon_release_lock_if_possible( hostdata );
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
} else { } else {
/* restore_flags(flags); */ /* local_irq_restore(flags); */
printk("scsi%d: abort of connected command failed!\n", HOSTNO); printk("scsi%d: abort of connected command failed!\n", HOSTNO);
return SCSI_ABORT_ERROR; return SCSI_ABORT_ERROR;
} }
...@@ -2740,7 +2732,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2740,7 +2732,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
(*prev) = NEXT(tmp); (*prev) = NEXT(tmp);
NEXT(tmp) = NULL; NEXT(tmp) = NULL;
tmp->result = DID_ABORT << 16; tmp->result = DID_ABORT << 16;
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n", ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
HOSTNO); HOSTNO);
/* Tagged queuing note: no tag to free here, hasn't been assigned /* Tagged queuing note: no tag to free here, hasn't been assigned
...@@ -2762,7 +2754,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2762,7 +2754,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
*/ */
if (hostdata->connected) { if (hostdata->connected) {
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO); ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
return SCSI_ABORT_SNOOZE; return SCSI_ABORT_SNOOZE;
} }
...@@ -2795,7 +2787,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2795,7 +2787,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp;
tmp = NEXT(tmp)) tmp = NEXT(tmp))
if (cmd == tmp) { if (cmd == tmp) {
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO); ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
if (NCR5380_select (instance, cmd, (int) cmd->tag)) if (NCR5380_select (instance, cmd, (int) cmd->tag))
...@@ -2805,8 +2797,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2805,8 +2797,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
do_abort (instance); do_abort (instance);
save_flags(flags); local_irq_save(flags);
cli();
for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue),
tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp = (Scsi_Cmnd *) hostdata->disconnected_queue;
tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )
...@@ -2824,7 +2815,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2824,7 +2815,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
falcon_release_lock_if_possible( hostdata ); falcon_release_lock_if_possible( hostdata );
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
...@@ -2841,7 +2832,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2841,7 +2832,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
* broke. * broke.
*/ */
restore_flags(flags); local_irq_restore(flags);
printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n"
KERN_INFO " before abortion\n", HOSTNO); KERN_INFO " before abortion\n", HOSTNO);
...@@ -2904,8 +2895,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2904,8 +2895,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
* into the issue_queue (via scsi_done()), the aborted commands are * into the issue_queue (via scsi_done()), the aborted commands are
* remembered in local variables first. * remembered in local variables first.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
connected = (Scsi_Cmnd *)hostdata->connected; connected = (Scsi_Cmnd *)hostdata->connected;
hostdata->connected = NULL; hostdata->connected = NULL;
disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue;
...@@ -2918,7 +2908,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2918,7 +2908,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
#ifdef REAL_DMA #ifdef REAL_DMA
hostdata->dma_len = 0; hostdata->dma_len = 0;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
/* In order to tell the mid-level code which commands were aborted, /* In order to tell the mid-level code which commands were aborted,
* set the command status to DID_RESET and call scsi_done() !!! * set the command status to DID_RESET and call scsi_done() !!!
...@@ -2984,8 +2974,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2984,8 +2974,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
if (hostdata->disconnected_queue) if (hostdata->disconnected_queue)
ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
save_flags(flags); local_irq_save(flags);
cli();
hostdata->issue_queue = NULL; hostdata->issue_queue = NULL;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = NULL; hostdata->disconnected_queue = NULL;
...@@ -2997,7 +2986,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2997,7 +2986,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
#ifdef REAL_DMA #ifdef REAL_DMA
hostdata->dma_len = 0; hostdata->dma_len = 0;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
/* we did no complete reset of all commands, so a wakeup is required */ /* we did no complete reset of all commands, so a wakeup is required */
return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET; return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
......
...@@ -508,12 +508,11 @@ static int falcon_dont_release = 0; ...@@ -508,12 +508,11 @@ static int falcon_dont_release = 0;
static void static void
falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata ) falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
{ {
unsigned long oldflags; unsigned long flags;
if (IS_A_TT()) return; if (IS_A_TT()) return;
save_flags(oldflags); local_irq_save(flags);
cli();
if (falcon_got_lock && if (falcon_got_lock &&
!hostdata->disconnected_queue && !hostdata->disconnected_queue &&
...@@ -524,7 +523,7 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata ) ...@@ -524,7 +523,7 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
#if 0 #if 0
printk("WARNING: Lock release not allowed. Ignored\n"); printk("WARNING: Lock release not allowed. Ignored\n");
#endif #endif
restore_flags(oldflags); local_irq_restore(flags);
return; return;
} }
falcon_got_lock = 0; falcon_got_lock = 0;
...@@ -532,7 +531,7 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata ) ...@@ -532,7 +531,7 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
wake_up( &falcon_fairness_wait ); wake_up( &falcon_fairness_wait );
} }
restore_flags(oldflags); local_irq_restore(flags);
} }
/* This function manages the locking of the ST-DMA. /* This function manages the locking of the ST-DMA.
...@@ -552,12 +551,11 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata ) ...@@ -552,12 +551,11 @@ falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
static void falcon_get_lock( void ) static void falcon_get_lock( void )
{ {
unsigned long oldflags; unsigned long flags;
if (IS_A_TT()) return; if (IS_A_TT()) return;
save_flags(oldflags); local_irq_save(flags);
cli();
while( !in_interrupt() && falcon_got_lock && stdma_others_waiting() ) while( !in_interrupt() && falcon_got_lock && stdma_others_waiting() )
sleep_on( &falcon_fairness_wait ); sleep_on( &falcon_fairness_wait );
...@@ -577,7 +575,7 @@ static void falcon_get_lock( void ) ...@@ -577,7 +575,7 @@ static void falcon_get_lock( void )
} }
} }
restore_flags(oldflags); local_irq_restore(flags);
if (!falcon_got_lock) if (!falcon_got_lock)
panic("Falcon SCSI: someone stole the lock :-(\n"); panic("Falcon SCSI: someone stole the lock :-(\n");
} }
......
...@@ -578,14 +578,13 @@ static void NCR5380_print(struct Scsi_Host *instance) { ...@@ -578,14 +578,13 @@ static void NCR5380_print(struct Scsi_Host *instance) {
unsigned char status, data, basr, mr, icr, i; unsigned char status, data, basr, mr, icr, i;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
data = NCR5380_read(CURRENT_SCSI_DATA_REG); data = NCR5380_read(CURRENT_SCSI_DATA_REG);
status = NCR5380_read(STATUS_REG); status = NCR5380_read(STATUS_REG);
mr = NCR5380_read(MODE_REG); mr = NCR5380_read(MODE_REG);
icr = NCR5380_read(INITIATOR_COMMAND_REG); icr = NCR5380_read(INITIATOR_COMMAND_REG);
basr = NCR5380_read(BUS_AND_STATUS_REG); basr = NCR5380_read(BUS_AND_STATUS_REG);
restore_flags(flags); local_irq_restore(flags);
printk("STATUS_REG: %02x ", status); printk("STATUS_REG: %02x ", status);
for (i = 0; signals[i].mask ; ++i) for (i = 0; signals[i].mask ; ++i)
if (status & signals[i].mask) if (status & signals[i].mask)
...@@ -801,8 +800,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset, ...@@ -801,8 +800,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset,
} }
SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
check_offset(); check_offset();
save_flags(flags); local_irq_save(flags);
cli();
SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't"); SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't");
check_offset(); check_offset();
if (!hostdata->connected) if (!hostdata->connected)
...@@ -825,7 +823,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset, ...@@ -825,7 +823,7 @@ int NCR5380_proc_info (char *buffer, char **start, off_t offset,
check_offset(); check_offset();
} }
restore_flags(flags); local_irq_restore(flags);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
if (pos - buffer < offset - begin) if (pos - buffer < offset - begin)
return 0; return 0;
...@@ -999,8 +997,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -999,8 +997,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
* sense data is only guaranteed to be valid while the condition exists. * sense data is only guaranteed to be valid while the condition exists.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) { if (!(hostdata->issue_queue) || (cmd->cmnd[0] == REQUEST_SENSE)) {
LIST(cmd, hostdata->issue_queue); LIST(cmd, hostdata->issue_queue);
...@@ -1013,7 +1010,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -1013,7 +1010,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
LIST(cmd, tmp); LIST(cmd, tmp);
NEXT(tmp) = cmd; NEXT(tmp) = cmd;
} }
restore_flags(flags); local_irq_restore(flags);
QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd), QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd),
(cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
...@@ -1077,9 +1074,9 @@ static void NCR5380_main (void) ...@@ -1077,9 +1074,9 @@ static void NCR5380_main (void)
return; return;
main_running = 1; main_running = 1;
save_flags(flags); local_save_flags(flags);
do { do {
cli(); /* Freeze request queues */ local_irq_disable(); /* Freeze request queues */
done = 1; done = 1;
if (!hostdata->connected) { if (!hostdata->connected) {
...@@ -1112,7 +1109,8 @@ static void NCR5380_main (void) ...@@ -1112,7 +1109,8 @@ static void NCR5380_main (void)
!(hostdata->busy[tmp->target] & (1 << tmp->lun)) !(hostdata->busy[tmp->target] & (1 << tmp->lun))
#endif #endif
) { ) {
cli(); /* ++guenther: just to be sure, this must be atomic */ /* ++guenther: just to be sure, this must be atomic */
local_irq_disable();
if (prev) { if (prev) {
REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
NEXT(prev) = NEXT(tmp); NEXT(prev) = NEXT(tmp);
...@@ -1123,7 +1121,7 @@ static void NCR5380_main (void) ...@@ -1123,7 +1121,7 @@ static void NCR5380_main (void)
NEXT(tmp) = NULL; NEXT(tmp) = NULL;
/* reenable interrupts after finding one */ /* reenable interrupts after finding one */
restore_flags(flags); local_irq_restore(flags);
/* /*
* Attempt to establish an I_T_L nexus here. * Attempt to establish an I_T_L nexus here.
...@@ -1152,14 +1150,14 @@ static void NCR5380_main (void) ...@@ -1152,14 +1150,14 @@ static void NCR5380_main (void)
TAG_NEXT)) { TAG_NEXT)) {
break; break;
} else { } else {
cli(); local_irq_disable();
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
NEXT(tmp) = hostdata->issue_queue; NEXT(tmp) = hostdata->issue_queue;
hostdata->issue_queue = tmp; hostdata->issue_queue = tmp;
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( tmp ); cmd_free_tag( tmp );
#endif #endif
restore_flags(flags); local_irq_restore(flags);
MAIN_PRINTK("scsi%d: main(): select() failed, " MAIN_PRINTK("scsi%d: main(): select() failed, "
"returned to issue_queue\n", HOSTNO); "returned to issue_queue\n", HOSTNO);
if (hostdata->connected) if (hostdata->connected)
...@@ -1174,7 +1172,7 @@ static void NCR5380_main (void) ...@@ -1174,7 +1172,7 @@ static void NCR5380_main (void)
&& !hostdata->dma_len && !hostdata->dma_len
#endif #endif
) { ) {
restore_flags(flags); local_irq_restore(flags);
MAIN_PRINTK("scsi%d: main: performing information transfer\n", MAIN_PRINTK("scsi%d: main: performing information transfer\n",
HOSTNO); HOSTNO);
NCR5380_information_transfer(instance); NCR5380_information_transfer(instance);
...@@ -1187,7 +1185,7 @@ static void NCR5380_main (void) ...@@ -1187,7 +1185,7 @@ static void NCR5380_main (void)
an interrupt could believe we'll pick up the work it left for an interrupt could believe we'll pick up the work it left for
us, but we won't see it anymore here... */ us, but we won't see it anymore here... */
main_running = 0; main_running = 0;
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -1428,10 +1426,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1428,10 +1426,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
* data bus during SELECTION. * data bus during SELECTION.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
if (hostdata->connected) { if (hostdata->connected) {
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
NCR5380_write(TARGET_COMMAND_REG, 0); NCR5380_write(TARGET_COMMAND_REG, 0);
...@@ -1444,7 +1441,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1444,7 +1441,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask); NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
NCR5380_write(MODE_REG, MR_ARBITRATE); NCR5380_write(MODE_REG, MR_ARBITRATE);
restore_flags(flags); local_irq_restore(flags);
/* Wait for arbitration logic to complete */ /* Wait for arbitration logic to complete */
#if NCR_TIMEOUT #if NCR_TIMEOUT
...@@ -1950,8 +1947,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -1950,8 +1947,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY); NCR5380_write(MODE_REG, MR_BASE | MR_DMA_MODE | MR_ENABLE_EOP_INTR | MR_MONITOR_BSY);
#else /* PSEUDO_DMA! */ #else /* PSEUDO_DMA! */
#if defined(PSEUDO_DMA) && !defined(UNSAFE) #if defined(PSEUDO_DMA) && !defined(UNSAFE)
save_flags(flags); local_irq_save(flags);
cli();
#endif #endif
/* KLL May need eop and parity in 53c400 */ /* KLL May need eop and parity in 53c400 */
if (hostdata->flags & FLAG_NCR53C400) if (hostdata->flags & FLAG_NCR53C400)
...@@ -1970,12 +1966,11 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -1970,12 +1966,11 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
/* On the Medusa, it is a must to initialize the DMA before /* On the Medusa, it is a must to initialize the DMA before
* starting the NCR. This is also the cleaner way for the TT. * starting the NCR. This is also the cleaner way for the TT.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
hostdata->dma_len = (p & SR_IO) ? hostdata->dma_len = (p & SR_IO) ?
NCR5380_dma_read_setup(instance, d, c) : NCR5380_dma_read_setup(instance, d, c) :
NCR5380_dma_write_setup(instance, d, c); NCR5380_dma_write_setup(instance, d, c);
restore_flags(flags); local_irq_restore(flags);
#endif /* def REAL_DMA */ #endif /* def REAL_DMA */
#ifndef EMULATE_PSEUDO_DMA #ifndef EMULATE_PSEUDO_DMA
...@@ -2120,7 +2115,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -2120,7 +2115,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
NCR5380_print_phase(instance); NCR5380_print_phase(instance);
#endif #endif
#if defined(PSEUDO_DMA) && !defined(UNSAFE) #if defined(PSEUDO_DMA) && !defined(UNSAFE)
restore_flags(flags); local_irq_restore(flags);
#endif /* defined(REAL_DMA_POLL) */ #endif /* defined(REAL_DMA_POLL) */
return foo; return foo;
#endif /* def REAL_DMA */ #endif /* def REAL_DMA */
...@@ -2410,12 +2405,11 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2410,12 +2405,11 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
cmd->request_buffer = (char *) cmd->sense_buffer; cmd->request_buffer = (char *) cmd->sense_buffer;
cmd->request_bufflen = sizeof(cmd->sense_buffer); cmd->request_bufflen = sizeof(cmd->sense_buffer);
save_flags(flags); local_irq_save(flags);
cli();
LIST(cmd,hostdata->issue_queue); LIST(cmd,hostdata->issue_queue);
NEXT(cmd) = hostdata->issue_queue; NEXT(cmd) = hostdata->issue_queue;
hostdata->issue_queue = (Scsi_Cmnd *) cmd; hostdata->issue_queue = (Scsi_Cmnd *) cmd;
restore_flags(flags); local_irq_restore(flags);
QU_PRINTK("scsi%d: REQUEST SENSE added to head of " QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
"issue queue\n", H_NO(cmd)); "issue queue\n", H_NO(cmd));
} else } else
...@@ -2466,14 +2460,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2466,14 +2460,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
case DISCONNECT: case DISCONNECT:
/* Accept message by clearing ACK */ /* Accept message by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
save_flags(flags); local_irq_save(flags);
cli();
cmd->device->disconnect = 1; cmd->device->disconnect = 1;
LIST(cmd,hostdata->disconnected_queue); LIST(cmd,hostdata->disconnected_queue);
NEXT(cmd) = hostdata->disconnected_queue; NEXT(cmd) = hostdata->disconnected_queue;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = cmd; hostdata->disconnected_queue = cmd;
restore_flags(flags); local_irq_restore(flags);
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,
...@@ -2812,8 +2805,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2812,8 +2805,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
NCR5380_print_status (instance); NCR5380_print_status (instance);
save_flags(flags); local_irq_save(flags);
cli();
ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO, ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(BUS_AND_STATUS_REG),
...@@ -2855,11 +2847,11 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2855,11 +2847,11 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
} else { } else {
/* restore_flags(flags); */ /* local_irq_restore(flags); */
printk("scsi%d: abort of connected command failed!\n", HOSTNO); printk("scsi%d: abort of connected command failed!\n", HOSTNO);
return SCSI_ABORT_ERROR; return SCSI_ABORT_ERROR;
} }
...@@ -2878,7 +2870,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2878,7 +2870,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
(*prev) = NEXT(tmp); (*prev) = NEXT(tmp);
NEXT(tmp) = NULL; NEXT(tmp) = NULL;
tmp->result = DID_ABORT << 16; tmp->result = DID_ABORT << 16;
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n", ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
HOSTNO); HOSTNO);
/* Tagged queuing note: no tag to free here, hasn't been assigned /* Tagged queuing note: no tag to free here, hasn't been assigned
...@@ -2899,7 +2891,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2899,7 +2891,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
*/ */
if (hostdata->connected) { if (hostdata->connected) {
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO); ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
return SCSI_ABORT_SNOOZE; return SCSI_ABORT_SNOOZE;
} }
...@@ -2932,7 +2924,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2932,7 +2924,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp;
tmp = NEXT(tmp)) tmp = NEXT(tmp))
if (cmd == tmp) { if (cmd == tmp) {
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO); ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
if (NCR5380_select (instance, cmd, (int) cmd->tag)) if (NCR5380_select (instance, cmd, (int) cmd->tag))
...@@ -2942,8 +2934,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2942,8 +2934,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
do_abort (instance); do_abort (instance);
save_flags(flags); local_irq_save(flags);
cli();
for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue),
tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp = (Scsi_Cmnd *) hostdata->disconnected_queue;
tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )
...@@ -2961,7 +2952,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2961,7 +2952,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
} }
...@@ -2977,7 +2968,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2977,7 +2968,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
* broke. * broke.
*/ */
restore_flags(flags); local_irq_restore(flags);
printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n"
KERN_INFO " before abortion\n", HOSTNO); KERN_INFO " before abortion\n", HOSTNO);
...@@ -3035,8 +3026,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -3035,8 +3026,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
* into the issue_queue (via scsi_done()), the aborted commands are * into the issue_queue (via scsi_done()), the aborted commands are
* remembered in local variables first. * remembered in local variables first.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
connected = (Scsi_Cmnd *)hostdata->connected; connected = (Scsi_Cmnd *)hostdata->connected;
hostdata->connected = NULL; hostdata->connected = NULL;
disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue;
...@@ -3049,7 +3039,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -3049,7 +3039,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
#ifdef REAL_DMA #ifdef REAL_DMA
hostdata->dma_len = 0; hostdata->dma_len = 0;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
/* In order to tell the mid-level code which commands were aborted, /* In order to tell the mid-level code which commands were aborted,
* set the command status to DID_RESET and call scsi_done() !!! * set the command status to DID_RESET and call scsi_done() !!!
...@@ -3108,8 +3098,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -3108,8 +3098,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
if (hostdata->disconnected_queue) if (hostdata->disconnected_queue)
ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
save_flags(flags); local_irq_save(flags);
cli();
hostdata->issue_queue = NULL; hostdata->issue_queue = NULL;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = NULL; hostdata->disconnected_queue = NULL;
...@@ -3121,7 +3110,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -3121,7 +3110,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
#ifdef REAL_DMA #ifdef REAL_DMA
hostdata->dma_len = 0; hostdata->dma_len = 0;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
/* we did no complete reset of all commands, so a wakeup is required */ /* we did no complete reset of all commands, so a wakeup is required */
return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET; return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
......
...@@ -370,9 +370,9 @@ void restore_irq(struct pt_regs *regs) ...@@ -370,9 +370,9 @@ void restore_irq(struct pt_regs *regs)
{ {
unsigned long flags; unsigned long flags;
save_flags(flags); local_save_flags(flags);
flags = (flags & ~0x0700) | (regs->sr & 0x0700); flags = (flags & ~0x0700) | (regs->sr & 0x0700);
restore_flags(flags); local_irq_restore(flags);
} }
/* /*
...@@ -621,10 +621,9 @@ void scsi_mac_debug (void) ...@@ -621,10 +621,9 @@ void scsi_mac_debug (void)
NCR5380_setup(default_instance); NCR5380_setup(default_instance);
if(NCR5380_read(BUS_AND_STATUS_REG)&BASR_IRQ) if(NCR5380_read(BUS_AND_STATUS_REG)&BASR_IRQ)
#endif #endif
save_flags(flags); local_irq_save(flags);
cli();
NCR5380_print_status(default_instance); NCR5380_print_status(default_instance);
restore_flags(flags); local_irq_restore(flags);
} }
#if 0 #if 0
polled_scsi_on = 1; polled_scsi_on = 1;
...@@ -651,10 +650,9 @@ void scsi_mac_polled (void) ...@@ -651,10 +650,9 @@ void scsi_mac_polled (void)
if(NCR5380_read(BUS_AND_STATUS_REG)&BASR_IRQ) if(NCR5380_read(BUS_AND_STATUS_REG)&BASR_IRQ)
{ {
printk("SCSI poll\n"); printk("SCSI poll\n");
save_flags(flags); local_irq_save(flags);
cli();
NCR5380_intr(IRQ_MAC_SCSI, instance, NULL); NCR5380_intr(IRQ_MAC_SCSI, instance, NULL);
restore_flags(flags); local_irq_restore(flags);
} }
#if 0 #if 0
} }
......
...@@ -567,14 +567,13 @@ static void NCR5380_print(struct Scsi_Host *instance) { ...@@ -567,14 +567,13 @@ static void NCR5380_print(struct Scsi_Host *instance) {
unsigned char status, data, basr, mr, icr, i; unsigned char status, data, basr, mr, icr, i;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
data = NCR5380_read(CURRENT_SCSI_DATA_REG); data = NCR5380_read(CURRENT_SCSI_DATA_REG);
status = NCR5380_read(STATUS_REG); status = NCR5380_read(STATUS_REG);
mr = NCR5380_read(MODE_REG); mr = NCR5380_read(MODE_REG);
icr = NCR5380_read(INITIATOR_COMMAND_REG); icr = NCR5380_read(INITIATOR_COMMAND_REG);
basr = NCR5380_read(BUS_AND_STATUS_REG); basr = NCR5380_read(BUS_AND_STATUS_REG);
restore_flags(flags); local_irq_restore(flags);
printk("STATUS_REG: %02x ", status); printk("STATUS_REG: %02x ", status);
for (i = 0; signals[i].mask ; ++i) for (i = 0; signals[i].mask ; ++i)
if (status & signals[i].mask) if (status & signals[i].mask)
...@@ -782,8 +781,7 @@ static int NCR5380_proc_info (char *buffer, char **start, off_t offset, ...@@ -782,8 +781,7 @@ static int NCR5380_proc_info (char *buffer, char **start, off_t offset,
} }
SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE); SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
check_offset(); check_offset();
save_flags(flags); local_irq_save(flags);
cli();
SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't"); SPRINTF("NCR5380: coroutine is%s running.\n", main_running ? "" : "n't");
check_offset(); check_offset();
if (!hostdata->connected) if (!hostdata->connected)
...@@ -806,7 +804,7 @@ static int NCR5380_proc_info (char *buffer, char **start, off_t offset, ...@@ -806,7 +804,7 @@ static int NCR5380_proc_info (char *buffer, char **start, off_t offset,
check_offset(); check_offset();
} }
restore_flags(flags); local_irq_restore(flags);
*start = buffer + (offset - begin); *start = buffer + (offset - begin);
if (pos - buffer < offset - begin) if (pos - buffer < offset - begin)
return 0; return 0;
...@@ -976,8 +974,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -976,8 +974,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
* sense data is only guaranteed to be valid while the condition exists. * sense data is only guaranteed to be valid while the condition exists.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
/* ++guenther: now that the issue queue is being set up, we can lock ST-DMA. /* ++guenther: now that the issue queue is being set up, we can lock ST-DMA.
* Otherwise a running NCR5380_main may steal the lock. * Otherwise a running NCR5380_main may steal the lock.
* Lock before actually inserting due to fairness reasons explained in * Lock before actually inserting due to fairness reasons explained in
...@@ -1002,7 +999,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) ...@@ -1002,7 +999,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
NEXT(tmp) = cmd; NEXT(tmp) = cmd;
} }
restore_flags(flags); local_irq_restore(flags);
QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd), QU_PRINTK("scsi%d: command added to %s of queue\n", H_NO(cmd),
(cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail"); (cmd->cmnd[0] == REQUEST_SENSE) ? "head" : "tail");
...@@ -1066,9 +1063,9 @@ static void NCR5380_main (void) ...@@ -1066,9 +1063,9 @@ static void NCR5380_main (void)
return; return;
main_running = 1; main_running = 1;
save_flags(flags); local_save_flags(flags);
do { do {
cli(); /* Freeze request queues */ local_irq_disable(flags); /* Freeze request queues */
done = 1; done = 1;
if (!hostdata->connected) { if (!hostdata->connected) {
...@@ -1101,7 +1098,8 @@ static void NCR5380_main (void) ...@@ -1101,7 +1098,8 @@ static void NCR5380_main (void)
!(hostdata->busy[tmp->target] & (1 << tmp->lun)) !(hostdata->busy[tmp->target] & (1 << tmp->lun))
#endif #endif
) { ) {
cli(); /* ++guenther: just to be sure, this must be atomic */ /* ++guenther: just to be sure, this must be atomic */
local_irq_disable();
if (prev) { if (prev) {
REMOVE(prev, NEXT(prev), tmp, NEXT(tmp)); REMOVE(prev, NEXT(prev), tmp, NEXT(tmp));
NEXT(prev) = NEXT(tmp); NEXT(prev) = NEXT(tmp);
...@@ -1112,7 +1110,7 @@ static void NCR5380_main (void) ...@@ -1112,7 +1110,7 @@ static void NCR5380_main (void)
NEXT(tmp) = NULL; NEXT(tmp) = NULL;
/* reenable interrupts after finding one */ /* reenable interrupts after finding one */
restore_flags(flags); local_irq_restore(flags);
/* /*
* Attempt to establish an I_T_L nexus here. * Attempt to establish an I_T_L nexus here.
...@@ -1141,14 +1139,14 @@ static void NCR5380_main (void) ...@@ -1141,14 +1139,14 @@ static void NCR5380_main (void)
TAG_NEXT)) { TAG_NEXT)) {
break; break;
} else { } else {
cli(); local_irq_disable();
LIST(tmp, hostdata->issue_queue); LIST(tmp, hostdata->issue_queue);
NEXT(tmp) = hostdata->issue_queue; NEXT(tmp) = hostdata->issue_queue;
hostdata->issue_queue = tmp; hostdata->issue_queue = tmp;
#ifdef SUPPORT_TAGS #ifdef SUPPORT_TAGS
cmd_free_tag( tmp ); cmd_free_tag( tmp );
#endif #endif
restore_flags(flags); local_irq_restore(flags);
MAIN_PRINTK("scsi%d: main(): select() failed, " MAIN_PRINTK("scsi%d: main(): select() failed, "
"returned to issue_queue\n", HOSTNO); "returned to issue_queue\n", HOSTNO);
if (hostdata->connected) if (hostdata->connected)
...@@ -1162,7 +1160,7 @@ static void NCR5380_main (void) ...@@ -1162,7 +1160,7 @@ static void NCR5380_main (void)
&& !hostdata->dma_len && !hostdata->dma_len
#endif #endif
) { ) {
restore_flags(flags); local_irq_restore(flags);
MAIN_PRINTK("scsi%d: main: performing information transfer\n", MAIN_PRINTK("scsi%d: main: performing information transfer\n",
HOSTNO); HOSTNO);
NCR5380_information_transfer(instance); NCR5380_information_transfer(instance);
...@@ -1175,7 +1173,7 @@ static void NCR5380_main (void) ...@@ -1175,7 +1173,7 @@ static void NCR5380_main (void)
an interrupt could believe we'll pick up the work it left for an interrupt could believe we'll pick up the work it left for
us, but we won't see it anymore here... */ us, but we won't see it anymore here... */
main_running = 0; main_running = 0;
restore_flags(flags); local_irq_restore(flags);
} }
...@@ -1416,10 +1414,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1416,10 +1414,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
* data bus during SELECTION. * data bus during SELECTION.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
if (hostdata->connected) { if (hostdata->connected) {
restore_flags(flags); local_irq_restore(flags);
return -1; return -1;
} }
NCR5380_write(TARGET_COMMAND_REG, 0); NCR5380_write(TARGET_COMMAND_REG, 0);
...@@ -1432,7 +1429,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag) ...@@ -1432,7 +1429,7 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask); NCR5380_write(OUTPUT_DATA_REG, hostdata->id_mask);
NCR5380_write(MODE_REG, MR_ARBITRATE); NCR5380_write(MODE_REG, MR_ARBITRATE);
restore_flags(flags); local_irq_restore(flags);
/* Wait for arbitration logic to complete */ /* Wait for arbitration logic to complete */
#if NCR_TIMEOUT #if NCR_TIMEOUT
...@@ -1929,8 +1926,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -1929,8 +1926,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
c, (p & SR_IO) ? "to" : "from", *data); c, (p & SR_IO) ? "to" : "from", *data);
/* netbsd turns off ints here, why not be safe and do it too */ /* netbsd turns off ints here, why not be safe and do it too */
save_flags(flags); local_irq_save(flags);
cli();
/* send start chain */ /* send start chain */
sun3scsi_dma_start(c, *data); sun3scsi_dma_start(c, *data);
...@@ -1953,7 +1949,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance, ...@@ -1953,7 +1949,7 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
dregs->csr |= CSR_DMA_ENABLE; dregs->csr |= CSR_DMA_ENABLE;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
sun3_dma_active = 1; sun3_dma_active = 1;
return 0; return 0;
...@@ -2273,12 +2269,11 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2273,12 +2269,11 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
cmd->request_buffer = (char *) cmd->sense_buffer; cmd->request_buffer = (char *) cmd->sense_buffer;
cmd->request_bufflen = sizeof(cmd->sense_buffer); cmd->request_bufflen = sizeof(cmd->sense_buffer);
save_flags(flags); local_irq_save(flags);
cli();
LIST(cmd,hostdata->issue_queue); LIST(cmd,hostdata->issue_queue);
NEXT(cmd) = hostdata->issue_queue; NEXT(cmd) = hostdata->issue_queue;
hostdata->issue_queue = (Scsi_Cmnd *) cmd; hostdata->issue_queue = (Scsi_Cmnd *) cmd;
restore_flags(flags); local_irq_restore(flags);
QU_PRINTK("scsi%d: REQUEST SENSE added to head of " QU_PRINTK("scsi%d: REQUEST SENSE added to head of "
"issue queue\n", H_NO(cmd)); "issue queue\n", H_NO(cmd));
} else } else
...@@ -2329,14 +2324,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance) ...@@ -2329,14 +2324,13 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
case DISCONNECT: case DISCONNECT:
/* Accept message by clearing ACK */ /* Accept message by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
save_flags(flags); local_irq_save(flags);
cli();
cmd->device->disconnect = 1; cmd->device->disconnect = 1;
LIST(cmd,hostdata->disconnected_queue); LIST(cmd,hostdata->disconnected_queue);
NEXT(cmd) = hostdata->disconnected_queue; NEXT(cmd) = hostdata->disconnected_queue;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = cmd; hostdata->disconnected_queue = cmd;
restore_flags(flags); local_irq_restore(flags);
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,
...@@ -2702,8 +2696,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2702,8 +2696,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
NCR5380_print_status (instance); NCR5380_print_status (instance);
save_flags(flags); local_irq_save(flags);
cli();
ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO, ABRT_PRINTK("scsi%d: abort called basr 0x%02x, sr 0x%02x\n", HOSTNO,
NCR5380_read(BUS_AND_STATUS_REG), NCR5380_read(BUS_AND_STATUS_REG),
...@@ -2745,11 +2738,11 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2745,11 +2738,11 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
cmd->scsi_done(cmd); cmd->scsi_done(cmd);
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
} else { } else {
/* restore_flags(flags); */ /* local_irq_restore(flags); */
printk("scsi%d: abort of connected command failed!\n", HOSTNO); printk("scsi%d: abort of connected command failed!\n", HOSTNO);
return SCSI_ABORT_ERROR; return SCSI_ABORT_ERROR;
} }
...@@ -2768,7 +2761,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2768,7 +2761,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
(*prev) = NEXT(tmp); (*prev) = NEXT(tmp);
NEXT(tmp) = NULL; NEXT(tmp) = NULL;
tmp->result = DID_ABORT << 16; tmp->result = DID_ABORT << 16;
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n", ABRT_PRINTK("scsi%d: abort removed command from issue queue.\n",
HOSTNO); HOSTNO);
/* Tagged queuing note: no tag to free here, hasn't been assigned /* Tagged queuing note: no tag to free here, hasn't been assigned
...@@ -2789,7 +2782,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2789,7 +2782,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
*/ */
if (hostdata->connected) { if (hostdata->connected) {
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO); ABRT_PRINTK("scsi%d: abort failed, command connected.\n", HOSTNO);
return SCSI_ABORT_SNOOZE; return SCSI_ABORT_SNOOZE;
} }
...@@ -2822,7 +2815,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2822,7 +2815,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp; for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp;
tmp = NEXT(tmp)) tmp = NEXT(tmp))
if (cmd == tmp) { if (cmd == tmp) {
restore_flags(flags); local_irq_restore(flags);
ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO); ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
if (NCR5380_select (instance, cmd, (int) cmd->tag)) if (NCR5380_select (instance, cmd, (int) cmd->tag))
...@@ -2832,8 +2825,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2832,8 +2825,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
do_abort (instance); do_abort (instance);
save_flags(flags); local_irq_save(flags);
cli();
for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue), for (prev = (Scsi_Cmnd **) &(hostdata->disconnected_queue),
tmp = (Scsi_Cmnd *) hostdata->disconnected_queue; tmp = (Scsi_Cmnd *) hostdata->disconnected_queue;
tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) ) tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )
...@@ -2851,7 +2843,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2851,7 +2843,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
#else #else
hostdata->busy[cmd->target] &= ~(1 << cmd->lun); hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
#endif #endif
restore_flags(flags); local_irq_restore(flags);
tmp->scsi_done(tmp); tmp->scsi_done(tmp);
return SCSI_ABORT_SUCCESS; return SCSI_ABORT_SUCCESS;
} }
...@@ -2867,7 +2859,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd) ...@@ -2867,7 +2859,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
* broke. * broke.
*/ */
restore_flags(flags); local_irq_restore(flags);
printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n"
KERN_INFO " before abortion\n", HOSTNO); KERN_INFO " before abortion\n", HOSTNO);
...@@ -2921,8 +2913,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2921,8 +2913,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
* into the issue_queue (via scsi_done()), the aborted commands are * into the issue_queue (via scsi_done()), the aborted commands are
* remembered in local variables first. * remembered in local variables first.
*/ */
save_flags(flags); local_irq_save(flags);
cli();
connected = (Scsi_Cmnd *)hostdata->connected; connected = (Scsi_Cmnd *)hostdata->connected;
hostdata->connected = NULL; hostdata->connected = NULL;
disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue; disconnected_queue = (Scsi_Cmnd *)hostdata->disconnected_queue;
...@@ -2935,7 +2926,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2935,7 +2926,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
#ifdef REAL_DMA #ifdef REAL_DMA
hostdata->dma_len = 0; hostdata->dma_len = 0;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
/* In order to tell the mid-level code which commands were aborted, /* In order to tell the mid-level code which commands were aborted,
* set the command status to DID_RESET and call scsi_done() !!! * set the command status to DID_RESET and call scsi_done() !!!
...@@ -2995,8 +2986,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -2995,8 +2986,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
if (hostdata->disconnected_queue) if (hostdata->disconnected_queue)
ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd)); ABRT_PRINTK("scsi%d: reset aborted disconnected command(s)\n", H_NO(cmd));
save_flags(flags); local_irq_save(flags);
cli();
hostdata->issue_queue = NULL; hostdata->issue_queue = NULL;
hostdata->connected = NULL; hostdata->connected = NULL;
hostdata->disconnected_queue = NULL; hostdata->disconnected_queue = NULL;
...@@ -3008,7 +2998,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags) ...@@ -3008,7 +2998,7 @@ static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
#ifdef REAL_DMA #ifdef REAL_DMA
hostdata->dma_len = 0; hostdata->dma_len = 0;
#endif #endif
restore_flags(flags); local_irq_restore(flags);
/* we did no complete reset of all commands, so a wakeup is required */ /* we did no complete reset of all commands, so a wakeup is required */
return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET; return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
......
...@@ -402,10 +402,9 @@ void sun3_sun3_debug (void) ...@@ -402,10 +402,9 @@ void sun3_sun3_debug (void)
NCR5380_local_declare(); NCR5380_local_declare();
if (default_instance) { if (default_instance) {
save_flags(flags); local_irq_save(flags);
cli();
NCR5380_print_status(default_instance); NCR5380_print_status(default_instance);
restore_flags(flags); local_irq_restore(flags);
} }
} }
#endif #endif
......
...@@ -387,10 +387,9 @@ void sun3_sun3_debug (void) ...@@ -387,10 +387,9 @@ void sun3_sun3_debug (void)
NCR5380_local_declare(); NCR5380_local_declare();
if (default_instance) { if (default_instance) {
save_flags(flags); local_irq_save(flags);
cli();
NCR5380_print_status(default_instance); NCR5380_print_status(default_instance);
restore_flags(flags); local_irq_restore(flags);
} }
} }
#endif #endif
......
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