Commit 7182182f authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] initial eata driver updates

parent 06dd98e3
/*
* eata.c - Low-level driver for EATA/DMA SCSI host adapters.
*
* 10 Oct 2002 Rev. 7.70 for linux 2.5.42
* + Foreport from revision 6.70.
*
* 25 Jun 2002 Rev. 6.70 for linux 2.4.19
* + This release is the first one tested on a Big Endian platform:
* fixed endian-ness problem due to bitfields;
* fixed endian-ness problem in read_pio.
* + Added new options for selectively probing ISA, EISA and PCI bus:
*
* Boot option Parameter name Default according to
*
* ip:[y|n] isa_probe=[1|0] CONFIG_ISA defined
* ep:[y|n] eisa_probe=[1|0] CONFIG_EISA defined
* pp:[y|n] pci_probe=[1|0] CONFIG_PCI defined
*
* The default action is to perform probing if the corrisponding
* bus is configured and to skip probing otherwise.
*
* + If pci_probe is in effect and a list of I/O ports is specified
* as parameter or boot option, pci_enable_device() is performed
* on all pci devices matching PCI_CLASS_STORAGE_SCSI.
*
* 21 Feb 2002 Rev. 6.52 for linux 2.4.18
* + Backport from rev. 7.22 (use io_request_lock).
*
* 20 Feb 2002 Rev. 7.22 for linux 2.5.5
* + Remove any reference to virt_to_bus().
* + Fix pio hang while detecting multiple HBAs.
......@@ -428,6 +453,9 @@ MODULE_PARM(max_queue_depth, "i");
MODULE_PARM(tag_mode, "i");
MODULE_PARM(ext_tran, "i");
MODULE_PARM(rev_scan, "i");
MODULE_PARM(isa_probe, "i");
MODULE_PARM(eisa_probe, "i");
MODULE_PARM(pci_probe, "i");
MODULE_AUTHOR("Dario Ballabio");
#endif
......@@ -455,6 +483,10 @@ MODULE_AUTHOR("Dario Ballabio");
#include <linux/ctype.h>
#include <linux/spinlock.h>
#if !defined(__BIG_ENDIAN_BITFIELD) && !defined(__LITTLE_ENDIAN_BITFIELD)
#error "Adjust your <asm/byteorder.h> defines"
#endif
/* Subversion values */
#define ISA 0
#define ESA 1
......@@ -512,7 +544,7 @@ MODULE_AUTHOR("Dario Ballabio");
#define REG_LM 3
#define REG_MID 4
#define REG_MSB 5
#define REGION_SIZE 9
#define REGION_SIZE 9UL
#define MAX_ISA_ADDR 0x03ff
#define MIN_EISA_ADDR 0x1c88
#define MAX_EISA_ADDR 0xfc88
......@@ -536,7 +568,7 @@ MODULE_AUTHOR("Dario Ballabio");
#define TLDEV(type) ((type) == TYPE_DISK || (type) == TYPE_ROM)
/* "EATA", in Big Endian format */
#define EATA_SIGNATURE 0x41544145
#define EATA_SIG_BE 0x45415441
/* Number of valid bytes in the board config structure for EATA 2.0x */
#define EATA_2_0A_SIZE 28
......@@ -547,6 +579,12 @@ MODULE_AUTHOR("Dario Ballabio");
struct eata_info {
u_int32_t data_len; /* Number of valid bytes after this field */
u_int32_t sign; /* ASCII "EATA" signature */
#if defined(__BIG_ENDIAN_BITFIELD)
unchar version:4, :4;
unchar haaval:1, ata:1, drqvld:1, dmasup:1, morsup:1, trnxfr:1, tarsup:1,
ocsena:1;
#else
unchar :4, /* unused low nibble */
version:4; /* EATA version, should be 0x1 */
unchar ocsena:1, /* Overlap Command Support Enabled */
......@@ -557,6 +595,8 @@ struct eata_info {
drqvld:1, /* DRQ Index (DRQX) is valid */
ata:1, /* This is an ATA device */
haaval:1; /* Host Adapter Address Valid */
#endif
ushort cp_pad_len; /* Number of pad bytes after cp_len */
unchar host_addr[4]; /* Host Adapter SCSI ID for channels 3, 2, 1, 0 */
u_int32_t cp_len; /* Number of valid bytes in cp */
......@@ -564,6 +604,15 @@ struct eata_info {
ushort queue_size; /* Max number of cp that can be queued */
ushort unused;
ushort scatt_size; /* Max number of entries in scatter/gather table */
#if defined(__BIG_ENDIAN_BITFIELD)
unchar drqx:2, second:1, irq_tr:1, irq:4;
unchar sync;
unchar :4, res1:1, large_sg:1, forcaddr:1, isaena:1;
unchar max_chan:3, max_id:5;
unchar max_lun;
unchar eisa:1, pci:1, idquest:1, m1:1, :4;
#else
unchar irq:4, /* Interrupt Request assigned to this controller */
irq_tr:1, /* 0 for edge triggered, 1 for level triggered */
second:1, /* 1 if this is a secondary (not primary) controller */
......@@ -586,6 +635,8 @@ struct eata_info {
idquest:1, /* RAIDNUM returned is questionable */
pci:1, /* This board is PCI */
eisa:1; /* This board is EISA */
#endif
unchar raidnum; /* Uniquely identifies this HBA in a system */
unchar notused;
......@@ -595,18 +646,30 @@ struct eata_info {
/* Board config structure */
struct eata_config {
ushort len; /* Number of bytes following this field */
#if defined(__BIG_ENDIAN_BITFIELD)
unchar :4, tarena:1, mdpena:1, ocena:1, edis:1;
#else
unchar edis:1, /* Disable EATA interface after config command */
ocena:1, /* Overlapped Commands Enabled */
mdpena:1, /* Transfer all Modified Data Pointer Messages */
tarena:1, /* Target Mode Enabled for this controller */
:4;
#endif
unchar cpad[511];
};
/* Returned status packet structure */
struct mssp {
#if defined(__BIG_ENDIAN_BITFIELD)
unchar eoc:1, adapter_status:7;
#else
unchar adapter_status:7, /* State related to current command */
eoc:1; /* End Of Command (1 = command completed) */
#endif
unchar target_status; /* SCSI status received after data transfer */
unchar unused[2];
u_int32_t inv_res_len; /* Number of bytes not transferred */
......@@ -621,6 +684,16 @@ struct sg_list {
/* MailBox SCSI Command Packet */
struct mscp {
#if defined(__BIG_ENDIAN_BITFIELD)
unchar din:1, dout:1, interp:1, :1, sg:1, reqsen:1, init:1, sreset:1;
unchar sense_len;
unchar unused[3];
unchar :7, fwnest:1;
unchar :5, hbaci:1, iat:1, phsunit:1;
unchar channel:3, target:5;
unchar one:1, dispri:1, luntar:1, lun:5;
#else
unchar sreset:1, /* SCSI Bus Reset Signal should be asserted */
init:1, /* Re-initialize controller and self test */
reqsen:1, /* Transfer Request Sense Data to addr using DMA */
......@@ -643,6 +716,8 @@ struct mscp {
luntar:1, /* This cp is for Target (not LUN) */
dispri:1, /* Disconnect Privilege granted */
one:1; /* 1 */
#endif
unchar mess[3]; /* Massage to/from Target */
unchar cdb[12]; /* Command Descriptor Block */
u_int32_t data_len; /* If sg=0 Data Length, if sg=1 sglist length */
......@@ -719,8 +794,13 @@ static unsigned long io_port[] = {
#define BN(board) (HD(board)->board_name)
/* Device is Big Endian */
#define H2DEV(x) cpu_to_be32(x)
#define DEV2H(x) be32_to_cpu(x)
#define H2DEV(x) cpu_to_be32(x)
#define DEV2H(x) be32_to_cpu(x)
#define H2DEV16(x) cpu_to_be16(x)
#define DEV2H16(x) be16_to_cpu(x)
/* But transfer orientation from the 16 bit data register is Little Endian */
#define REG2H(x) le16_to_cpu(x)
static void do_interrupt_handler(int, void *, struct pt_regs *);
static void flush_dev(Scsi_Device *, unsigned long, unsigned int, unsigned int);
......@@ -750,6 +830,24 @@ static int max_queue_depth = CONFIG_SCSI_EATA_MAX_TAGS;
static int max_queue_depth = MAX_CMD_PER_LUN;
#endif
#if defined(CONFIG_ISA)
static int isa_probe = TRUE;
#else
static int isa_probe = FALSE;
#endif
#if defined(CONFIG_EISA)
static int eisa_probe = TRUE;
#else
static int eisa_probe = FALSE;
#endif
#if defined(CONFIG_PCI)
static int pci_probe = TRUE;
#else
static int pci_probe = FALSE;
#endif
static int eata2x_slave_attach(Scsi_Device *dev) {
int j, tqd, utqd;
char *link_suffix = "";
......@@ -791,14 +889,18 @@ static inline int wait_on_busy(unsigned long iobase, unsigned int loop) {
}
static inline int do_dma(unsigned long iobase, unsigned long addr, unchar cmd) {
unsigned char *byaddr;
unsigned long devaddr;
if (wait_on_busy(iobase, (addr ? MAXLOOP * 100 : MAXLOOP))) return TRUE;
if ((addr = H2DEV(addr))) {
outb((char) (addr >> 24), iobase + REG_LOW);
outb((char) (addr >> 16), iobase + REG_LM);
outb((char) (addr >> 8), iobase + REG_MID);
outb((char) addr, iobase + REG_MSB);
if (addr) {
devaddr = H2DEV(addr);
byaddr = (unsigned char *) &devaddr;
outb(byaddr[3], iobase + REG_LOW);
outb(byaddr[2], iobase + REG_LM);
outb(byaddr[1], iobase + REG_MID);
outb(byaddr[0], iobase + REG_MSB);
}
outb(cmd, iobase + REG_CMD);
......@@ -817,7 +919,7 @@ static inline int read_pio(unsigned long iobase, ushort *start, ushort *end) {
}
loop = MAXLOOP;
*p = inw(iobase);
*p = REG2H(inw(iobase));
}
return FALSE;
......@@ -848,6 +950,29 @@ static inline struct pci_dev *get_pci_dev(unsigned long port_base) {
return NULL;
}
static void enable_pci_ports(void) {
#if defined(CONFIG_PCI)
struct pci_dev *dev = NULL;
if (!pci_present()) return;
while((dev = pci_find_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) {
#if defined(DEBUG_PCI_DETECT)
printk("%s: enable_pci_ports, bus %d, devfn 0x%x.\n",
driver_name, dev->bus->number, dev->devfn);
#endif
if (pci_enable_device (dev))
printk("%s: warning, pci_enable_device failed, bus %d devfn 0x%x.\n",
driver_name, dev->bus->number, dev->devfn);
}
#endif /* end CONFIG_PCI */
}
static inline int port_detect \
(unsigned long port_base, unsigned int j, Scsi_Host_Template *tpnt) {
unsigned char irq, dma_channel, subversion, i, is_pci = FALSE;
......@@ -871,31 +996,48 @@ static inline int port_detect \
}
if (do_dma(port_base, 0, READ_CONFIG_PIO)) {
#if defined(DEBUG_DETECT)
printk("%s: detect, do_dma failed at 0x%03lx.\n", name, port_base);
#endif
release_region(port_base, REGION_SIZE);
return FALSE;
}
/* Read the info structure */
if (read_pio(port_base, (ushort *)&info, (ushort *)&info.ipad[0])) {
#if defined(DEBUG_DETECT)
printk("%s: detect, read_pio failed at 0x%03lx.\n", name, port_base);
#endif
release_region(port_base, REGION_SIZE);
return FALSE;
}
info.data_len = DEV2H(info.data_len);
info.sign = DEV2H(info.sign);
info.cp_pad_len = DEV2H16(info.cp_pad_len);
info.cp_len = DEV2H(info.cp_len);
info.sp_len = DEV2H(info.sp_len);
info.scatt_size = DEV2H16(info.scatt_size);
info.queue_size = DEV2H16(info.queue_size);
/* Check the controller "EATA" signature */
if (info.sign != EATA_SIGNATURE) {
if (info.sign != EATA_SIG_BE) {
#if defined(DEBUG_DETECT)
printk("%s: signature 0x%04x discarded.\n", name, info.sign);
#endif
release_region(port_base, REGION_SIZE);
return FALSE;
}
if (DEV2H(info.data_len) < EATA_2_0A_SIZE) {
if (info.data_len < EATA_2_0A_SIZE) {
printk("%s: config structure size (%d bytes) too short, detaching.\n",
name, DEV2H(info.data_len));
name, info.data_len);
release_region(port_base, REGION_SIZE);
return FALSE;
}
else if (DEV2H(info.data_len) == EATA_2_0A_SIZE)
else if (info.data_len == EATA_2_0A_SIZE)
protocol_rev = 'A';
else if (DEV2H(info.data_len) == EATA_2_0B_SIZE)
else if (info.data_len == EATA_2_0B_SIZE)
protocol_rev = 'B';
else
protocol_rev = 'C';
......@@ -1007,7 +1149,7 @@ static inline int port_detect \
/* Set board configuration */
memset((char *)cf, 0, sizeof(struct eata_config));
cf->len = (ushort) cpu_to_be16((ushort)510);
cf->len = (ushort) H2DEV16((ushort)510);
cf->ocena = TRUE;
if (do_dma(port_base, cf_dma_addr, SET_CONFIG_DMA)) {
......@@ -1038,9 +1180,9 @@ static inline int port_detect \
sh[j]->n_io_port = REGION_SIZE;
sh[j]->dma_channel = dma_channel;
sh[j]->irq = irq;
sh[j]->sg_tablesize = (ushort) be16_to_cpu(info.scatt_size);
sh[j]->sg_tablesize = (ushort) info.scatt_size;
sh[j]->this_id = (ushort) info.host_addr[3];
sh[j]->can_queue = (ushort) be16_to_cpu(info.queue_size);
sh[j]->can_queue = (ushort) info.queue_size;
sh[j]->cmd_per_lun = MAX_CMD_PER_LUN;
memset(HD(j), 0, sizeof(struct hostdata));
HD(j)->subversion = subversion;
......@@ -1137,9 +1279,11 @@ static inline int port_detect \
if (j == 0) {
printk("EATA/DMA 2.0x: Copyright (C) 1994-2002 Dario Ballabio.\n");
printk("%s config options -> tc:%c, lc:%c, mq:%d, rs:%c, et:%c.\n",
driver_name, tag_type, YESNO(linked_comm), max_queue_depth,
YESNO(rev_scan), YESNO(ext_tran));
printk("%s config options -> tc:%c, lc:%c, mq:%d, rs:%c, et:%c, "\
"ip:%c, ep:%c, pp:%c.\n", driver_name, tag_type,
YESNO(linked_comm), max_queue_depth, YESNO(rev_scan),
YESNO(ext_tran), YESNO(isa_probe), YESNO(eisa_probe),
YESNO(pci_probe));
}
printk("%s: 2.0%c, %s 0x%03lx, IRQ %u, %s, SG %d, MB %d.\n",
......@@ -1158,8 +1302,8 @@ static inline int port_detect \
printk("%s: Vers. 0x%x, ocs %u, tar %u, trnxfr %u, more %u, SYNC 0x%x, "\
"sec. %u, infol %d, cpl %d spl %d.\n", name, info.version,
info.ocsena, info.tarsup, info.trnxfr, info.morsup, info.sync,
info.second, DEV2H(info.data_len), DEV2H(info.cp_len),
DEV2H(info.sp_len));
info.second, info.data_len, info.cp_len,
info.sp_len);
if (protocol_rev == 'B' || protocol_rev == 'C')
printk("%s: isaena %u, forcaddr %u, max_id %u, max_chan %u, "\
......@@ -1209,6 +1353,9 @@ static void internal_setup(char *str, int *ints) {
else if (!strncmp(cur, "ls:", 3)) link_statistics = val;
else if (!strncmp(cur, "et:", 3)) ext_tran = val;
else if (!strncmp(cur, "rs:", 3)) rev_scan = val;
else if (!strncmp(cur, "ip:", 3)) isa_probe = val;
else if (!strncmp(cur, "ep:", 3)) eisa_probe = val;
else if (!strncmp(cur, "pp:", 3)) pci_probe = val;
if ((cur = strchr(cur, ','))) ++cur;
}
......@@ -1293,7 +1440,19 @@ int eata2x_detect(Scsi_Host_Template *tpnt) {
for (k = 0; k < MAX_BOARDS + 1; k++) sh[k] = NULL;
if (!setup_done) add_pci_ports();
for (k = MAX_INT_PARAM; io_port[k]; k++)
if (io_port[k] == SKIP) continue;
else if (io_port[k] <= MAX_ISA_ADDR) {
if (!isa_probe) io_port[k] = SKIP;
}
else if (io_port[k] >= MIN_EISA_ADDR && io_port[k] <= MAX_EISA_ADDR) {
if (!eisa_probe) io_port[k] = SKIP;
}
if (pci_probe) {
if (!setup_done) add_pci_ports();
else enable_pci_ports();
}
for (k = 0; io_port[k]; k++) {
......@@ -1985,6 +2144,19 @@ static inline void ihdlr(int irq, unsigned int j) {
/* Read the status register to clear the interrupt indication */
reg = inb(sh[j]->io_port + REG_STATUS);
#if defined (DEBUG_INTERRUPT)
{
unsigned char *bytesp;
int cnt;
bytesp= (unsigned char *) spp;
if (HD(j)->iocount < 200) {
printk("sp[] =");
for (cnt=0; cnt < 15; cnt++) printk(" 0x%x", bytesp[cnt]);
printk("\n");
}
}
#endif
/* Reject any sp with supspect data */
if (spp->eoc == FALSE && HD(j)->iocount > 1)
printk("%s: ihdlr, spp->eoc == FALSE, irq %d, reg 0x%x, count %d.\n",
......
......@@ -14,7 +14,7 @@ int eata2x_reset(Scsi_Cmnd *);
int eata2x_biosparam(Disk *, struct block_device *, int *);
static int eata2x_slave_attach(Scsi_Device *);
#define EATA_VERSION "7.22.00"
#define EATA_VERSION "7.70.00"
#define EATA { \
name: "EATA/DMA 2.0x rev. " EATA_VERSION " ", \
......
......@@ -94,12 +94,6 @@
#define CD(cmd) ((struct eata_ccb *)(cmd->host_scribble))
#define SD(host) ((hostdata *)&(host->hostdata))
#define DELAY(x) { ulong flags, i; \
save_flags(flags); sti(); \
i = jiffies + (x * HZ); \
while (jiffies < i); \
restore_flags(flags); }
/***********************************************
* EATA Command & Register definitions *
***********************************************/
......
......@@ -99,7 +99,7 @@ void IncStat(Scsi_Pointer *SCp, uint Increment)
else
{
SCp->buffer++;
SCp->ptr=SCp->buffer->address;
SCp->ptr=page_address(SCp->buffer->page) + SCp->buffer->offset;
SCp->this_residual=SCp->buffer->length;
}
}
......@@ -124,15 +124,11 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
hostdata *hd;
struct eata_ccb *cp;
uint base;
ulong flags;
uint x,z;
struct Scsi_Host *sh;
ushort zwickel=0;
unchar stat,odd;
save_flags(flags);
cli();
for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->prev) {
if (sh->irq != irq)
continue;
......@@ -234,10 +230,8 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
if (cp->status == LOCKED) {
cp->status = FREE;
eata_stat = inb(base + HA_RSTATUS);
printk(KERN_NOTICE "eata_pio: int_handler, freeing locked "
printk(KERN_CRIT "eata_pio: int_handler, freeing locked "
"queueslot\n");
DBG(DBG_INTR&&DBG_DELAY,DELAY(1));
restore_flags(flags);
return;
}
......@@ -245,17 +239,12 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
if (stat != 0x50)
printk(KERN_DEBUG "stat: %#.2x, result: %#.8x\n", stat,
cmd->result);
DBG(DBG_INTR&&DBG_DELAY,DELAY(1));
#endif
cp->status = FREE; /* now we can release the slot */
restore_flags(flags);
cmd->scsi_done(cmd);
save_flags(flags);
cli();
}
restore_flags(flags);
return;
}
......@@ -281,16 +270,12 @@ inline uint eata_pio_send_command(uint base, unchar command)
int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
{
uint x, y;
long flags;
uint base;
hostdata *hd;
struct Scsi_Host *sh;
struct eata_ccb *cp;
save_flags(flags);
cli();
queue_counter++;
hd = HD(cmd);
......@@ -322,10 +307,10 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
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));
DBG(DBG_QUEUE && DBG_DELAY, DELAY(1));
cmd->scsi_done = (void *)done;
/* 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:
......@@ -372,7 +357,7 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
} else {
cmd->SCp.buffer = cmd->request_buffer;
cmd->SCp.buffers_residual = cmd->use_sg;
cmd->SCp.ptr = cmd->SCp.buffer->address;
cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset;
cmd->SCp.this_residual = cmd->SCp.buffer->length;
}
cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes
......@@ -385,10 +370,10 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
"returning DID_BUS_BUSY, done.\n", cmd->target, cmd->pid);
done(cmd);
cp->status = FREE;
restore_flags(flags);
return (0);
}
while (!(inb(base + HA_RSTATUS) & HA_SDRQ));
while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
cpu_relax();
outsw(base + HA_RDATA, cp, hd->cplen);
outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND);
for (x = 0; x < hd->cppadlen; x++) outw(0, base + HA_RDATA);
......@@ -396,9 +381,7 @@ int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
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));
DBG(DBG_QUEUE && DBG_DELAY, DELAY(1));
restore_flags(flags);
return (0);
}
......@@ -407,66 +390,58 @@ int eata_pio_abort(Scsi_Cmnd * cmd)
ulong flags;
uint loop = HZ;
save_flags(flags);
cli();
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 && DBG_DELAY, DELAY(1));
while (inb((uint)(cmd->host->base) + HA_RAUXSTAT) & HA_ABUSY)
if (--loop == 0) {
printk(KERN_WARNING "eata_pio: abort, timeout error.\n");
restore_flags(flags);
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
spin_unlock_irqrestore(cmd->host->host_lock, flags);
return (SCSI_ABORT_ERROR);
}
if (CD(cmd)->status == FREE) {
DBG(DBG_ABNORM, printk(KERN_WARNING "Returning: SCSI_ABORT_NOT_RUNNING\n"));
restore_flags(flags);
spin_unlock_irqrestore(cmd->host->host_lock, flags);
return (SCSI_ABORT_NOT_RUNNING);
}
if (CD(cmd)->status == USED) {
DBG(DBG_ABNORM, printk(KERN_WARNING "Returning: SCSI_ABORT_BUSY\n"));
restore_flags(flags);
spin_unlock_irqrestore(cmd->host->host_lock, flags);
return (SCSI_ABORT_BUSY); /* SNOOZE */
}
if (CD(cmd)->status == RESET) {
restore_flags(flags);
spin_unlock_irqrestore(cmd->host->host_lock, flags);
printk(KERN_WARNING "eata_pio: abort, command reset error.\n");
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
return (SCSI_ABORT_ERROR);
}
if (CD(cmd)->status == LOCKED) {
restore_flags(flags);
spin_unlock_irqrestore(cmd->host->host_lock, flags);
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio: abort, queue slot "
"locked.\n"));
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
return (SCSI_ABORT_NOT_RUNNING);
}
restore_flags(flags);
spin_unlock_irqrestore(cmd->host->host_lock, flags);
panic("eata_pio: abort: invalid slot status\n");
}
int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy)
{
uint x, time, limit = 0;
uint x, limit = 0;
ulong flags;
unchar success = FALSE;
Scsi_Cmnd *sp;
save_flags(flags);
cli();
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));
spin_lock_irqsave(cmd->host->host_lock, flags);
if (HD(cmd)->state == RESET) {
printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n");
restore_flags(flags);
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
spin_unlock_irqrestore(cmd->host->host_lock, flags);
return (SCSI_RESET_ERROR);
}
......@@ -481,11 +456,9 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy)
HD(cmd)->ccb[x].status = RESET;
printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x,
sp->pid);
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
if (sp == NULL)
panic("eata_pio_reset: slot %d, sp==NULL.\n", x);
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
}
/* hard reset the HBA */
......@@ -494,12 +467,11 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy)
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: board reset done.\n"));
HD(cmd)->state = RESET;
time = jiffies;
while (time_before(jiffies, time + 3 * HZ) && limit++ < 10000000);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(3*HZ);
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: interrupts disabled, "
"loops %d.\n", limit));
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
for (x = 0; x < cmd->host->can_queue; x++) {
......@@ -514,21 +486,17 @@ int eata_pio_reset(Scsi_Cmnd * cmd, unsigned int dummy)
printk(KERN_WARNING "eata_pio_reset: reset ccb %d.\n",x);
HD(cmd)->ccb[x].status = FREE;
restore_flags(flags);
sp->scsi_done(sp);
cli();
}
HD(cmd)->state = FALSE;
restore_flags(flags);
spin_unlock_irqrestore(cmd->host->host_lock, flags);
if (success) { /* hmmm... */
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, success.\n"));
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
return (SCSI_RESET_SUCCESS);
} else {
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: exit, wakeup.\n"));
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
return (SCSI_RESET_PUNT);
}
}
......@@ -643,7 +611,6 @@ void print_pio_config(struct get_conf *gc)
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);
DBG(DPT_DEBUG, DELAY(14));
}
static uint print_selftest(uint base)
......@@ -949,9 +916,6 @@ int eata_pio_detect(Scsi_Host_Template * tpnt)
struct get_conf gc;
int i;
DBG((DBG_PROBE && DBG_DELAY) || DPT_DEBUG,
printk("Using lots of delays to let you read the debugging output\n"));
tpnt->proc_name = "eata_pio";
find_pio_PCI(&gc, tpnt);
......@@ -989,8 +953,6 @@ int eata_pio_detect(Scsi_Host_Template * tpnt)
HBA_ptr = SD(HBA_ptr)->next;
}
}
DBG(DPT_DEBUG,DELAY(12));
return (registered_HBAs);
}
......
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