aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/eata_pio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/eata_pio.c')
-rw-r--r--drivers/scsi/eata_pio.c100
1 files changed, 45 insertions, 55 deletions
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index f33ad01064a9..96180bb47e41 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -107,59 +107,44 @@ static struct scsi_host_template driver_template;
107static int eata_pio_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, 107static int eata_pio_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset,
108 int length, int rw) 108 int length, int rw)
109{ 109{
110 static u8 buff[512]; 110 int len = 0;
111 int size, len = 0; 111 off_t begin = 0, pos = 0;
112 off_t begin = 0, pos = 0;
113 112
114 if (rw) 113 if (rw)
115 return -ENOSYS; 114 return -ENOSYS;
116 if (offset == 0)
117 memset(buff, 0, sizeof(buff));
118 115
119 size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: " 116 len += sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: "
120 "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB); 117 "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
121 len += size; pos = begin + len; 118 len += sprintf(buffer + len, "queued commands: %10ld\n"
122 size = sprintf(buffer + len, "queued commands: %10ld\n"
123 "processed interrupts:%10ld\n", queue_counter, int_counter); 119 "processed interrupts:%10ld\n", queue_counter, int_counter);
124 len += size; pos = begin + len; 120 len += sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
125
126 size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
127 shost->host_no, SD(shost)->name); 121 shost->host_no, SD(shost)->name);
128 len += size; 122 len += sprintf(buffer + len, "Firmware revision: v%s\n",
129 pos = begin + len;
130 size = sprintf(buffer + len, "Firmware revision: v%s\n",
131 SD(shost)->revision); 123 SD(shost)->revision);
132 len += size; 124 len += sprintf(buffer + len, "IO: PIO\n");
133 pos = begin + len; 125 len += sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base);
134 size = sprintf(buffer + len, "IO: PIO\n"); 126 len += sprintf(buffer + len, "Host Bus: %s\n",
135 len += size;
136 pos = begin + len;
137 size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base);
138 len += size;
139 pos = begin + len;
140 size = sprintf(buffer + len, "Host Bus: %s\n",
141 (SD(shost)->bustype == 'P')?"PCI ": 127 (SD(shost)->bustype == 'P')?"PCI ":
142 (SD(shost)->bustype == 'E')?"EISA":"ISA "); 128 (SD(shost)->bustype == 'E')?"EISA":"ISA ");
143 129
144 len += size; 130 pos = begin + len;
145 pos = begin + len;
146 131
147 if (pos < offset) { 132 if (pos < offset) {
148 len = 0; 133 len = 0;
149 begin = pos; 134 begin = pos;
150 } 135 }
151 if (pos > offset + length) 136 if (pos > offset + length)
152 goto stop_output; 137 goto stop_output;
153 138
154 stop_output: 139stop_output:
155 DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len)); 140 DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
156 *start=buffer+(offset-begin); /* Start of wanted data */ 141 *start = buffer + (offset - begin); /* Start of wanted data */
157 len-=(offset-begin); /* Start slop */ 142 len -= (offset - begin); /* Start slop */
158 if(len>length) 143 if (len > length)
159 len = length; /* Ending slop */ 144 len = length; /* Ending slop */
160 DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len)); 145 DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
161 146
162 return (len); 147 return len;
163} 148}
164 149
165static int eata_pio_release(struct Scsi_Host *sh) 150static int eata_pio_release(struct Scsi_Host *sh)
@@ -390,7 +375,7 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
390 375
391 DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd, 376 DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd,
392 "eata_pio_queue pid %ld, y %d\n", 377 "eata_pio_queue pid %ld, y %d\n",
393 cmd->pid, y)); 378 cmd->serial_number, y));
394 379
395 cmd->scsi_done = (void *) done; 380 cmd->scsi_done = (void *) done;
396 381
@@ -435,10 +420,10 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
435 cmd->result = DID_BUS_BUSY << 16; 420 cmd->result = DID_BUS_BUSY << 16;
436 scmd_printk(KERN_NOTICE, cmd, 421 scmd_printk(KERN_NOTICE, cmd,
437 "eata_pio_queue pid %ld, HBA busy, " 422 "eata_pio_queue pid %ld, HBA busy, "
438 "returning DID_BUS_BUSY, done.\n", cmd->pid); 423 "returning DID_BUS_BUSY, done.\n", cmd->serial_number);
439 done(cmd); 424 done(cmd);
440 cp->status = FREE; 425 cp->status = FREE;
441 return (0); 426 return 0;
442 } 427 }
443 /* FIXME: timeout */ 428 /* FIXME: timeout */
444 while (!(inb(base + HA_RSTATUS) & HA_SDRQ)) 429 while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
@@ -450,9 +435,9 @@ static int eata_pio_queue(struct scsi_cmnd *cmd,
450 435
451 DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd, 436 DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd,
452 "Queued base %#.4lx pid: %ld " 437 "Queued base %#.4lx pid: %ld "
453 "slot %d irq %d\n", sh->base, cmd->pid, y, sh->irq)); 438 "slot %d irq %d\n", sh->base, cmd->serial_number, y, sh->irq));
454 439
455 return (0); 440 return 0;
456} 441}
457 442
458static int eata_pio_abort(struct scsi_cmnd *cmd) 443static int eata_pio_abort(struct scsi_cmnd *cmd)
@@ -461,7 +446,7 @@ static int eata_pio_abort(struct scsi_cmnd *cmd)
461 446
462 DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd, 447 DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
463 "eata_pio_abort called pid: %ld\n", 448 "eata_pio_abort called pid: %ld\n",
464 cmd->pid)); 449 cmd->serial_number));
465 450
466 while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY) 451 while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY)
467 if (--loop == 0) { 452 if (--loop == 0) {
@@ -497,7 +482,7 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
497 482
498 DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd, 483 DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
499 "eata_pio_reset called pid:%ld\n", 484 "eata_pio_reset called pid:%ld\n",
500 cmd->pid)); 485 cmd->serial_number));
501 486
502 spin_lock_irq(host->host_lock); 487 spin_lock_irq(host->host_lock);
503 488
@@ -516,7 +501,7 @@ static int eata_pio_host_reset(struct scsi_cmnd *cmd)
516 501
517 sp = HD(cmd)->ccb[x].cmd; 502 sp = HD(cmd)->ccb[x].cmd;
518 HD(cmd)->ccb[x].status = RESET; 503 HD(cmd)->ccb[x].status = RESET;
519 printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x, sp->pid); 504 printk(KERN_WARNING "eata_pio_reset: slot %d in reset, pid %ld.\n", x, sp->serial_number);
520 505
521 if (sp == NULL) 506 if (sp == NULL)
522 panic("eata_pio_reset: slot %d, sp==NULL.\n", x); 507 panic("eata_pio_reset: slot %d, sp==NULL.\n", x);
@@ -589,23 +574,28 @@ static char *get_pio_board_data(unsigned long base, unsigned int irq, unsigned i
589 cp.cp_cdb[5] = 0; 574 cp.cp_cdb[5] = 0;
590 575
591 if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP)) 576 if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP))
592 return (NULL); 577 return NULL;
593 while (!(inb(base + HA_RSTATUS) & HA_SDRQ)); 578
579 while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
580 cpu_relax();
581
594 outsw(base + HA_RDATA, &cp, cplen); 582 outsw(base + HA_RDATA, &cp, cplen);
595 outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND); 583 outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND);
596 for (z = 0; z < cppadlen; z++) 584 for (z = 0; z < cppadlen; z++)
597 outw(0, base + HA_RDATA); 585 outw(0, base + HA_RDATA);
598 586
599 while (inb(base + HA_RSTATUS) & HA_SBUSY); 587 while (inb(base + HA_RSTATUS) & HA_SBUSY)
588 cpu_relax();
589
600 if (inb(base + HA_RSTATUS) & HA_SERROR) 590 if (inb(base + HA_RSTATUS) & HA_SERROR)
601 return (NULL); 591 return NULL;
602 else if (!(inb(base + HA_RSTATUS) & HA_SDRQ)) 592 else if (!(inb(base + HA_RSTATUS) & HA_SDRQ))
603 return (NULL); 593 return NULL;
604 else { 594 else {
605 insw(base + HA_RDATA, &buff, 127); 595 insw(base + HA_RDATA, &buff, 127);
606 while (inb(base + HA_RSTATUS) & HA_SDRQ) 596 while (inb(base + HA_RSTATUS) & HA_SDRQ)
607 inw(base + HA_RDATA); 597 inw(base + HA_RDATA);
608 return (buff); 598 return buff;
609 } 599 }
610} 600}
611 601