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