Commit 6fc80776 authored by Alan Cox's avatar Alan Cox Committed by Dave Jones

[PATCH] first pass eata-pio updates

parent 8ecb25b5
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
* neuffer@goofy.zdv.uni-mainz.de * * neuffer@goofy.zdv.uni-mainz.de *
* a.arnold@kfa-juelich.de * * a.arnold@kfa-juelich.de *
* * * *
* Updated 2002 by Alan Cox <alan@redhat.com> for Linux *
* 2.5.x and the newer locking and error handling *
* *
* This program is free software; you can redistribute it * * This program is free software; you can redistribute it *
* and/or modify it under the terms of the GNU General * * and/or modify it under the terms of the GNU General *
* Public License as published by the Free Software * * Public License as published by the Free Software *
...@@ -31,8 +34,16 @@ ...@@ -31,8 +34,16 @@
* the Free Software Foundation, Inc., 675 Mass Ave, * * the Free Software Foundation, Inc., 675 Mass Ave, *
* Cambridge, MA 02139, USA. * * Cambridge, MA 02139, USA. *
* * * *
* For the avoidance of doubt the "preferred form" of this *
* code is one which is in an open non patent encumbered *
* format. Where cryptographic key signing forms part of *
* the process of creating an executable the information *
* including keys needed to generate an equivalently *
* functional executable are deemed to be part of the *
* source code are deemed to be part of the source code. *
* *
************************************************************ ************************************************************
* last change: 96/07/16 OS: Linux 2.0.8 * * last change: 2002/11/02 OS: Linux 2.5.45 *
************************************************************/ ************************************************************/
/* Look in eata_pio.h for configuration information */ /* Look in eata_pio.h for configuration information */
...@@ -57,56 +68,60 @@ ...@@ -57,56 +68,60 @@
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
static uint ISAbases[MAXISA] = static uint ISAbases[MAXISA] = {
{0x1F0, 0x170, 0x330, 0x230}; 0x1F0, 0x170, 0x330, 0x230
static uint ISAirqs[MAXISA] = };
{14,12,15,11};
static unchar EISAbases[] = static uint ISAirqs[MAXISA] = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; 14, 12, 15, 11
};
static unsigned char EISAbases[] = {
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1
};
static uint registered_HBAs = 0; static uint registered_HBAs = 0;
static struct Scsi_Host *last_HBA = NULL; static struct Scsi_Host *last_HBA;
static struct Scsi_Host *first_HBA = NULL; static struct Scsi_Host *first_HBA;
static unchar reg_IRQ[] = static unsigned char reg_IRQ[];
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static unsigned char reg_IRQL[];
static unchar reg_IRQL[] =
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static ulong int_counter = 0; static unsigned long int_counter = 0;
static ulong queue_counter = 0; static unsigned long queue_counter = 0;
#include "eata_pio_proc.c" #include "eata_pio_proc.c"
#ifdef MODULE static int eata_pio_release(struct Scsi_Host *sh)
int eata_pio_release(struct Scsi_Host *sh)
{ {
if (sh->irq && reg_IRQ[sh->irq] == 1) free_irq(sh->irq, NULL); if (sh->irq && reg_IRQ[sh->irq] == 1)
else reg_IRQ[sh->irq]--; free_irq(sh->irq, NULL);
else
reg_IRQ[sh->irq]--;
if (SD(sh)->channel == 0) { if (SD(sh)->channel == 0) {
if (sh->io_port && sh->n_io_port) if (sh->io_port && sh->n_io_port)
release_region(sh->io_port, sh->n_io_port); release_region(sh->io_port, sh->n_io_port);
} }
return(TRUE); return (TRUE);
} }
#endif
void IncStat(Scsi_Pointer *SCp, uint Increment) static void IncStat(Scsi_Pointer * SCp, uint Increment)
{ {
SCp->ptr+=Increment; SCp->ptr += Increment;
if ((SCp->this_residual-=Increment)==0) if ((SCp->this_residual -= Increment) == 0) {
{ if ((--SCp->buffers_residual) == 0)
if ((--SCp->buffers_residual)==0) SCp->Status=FALSE; SCp->Status = FALSE;
else else {
{
SCp->buffer++; SCp->buffer++;
SCp->ptr=page_address(SCp->buffer->page) + SCp->buffer->offset; SCp->ptr = page_address(SCp->buffer->page) + SCp->buffer->offset;
SCp->this_residual=SCp->buffer->length; SCp->this_residual = SCp->buffer->length;
} }
} }
} }
void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs); static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs);
void do_eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs) static void do_eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs)
{ {
unsigned long flags; unsigned long flags;
struct Scsi_Host *dev = dev_id; struct Scsi_Host *dev = dev_id;
...@@ -116,128 +131,120 @@ void do_eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs) ...@@ -116,128 +131,120 @@ void do_eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
spin_unlock_irqrestore(dev->host_lock, flags); spin_unlock_irqrestore(dev->host_lock, flags);
} }
void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs) static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs)
{ {
uint eata_stat = 0xfffff; uint eata_stat = 0xfffff;
Scsi_Cmnd *cmd; Scsi_Cmnd *cmd;
hostdata *hd; hostdata *hd;
struct eata_ccb *cp; struct eata_ccb *cp;
uint base; uint base;
uint x,z; uint x, z;
struct Scsi_Host *sh; struct Scsi_Host *sh;
ushort zwickel=0; unsigned short zwickel = 0;
unchar stat,odd; unsigned char stat, odd;
for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->prev) { for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->prev)
{
if (sh->irq != irq) if (sh->irq != irq)
continue; continue;
if (inb((uint)sh->base + HA_RSTATUS) & HA_SBUSY) if (inb((uint) sh->base + HA_RSTATUS) & HA_SBUSY)
continue; continue;
int_counter++; int_counter++;
hd=SD(sh); hd = SD(sh);
cp = &hd->ccb[0]; cp = &hd->ccb[0];
cmd = cp->cmd; cmd = cp->cmd;
base = (uint) cmd->host->base; base = (uint) cmd->host->base;
do do {
{ stat = inb(base + HA_RSTATUS);
stat=inb(base+HA_RSTATUS); if (stat & HA_SDRQ) {
if (stat&HA_SDRQ) { if (cp->DataIn) {
if (cp->DataIn) z = 256;
{ odd = FALSE;
z=256; odd=FALSE; while ((cmd->SCp.Status) && ((z > 0) || (odd))) {
while ((cmd->SCp.Status)&&((z>0)||(odd))) if (odd) {
{ *(cmd->SCp.ptr) = zwickel >> 8;
if (odd) IncStat(&cmd->SCp, 1);
{ odd = FALSE;
*(cmd->SCp.ptr)=zwickel>>8; }
IncStat(&cmd->SCp,1); x = min_t(unsigned int, z, cmd->SCp.this_residual / 2);
odd=FALSE; insw(base + HA_RDATA, cmd->SCp.ptr, x);
} z -= x;
x=min_t(unsigned int,z,cmd->SCp.this_residual/2); IncStat(&cmd->SCp, 2 * x);
insw(base+HA_RDATA,cmd->SCp.ptr,x); if ((z > 0) && (cmd->SCp.this_residual == 1)) {
z-=x; zwickel = inw(base + HA_RDATA);
IncStat(&cmd->SCp,2*x); *(cmd->SCp.ptr) = zwickel & 0xff;
if ((z>0)&&(cmd->SCp.this_residual==1)) IncStat(&cmd->SCp, 1);
{ z--;
zwickel=inw(base+HA_RDATA); odd = TRUE;
*(cmd->SCp.ptr)=zwickel&0xff;
IncStat(&cmd->SCp,1); z--;
odd=TRUE;
} }
} }
while (z>0) { while (z > 0) {
zwickel=inw(base+HA_RDATA); zwickel = inw(base + HA_RDATA);
z--; z--;
} }
} } else { /* cp->DataOut */
else /* cp->DataOut */
{ odd = FALSE;
odd=FALSE; z=256; z = 256;
while ((cmd->SCp.Status)&&((z>0)||(odd))) while ((cmd->SCp.Status) && ((z > 0) || (odd))) {
{ if (odd) {
if (odd) zwickel += *(cmd->SCp.ptr) << 8;
{ IncStat(&cmd->SCp, 1);
zwickel+=*(cmd->SCp.ptr)<<8; outw(zwickel, base + HA_RDATA);
IncStat(&cmd->SCp,1);
outw(zwickel,base+HA_RDATA);
z--; z--;
odd=FALSE; odd = FALSE;
} }
x=min_t(unsigned int,z,cmd->SCp.this_residual/2); x = min_t(unsigned int, z, cmd->SCp.this_residual / 2);
outsw(base+HA_RDATA,cmd->SCp.ptr,x); outsw(base + HA_RDATA, cmd->SCp.ptr, x);
z-=x; z -= x;
IncStat(&cmd->SCp,2*x); IncStat(&cmd->SCp, 2 * x);
if ((z>0)&&(cmd->SCp.this_residual==1)) if ((z > 0) && (cmd->SCp.this_residual == 1)) {
{ zwickel = *(cmd->SCp.ptr);
zwickel=*(cmd->SCp.ptr); zwickel &= 0xff;
zwickel&=0xff; IncStat(&cmd->SCp, 1);
IncStat(&cmd->SCp,1); odd = TRUE;
odd=TRUE;
} }
} }
while (z>0||odd) { while (z > 0 || odd) {
outw(zwickel,base+HA_RDATA); outw(zwickel, base + HA_RDATA);
z--; z--;
odd=FALSE; odd = FALSE;
} }
} }
} }
} }
while ((stat&HA_SDRQ)||((stat&HA_SMORE)&&hd->moresupport)); while ((stat & HA_SDRQ) || ((stat & HA_SMORE) && hd->moresupport));
/* terminate handler if HBA goes busy again, i.e. transfers /* terminate handler if HBA goes busy again, i.e. transfers
* more data */ * more data */
if (stat&HA_SBUSY) break; if (stat & HA_SBUSY)
break;
/* OK, this is quite stupid, but I haven't found any correct /* OK, this is quite stupid, but I haven't found any correct
* way to get HBA&SCSI status so far */ * way to get HBA&SCSI status so far */
if (!(inb(base+HA_RSTATUS)&HA_SERROR)) if (!(inb(base + HA_RSTATUS) & HA_SERROR)) {
{ cmd->result = (DID_OK << 16);
cmd->result=(DID_OK<<16); hd->devflags |= (1 << cp->cp_id);
hd->devflags|=(1<<cp->cp_id); } else if (hd->devflags & 1 << cp->cp_id)
} cmd->result = (DID_OK << 16) + 0x02;
else if (hd->devflags&1<<cp->cp_id) else
cmd->result=(DID_OK<<16)+0x02; cmd->result = (DID_NO_CONNECT << 16);
else cmd->result=(DID_NO_CONNECT<<16);
if (cp->status == LOCKED) { if (cp->status == LOCKED) {
cp->status = FREE; cp->status = FREE;
eata_stat = inb(base + HA_RSTATUS); eata_stat = inb(base + HA_RSTATUS);
printk(KERN_CRIT "eata_pio: int_handler, freeing locked " printk(KERN_CRIT "eata_pio: int_handler, freeing locked " "queueslot\n");
"queueslot\n");
return; return;
} }
#if DBG_INTR2 #if DBG_INTR2
if (stat != 0x50) if (stat != 0x50)
printk(KERN_DEBUG "stat: %#.2x, result: %#.8x\n", stat, printk(KERN_DEBUG "stat: %#.2x, result: %#.8x\n", stat, cmd->result);
cmd->result);
#endif #endif
cp->status = FREE; /* now we can release the slot */ cp->status = FREE; /* now we can release the slot */
...@@ -248,25 +255,25 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs) ...@@ -248,25 +255,25 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
return; return;
} }
inline uint eata_pio_send_command(uint base, unchar command) static inline uint eata_pio_send_command(uint base, unsigned char command)
{ {
uint loop = HZ/2; uint loop = HZ / 2;
while (inb(base + HA_RSTATUS) & HA_SBUSY) while (inb(base + HA_RSTATUS) & HA_SBUSY)
if (--loop == 0) if (--loop == 0)
return(TRUE); return (TRUE);
/* Enable interrupts for HBA. It is not the best way to do it at this /* Enable interrupts for HBA. It is not the best way to do it at this
* place, but I hope that it doesn't interfere with the IDE driver * place, but I hope that it doesn't interfere with the IDE driver
* initialization this way */ * initialization this way */
outb(HA_CTRL_8HEADS,base+HA_CTRLREG); outb(HA_CTRL_8HEADS, base + HA_CTRLREG);
outb(command, base + HA_WCOMMAND); outb(command, base + HA_WCOMMAND);
return(FALSE); return (FALSE);
} }
int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
{ {
uint x, y; uint x, y;
uint base; uint base;
...@@ -285,13 +292,11 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) ...@@ -285,13 +292,11 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
y = x = 0; y = x = 0;
if (hd->ccb[y].status!=FREE) { if (hd->ccb[y].status != FREE) {
DBG(DBG_QUEUE, printk(KERN_EMERG "can_queue %d, x %d, y %d\n", DBG(DBG_QUEUE, printk(KERN_EMERG "can_queue %d, x %d, y %d\n", sh->can_queue, x, y));
sh->can_queue,x,y));
#if DEBUG_EATA #if DEBUG_EATA
panic(KERN_EMERG "eata_pio: run out of queue slots cmdno:%ld " panic(KERN_EMERG "eata_pio: run out of queue slots cmdno:%ld " "intrno: %ld\n", queue_counter, int_counter);
"intrno: %ld\n", queue_counter, int_counter);
#else #else
panic(KERN_EMERG "eata_pio: run out of queue slots....\n"); panic(KERN_EMERG "eata_pio: run out of queue slots....\n");
#endif #endif
...@@ -304,33 +309,17 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) ...@@ -304,33 +309,17 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
cp->status = USED; /* claim free slot */ cp->status = USED; /* claim free slot */
DBG(DBG_QUEUE, printk(KERN_DEBUG "eata_pio_queue pid %ld, target: %x, lun:" DBG(DBG_QUEUE, printk(KERN_DEBUG "eata_pio_queue pid %ld, target: %x, lun:" " %x, y %d\n", cmd->pid, cmd->target, cmd->lun, y));
" %x, y %d\n", cmd->pid, cmd->target, cmd->lun, y));
cmd->scsi_done = (void *) done;
cmd->scsi_done = (void *)done;
if(cmd->sc_data_direction == SCSI_DATA_WRITE)
/* FIXME: use passed direction flag !! */
switch (cmd->cmnd[0]) {
case CHANGE_DEFINITION: case COMPARE: case COPY:
case COPY_VERIFY: case LOG_SELECT: case MODE_SELECT:
case MODE_SELECT_10: case SEND_DIAGNOSTIC: case WRITE_BUFFER:
case FORMAT_UNIT: case REASSIGN_BLOCKS: case RESERVE:
case SEARCH_EQUAL: case SEARCH_HIGH: case SEARCH_LOW:
case WRITE_6: case WRITE_10: case WRITE_VERIFY:
case UPDATE_BLOCK: case WRITE_LONG: case WRITE_SAME:
case SEARCH_HIGH_12: case SEARCH_EQUAL_12: case SEARCH_LOW_12:
case WRITE_12: case WRITE_VERIFY_12: case SET_WINDOW:
case MEDIUM_SCAN: case SEND_VOLUME_TAG:
case 0xea: /* alternate number for WRITE LONG */
cp->DataOut = TRUE; /* Output mode */ cp->DataOut = TRUE; /* Output mode */
break; else
case TEST_UNIT_READY:
default:
cp->DataIn = TRUE; /* Input mode */ cp->DataIn = TRUE; /* Input mode */
}
cp->Interpret = (cmd->target == hd->hostid); cp->Interpret = (cmd->target == hd->hostid);
cp->cp_datalen = htonl((ulong)cmd->request_bufflen); cp->cp_datalen = htonl((unsigned long) cmd->request_bufflen);
cp->Auto_Req_Sen = FALSE; cp->Auto_Req_Sen = FALSE;
cp->cp_reqDMA = htonl(0); cp->cp_reqDMA = htonl(0);
cp->reqlen = 0; cp->reqlen = 0;
...@@ -345,11 +334,10 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) ...@@ -345,11 +334,10 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
cp->cp_viraddr = cp; cp->cp_viraddr = cp;
cp->cmd = cmd; cp->cmd = cmd;
cmd->host_scribble = (char *)&hd->ccb[y]; cmd->host_scribble = (char *) &hd->ccb[y];
if (cmd->use_sg == 0) if (cmd->use_sg == 0) {
{ cmd->SCp.buffers_residual = 1;
cmd->SCp.buffers_residual=1;
cmd->SCp.ptr = cmd->request_buffer; cmd->SCp.ptr = cmd->request_buffer;
cmd->SCp.this_residual = cmd->request_bufflen; cmd->SCp.this_residual = cmd->request_bufflen;
cmd->SCp.buffer = NULL; cmd->SCp.buffer = NULL;
...@@ -362,86 +350,70 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) ...@@ -362,86 +350,70 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes
* are to transfer */ * are to transfer */
if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP)) if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP)) {
{
cmd->result = DID_BUS_BUSY << 16; cmd->result = DID_BUS_BUSY << 16;
printk(KERN_NOTICE "eata_pio_queue target %d, pid %ld, HBA busy, " printk(KERN_NOTICE "eata_pio_queue target %d, pid %ld, HBA busy, " "returning DID_BUS_BUSY, done.\n", cmd->target, cmd->pid);
"returning DID_BUS_BUSY, done.\n", cmd->target, cmd->pid);
done(cmd); done(cmd);
cp->status = FREE; cp->status = FREE;
return (0); return (0);
} }
/* FIXME: timeout */
while (!(inb(base + HA_RSTATUS) & HA_SDRQ)) while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
cpu_relax(); cpu_relax();
outsw(base + HA_RDATA, cp, hd->cplen); outsw(base + HA_RDATA, cp, hd->cplen);
outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND); outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND);
for (x = 0; x < hd->cppadlen; x++) outw(0, base + HA_RDATA); for (x = 0; x < hd->cppadlen; x++)
outw(0, base + HA_RDATA);
DBG(DBG_QUEUE,printk(KERN_DEBUG "Queued base %#.4lx pid: %ld target: %x " DBG(DBG_QUEUE, printk(KERN_DEBUG "Queued base %#.4lx pid: %ld target: %x " "lun: %x slot %d irq %d\n", (long) sh->base, cmd->pid, cmd->target, cmd->lun, y, sh->irq));
"lun: %x slot %d irq %d\n", (long)sh->base, cmd->pid,
cmd->target, cmd->lun, y, sh->irq));
return (0); return (0);
} }
int eata_pio_abort(Scsi_Cmnd * cmd) static int eata_pio_abort(Scsi_Cmnd * cmd)
{ {
ulong flags;
uint loop = HZ; uint loop = HZ;
spin_lock_irqsave(cmd->host->host_lock, flags); DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x reason %x\n", cmd->pid, cmd->target, cmd->lun, cmd->abort_reason));
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld "
"target: %x lun: %x reason %x\n", cmd->pid,
cmd->target, cmd->lun, cmd->abort_reason));
while (inb((uint)(cmd->host->base) + HA_RAUXSTAT) & HA_ABUSY) while (inb(cmd->host->base + HA_RAUXSTAT) & HA_ABUSY)
if (--loop == 0) { if (--loop == 0) {
printk(KERN_WARNING "eata_pio: abort, timeout error.\n"); printk(KERN_WARNING "eata_pio: abort, timeout error.\n");
spin_unlock_irqrestore(cmd->host->host_lock, flags); return FAILED;
return (SCSI_ABORT_ERROR);
} }
if (CD(cmd)->status == FREE) { if (CD(cmd)->status == FREE) {
DBG(DBG_ABNORM, printk(KERN_WARNING "Returning: SCSI_ABORT_NOT_RUNNING\n")); DBG(DBG_ABNORM, printk(KERN_WARNING "Returning: SCSI_ABORT_NOT_RUNNING\n"));
spin_unlock_irqrestore(cmd->host->host_lock, flags); return FAILED;
return (SCSI_ABORT_NOT_RUNNING);
} }
if (CD(cmd)->status == USED) { if (CD(cmd)->status == USED) {
DBG(DBG_ABNORM, printk(KERN_WARNING "Returning: SCSI_ABORT_BUSY\n")); DBG(DBG_ABNORM, printk(KERN_WARNING "Returning: SCSI_ABORT_BUSY\n"));
spin_unlock_irqrestore(cmd->host->host_lock, flags); /* We want to sleep a bit more here */
return (SCSI_ABORT_BUSY); /* SNOOZE */ return FAILED; /* SNOOZE */
} }
if (CD(cmd)->status == RESET) { if (CD(cmd)->status == RESET) {
spin_unlock_irqrestore(cmd->host->host_lock, flags);
printk(KERN_WARNING "eata_pio: abort, command reset error.\n"); printk(KERN_WARNING "eata_pio: abort, command reset error.\n");
return (SCSI_ABORT_ERROR); return FAILED;
} }
if (CD(cmd)->status == LOCKED) { if (CD(cmd)->status == LOCKED) {
spin_unlock_irqrestore(cmd->host->host_lock, flags); DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio: abort, queue slot " "locked.\n"));
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio: abort, queue slot " return FAILED;
"locked.\n"));
return (SCSI_ABORT_NOT_RUNNING);
} }
spin_unlock_irqrestore(cmd->host->host_lock, flags);
panic("eata_pio: abort: invalid slot status\n"); panic("eata_pio: abort: invalid slot status\n");
} }
int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy) static int eata_pio_host_reset(Scsi_Cmnd * cmd)
{ {
uint x, limit = 0; uint x, limit = 0;
ulong flags; unsigned char success = FALSE;
unchar success = FALSE;
Scsi_Cmnd *sp; Scsi_Cmnd *sp;
struct Scsi_Host *host = cmd->host;
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->target, cmd->lun, cmd->abort_reason));
" %x lun: %x reason %x\n", cmd->pid, cmd->target,
cmd->lun, cmd->abort_reason));
spin_lock_irqsave(cmd->host->host_lock, flags);
if (HD(cmd)->state == RESET) { if (HD(cmd)->state == RESET) {
printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n"); printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n");
spin_unlock_irqrestore(cmd->host->host_lock, flags); return FAILED;
return (SCSI_RESET_ERROR);
} }
/* force all slots to be free */ /* force all slots to be free */
...@@ -453,24 +425,24 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy) ...@@ -453,24 +425,24 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy)
sp = HD(cmd)->ccb[x].cmd; sp = HD(cmd)->ccb[x].cmd;
HD(cmd)->ccb[x].status = RESET; HD(cmd)->ccb[x].status = RESET;
printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x, printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x, sp->pid);
sp->pid);
if (sp == NULL) if (sp == NULL)
panic("eata_pio_reset: slot %d, sp==NULL.\n", x); panic("eata_pio_reset: slot %d, sp==NULL.\n", x);
} }
/* hard reset the HBA */ /* hard reset the HBA */
outb(EATA_CMD_RESET, (uint) cmd->host->base+HA_WCOMMAND); outb(EATA_CMD_RESET, (uint) cmd->host->base + HA_WCOMMAND);
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: board reset done.\n")); DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: board reset done.\n"));
HD(cmd)->state = RESET; HD(cmd)->state = RESET;
spin_unlock_irq(host->host_lock);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(3*HZ); schedule_timeout(3 * HZ);
spin_lock_irq(host->host_lock);
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: interrupts disabled, " DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: interrupts disabled, " "loops %d.\n", limit));
"loops %d.\n", limit));
for (x = 0; x < cmd->host->can_queue; x++) { for (x = 0; x < cmd->host->can_queue; x++) {
...@@ -482,25 +454,24 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy) ...@@ -482,25 +454,24 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy)
sp->result = DID_RESET << 16; sp->result = DID_RESET << 16;
/* This mailbox is terminated */ /* This mailbox is terminated */
printk(KERN_WARNING "eata_pio_reset: reset ccb %d.\n",x); printk(KERN_WARNING "eata_pio_reset: reset ccb %d.\n", x);
HD(cmd)->ccb[x].status = FREE; HD(cmd)->ccb[x].status = FREE;
sp->scsi_done(sp); sp->scsi_done(sp);
} }
HD(cmd)->state = FALSE; HD(cmd)->state = FALSE;
spin_unlock_irqrestore(cmd->host->host_lock, flags);
if (success) { /* hmmm... */ if (success) { /* hmmm... */
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n")); DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n"));
return (SCSI_RESET_SUCCESS); return SUCCESS;
} else { } else {
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, wakeup.\n")); DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, wakeup.\n"));
return (SCSI_RESET_PUNT); return FAILED;
} }
} }
char * get_pio_board_data(ulong base, uint irq, uint id, ulong cplen, ushort cppadlen) static char *get_pio_board_data(unsigned long base, uint irq, uint id, unsigned long cplen, unsigned short cppadlen)
{ {
struct eata_ccb cp; struct eata_ccb cp;
static char buff[256]; static char buff[256];
...@@ -530,28 +501,29 @@ char * get_pio_board_data(ulong base, uint irq, uint id, ulong cplen, ushort cpp ...@@ -530,28 +501,29 @@ char * get_pio_board_data(ulong base, uint irq, uint id, ulong cplen, ushort cpp
while (!(inb(base + HA_RSTATUS) & HA_SDRQ)); while (!(inb(base + HA_RSTATUS) & HA_SDRQ));
outsw(base + HA_RDATA, &cp, cplen); outsw(base + HA_RDATA, &cp, cplen);
outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND); outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND);
for (z = 0; z < cppadlen; z++) outw(0, base + HA_RDATA); for (z = 0; z < cppadlen; z++)
outw(0, base + HA_RDATA);
while (inb(base + HA_RSTATUS) & HA_SBUSY); while (inb(base + HA_RSTATUS) & HA_SBUSY);
if (inb(base + HA_RSTATUS) & HA_SERROR) if (inb(base + HA_RSTATUS) & HA_SERROR)
return (NULL); return (NULL);
else if (!(inb(base + HA_RSTATUS) & HA_SDRQ)) else if (!(inb(base + HA_RSTATUS) & HA_SDRQ))
return (NULL); return (NULL);
else else {
{ insw(base + HA_RDATA, &buff, 127);
insw(base+HA_RDATA, &buff, 127); while (inb(base + HA_RSTATUS) & HA_SDRQ)
while (inb(base + HA_RSTATUS)&HA_SDRQ) inw(base + HA_RDATA); inw(base + HA_RDATA);
return (buff); return (buff);
} }
} }
int get_pio_conf_PIO(u32 base, struct get_conf *buf) static int get_pio_conf_PIO(u32 base, struct get_conf *buf)
{ {
ulong loop = HZ/2; unsigned long loop = HZ / 2;
int z; int z;
ushort *p; unsigned short *p;
if(check_region(base, 9)) if (check_region(base, 9))
return (FALSE); return (FALSE);
memset(buf, 0, sizeof(struct get_conf)); memset(buf, 0, sizeof(struct get_conf));
...@@ -560,29 +532,25 @@ int get_pio_conf_PIO(u32 base, struct get_conf *buf) ...@@ -560,29 +532,25 @@ int get_pio_conf_PIO(u32 base, struct get_conf *buf)
if (--loop == 0) if (--loop == 0)
return (FALSE); return (FALSE);
DBG(DBG_PIO && DBG_PROBE, DBG(DBG_PIO && DBG_PROBE, printk(KERN_DEBUG "Issuing PIO READ CONFIG to HBA at %#x\n", base));
printk(KERN_DEBUG "Issuing PIO READ CONFIG to HBA at %#x\n", base));
eata_pio_send_command(base, EATA_CMD_PIO_READ_CONFIG); eata_pio_send_command(base, EATA_CMD_PIO_READ_CONFIG);
loop = HZ/2; loop = HZ / 2;
for (p = (ushort *) buf; for (p = (unsigned short *) buf; (long) p <= ((long) buf + (sizeof(struct get_conf) / 2)); p++) {
(long)p <= ((long)buf + (sizeof(struct get_conf) / 2)); p++) {
while (!(inb(base + HA_RSTATUS) & HA_SDRQ)) while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
if (--loop == 0) if (--loop == 0)
return (FALSE); return (FALSE);
loop = HZ/2; loop = HZ / 2;
*p = inw(base + HA_RDATA); *p = inw(base + HA_RDATA);
} }
if (!(inb(base + HA_RSTATUS) & HA_SERROR)) { /* Error ? */ if (!(inb(base + HA_RSTATUS) & HA_SERROR)) { /* Error ? */
if (htonl(EATA_SIGNATURE) == buf->signature) { if (htonl(EATA_SIGNATURE) == buf->signature) {
DBG(DBG_PIO&&DBG_PROBE, printk(KERN_NOTICE "EATA Controller found " DBG(DBG_PIO && DBG_PROBE, printk(KERN_NOTICE "EATA Controller found " "at %#4x EATA Level: %x\n", base, (uint) (buf->version)));
"at %#4x EATA Level: %x\n", base,
(uint) (buf->version)));
while (inb(base + HA_RSTATUS) & HA_SDRQ) while (inb(base + HA_RSTATUS) & HA_SDRQ)
inw(base + HA_RDATA); inw(base + HA_RDATA);
if(ALLOW_DMA_BOARDS == FALSE) { if (ALLOW_DMA_BOARDS == FALSE) {
for (z = 0; z < MAXISA; z++) for (z = 0; z < MAXISA; z++)
if (base == ISAbases[z]) { if (base == ISAbases[z]) {
buf->IRQ = ISAirqs[z]; buf->IRQ = ISAirqs[z];
...@@ -592,29 +560,22 @@ int get_pio_conf_PIO(u32 base, struct get_conf *buf) ...@@ -592,29 +560,22 @@ int get_pio_conf_PIO(u32 base, struct get_conf *buf)
return (TRUE); return (TRUE);
} }
} else { } else {
DBG(DBG_PROBE, printk("eata_dma: get_conf_PIO, error during transfer " DBG(DBG_PROBE, printk("eata_dma: get_conf_PIO, error during transfer " "for HBA at %x\n", base));
"for HBA at %x\n", base));
} }
return (FALSE); return (FALSE);
} }
void print_pio_config(struct get_conf *gc) static void print_pio_config(struct get_conf *gc)
{ {
printk("Please check values: (read config data)\n"); printk("Please check values: (read config data)\n");
printk("LEN: %d ver:%d OCS:%d TAR:%d TRNXFR:%d MORES:%d\n", printk("LEN: %d ver:%d OCS:%d TAR:%d TRNXFR:%d MORES:%d\n", (uint) ntohl(gc->len), gc->version, gc->OCS_enabled, gc->TAR_support, gc->TRNXFR, gc->MORE_support);
(uint) ntohl(gc->len), gc->version, printk("HAAV:%d SCSIID0:%d ID1:%d ID2:%d QUEUE:%d SG:%d SEC:%d\n", gc->HAA_valid, gc->scsi_id[3], gc->scsi_id[2], gc->scsi_id[1], ntohs(gc->queuesiz), ntohs(gc->SGsiz), gc->SECOND);
gc->OCS_enabled, gc->TAR_support, gc->TRNXFR, gc->MORE_support); printk("IRQ:%d IRQT:%d FORCADR:%d MCH:%d RIDQ:%d\n", gc->IRQ, gc->IRQ_TR, gc->FORCADR, gc->MAX_CHAN, gc->ID_qest);
printk("HAAV:%d SCSIID0:%d ID1:%d ID2:%d QUEUE:%d SG:%d SEC:%d\n",
gc->HAA_valid, gc->scsi_id[3], gc->scsi_id[2],
gc->scsi_id[1], ntohs(gc->queuesiz), ntohs(gc->SGsiz), gc->SECOND);
printk("IRQ:%d IRQT:%d FORCADR:%d MCH:%d RIDQ:%d\n",
gc->IRQ, gc->IRQ_TR, gc->FORCADR,
gc->MAX_CHAN, gc->ID_qest);
} }
static uint print_selftest(uint base) static uint print_selftest(uint base)
{ {
unchar buffer[512]; unsigned char buffer[512];
#ifdef VERBOSE_SETUP #ifdef VERBOSE_SETUP
int z; int z;
#endif #endif
...@@ -625,49 +586,44 @@ static uint print_selftest(uint base) ...@@ -625,49 +586,44 @@ static uint print_selftest(uint base)
do { do {
while (inb(base + HA_RSTATUS) & HA_SBUSY) while (inb(base + HA_RSTATUS) & HA_SBUSY)
/* nothing */ ; /* nothing */ ;
if (inb(base + HA_RSTATUS) & HA_SDRQ) if (inb(base + HA_RSTATUS) & HA_SDRQ) {
{
insw(base + HA_RDATA, &buffer, 256); insw(base + HA_RDATA, &buffer, 256);
#ifdef VERBOSE_SETUP #ifdef VERBOSE_SETUP
/* no beeps please... */ /* no beeps please... */
for (z = 0; z < 511 && buffer[z]; z++) for (z = 0; z < 511 && buffer[z]; z++)
if (buffer[z] != 7) printk("%c", buffer[z]); if (buffer[z] != 7)
printk("%c", buffer[z]);
#endif #endif
} }
} while (inb(base+HA_RSTATUS) & (HA_SBUSY|HA_SDRQ)); } while (inb(base + HA_RSTATUS) & (HA_SBUSY | HA_SDRQ));
return (!(inb(base+HA_RSTATUS) & HA_SERROR)); return (!(inb(base + HA_RSTATUS) & HA_SERROR));
} }
int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) static int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
{ {
ulong size = 0; unsigned long size = 0;
char *buff; char *buff;
ulong cplen; unsigned long cplen;
ushort cppadlen; unsigned short cppadlen;
struct Scsi_Host *sh; struct Scsi_Host *sh;
hostdata *hd; hostdata *hd;
DBG(DBG_REGISTER, print_pio_config(gc)); DBG(DBG_REGISTER, print_pio_config(gc));
if (gc->DMA_support == TRUE) { if (gc->DMA_support == TRUE) {
printk("HBA at %#.4lx supports DMA. Please use EATA-DMA driver.\n",base); printk("HBA at %#.4lx supports DMA. Please use EATA-DMA driver.\n", base);
if(ALLOW_DMA_BOARDS == FALSE) if (ALLOW_DMA_BOARDS == FALSE)
return (FALSE); return (FALSE);
} }
if ((buff = get_pio_board_data((uint)base, gc->IRQ, gc->scsi_id[3], if ((buff = get_pio_board_data((uint) base, gc->IRQ, gc->scsi_id[3], cplen = (htonl(gc->cplen) + 1) / 2, cppadlen = (htons(gc->cppadlen) + 1) / 2)) == NULL) {
cplen =(htonl(gc->cplen )+1)/2, printk("HBA at %#lx didn't react on INQUIRY. Sorry.\n", (unsigned long) base);
cppadlen=(htons(gc->cppadlen)+1)/2)) == NULL)
{
printk("HBA at %#lx didn't react on INQUIRY. Sorry.\n", (ulong) base);
return (FALSE); return (FALSE);
} }
if (print_selftest(base) == FALSE && ALLOW_DMA_BOARDS == FALSE) if (print_selftest(base) == FALSE && ALLOW_DMA_BOARDS == FALSE) {
{ printk("HBA at %#lx failed while performing self test & setup.\n", (unsigned long) base);
printk("HBA at %#lx failed while performing self test & setup.\n",
(ulong) base);
return (FALSE); return (FALSE);
} }
...@@ -676,15 +632,13 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -676,15 +632,13 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
size = sizeof(hostdata) + (sizeof(struct eata_ccb) * ntohs(gc->queuesiz)); size = sizeof(hostdata) + (sizeof(struct eata_ccb) * ntohs(gc->queuesiz));
sh = scsi_register(tpnt, size); sh = scsi_register(tpnt, size);
if(sh == NULL) if (sh == NULL) {
{
release_region(base, 8); release_region(base, 8);
return FALSE; return FALSE;
} }
if (!reg_IRQ[gc->IRQ]) { /* Interrupt already registered ? */ if (!reg_IRQ[gc->IRQ]) { /* Interrupt already registered ? */
if (!request_irq(gc->IRQ, do_eata_pio_int_handler, SA_INTERRUPT, if (!request_irq(gc->IRQ, do_eata_pio_int_handler, SA_INTERRUPT, "EATA-PIO", sh)) {
"EATA-PIO", sh)){
reg_IRQ[gc->IRQ]++; reg_IRQ[gc->IRQ]++;
if (!gc->IRQ_TR) if (!gc->IRQ_TR)
reg_IRQL[gc->IRQ] = TRUE; /* IRQ is edge triggered */ reg_IRQL[gc->IRQ] = TRUE; /* IRQ is edge triggered */
...@@ -695,8 +649,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -695,8 +649,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
} }
} else { /* More than one HBA on this IRQ */ } else { /* More than one HBA on this IRQ */
if (reg_IRQL[gc->IRQ] == TRUE) { if (reg_IRQL[gc->IRQ] == TRUE) {
printk("Can't support more than one HBA on this IRQ,\n" printk("Can't support more than one HBA on this IRQ,\n" " if the IRQ is edge triggered. Sorry.\n");
" if the IRQ is edge triggered. Sorry.\n");
release_region(base, 8); release_region(base, 8);
return (FALSE); return (FALSE);
} else } else
...@@ -706,7 +659,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -706,7 +659,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
hd = SD(sh); hd = SD(sh);
memset(hd->ccb, 0, (sizeof(struct eata_ccb) * ntohs(gc->queuesiz))); memset(hd->ccb, 0, (sizeof(struct eata_ccb) * ntohs(gc->queuesiz)));
memset(hd->reads, 0, sizeof(ulong) * 26); memset(hd->reads, 0, sizeof(unsigned long) * 26);
strncpy(SD(sh)->vendor, &buff[8], 8); strncpy(SD(sh)->vendor, &buff[8], 8);
SD(sh)->vendor[8] = 0; SD(sh)->vendor[8] = 0;
...@@ -735,7 +688,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -735,7 +688,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
SD(sh)->EATA_revision = '?'; SD(sh)->EATA_revision = '?';
} }
if(ntohl(gc->len) >= 0x22) { if (ntohl(gc->len) >= 0x22) {
if (gc->is_PCI == TRUE) if (gc->is_PCI == TRUE)
hd->bustype = IS_PCI; hd->bustype = IS_PCI;
else if (gc->is_EISA == TRUE) else if (gc->is_EISA == TRUE)
...@@ -751,11 +704,11 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -751,11 +704,11 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
hd->bustype = IS_ISA; hd->bustype = IS_ISA;
} }
SD(sh)->cplen=cplen; SD(sh)->cplen = cplen;
SD(sh)->cppadlen=cppadlen; SD(sh)->cppadlen = cppadlen;
SD(sh)->hostid=gc->scsi_id[3]; SD(sh)->hostid = gc->scsi_id[3];
SD(sh)->devflags=1<<gc->scsi_id[3]; SD(sh)->devflags = 1 << gc->scsi_id[3];
SD(sh)->moresupport=gc->MORE_support; SD(sh)->moresupport = gc->MORE_support;
sh->unique_id = base; sh->unique_id = base;
sh->base = base; sh->base = base;
sh->io_port = base; sh->io_port = base;
...@@ -781,7 +734,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -781,7 +734,7 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
hd->next = NULL; /* build a linked list of all HBAs */ hd->next = NULL; /* build a linked list of all HBAs */
hd->prev = last_HBA; hd->prev = last_HBA;
if(hd->prev != NULL) if (hd->prev != NULL)
SD(hd->prev)->next = sh; SD(hd->prev)->next = sh;
last_HBA = sh; last_HBA = sh;
if (first_HBA == NULL) if (first_HBA == NULL)
...@@ -790,13 +743,13 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt) ...@@ -790,13 +743,13 @@ int register_pio_HBA(long base, struct get_conf *gc, Scsi_Host_Template * tpnt)
return (1); return (1);
} }
void find_pio_ISA(struct get_conf *buf, Scsi_Host_Template * tpnt) static void find_pio_ISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
{ {
int i; int i;
for (i = 0; i < MAXISA; i++) { for (i = 0; i < MAXISA; i++) {
if (ISAbases[i]) { if (ISAbases[i]) {
if (get_pio_conf_PIO(ISAbases[i], buf) == TRUE){ if (get_pio_conf_PIO(ISAbases[i], buf) == TRUE) {
register_pio_HBA(ISAbases[i], buf, tpnt); register_pio_HBA(ISAbases[i], buf, tpnt);
} }
ISAbases[i] = 0; ISAbases[i] = 0;
...@@ -805,7 +758,7 @@ void find_pio_ISA(struct get_conf *buf, Scsi_Host_Template * tpnt) ...@@ -805,7 +758,7 @@ void find_pio_ISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
return; return;
} }
void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) static void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
{ {
u32 base; u32 base;
int i; int i;
...@@ -819,24 +772,19 @@ void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) ...@@ -819,24 +772,19 @@ void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
base = 0x1c88 + (i * 0x1000); base = 0x1c88 + (i * 0x1000);
#if CHECKPAL #if CHECKPAL
pal1 = inb((u16)base - 8); pal1 = inb((u16) base - 8);
pal2 = inb((u16)base - 7); pal2 = inb((u16) base - 7);
pal3 = inb((u16)base - 6); pal3 = inb((u16) base - 6);
if (((pal1 == 0x12) && (pal2 == 0x14)) || if (((pal1 == 0x12) && (pal2 == 0x14)) || ((pal1 == 0x38) && (pal2 == 0xa3) && (pal3 == 0x82)) || ((pal1 == 0x06) && (pal2 == 0x94) && (pal3 == 0x24))) {
((pal1 == 0x38) && (pal2 == 0xa3) && (pal3 == 0x82)) || DBG(DBG_PROBE, printk(KERN_NOTICE "EISA EATA id tags found: " "%x %x %x \n", (int) pal1, (int) pal2, (int) pal3));
((pal1 == 0x06) && (pal2 == 0x94) && (pal3 == 0x24))) {
DBG(DBG_PROBE, printk(KERN_NOTICE "EISA EATA id tags found: "
"%x %x %x \n",
(int)pal1, (int)pal2, (int)pal3));
#endif #endif
if (get_pio_conf_PIO(base, buf) == TRUE) { if (get_pio_conf_PIO(base, buf) == TRUE) {
DBG(DBG_PROBE && DBG_EISA, print_pio_config(buf)); DBG(DBG_PROBE && DBG_EISA, print_pio_config(buf));
if (buf->IRQ) { if (buf->IRQ) {
register_pio_HBA(base, buf, tpnt); register_pio_HBA(base, buf, tpnt);
} else } else
printk(KERN_NOTICE "eata_dma: No valid IRQ. HBA " printk(KERN_NOTICE "eata_dma: No valid IRQ. HBA " "removed from list\n");
"removed from list\n");
} }
/* Nothing found here so we take it from the list */ /* Nothing found here so we take it from the list */
EISAbases[i] = 0; EISAbases[i] = 0;
...@@ -848,7 +796,7 @@ void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt) ...@@ -848,7 +796,7 @@ void find_pio_EISA(struct get_conf *buf, Scsi_Host_Template * tpnt)
return; return;
} }
void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) static void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
{ {
#ifndef CONFIG_PCI #ifndef CONFIG_PCI
printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n"); printk("eata_dma: kernel PCI support not enabled. Skipping scan for PCI HBAs.\n");
...@@ -857,8 +805,7 @@ void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) ...@@ -857,8 +805,7 @@ void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
u32 base, x; u32 base, x;
while ((dev = pci_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, dev)) != NULL) { while ((dev = pci_find_device(PCI_VENDOR_ID_DPT, PCI_DEVICE_ID_DPT, dev)) != NULL) {
DBG(DBG_PROBE && DBG_PCI, DBG(DBG_PROBE && DBG_PCI, printk("eata_pio: find_PCI, HBA at %s\n", dev->name));
printk("eata_pio: find_PCI, HBA at %s\n", dev->name));
if (pci_enable_device(dev)) if (pci_enable_device(dev))
continue; continue;
pci_set_master(dev); pci_set_master(dev);
...@@ -899,8 +846,7 @@ void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) ...@@ -899,8 +846,7 @@ void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
} }
#if CHECK_BLINK #if CHECK_BLINK
else if (check_blink_state(base) == TRUE) { else if (check_blink_state(base) == TRUE) {
printk("eata_pio: HBA is in BLINK state.\n" printk("eata_pio: HBA is in BLINK state.\n" "Consult your HBAs manual to correct this.\n");
"Consult your HBAs manual to correct this.\n");
} }
#endif #endif
} }
...@@ -909,7 +855,7 @@ void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt) ...@@ -909,7 +855,7 @@ void find_pio_PCI(struct get_conf *buf, Scsi_Host_Template * tpnt)
} }
int eata_pio_detect(Scsi_Host_Template * tpnt) static int eata_pio_detect(Scsi_Host_Template * tpnt)
{ {
struct Scsi_Host *HBA_ptr; struct Scsi_Host *HBA_ptr;
struct get_conf gc; struct get_conf gc;
...@@ -931,24 +877,17 @@ int eata_pio_detect(Scsi_Host_Template * tpnt) ...@@ -931,24 +877,17 @@ int eata_pio_detect(Scsi_Host_Template * tpnt)
if (registered_HBAs != 0) { if (registered_HBAs != 0) {
printk("EATA (Extended Attachment) PIO driver version: %d.%d%s\n" printk("EATA (Extended Attachment) PIO driver version: %d.%d%s\n"
"(c) 1993-95 Michael Neuffer, neuffer@goofy.zdv.uni-mainz.de\n" "(c) 1993-95 Michael Neuffer, neuffer@goofy.zdv.uni-mainz.de\n" " Alfred Arnold, a.arnold@kfa-juelich.de\n" "This release only supports DASD devices (harddisks)\n", VER_MAJOR, VER_MINOR, VER_SUB);
" Alfred Arnold, a.arnold@kfa-juelich.de\n"
"This release only supports DASD devices (harddisks)\n",
VER_MAJOR, VER_MINOR, VER_SUB);
printk("Registered HBAs:\n"); printk("Registered HBAs:\n");
printk("HBA no. Boardtype: Revis: EATA: Bus: BaseIO: IRQ: Ch: ID: Pr:" printk("HBA no. Boardtype: Revis: EATA: Bus: BaseIO: IRQ: Ch: ID: Pr:" " QS: SG: CPL:\n");
" QS: SG: CPL:\n");
for (i = 1; i <= registered_HBAs; i++) { for (i = 1; i <= registered_HBAs; i++) {
printk("scsi%-2d: %.10s v%s 2.0%c %s %#.4x %2d %d %d %c" printk("scsi%-2d: %.10s v%s 2.0%c %s %#.4x %2d %d %d %c"
" %2d %2d %2d\n", " %2d %2d %2d\n",
HBA_ptr->host_no, SD(HBA_ptr)->name, SD(HBA_ptr)->revision, HBA_ptr->host_no, SD(HBA_ptr)->name, SD(HBA_ptr)->revision,
SD(HBA_ptr)->EATA_revision, (SD(HBA_ptr)->bustype == 'P')? SD(HBA_ptr)->EATA_revision, (SD(HBA_ptr)->bustype == 'P') ?
"PCI ":(SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ", "PCI " : (SD(HBA_ptr)->bustype == 'E') ? "EISA" : "ISA ",
(uint) HBA_ptr->base, HBA_ptr->irq, SD(HBA_ptr)->channel, (uint) HBA_ptr->base, HBA_ptr->irq, SD(HBA_ptr)->channel, HBA_ptr->this_id, (SD(HBA_ptr)->primary == TRUE) ? 'Y' : 'N', HBA_ptr->can_queue, HBA_ptr->sg_tablesize, HBA_ptr->cmd_per_lun);
HBA_ptr->this_id, (SD(HBA_ptr)->primary == TRUE)?'Y':'N',
HBA_ptr->can_queue, HBA_ptr->sg_tablesize,
HBA_ptr->cmd_per_lun);
HBA_ptr = SD(HBA_ptr)->next; HBA_ptr = SD(HBA_ptr)->next;
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Header file for eata_pio.c Linux EATA-PIO SCSI driver * * Header file for eata_pio.c Linux EATA-PIO SCSI driver *
* (c) 1993-96 Michael Neuffer * * (c) 1993-96 Michael Neuffer *
********************************************************* *********************************************************
* last change: 96/05/05 * * last change: 2002/11/02 *
********************************************************/ ********************************************************/
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "hosts.h" #include "hosts.h"
#include <scsi/scsicam.h> #include <scsi/scsicam.h>
#ifndef HOSTS_C
#include "eata_generic.h" #include "eata_generic.h"
#define VER_MAJOR 0 #define VER_MAJOR 0
...@@ -58,49 +57,22 @@ ...@@ -58,49 +57,22 @@
#define DBG(x, y) #define DBG(x, y)
#endif #endif
#endif /* !HOSTS_C */ static int eata_pio_detect(Scsi_Host_Template *);
static int eata_pio_queue(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
int eata_pio_detect(Scsi_Host_Template *); static int eata_pio_abort(Scsi_Cmnd *);
const char *eata_pio_info(struct Scsi_Host *); static int eata_pio_host_reset(Scsi_Cmnd *);
int eata_pio_command(Scsi_Cmnd *); static int eata_pio_proc_info(char *, char **, off_t, int, int, int);
int eata_pio_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); static int eata_pio_release(struct Scsi_Host *);
int eata_pio_abort(Scsi_Cmnd *);
int eata_pio_reset(Scsi_Cmnd *, unsigned int);
int eata_pio_proc_info(char *, char **, off_t, int, int, int);
#ifdef MODULE
int eata_pio_release(struct Scsi_Host *);
#else
#define eata_pio_release NULL
#endif
#define EATA_PIO { \ #define EATA_PIO { \
proc_info: eata_pio_proc_info, /* procinfo */ \ proc_info: eata_pio_proc_info, /* procinfo */ \
name: "EATA (Extended Attachment) PIO driver", \ name: "EATA (Extended Attachment) PIO driver",\
detect: eata_pio_detect, \ detect: eata_pio_detect, \
release: eata_pio_release, \ release: eata_pio_release, \
queuecommand: eata_pio_queue, \ queuecommand: eata_pio_queue, \
abort: eata_pio_abort, \ eh_abort_handler: eata_pio_abort, \
reset: eata_pio_reset, \ eh_host_reset_handler: eata_pio_host_reset, \
unchecked_isa_dma: 1, /* True if ISA */ \ use_clustering: ENABLE_CLUSTERING \
use_clustering: ENABLE_CLUSTERING } }
#endif /* _EATA_PIO_H */ #endif /* _EATA_PIO_H */
/*
* Overrides for Emacs so that we almost follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 4
* c-brace-imaginary-offset: 0
* c-brace-offset: -4
* c-argdecl-indent: 4
* c-label-offset: -4
* c-continued-statement-offset: 4
* c-continued-brace-offset: 0
* tab-width: 8
* End:
*/
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