m68k: Reformat the Atari SCSI driver
Reformat the Atari SCSI driver Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
fb810d121b
commit
c28bda2517
@@ -78,12 +78,20 @@
|
|||||||
|
|
||||||
#if (NDEBUG & NDEBUG_LISTS)
|
#if (NDEBUG & NDEBUG_LISTS)
|
||||||
#define LIST(x, y) \
|
#define LIST(x, y) \
|
||||||
{ printk("LINE:%d Adding %p to %p\n", __LINE__, (void*)(x), (void*)(y)); \
|
do { \
|
||||||
if ((x)==(y)) udelay(5); }
|
printk("LINE:%d Adding %p to %p\n", \
|
||||||
|
__LINE__, (void*)(x), (void*)(y)); \
|
||||||
|
if ((x) == (y)) \
|
||||||
|
udelay(5); \
|
||||||
|
} while (0)
|
||||||
#define REMOVE(w, x, y, z) \
|
#define REMOVE(w, x, y, z) \
|
||||||
{ printk("LINE:%d Removing: %p->%p %p->%p \n", __LINE__, \
|
do { \
|
||||||
(void*)(w), (void*)(x), (void*)(y), (void*)(z)); \
|
printk("LINE:%d Removing: %p->%p %p->%p \n", \
|
||||||
if ((x)==(y)) udelay(5); }
|
__LINE__, (void*)(w), (void*)(x), \
|
||||||
|
(void*)(y), (void*)(z)); \
|
||||||
|
if ((x) == (y)) \
|
||||||
|
udelay(5); \
|
||||||
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define LIST(x,y)
|
#define LIST(x,y)
|
||||||
#define REMOVE(w,x,y,z)
|
#define REMOVE(w,x,y,z)
|
||||||
@@ -355,17 +363,17 @@ static int is_lun_busy( Scsi_Cmnd *cmd, int should_be_tagged )
|
|||||||
SETUP_HOSTDATA(cmd->device->host);
|
SETUP_HOSTDATA(cmd->device->host);
|
||||||
|
|
||||||
if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))
|
if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))
|
||||||
return( 1 );
|
return 1;
|
||||||
if (!should_be_tagged ||
|
if (!should_be_tagged ||
|
||||||
!setup_use_tagged_queuing || !cmd->device->tagged_supported)
|
!setup_use_tagged_queuing || !cmd->device->tagged_supported)
|
||||||
return( 0 );
|
return 0;
|
||||||
if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
|
if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >=
|
||||||
TagAlloc[cmd->device->id][cmd->device->lun].queue_size) {
|
TagAlloc[cmd->device->id][cmd->device->lun].queue_size) {
|
||||||
TAG_PRINTK("scsi%d: target %d lun %d: no free tags\n",
|
TAG_PRINTK("scsi%d: target %d lun %d: no free tags\n",
|
||||||
H_NO(cmd), cmd->device->id, cmd->device->lun);
|
H_NO(cmd), cmd->device->id, cmd->device->lun);
|
||||||
return( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
return( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -387,8 +395,7 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
|
|||||||
hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
|
hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
|
||||||
TAG_PRINTK("scsi%d: target %d lun %d now allocated by untagged "
|
TAG_PRINTK("scsi%d: target %d lun %d now allocated by untagged "
|
||||||
"command\n", H_NO(cmd), cmd->device->id, cmd->device->lun);
|
"command\n", H_NO(cmd), cmd->device->id, cmd->device->lun);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
|
TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
|
||||||
|
|
||||||
cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS);
|
cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS);
|
||||||
@@ -396,8 +403,8 @@ static void cmd_get_tag( Scsi_Cmnd *cmd, int should_be_tagged )
|
|||||||
ta->nr_allocated++;
|
ta->nr_allocated++;
|
||||||
TAG_PRINTK("scsi%d: using tag %d for target %d lun %d "
|
TAG_PRINTK("scsi%d: using tag %d for target %d lun %d "
|
||||||
"(now %d tags in use)\n",
|
"(now %d tags in use)\n",
|
||||||
H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun,
|
H_NO(cmd), cmd->tag, cmd->device->id,
|
||||||
ta->nr_allocated );
|
cmd->device->lun, ta->nr_allocated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,12 +421,10 @@ static void cmd_free_tag( Scsi_Cmnd *cmd )
|
|||||||
hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
|
hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
|
||||||
TAG_PRINTK("scsi%d: target %d lun %d untagged cmd finished\n",
|
TAG_PRINTK("scsi%d: target %d lun %d untagged cmd finished\n",
|
||||||
H_NO(cmd), cmd->device->id, cmd->device->lun);
|
H_NO(cmd), cmd->device->id, cmd->device->lun);
|
||||||
}
|
} else if (cmd->tag >= MAX_TAGS) {
|
||||||
else if (cmd->tag >= MAX_TAGS) {
|
|
||||||
printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
|
printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
|
||||||
H_NO(cmd), cmd->tag);
|
H_NO(cmd), cmd->tag);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
|
TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
|
||||||
clear_bit(cmd->tag, ta->allocated);
|
clear_bit(cmd->tag, ta->allocated);
|
||||||
ta->nr_allocated--;
|
ta->nr_allocated--;
|
||||||
@@ -499,7 +504,7 @@ static void merge_contiguous_buffers( Scsi_Cmnd *cmd )
|
|||||||
* Inputs : cmd - Scsi_Cmnd structure to have pointers reset.
|
* Inputs : cmd - Scsi_Cmnd structure to have pointers reset.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static __inline__ void initialize_SCp(Scsi_Cmnd *cmd)
|
static inline void initialize_SCp(Scsi_Cmnd *cmd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Initialize the Scsi Pointer field so that all of the commands in the
|
* Initialize the Scsi Pointer field so that all of the commands in the
|
||||||
@@ -529,21 +534,26 @@ static __inline__ void initialize_SCp(Scsi_Cmnd *cmd)
|
|||||||
#if NDEBUG
|
#if NDEBUG
|
||||||
static struct {
|
static struct {
|
||||||
unsigned char mask;
|
unsigned char mask;
|
||||||
const char * name;}
|
const char *name;
|
||||||
signals[] = {{ SR_DBP, "PARITY"}, { SR_RST, "RST" }, { SR_BSY, "BSY" },
|
} signals[] = {
|
||||||
|
{ SR_DBP, "PARITY"}, { SR_RST, "RST" }, { SR_BSY, "BSY" },
|
||||||
{ SR_REQ, "REQ" }, { SR_MSG, "MSG" }, { SR_CD, "CD" }, { SR_IO, "IO" },
|
{ SR_REQ, "REQ" }, { SR_MSG, "MSG" }, { SR_CD, "CD" }, { SR_IO, "IO" },
|
||||||
{ SR_SEL, "SEL" }, {0, NULL}},
|
{ SR_SEL, "SEL" }, {0, NULL}
|
||||||
basrs[] = {{BASR_ATN, "ATN"}, {BASR_ACK, "ACK"}, {0, NULL}},
|
}, basrs[] = {
|
||||||
icrs[] = {{ICR_ASSERT_RST, "ASSERT RST"},{ICR_ASSERT_ACK, "ASSERT ACK"},
|
{BASR_ATN, "ATN"}, {BASR_ACK, "ACK"}, {0, NULL}
|
||||||
|
}, icrs[] = {
|
||||||
|
{ICR_ASSERT_RST, "ASSERT RST"},{ICR_ASSERT_ACK, "ASSERT ACK"},
|
||||||
{ICR_ASSERT_BSY, "ASSERT BSY"}, {ICR_ASSERT_SEL, "ASSERT SEL"},
|
{ICR_ASSERT_BSY, "ASSERT BSY"}, {ICR_ASSERT_SEL, "ASSERT SEL"},
|
||||||
{ICR_ASSERT_ATN, "ASSERT ATN"}, {ICR_ASSERT_DATA, "ASSERT DATA"},
|
{ICR_ASSERT_ATN, "ASSERT ATN"}, {ICR_ASSERT_DATA, "ASSERT DATA"},
|
||||||
{0, NULL}},
|
{0, NULL}
|
||||||
mrs[] = {{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, {MR_TARGET, "MODE TARGET"},
|
}, mrs[] = {
|
||||||
|
{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, {MR_TARGET, "MODE TARGET"},
|
||||||
{MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"}, {MR_ENABLE_PAR_INTR,
|
{MR_ENABLE_PAR_CHECK, "MODE PARITY CHECK"}, {MR_ENABLE_PAR_INTR,
|
||||||
"MODE PARITY INTR"}, {MR_ENABLE_EOP_INTR,"MODE EOP INTR"},
|
"MODE PARITY INTR"}, {MR_ENABLE_EOP_INTR,"MODE EOP INTR"},
|
||||||
{MR_MONITOR_BSY, "MODE MONITOR BSY"},
|
{MR_MONITOR_BSY, "MODE MONITOR BSY"},
|
||||||
{MR_DMA_MODE, "MODE DMA"}, {MR_ARBITRATE, "MODE ARBITRATION"},
|
{MR_DMA_MODE, "MODE DMA"}, {MR_ARBITRATE, "MODE ARBITRATION"},
|
||||||
{0, NULL}};
|
{0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function : void NCR5380_print(struct Scsi_Host *instance)
|
* Function : void NCR5380_print(struct Scsi_Host *instance)
|
||||||
@@ -553,7 +563,8 @@ mrs[] = {{MR_BLOCK_DMA_MODE, "MODE BLOCK DMA"}, {MR_TARGET, "MODE TARGET"},
|
|||||||
* Input : instance - which NCR5380
|
* Input : instance - which NCR5380
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void NCR5380_print(struct Scsi_Host *instance) {
|
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;
|
||||||
|
|
||||||
@@ -589,7 +600,8 @@ static struct {
|
|||||||
} phases[] = {
|
} phases[] = {
|
||||||
{PHASE_DATAOUT, "DATAOUT"}, {PHASE_DATAIN, "DATAIN"}, {PHASE_CMDOUT, "CMDOUT"},
|
{PHASE_DATAOUT, "DATAOUT"}, {PHASE_DATAIN, "DATAIN"}, {PHASE_CMDOUT, "CMDOUT"},
|
||||||
{PHASE_STATIN, "STATIN"}, {PHASE_MSGOUT, "MSGOUT"}, {PHASE_MSGIN, "MSGIN"},
|
{PHASE_STATIN, "STATIN"}, {PHASE_MSGOUT, "MSGOUT"}, {PHASE_MSGIN, "MSGIN"},
|
||||||
{PHASE_UNKNOWN, "UNKNOWN"}};
|
{PHASE_UNKNOWN, "UNKNOWN"}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function : void NCR5380_print_phase(struct Scsi_Host *instance)
|
* Function : void NCR5380_print_phase(struct Scsi_Host *instance)
|
||||||
@@ -609,7 +621,8 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
|
|||||||
printk(KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n", HOSTNO);
|
printk(KERN_DEBUG "scsi%d: REQ not asserted, phase unknown.\n", HOSTNO);
|
||||||
else {
|
else {
|
||||||
for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
|
for (i = 0; (phases[i].value != PHASE_UNKNOWN) &&
|
||||||
(phases[i].value != (status & PHASE_MASK)); ++i);
|
(phases[i].value != (status & PHASE_MASK)); ++i)
|
||||||
|
;
|
||||||
printk(KERN_DEBUG "scsi%d: phase %s\n", HOSTNO, phases[i].name);
|
printk(KERN_DEBUG "scsi%d: phase %s\n", HOSTNO, phases[i].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -617,8 +630,12 @@ static void NCR5380_print_phase(struct Scsi_Host *instance)
|
|||||||
#else /* !NDEBUG */
|
#else /* !NDEBUG */
|
||||||
|
|
||||||
/* dummies... */
|
/* dummies... */
|
||||||
__inline__ void NCR5380_print(struct Scsi_Host *instance) { };
|
static inline void NCR5380_print(struct Scsi_Host *instance)
|
||||||
__inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
|
{
|
||||||
|
};
|
||||||
|
static inline void NCR5380_print_phase(struct Scsi_Host *instance)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -638,10 +655,10 @@ __inline__ void NCR5380_print_phase(struct Scsi_Host *instance) { };
|
|||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
|
||||||
static volatile int main_running = 0;
|
static volatile int main_running;
|
||||||
static DECLARE_WORK(NCR5380_tqueue, (void (*)(void *))NCR5380_main, NULL);
|
static DECLARE_WORK(NCR5380_tqueue, (void (*)(void *))NCR5380_main, NULL);
|
||||||
|
|
||||||
static __inline__ void queue_main(void)
|
static inline void queue_main(void)
|
||||||
{
|
{
|
||||||
if (!main_running) {
|
if (!main_running) {
|
||||||
/* If in interrupt and NCR5380_main() not already running,
|
/* If in interrupt and NCR5380_main() not already running,
|
||||||
@@ -739,14 +756,14 @@ static void NCR5380_print_status (struct Scsi_Host *instance)
|
|||||||
|
|
||||||
#undef SPRINTF
|
#undef SPRINTF
|
||||||
#define SPRINTF(fmt,args...) \
|
#define SPRINTF(fmt,args...) \
|
||||||
do { if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \
|
do { \
|
||||||
pos += sprintf(pos, fmt , ## args); } while(0)
|
if (pos + strlen(fmt) + 20 /* slop */ < buffer + length) \
|
||||||
static
|
pos += sprintf(pos, fmt , ## args); \
|
||||||
char *lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length);
|
} while(0)
|
||||||
|
static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length);
|
||||||
|
|
||||||
static
|
static int NCR5380_proc_info(struct Scsi_Host *instance, char *buffer,
|
||||||
int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, off_t offset,
|
char **start, off_t offset, int length, int inout)
|
||||||
int length, int inout)
|
|
||||||
{
|
{
|
||||||
char *pos = buffer;
|
char *pos = buffer;
|
||||||
struct NCR5380_hostdata *hostdata;
|
struct NCR5380_hostdata *hostdata;
|
||||||
@@ -763,13 +780,13 @@ int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, o
|
|||||||
|
|
||||||
hostdata = (struct NCR5380_hostdata *)instance->hostdata;
|
hostdata = (struct NCR5380_hostdata *)instance->hostdata;
|
||||||
|
|
||||||
if (inout) { /* Has data been written to the file ? */
|
if (inout) /* Has data been written to the file ? */
|
||||||
return(-ENOSYS); /* Currently this is a no-op */
|
return -ENOSYS; /* Currently this is a no-op */
|
||||||
}
|
|
||||||
SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
|
SPRINTF("NCR5380 core release=%d.\n", NCR5380_PUBLIC_RELEASE);
|
||||||
check_offset();
|
check_offset();
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
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)
|
||||||
SPRINTF("scsi%d: no currently connected command\n", HOSTNO);
|
SPRINTF("scsi%d: no currently connected command\n", HOSTNO);
|
||||||
@@ -800,8 +817,7 @@ int NCR5380_proc_info (struct Scsi_Host *instance, char *buffer, char **start, o
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *lprint_Scsi_Cmnd(Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
|
||||||
lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
|
|
||||||
{
|
{
|
||||||
int i, s;
|
int i, s;
|
||||||
unsigned char *command;
|
unsigned char *command;
|
||||||
@@ -861,7 +877,6 @@ static int NCR5380_init (struct Scsi_Host *instance, int flags)
|
|||||||
first_instance = instance;
|
first_instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef AUTOSENSE
|
#ifndef AUTOSENSE
|
||||||
if ((instance->cmd_per_lun > 1) || (instance->can_queue > 1))
|
if ((instance->cmd_per_lun > 1) || (instance->can_queue > 1))
|
||||||
printk("scsi%d: WARNING : support for multiple outstanding commands enabled\n"
|
printk("scsi%d: WARNING : support for multiple outstanding commands enabled\n"
|
||||||
@@ -897,11 +912,10 @@ int atari_scsi_update_timeout(Scsi_Cmnd * SCset, int timeout)
|
|||||||
* timers for timeout.
|
* timers for timeout.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!timer_pending(&SCset->eh_timeout)) {
|
if (!timer_pending(&SCset->eh_timeout))
|
||||||
rtn = 0;
|
rtn = 0;
|
||||||
} else {
|
else
|
||||||
rtn = SCset->eh_timeout.expires - jiffies;
|
rtn = SCset->eh_timeout.expires - jiffies;
|
||||||
}
|
|
||||||
|
|
||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
del_timer(&SCset->eh_timeout);
|
del_timer(&SCset->eh_timeout);
|
||||||
@@ -935,8 +949,7 @@ int atari_scsi_update_timeout(Scsi_Cmnd * SCset, int timeout)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static
|
static int NCR5380_queue_command(Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
||||||
int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
|
||||||
{
|
{
|
||||||
SETUP_HOSTDATA(cmd->device->host);
|
SETUP_HOSTDATA(cmd->device->host);
|
||||||
Scsi_Cmnd *tmp;
|
Scsi_Cmnd *tmp;
|
||||||
@@ -956,7 +969,6 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
|||||||
}
|
}
|
||||||
#endif /* (NDEBUG & NDEBUG_NO_WRITE) */
|
#endif /* (NDEBUG & NDEBUG_NO_WRITE) */
|
||||||
|
|
||||||
|
|
||||||
#ifdef NCR5380_STATS
|
#ifdef NCR5380_STATS
|
||||||
# if 0
|
# if 0
|
||||||
if (!hostdata->connected && !hostdata->issue_queue &&
|
if (!hostdata->connected && !hostdata->issue_queue &&
|
||||||
@@ -967,8 +979,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
|||||||
# ifdef NCR5380_STAT_LIMIT
|
# ifdef NCR5380_STAT_LIMIT
|
||||||
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
||||||
# endif
|
# endif
|
||||||
switch (cmd->cmnd[0])
|
switch (cmd->cmnd[0]) {
|
||||||
{
|
|
||||||
case WRITE:
|
case WRITE:
|
||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
@@ -996,7 +1007,6 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
|||||||
|
|
||||||
cmd->result = 0;
|
cmd->result = 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Insert the cmd into the issue queue. Note that REQUEST SENSE
|
* Insert the cmd into the issue queue. Note that REQUEST SENSE
|
||||||
* commands are added to the head of the queue since any command will
|
* commands are added to the head of the queue since any command will
|
||||||
@@ -1113,7 +1123,9 @@ static void NCR5380_main (void *bl)
|
|||||||
tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp))
|
tmp && (tmp != prev); prev = tmp, tmp = NEXT(tmp))
|
||||||
;
|
;
|
||||||
/*printk("%p ", tmp);*/
|
/*printk("%p ", tmp);*/
|
||||||
if ((tmp == prev) && tmp) printk(" LOOP\n");/* else printk("\n");*/
|
if ((tmp == prev) && tmp)
|
||||||
|
printk(" LOOP\n");
|
||||||
|
/* else printk("\n"); */
|
||||||
#endif
|
#endif
|
||||||
for (tmp = (Scsi_Cmnd *) hostdata->issue_queue,
|
for (tmp = (Scsi_Cmnd *) hostdata->issue_queue,
|
||||||
prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) {
|
prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) {
|
||||||
@@ -1246,9 +1258,9 @@ static void NCR5380_dma_complete( struct Scsi_Host *instance )
|
|||||||
p = hostdata->connected->SCp.phase;
|
p = hostdata->connected->SCp.phase;
|
||||||
if (p & SR_IO) {
|
if (p & SR_IO) {
|
||||||
udelay(10);
|
udelay(10);
|
||||||
if ((((NCR5380_read(BUS_AND_STATUS_REG)) &
|
if ((NCR5380_read(BUS_AND_STATUS_REG) &
|
||||||
(BASR_PHASE_MATCH|BASR_ACK)) ==
|
(BASR_PHASE_MATCH|BASR_ACK)) ==
|
||||||
(BASR_PHASE_MATCH|BASR_ACK))) {
|
(BASR_PHASE_MATCH|BASR_ACK)) {
|
||||||
saved_data = NCR5380_read(INPUT_DATA_REG);
|
saved_data = NCR5380_read(INPUT_DATA_REG);
|
||||||
overrun = 1;
|
overrun = 1;
|
||||||
DMA_PRINTK("scsi%d: read overrun handled\n", HOSTNO);
|
DMA_PRINTK("scsi%d: read overrun handled\n", HOSTNO);
|
||||||
@@ -1267,8 +1279,8 @@ static void NCR5380_dma_complete( struct Scsi_Host *instance )
|
|||||||
transfered = hostdata->dma_len - NCR5380_dma_residual(instance);
|
transfered = hostdata->dma_len - NCR5380_dma_residual(instance);
|
||||||
hostdata->dma_len = 0;
|
hostdata->dma_len = 0;
|
||||||
|
|
||||||
data = (unsigned char **) &(hostdata->connected->SCp.ptr);
|
data = (unsigned char **)&hostdata->connected->SCp.ptr;
|
||||||
count = &(hostdata->connected->SCp.this_residual);
|
count = &hostdata->connected->SCp.this_residual;
|
||||||
*data += transfered;
|
*data += transfered;
|
||||||
*count -= transfered;
|
*count -= transfered;
|
||||||
|
|
||||||
@@ -1322,16 +1334,13 @@ static irqreturn_t NCR5380_intr (int irq, void *dev_id)
|
|||||||
INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO);
|
INT_PRINTK("scsi%d: SEL interrupt\n", HOSTNO);
|
||||||
NCR5380_reselect(instance);
|
NCR5380_reselect(instance);
|
||||||
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
|
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
|
||||||
}
|
} else if (basr & BASR_PARITY_ERROR) {
|
||||||
else if (basr & BASR_PARITY_ERROR) {
|
|
||||||
INT_PRINTK("scsi%d: PARITY interrupt\n", HOSTNO);
|
INT_PRINTK("scsi%d: PARITY interrupt\n", HOSTNO);
|
||||||
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
|
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
|
||||||
}
|
} else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) {
|
||||||
else if ((NCR5380_read(STATUS_REG) & SR_RST) == SR_RST) {
|
|
||||||
INT_PRINTK("scsi%d: RESET interrupt\n", HOSTNO);
|
INT_PRINTK("scsi%d: RESET interrupt\n", HOSTNO);
|
||||||
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
|
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* The rest of the interrupt conditions can occur only during a
|
* The rest of the interrupt conditions can occur only during a
|
||||||
* DMA transfer
|
* DMA transfer
|
||||||
@@ -1365,8 +1374,7 @@ static irqreturn_t NCR5380_intr (int irq, void *dev_id)
|
|||||||
}
|
}
|
||||||
} /* if !(SELECTION || PARITY) */
|
} /* if !(SELECTION || PARITY) */
|
||||||
handled = 1;
|
handled = 1;
|
||||||
} /* BASR & IRQ */
|
} /* BASR & IRQ */ else {
|
||||||
else {
|
|
||||||
printk(KERN_NOTICE "scsi%d: interrupt without IRQ bit set in BASR, "
|
printk(KERN_NOTICE "scsi%d: interrupt without IRQ bit set in BASR, "
|
||||||
"BASR 0x%X, MR 0x%X, SR 0x%x\n", HOSTNO, basr,
|
"BASR 0x%X, MR 0x%X, SR 0x%x\n", HOSTNO, basr,
|
||||||
NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG));
|
NCR5380_read(MODE_REG), NCR5380_read(STATUS_REG));
|
||||||
@@ -1387,8 +1395,7 @@ static void collect_stats(struct NCR5380_hostdata* hostdata, Scsi_Cmnd* cmd)
|
|||||||
# ifdef NCR5380_STAT_LIMIT
|
# ifdef NCR5380_STAT_LIMIT
|
||||||
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
if (cmd->request_bufflen > NCR5380_STAT_LIMIT)
|
||||||
# endif
|
# endif
|
||||||
switch (cmd->cmnd[0])
|
switch (cmd->cmnd[0]) {
|
||||||
{
|
|
||||||
case WRITE:
|
case WRITE:
|
||||||
case WRITE_6:
|
case WRITE_6:
|
||||||
case WRITE_10:
|
case WRITE_10:
|
||||||
@@ -1464,7 +1471,6 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
}
|
}
|
||||||
NCR5380_write(TARGET_COMMAND_REG, 0);
|
NCR5380_write(TARGET_COMMAND_REG, 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start arbitration.
|
* Start arbitration.
|
||||||
*/
|
*/
|
||||||
@@ -1479,11 +1485,10 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
{
|
{
|
||||||
unsigned long timeout = jiffies + 2*NCR_TIMEOUT;
|
unsigned long timeout = jiffies + 2*NCR_TIMEOUT;
|
||||||
|
|
||||||
while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS)
|
while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS) &&
|
||||||
&& time_before(jiffies, timeout) && !hostdata->connected)
|
time_before(jiffies, timeout) && !hostdata->connected)
|
||||||
;
|
;
|
||||||
if (time_after_eq(jiffies, timeout))
|
if (time_after_eq(jiffies, timeout)) {
|
||||||
{
|
|
||||||
printk("scsi : arbitration timeout at %d\n", __LINE__);
|
printk("scsi : arbitration timeout at %d\n", __LINE__);
|
||||||
NCR5380_write(MODE_REG, MR_BASE);
|
NCR5380_write(MODE_REG, MR_BASE);
|
||||||
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
|
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
|
||||||
@@ -1491,8 +1496,9 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* NCR_TIMEOUT */
|
#else /* NCR_TIMEOUT */
|
||||||
while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS)
|
while (!(NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_PROGRESS) &&
|
||||||
&& !hostdata->connected);
|
!hostdata->connected)
|
||||||
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ARB_PRINTK("scsi%d: arbitration complete\n", HOSTNO);
|
ARB_PRINTK("scsi%d: arbitration complete\n", HOSTNO);
|
||||||
@@ -1524,8 +1530,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
/* after/during arbitration, BSY should be asserted.
|
/* after/during arbitration, BSY should be asserted.
|
||||||
IBM DPES-31080 Version S31Q works now */
|
IBM DPES-31080 Version S31Q works now */
|
||||||
/* Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman) */
|
/* Tnx to Thomas_Roesch@m2.maus.de for finding this! (Roman) */
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_SEL |
|
NCR5380_write(INITIATOR_COMMAND_REG,
|
||||||
ICR_ASSERT_BSY ) ;
|
ICR_BASE | ICR_ASSERT_SEL | ICR_ASSERT_BSY);
|
||||||
|
|
||||||
if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
|
if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) ||
|
||||||
hostdata->connected) {
|
hostdata->connected) {
|
||||||
@@ -1634,14 +1640,14 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
* IO while SEL is true. But again, there are some disks out the in the
|
* IO while SEL is true. But again, there are some disks out the in the
|
||||||
* world that do that nevertheless. (Somebody claimed that this announces
|
* world that do that nevertheless. (Somebody claimed that this announces
|
||||||
* reselection capability of the target.) So we better skip that test and
|
* reselection capability of the target.) So we better skip that test and
|
||||||
* only wait for BSY... (Famous german words: Der Kl<EFBFBD>gere gibt nach :-)
|
* only wait for BSY... (Famous german words: Der Klügere gibt nach :-)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) &
|
while (time_before(jiffies, timeout) &&
|
||||||
(SR_BSY | SR_IO)));
|
!(NCR5380_read(STATUS_REG) & (SR_BSY | SR_IO)))
|
||||||
|
;
|
||||||
|
|
||||||
if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) ==
|
if ((NCR5380_read(STATUS_REG) & (SR_SEL | SR_IO)) == (SR_SEL | SR_IO)) {
|
||||||
(SR_SEL | SR_IO)) {
|
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
|
||||||
NCR5380_reselect(instance);
|
NCR5380_reselect(instance);
|
||||||
printk(KERN_ERR "scsi%d: reselection after won arbitration?\n",
|
printk(KERN_ERR "scsi%d: reselection after won arbitration?\n",
|
||||||
@@ -1650,7 +1656,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & SR_BSY));
|
while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & SR_BSY))
|
||||||
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1705,7 +1712,8 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Wait for start of REQ/ACK handshake */
|
/* Wait for start of REQ/ACK handshake */
|
||||||
while (!(NCR5380_read(STATUS_REG) & SR_REQ));
|
while (!(NCR5380_read(STATUS_REG) & SR_REQ))
|
||||||
|
;
|
||||||
|
|
||||||
SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
|
SEL_PRINTK("scsi%d: target %d selected, going into MESSAGE OUT phase.\n",
|
||||||
HOSTNO, cmd->device->id);
|
HOSTNO, cmd->device->id);
|
||||||
@@ -1736,7 +1744,6 @@ static int NCR5380_select (struct Scsi_Host *instance, Scsi_Cmnd *cmd, int tag)
|
|||||||
|
|
||||||
initialize_SCp(cmd);
|
initialize_SCp(cmd);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1786,7 +1793,8 @@ static int NCR5380_transfer_pio( struct Scsi_Host *instance,
|
|||||||
* Wait for assertion of REQ, after which the phase bits will be
|
* Wait for assertion of REQ, after which the phase bits will be
|
||||||
* valid
|
* valid
|
||||||
*/
|
*/
|
||||||
while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ));
|
while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ))
|
||||||
|
;
|
||||||
|
|
||||||
HSH_PRINTK("scsi%d: REQ detected\n", HOSTNO);
|
HSH_PRINTK("scsi%d: REQ detected\n", HOSTNO);
|
||||||
|
|
||||||
@@ -1814,8 +1822,7 @@ static int NCR5380_transfer_pio( struct Scsi_Host *instance,
|
|||||||
|
|
||||||
if (!(p & SR_IO)) {
|
if (!(p & SR_IO)) {
|
||||||
if (!((p & SR_MSG) && c > 1)) {
|
if (!((p & SR_MSG) && c > 1)) {
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_DATA);
|
||||||
ICR_ASSERT_DATA);
|
|
||||||
NCR_PRINT(NDEBUG_PIO);
|
NCR_PRINT(NDEBUG_PIO);
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
|
||||||
ICR_ASSERT_DATA | ICR_ASSERT_ACK);
|
ICR_ASSERT_DATA | ICR_ASSERT_ACK);
|
||||||
@@ -1831,7 +1838,8 @@ static int NCR5380_transfer_pio( struct Scsi_Host *instance,
|
|||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (NCR5380_read(STATUS_REG) & SR_REQ);
|
while (NCR5380_read(STATUS_REG) & SR_REQ)
|
||||||
|
;
|
||||||
|
|
||||||
HSH_PRINTK("scsi%d: req false, handshake complete\n", HOSTNO);
|
HSH_PRINTK("scsi%d: req false, handshake complete\n", HOSTNO);
|
||||||
|
|
||||||
@@ -1861,7 +1869,8 @@ static int NCR5380_transfer_pio( struct Scsi_Host *instance,
|
|||||||
tmp = NCR5380_read(STATUS_REG);
|
tmp = NCR5380_read(STATUS_REG);
|
||||||
/* The phase read from the bus is valid if either REQ is (already)
|
/* The phase read from the bus is valid if either REQ is (already)
|
||||||
* asserted or if ACK hasn't been released yet. The latter is the case if
|
* asserted or if ACK hasn't been released yet. The latter is the case if
|
||||||
* we're in MSGIN and all wanted bytes have been received. */
|
* we're in MSGIN and all wanted bytes have been received.
|
||||||
|
*/
|
||||||
if ((tmp & SR_REQ) || (p == PHASE_MSGIN && c == 0))
|
if ((tmp & SR_REQ) || (p == PHASE_MSGIN && c == 0))
|
||||||
*phase = tmp & PHASE_MASK;
|
*phase = tmp & PHASE_MASK;
|
||||||
else
|
else
|
||||||
@@ -1900,14 +1909,16 @@ static int do_abort (struct Scsi_Host *host)
|
|||||||
* the target sees, so we just handshake.
|
* the target sees, so we just handshake.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ);
|
while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ)
|
||||||
|
;
|
||||||
|
|
||||||
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
|
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
|
||||||
|
|
||||||
if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
|
if ((tmp & PHASE_MASK) != PHASE_MSGOUT) {
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
|
||||||
ICR_ASSERT_ACK);
|
ICR_ASSERT_ACK);
|
||||||
while (NCR5380_read(STATUS_REG) & SR_REQ);
|
while (NCR5380_read(STATUS_REG) & SR_REQ)
|
||||||
|
;
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1962,9 +1973,8 @@ static int NCR5380_transfer_dma( struct Scsi_Host *instance,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atari_read_overruns && (p & SR_IO)) {
|
if (atari_read_overruns && (p & SR_IO))
|
||||||
c -= atari_read_overruns;
|
c -= atari_read_overruns;
|
||||||
}
|
|
||||||
|
|
||||||
DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n",
|
DMA_PRINTK("scsi%d: initializing DMA for %s, %d bytes %s %p\n",
|
||||||
HOSTNO, (p & SR_IO) ? "reading" : "writing",
|
HOSTNO, (p & SR_IO) ? "reading" : "writing",
|
||||||
@@ -2054,7 +2064,8 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
|
|||||||
|
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN |
|
||||||
ICR_ASSERT_ACK);
|
ICR_ASSERT_ACK);
|
||||||
while (NCR5380_read(STATUS_REG) & SR_REQ);
|
while (NCR5380_read(STATUS_REG) & SR_REQ)
|
||||||
|
;
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
|
||||||
ICR_ASSERT_ATN);
|
ICR_ASSERT_ATN);
|
||||||
sink = 0;
|
sink = 0;
|
||||||
@@ -2145,8 +2156,8 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
|
|||||||
} else
|
} else
|
||||||
#endif /* defined(REAL_DMA) */
|
#endif /* defined(REAL_DMA) */
|
||||||
NCR5380_transfer_pio(instance, &phase,
|
NCR5380_transfer_pio(instance, &phase,
|
||||||
(int *) &cmd->SCp.this_residual, (unsigned char **)
|
(int *)&cmd->SCp.this_residual,
|
||||||
&cmd->SCp.ptr);
|
(unsigned char **)&cmd->SCp.ptr);
|
||||||
break;
|
break;
|
||||||
case PHASE_MSGIN:
|
case PHASE_MSGIN:
|
||||||
len = 1;
|
len = 1;
|
||||||
@@ -2265,8 +2276,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
|
|||||||
#ifdef AUTOSENSE
|
#ifdef AUTOSENSE
|
||||||
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
|
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
|
||||||
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
|
||||||
ASEN_PRINTK("scsi%d: performing request sense\n",
|
ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO);
|
||||||
HOSTNO);
|
|
||||||
cmd->cmnd[0] = REQUEST_SENSE;
|
cmd->cmnd[0] = REQUEST_SENSE;
|
||||||
cmd->cmnd[1] &= 0xe0;
|
cmd->cmnd[1] &= 0xe0;
|
||||||
cmd->cmnd[2] = 0;
|
cmd->cmnd[2] = 0;
|
||||||
@@ -2463,8 +2473,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
|
|||||||
|
|
||||||
|
|
||||||
msgout = MESSAGE_REJECT;
|
msgout = MESSAGE_REJECT;
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
|
||||||
ICR_ASSERT_ATN);
|
|
||||||
break;
|
break;
|
||||||
} /* switch (tmp) */
|
} /* switch (tmp) */
|
||||||
break;
|
break;
|
||||||
@@ -2499,8 +2508,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
|
|||||||
* PSEUDO-DMA architecture we should probably
|
* PSEUDO-DMA architecture we should probably
|
||||||
* use the dma transfer function.
|
* use the dma transfer function.
|
||||||
*/
|
*/
|
||||||
NCR5380_transfer_pio(instance, &phase, &len,
|
NCR5380_transfer_pio(instance, &phase, &len, &data);
|
||||||
&data);
|
|
||||||
break;
|
break;
|
||||||
case PHASE_STATIN:
|
case PHASE_STATIN:
|
||||||
len = 1;
|
len = 1;
|
||||||
@@ -2565,14 +2573,16 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
|
|||||||
|
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_BSY);
|
||||||
|
|
||||||
while (NCR5380_read(STATUS_REG) & SR_SEL);
|
while (NCR5380_read(STATUS_REG) & SR_SEL)
|
||||||
|
;
|
||||||
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
|
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for target to go into MSGIN.
|
* Wait for target to go into MSGIN.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (!(NCR5380_read(STATUS_REG) & SR_REQ));
|
while (!(NCR5380_read(STATUS_REG) & SR_REQ))
|
||||||
|
;
|
||||||
|
|
||||||
len = 1;
|
len = 1;
|
||||||
data = msg;
|
data = msg;
|
||||||
@@ -2755,7 +2765,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
|
|||||||
*/
|
*/
|
||||||
for (prev = (Scsi_Cmnd **)&(hostdata->issue_queue),
|
for (prev = (Scsi_Cmnd **)&(hostdata->issue_queue),
|
||||||
tmp = (Scsi_Cmnd *)hostdata->issue_queue;
|
tmp = (Scsi_Cmnd *)hostdata->issue_queue;
|
||||||
tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp) )
|
tmp; prev = NEXTADDR(tmp), tmp = NEXT(tmp)) {
|
||||||
if (cmd == tmp) {
|
if (cmd == tmp) {
|
||||||
REMOVE(5, *prev, tmp, NEXT(tmp));
|
REMOVE(5, *prev, tmp, NEXT(tmp));
|
||||||
(*prev) = NEXT(tmp);
|
(*prev) = NEXT(tmp);
|
||||||
@@ -2770,6 +2780,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
|
|||||||
falcon_release_lock_if_possible(hostdata);
|
falcon_release_lock_if_possible(hostdata);
|
||||||
return SCSI_ABORT_SUCCESS;
|
return SCSI_ABORT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Case 3 : If any commands are connected, we're going to fail the abort
|
* Case 3 : If any commands are connected, we're going to fail the abort
|
||||||
@@ -2814,7 +2825,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) {
|
||||||
local_irq_restore(flags);
|
local_irq_restore(flags);
|
||||||
ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
|
ABRT_PRINTK("scsi%d: aborting disconnected command.\n", HOSTNO);
|
||||||
@@ -2829,7 +2840,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
|
|||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
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)) {
|
||||||
if (cmd == tmp) {
|
if (cmd == tmp) {
|
||||||
REMOVE(5, *prev, tmp, NEXT(tmp));
|
REMOVE(5, *prev, tmp, NEXT(tmp));
|
||||||
*prev = NEXT(tmp);
|
*prev = NEXT(tmp);
|
||||||
@@ -2850,6 +2861,8 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
|
|||||||
return SCSI_ABORT_SUCCESS;
|
return SCSI_ABORT_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Case 5 : If we reached this point, the command was not found in any of
|
* Case 5 : If we reached this point, the command was not found in any of
|
||||||
@@ -3021,7 +3034,3 @@ static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
|
|||||||
return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
|
return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
|
||||||
#endif /* 1 */
|
#endif /* 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Local Variables: */
|
|
||||||
/* tab-width: 8 */
|
|
||||||
/* End: */
|
|
||||||
|
@@ -195,8 +195,7 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
|
|||||||
#endif
|
#endif
|
||||||
static irqreturn_t scsi_tt_intr(int irq, void *dummy);
|
static irqreturn_t scsi_tt_intr(int irq, void *dummy);
|
||||||
static irqreturn_t scsi_falcon_intr(int irq, void *dummy);
|
static irqreturn_t scsi_falcon_intr(int irq, void *dummy);
|
||||||
static void falcon_release_lock_if_possible( struct NCR5380_hostdata *
|
static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata);
|
||||||
hostdata );
|
|
||||||
static void falcon_get_lock(void);
|
static void falcon_get_lock(void);
|
||||||
#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
|
#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
|
||||||
static void atari_scsi_reset_boot(void);
|
static void atari_scsi_reset_boot(void);
|
||||||
@@ -209,7 +208,7 @@ static void atari_scsi_falcon_reg_write( unsigned char reg, unsigned char value
|
|||||||
/************************* End of Prototypes **************************/
|
/************************* End of Prototypes **************************/
|
||||||
|
|
||||||
|
|
||||||
static struct Scsi_Host *atari_scsi_host = NULL;
|
static struct Scsi_Host *atari_scsi_host;
|
||||||
static unsigned char (*atari_scsi_reg_read)(unsigned char reg);
|
static unsigned char (*atari_scsi_reg_read)(unsigned char reg);
|
||||||
static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value);
|
static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value);
|
||||||
|
|
||||||
@@ -217,7 +216,7 @@ static void (*atari_scsi_reg_write)( unsigned char reg, unsigned char value );
|
|||||||
static unsigned long atari_dma_residual, atari_dma_startaddr;
|
static unsigned long atari_dma_residual, atari_dma_startaddr;
|
||||||
static short atari_dma_active;
|
static short atari_dma_active;
|
||||||
/* pointer to the dribble buffer */
|
/* pointer to the dribble buffer */
|
||||||
static char *atari_dma_buffer = NULL;
|
static char *atari_dma_buffer;
|
||||||
/* precalculated physical address of the dribble buffer */
|
/* precalculated physical address of the dribble buffer */
|
||||||
static unsigned long atari_dma_phys_buffer;
|
static unsigned long atari_dma_phys_buffer;
|
||||||
/* != 0 tells the Falcon int handler to copy data from the dribble buffer */
|
/* != 0 tells the Falcon int handler to copy data from the dribble buffer */
|
||||||
@@ -233,7 +232,7 @@ static char *atari_dma_orig_addr;
|
|||||||
static unsigned long atari_dma_stram_mask;
|
static unsigned long atari_dma_stram_mask;
|
||||||
#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
|
#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
|
||||||
/* number of bytes to cut from a transfer to handle NCR overruns */
|
/* number of bytes to cut from a transfer to handle NCR overruns */
|
||||||
static int atari_read_overruns = 0;
|
static int atari_read_overruns;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int setup_can_queue = -1;
|
static int setup_can_queue = -1;
|
||||||
@@ -269,13 +268,12 @@ static int scsi_dma_is_ignored_buserr( unsigned char dma_stat )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < m68k_num_memory; ++i) {
|
for (i = 0; i < m68k_num_memory; ++i) {
|
||||||
end_addr = m68k_memory[i].addr +
|
end_addr = m68k_memory[i].addr + m68k_memory[i].size;
|
||||||
m68k_memory[i].size;
|
|
||||||
if (end_addr <= addr && addr <= end_addr + 4)
|
if (end_addr <= addr && addr <= end_addr + 4)
|
||||||
return( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -298,8 +296,7 @@ static void scsi_dma_buserr (int irq, void *dummy)
|
|||||||
if (dma_stat & 0x80) {
|
if (dma_stat & 0x80) {
|
||||||
if (!scsi_dma_is_ignored_buserr(dma_stat))
|
if (!scsi_dma_is_ignored_buserr(dma_stat))
|
||||||
printk("SCSI DMA bus error -- bad DMA programming!\n");
|
printk("SCSI DMA bus error -- bad DMA programming!\n");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Under normal circumstances we never should get to this point,
|
/* Under normal circumstances we never should get to this point,
|
||||||
* since both interrupts are triggered simultaneously and the 5380
|
* since both interrupts are triggered simultaneously and the 5380
|
||||||
* int has higher priority. When this irq is handled, that DMA
|
* int has higher priority. When this irq is handled, that DMA
|
||||||
@@ -344,8 +341,7 @@ static irqreturn_t scsi_tt_intr (int irq, void *dummy)
|
|||||||
* data reg!
|
* data reg!
|
||||||
*/
|
*/
|
||||||
if ((dma_stat & 0x02) && !(dma_stat & 0x40)) {
|
if ((dma_stat & 0x02) && !(dma_stat & 0x40)) {
|
||||||
atari_dma_residual = HOSTDATA_DMALEN - (SCSI_DMA_READ_P( dma_addr ) -
|
atari_dma_residual = HOSTDATA_DMALEN - (SCSI_DMA_READ_P(dma_addr) - atari_dma_startaddr);
|
||||||
atari_dma_startaddr);
|
|
||||||
|
|
||||||
DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
|
DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
|
||||||
atari_dma_residual);
|
atari_dma_residual);
|
||||||
@@ -353,27 +349,29 @@ static irqreturn_t scsi_tt_intr (int irq, void *dummy)
|
|||||||
if ((signed int)atari_dma_residual < 0)
|
if ((signed int)atari_dma_residual < 0)
|
||||||
atari_dma_residual = 0;
|
atari_dma_residual = 0;
|
||||||
if ((dma_stat & 1) == 0) {
|
if ((dma_stat & 1) == 0) {
|
||||||
/* After read operations, we maybe have to
|
/*
|
||||||
transport some rest bytes */
|
* After read operations, we maybe have to
|
||||||
|
* transport some rest bytes
|
||||||
|
*/
|
||||||
atari_scsi_fetch_restbytes();
|
atari_scsi_fetch_restbytes();
|
||||||
}
|
} else {
|
||||||
else {
|
/*
|
||||||
/* There seems to be a nasty bug in some SCSI-DMA/NCR
|
* There seems to be a nasty bug in some SCSI-DMA/NCR
|
||||||
combinations: If a target disconnects while a write
|
* combinations: If a target disconnects while a write
|
||||||
operation is going on, the address register of the
|
* operation is going on, the address register of the
|
||||||
DMA may be a few bytes farer than it actually read.
|
* DMA may be a few bytes farer than it actually read.
|
||||||
This is probably due to DMA prefetching and a delay
|
* This is probably due to DMA prefetching and a delay
|
||||||
between DMA and NCR. Experiments showed that the
|
* between DMA and NCR. Experiments showed that the
|
||||||
dma_addr is 9 bytes to high, but this could vary.
|
* dma_addr is 9 bytes to high, but this could vary.
|
||||||
The problem is, that the residual is thus calculated
|
* The problem is, that the residual is thus calculated
|
||||||
wrong and the next transfer will start behind where
|
* wrong and the next transfer will start behind where
|
||||||
it should. So we round up the residual to the next
|
* it should. So we round up the residual to the next
|
||||||
multiple of a sector size, if it isn't already a
|
* multiple of a sector size, if it isn't already a
|
||||||
multiple and the originally expected transfer size
|
* multiple and the originally expected transfer size
|
||||||
was. The latter condition is there to ensure that
|
* was. The latter condition is there to ensure that
|
||||||
the correction is taken only for "real" data
|
* the correction is taken only for "real" data
|
||||||
transfers and not for, e.g., the parameters of some
|
* transfers and not for, e.g., the parameters of some
|
||||||
other command. These shouldn't disconnect anyway.
|
* other command. These shouldn't disconnect anyway.
|
||||||
*/
|
*/
|
||||||
if (atari_dma_residual & 0x1ff) {
|
if (atari_dma_residual & 0x1ff) {
|
||||||
DMA_PRINTK("SCSI DMA: DMA bug corrected, "
|
DMA_PRINTK("SCSI DMA: DMA bug corrected, "
|
||||||
@@ -445,8 +443,7 @@ static irqreturn_t scsi_falcon_intr (int irq, void *dummy)
|
|||||||
atari_dma_residual = HOSTDATA_DMALEN - transferred;
|
atari_dma_residual = HOSTDATA_DMALEN - transferred;
|
||||||
DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
|
DMA_PRINTK("SCSI DMA: There are %ld residual bytes.\n",
|
||||||
atari_dma_residual);
|
atari_dma_residual);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
atari_dma_residual = 0;
|
atari_dma_residual = 0;
|
||||||
atari_dma_active = 0;
|
atari_dma_active = 0;
|
||||||
|
|
||||||
@@ -505,19 +502,17 @@ static int falcon_dont_release = 0;
|
|||||||
* again (but others waiting longer more probably will win).
|
* again (but others waiting longer more probably will win).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void falcon_release_lock_if_possible(struct NCR5380_hostdata *hostdata)
|
||||||
falcon_release_lock_if_possible( struct NCR5380_hostdata * hostdata )
|
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (IS_A_TT()) return;
|
if (IS_A_TT())
|
||||||
|
return;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
|
|
||||||
if (falcon_got_lock &&
|
if (falcon_got_lock && !hostdata->disconnected_queue &&
|
||||||
!hostdata->disconnected_queue &&
|
!hostdata->issue_queue && !hostdata->connected) {
|
||||||
!hostdata->issue_queue &&
|
|
||||||
!hostdata->connected) {
|
|
||||||
|
|
||||||
if (falcon_dont_release) {
|
if (falcon_dont_release) {
|
||||||
#if 0
|
#if 0
|
||||||
@@ -553,7 +548,8 @@ static void falcon_get_lock( void )
|
|||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (IS_A_TT()) return;
|
if (IS_A_TT())
|
||||||
|
return;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
|
|
||||||
@@ -569,8 +565,7 @@ static void falcon_get_lock( void )
|
|||||||
falcon_got_lock = 1;
|
falcon_got_lock = 1;
|
||||||
falcon_trying_lock = 0;
|
falcon_trying_lock = 0;
|
||||||
wake_up(&falcon_try_wait);
|
wake_up(&falcon_try_wait);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
sleep_on(&falcon_try_wait);
|
sleep_on(&falcon_try_wait);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -593,7 +588,7 @@ int atari_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
|
|||||||
* ++guenther: moved to NCR5380_queue_command() to prevent
|
* ++guenther: moved to NCR5380_queue_command() to prevent
|
||||||
* race condition, see there for an explanation.
|
* race condition, see there for an explanation.
|
||||||
*/
|
*/
|
||||||
return( NCR5380_queue_command( cmd, done ) );
|
return NCR5380_queue_command(cmd, done);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -606,7 +601,7 @@ int atari_scsi_detect (struct scsi_host_template *host)
|
|||||||
if (!MACH_IS_ATARI ||
|
if (!MACH_IS_ATARI ||
|
||||||
(!ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(TT_SCSI)) ||
|
(!ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(TT_SCSI)) ||
|
||||||
called)
|
called)
|
||||||
return( 0 );
|
return 0;
|
||||||
|
|
||||||
host->proc_name = "Atari";
|
host->proc_name = "Atari";
|
||||||
|
|
||||||
@@ -657,24 +652,25 @@ int atari_scsi_detect (struct scsi_host_template *host)
|
|||||||
if (!atari_dma_buffer) {
|
if (!atari_dma_buffer) {
|
||||||
printk(KERN_ERR "atari_scsi_detect: can't allocate ST-RAM "
|
printk(KERN_ERR "atari_scsi_detect: can't allocate ST-RAM "
|
||||||
"double buffer\n");
|
"double buffer\n");
|
||||||
return( 0 );
|
return 0;
|
||||||
}
|
}
|
||||||
atari_dma_phys_buffer = virt_to_phys(atari_dma_buffer);
|
atari_dma_phys_buffer = virt_to_phys(atari_dma_buffer);
|
||||||
atari_dma_orig_addr = 0;
|
atari_dma_orig_addr = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
instance = scsi_register(host, sizeof(struct NCR5380_hostdata));
|
instance = scsi_register(host, sizeof(struct NCR5380_hostdata));
|
||||||
if(instance == NULL)
|
if (instance == NULL) {
|
||||||
{
|
|
||||||
atari_stram_free(atari_dma_buffer);
|
atari_stram_free(atari_dma_buffer);
|
||||||
atari_dma_buffer = 0;
|
atari_dma_buffer = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
atari_scsi_host = instance;
|
atari_scsi_host = instance;
|
||||||
/* Set irq to 0, to avoid that the mid-level code disables our interrupt
|
/*
|
||||||
|
* Set irq to 0, to avoid that the mid-level code disables our interrupt
|
||||||
* during queue_command calls. This is completely unnecessary, and even
|
* during queue_command calls. This is completely unnecessary, and even
|
||||||
* worse causes bad problems on the Falcon, where the int is shared with
|
* worse causes bad problems on the Falcon, where the int is shared with
|
||||||
* IDE and floppy! */
|
* IDE and floppy!
|
||||||
|
*/
|
||||||
instance->irq = 0;
|
instance->irq = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
|
#ifdef CONFIG_ATARI_SCSI_RESET_BOOT
|
||||||
@@ -729,8 +725,7 @@ int atari_scsi_detect (struct scsi_host_template *host)
|
|||||||
atari_read_overruns = 4;
|
atari_read_overruns = 4;
|
||||||
}
|
}
|
||||||
#endif /*REAL_DMA*/
|
#endif /*REAL_DMA*/
|
||||||
}
|
} else { /* ! IS_A_TT */
|
||||||
else { /* ! IS_A_TT */
|
|
||||||
|
|
||||||
/* Nothing to do for the interrupt: the ST-DMA is initialized
|
/* Nothing to do for the interrupt: the ST-DMA is initialized
|
||||||
* already by atari_init_INTS()
|
* already by atari_init_INTS()
|
||||||
@@ -760,7 +755,7 @@ int atari_scsi_detect (struct scsi_host_template *host)
|
|||||||
printk("\n");
|
printk("\n");
|
||||||
|
|
||||||
called = 1;
|
called = 1;
|
||||||
return( 1 );
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int atari_scsi_release(struct Scsi_Host *sh)
|
int atari_scsi_release(struct Scsi_Host *sh)
|
||||||
@@ -833,8 +828,7 @@ int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
|
|||||||
#ifdef REAL_DMA
|
#ifdef REAL_DMA
|
||||||
tt_scsi_dma.dma_ctrl = 0;
|
tt_scsi_dma.dma_ctrl = 0;
|
||||||
#endif /* REAL_DMA */
|
#endif /* REAL_DMA */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
atari_turnoff_irq(IRQ_MFP_FSCSI);
|
atari_turnoff_irq(IRQ_MFP_FSCSI);
|
||||||
#ifdef REAL_DMA
|
#ifdef REAL_DMA
|
||||||
st_dma.dma_mode_status = 0x90;
|
st_dma.dma_mode_status = 0x90;
|
||||||
@@ -848,14 +842,13 @@ int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
|
|||||||
/* Re-enable ints */
|
/* Re-enable ints */
|
||||||
if (IS_A_TT()) {
|
if (IS_A_TT()) {
|
||||||
atari_turnon_irq(IRQ_TT_MFP_SCSI);
|
atari_turnon_irq(IRQ_TT_MFP_SCSI);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
atari_turnon_irq(IRQ_MFP_FSCSI);
|
atari_turnon_irq(IRQ_MFP_FSCSI);
|
||||||
}
|
}
|
||||||
if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS)
|
if ((rv & SCSI_RESET_ACTION) == SCSI_RESET_SUCCESS)
|
||||||
falcon_release_lock_if_possible(hostdata);
|
falcon_release_lock_if_possible(hostdata);
|
||||||
|
|
||||||
return( rv );
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -944,8 +937,7 @@ unsigned long atari_scsi_dma_setup( struct Scsi_Host *instance, void *data,
|
|||||||
SCSI_DMA_WRITE_P(dma_addr, addr);
|
SCSI_DMA_WRITE_P(dma_addr, addr);
|
||||||
SCSI_DMA_WRITE_P(dma_cnt, count);
|
SCSI_DMA_WRITE_P(dma_cnt, count);
|
||||||
tt_scsi_dma.dma_ctrl = dir | 2;
|
tt_scsi_dma.dma_ctrl = dir | 2;
|
||||||
}
|
} else { /* ! IS_A_TT */
|
||||||
else { /* ! IS_A_TT */
|
|
||||||
|
|
||||||
/* set address */
|
/* set address */
|
||||||
SCSI_DMA_SETADR(addr);
|
SCSI_DMA_SETADR(addr);
|
||||||
@@ -966,13 +958,13 @@ unsigned long atari_scsi_dma_setup( struct Scsi_Host *instance, void *data,
|
|||||||
atari_dma_active = 1;
|
atari_dma_active = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return( count );
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static long atari_scsi_dma_residual(struct Scsi_Host *instance)
|
static long atari_scsi_dma_residual(struct Scsi_Host *instance)
|
||||||
{
|
{
|
||||||
return( atari_dma_residual );
|
return atari_dma_residual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -986,7 +978,7 @@ static int falcon_classify_cmd( Scsi_Cmnd *cmd )
|
|||||||
|
|
||||||
if (opcode == READ_DEFECT_DATA || opcode == READ_LONG ||
|
if (opcode == READ_DEFECT_DATA || opcode == READ_LONG ||
|
||||||
opcode == READ_BUFFER)
|
opcode == READ_BUFFER)
|
||||||
return( CMD_SURELY_BYTE_MODE );
|
return CMD_SURELY_BYTE_MODE;
|
||||||
else if (opcode == READ_6 || opcode == READ_10 ||
|
else if (opcode == READ_6 || opcode == READ_10 ||
|
||||||
opcode == 0xa8 /* READ_12 */ || opcode == READ_REVERSE ||
|
opcode == 0xa8 /* READ_12 */ || opcode == READ_REVERSE ||
|
||||||
opcode == RECOVER_BUFFERED_DATA) {
|
opcode == RECOVER_BUFFERED_DATA) {
|
||||||
@@ -994,12 +986,11 @@ static int falcon_classify_cmd( Scsi_Cmnd *cmd )
|
|||||||
* needed here: The transfer is block-mode only if the 'fixed' bit is
|
* needed here: The transfer is block-mode only if the 'fixed' bit is
|
||||||
* set! */
|
* set! */
|
||||||
if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1))
|
if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1))
|
||||||
return( CMD_SURELY_BYTE_MODE );
|
return CMD_SURELY_BYTE_MODE;
|
||||||
else
|
else
|
||||||
return( CMD_SURELY_BLOCK_MODE );
|
return CMD_SURELY_BLOCK_MODE;
|
||||||
}
|
} else
|
||||||
else
|
return CMD_MODE_UNKNOWN;
|
||||||
return( CMD_MODE_UNKNOWN );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1013,18 +1004,17 @@ static int falcon_classify_cmd( Scsi_Cmnd *cmd )
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
|
static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
|
||||||
Scsi_Cmnd *cmd,
|
Scsi_Cmnd *cmd, int write_flag)
|
||||||
int write_flag )
|
|
||||||
{
|
{
|
||||||
unsigned long possible_len, limit;
|
unsigned long possible_len, limit;
|
||||||
#ifndef CONFIG_TT_DMA_EMUL
|
#ifndef CONFIG_TT_DMA_EMUL
|
||||||
if (MACH_IS_HADES)
|
if (MACH_IS_HADES)
|
||||||
/* Hades has no SCSI DMA at all :-( Always force use of PIO */
|
/* Hades has no SCSI DMA at all :-( Always force use of PIO */
|
||||||
return( 0 );
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
if (IS_A_TT())
|
if (IS_A_TT())
|
||||||
/* TT SCSI DMA can transfer arbitrary #bytes */
|
/* TT SCSI DMA can transfer arbitrary #bytes */
|
||||||
return( wanted_len );
|
return wanted_len;
|
||||||
|
|
||||||
/* ST DMA chip is stupid -- only multiples of 512 bytes! (and max.
|
/* ST DMA chip is stupid -- only multiples of 512 bytes! (and max.
|
||||||
* 255*512 bytes, but this should be enough)
|
* 255*512 bytes, but this should be enough)
|
||||||
@@ -1060,8 +1050,7 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
|
|||||||
* this).
|
* this).
|
||||||
*/
|
*/
|
||||||
possible_len = wanted_len;
|
possible_len = wanted_len;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Read operations: if the wanted transfer length is not a multiple of
|
/* Read operations: if the wanted transfer length is not a multiple of
|
||||||
* 512, we cannot use DMA, since the ST-DMA cannot split transfers
|
* 512, we cannot use DMA, since the ST-DMA cannot split transfers
|
||||||
* (no interrupt on DMA finished!)
|
* (no interrupt on DMA finished!)
|
||||||
@@ -1098,7 +1087,7 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
|
|||||||
DMA_PRINTK("Sorry, must cut DMA transfer size to %ld bytes "
|
DMA_PRINTK("Sorry, must cut DMA transfer size to %ld bytes "
|
||||||
"instead of %ld\n", possible_len, wanted_len);
|
"instead of %ld\n", possible_len, wanted_len);
|
||||||
|
|
||||||
return( possible_len );
|
return possible_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1114,7 +1103,7 @@ static unsigned long atari_dma_xfer_len( unsigned long wanted_len,
|
|||||||
|
|
||||||
static unsigned char atari_scsi_tt_reg_read(unsigned char reg)
|
static unsigned char atari_scsi_tt_reg_read(unsigned char reg)
|
||||||
{
|
{
|
||||||
return( tt_scsi_regp[reg * 2] );
|
return tt_scsi_regp[reg * 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value)
|
static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value)
|
||||||
@@ -1125,7 +1114,7 @@ static void atari_scsi_tt_reg_write( unsigned char reg, unsigned char value )
|
|||||||
static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
|
static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
|
||||||
{
|
{
|
||||||
dma_wd.dma_mode_status= (u_short)(0x88 + reg);
|
dma_wd.dma_mode_status= (u_short)(0x88 + reg);
|
||||||
return( (u_char)dma_wd.fdc_acces_seccount );
|
return (u_char)dma_wd.fdc_acces_seccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
|
static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
|
||||||
|
Reference in New Issue
Block a user