Commit 8ecb25b5 authored by Alan Cox's avatar Alan Cox Committed by Dave Jones

[PATCH] 2.5.46 - aha1740 update

parent d39111ed
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
* *
* aha1740_makecode may still need even more work * aha1740_makecode may still need even more work
* if it doesn't work for your devices, take a look. * if it doesn't work for your devices, take a look.
*
* Reworked for new_eh and new locking by Alan Cox <alan@redhat.com>
*
* 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.
*/ */
#include <linux/module.h> #include <linux/module.h>
...@@ -68,7 +76,7 @@ static spinlock_t aha1740_lock = SPIN_LOCK_UNLOCKED; ...@@ -68,7 +76,7 @@ static spinlock_t aha1740_lock = SPIN_LOCK_UNLOCKED;
/* One for each IRQ level (9-15) */ /* One for each IRQ level (9-15) */
static struct Scsi_Host * aha_host[8] = {NULL, }; static struct Scsi_Host * aha_host[8] = {NULL, };
int aha1740_proc_info(char *buffer, char **start, off_t offset, static int aha1740_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int inout) int length, int hostno, int inout)
{ {
int len; int len;
...@@ -76,7 +84,7 @@ int aha1740_proc_info(char *buffer, char **start, off_t offset, ...@@ -76,7 +84,7 @@ int aha1740_proc_info(char *buffer, char **start, off_t offset,
struct aha1740_hostdata *host; struct aha1740_hostdata *host;
if (inout) if (inout)
return(-ENOSYS); return-ENOSYS;
for (len = 0; len < 8; len++) { for (len = 0; len < 8; len++) {
shpnt = aha_host[len]; shpnt = aha_host[len];
...@@ -103,7 +111,7 @@ int aha1740_proc_info(char *buffer, char **start, off_t offset, ...@@ -103,7 +111,7 @@ int aha1740_proc_info(char *buffer, char **start, off_t offset,
} }
int aha1740_makecode(unchar *sense, unchar *status) static int aha1740_makecode(unchar *sense, unchar *status)
{ {
struct statusword struct statusword
{ {
...@@ -179,7 +187,7 @@ int aha1740_makecode(unchar *sense, unchar *status) ...@@ -179,7 +187,7 @@ int aha1740_makecode(unchar *sense, unchar *status)
return status[3] | retval << 16; return status[3] | retval << 16;
} }
int aha1740_test_port(unsigned int base) static int aha1740_test_port(unsigned int base)
{ {
char name[4], tmp; char name[4], tmp;
...@@ -212,7 +220,7 @@ int aha1740_test_port(unsigned int base) ...@@ -212,7 +220,7 @@ int aha1740_test_port(unsigned int base)
} }
/* A "high" level interrupt handler */ /* A "high" level interrupt handler */
void aha1740_intr_handle(int irq, void *dev_id, struct pt_regs * regs) static void aha1740_intr_handle(int irq, void *dev_id, struct pt_regs * regs)
{ {
struct Scsi_Host *host = aha_host[irq - 9]; struct Scsi_Host *host = aha_host[irq - 9];
void (*my_done)(Scsi_Cmnd *); void (*my_done)(Scsi_Cmnd *);
...@@ -303,7 +311,7 @@ void aha1740_intr_handle(int irq, void *dev_id, struct pt_regs * regs) ...@@ -303,7 +311,7 @@ void aha1740_intr_handle(int irq, void *dev_id, struct pt_regs * regs)
spin_unlock_irqrestore(host->host_lock, flags); spin_unlock_irqrestore(host->host_lock, flags);
} }
int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
{ {
unchar direction; unchar direction;
unchar *cmd = (unchar *) SCpnt->cmnd; unchar *cmd = (unchar *) SCpnt->cmnd;
...@@ -317,16 +325,6 @@ int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *)) ...@@ -317,16 +325,6 @@ int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
if(*cmd == REQUEST_SENSE) if(*cmd == REQUEST_SENSE)
{ {
#if 0
/* scsi_request_sense() provides a buffer of size 256,
so there is no reason to expect equality */
if (bufflen != sizeof(SCpnt->sense_buffer))
{
printk("Wrong buffer length supplied for request sense (%d)\n",
bufflen);
}
#endif
SCpnt->result = 0; SCpnt->result = 0;
done(SCpnt); done(SCpnt);
return 0; return 0;
...@@ -486,7 +484,7 @@ static void internal_done(Scsi_Cmnd * SCpnt) ...@@ -486,7 +484,7 @@ static void internal_done(Scsi_Cmnd * SCpnt)
SCpnt->SCp.Status++; SCpnt->SCp.Status++;
} }
int aha1740_command(Scsi_Cmnd * SCpnt) static int aha1740_command(Scsi_Cmnd * SCpnt)
{ {
aha1740_queuecommand(SCpnt, internal_done); aha1740_queuecommand(SCpnt, internal_done);
SCpnt->SCp.Status = 0; SCpnt->SCp.Status = 0;
...@@ -501,7 +499,7 @@ int aha1740_command(Scsi_Cmnd * SCpnt) ...@@ -501,7 +499,7 @@ int aha1740_command(Scsi_Cmnd * SCpnt)
/* Query the board for its irq_level. Nothing else matters /* Query the board for its irq_level. Nothing else matters
in enhanced mode on an EISA bus. */ in enhanced mode on an EISA bus. */
void aha1740_getconfig(unsigned int base, unsigned int *irq_level, static void aha1740_getconfig(unsigned int base, unsigned int *irq_level,
unsigned int *translation) unsigned int *translation)
{ {
static int intab[] = { 9, 10, 11, 12, 0, 14, 15, 0 }; static int intab[] = { 9, 10, 11, 12, 0, 14, 15, 0 };
...@@ -511,7 +509,7 @@ void aha1740_getconfig(unsigned int base, unsigned int *irq_level, ...@@ -511,7 +509,7 @@ void aha1740_getconfig(unsigned int base, unsigned int *irq_level,
outb(inb(INTDEF(base)) | 0x10, INTDEF(base)); outb(inb(INTDEF(base)) | 0x10, INTDEF(base));
} }
int aha1740_detect(Scsi_Host_Template * tpnt) static int aha1740_detect(Scsi_Host_Template * tpnt)
{ {
int count = 0, slot; int count = 0, slot;
...@@ -540,8 +538,8 @@ int aha1740_detect(Scsi_Host_Template * tpnt) ...@@ -540,8 +538,8 @@ int aha1740_detect(Scsi_Host_Template * tpnt)
outb(G2CNTRL_HRST, G2CNTRL(slotbase)); outb(G2CNTRL_HRST, G2CNTRL(slotbase));
outb(0, G2CNTRL(slotbase)); outb(0, G2CNTRL(slotbase));
} }
printk("Configuring aha174x at IO:%x, IRQ %d\n", slotbase, irq_level); printk(KERN_INFO "Configuring aha174x at IO:%x, IRQ %d\n", slotbase, irq_level);
printk("aha174x: Extended translation %sabled.\n", printk(KERN_INFO "aha174x: Extended translation %sabled.\n",
translation ? "en" : "dis"); translation ? "en" : "dis");
DEB(printk("aha1740_detect: enable interrupt channel %d\n",irq_level)); DEB(printk("aha1740_detect: enable interrupt channel %d\n",irq_level));
if (request_irq(irq_level,aha1740_intr_handle,0,"aha1740",NULL)) { if (request_irq(irq_level,aha1740_intr_handle,0,"aha1740",NULL)) {
...@@ -572,31 +570,7 @@ int aha1740_detect(Scsi_Host_Template * tpnt) ...@@ -572,31 +570,7 @@ int aha1740_detect(Scsi_Host_Template * tpnt)
return count; return count;
} }
/* Note: They following two functions do not apply very well to the Adaptec, static int aha1740_biosparam(struct scsi_device *sdev, struct block_device *dev,
which basically manages its own affairs quite well without our interference,
so I haven't put anything into them. I can faintly imagine someone with a
*very* badly behaved SCSI target (perhaps an old tape?) wanting the abort(),
but it hasn't happened yet, and doing aborts brings the Adaptec to its
knees. I cannot (at this moment in time) think of any reason to reset the
card once it's running. So there. */
int aha1740_abort(Scsi_Cmnd * SCpnt)
{
DEB(printk("aha1740_abort called\n"));
return SCSI_ABORT_SNOOZE;
}
/* We do not implement a reset function here, but the upper level code assumes
that it will get some kind of response for the command in SCpnt. We must
oblige, or the command will hang the scsi system */
int aha1740_reset(Scsi_Cmnd * SCpnt, unsigned int ignored)
{
DEB(printk("aha1740_reset called\n"));
return SCSI_RESET_PUNT;
}
int aha1740_biosparam(struct scsi_device *sdev, struct block_device *dev,
sector_t capacity, int* ip) sector_t capacity, int* ip)
{ {
int size = capacity; int size = capacity;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
/* Eisa Enhanced mode operation - slot locating and addressing */ /* Eisa Enhanced mode operation - slot locating and addressing */
#define MINEISA 1 /* I don't have an EISA Spec to know these ranges, so I */ #define MINEISA 1 /* I don't have an EISA Spec to know these ranges, so I */
#define MAXEISA 8 /* Just took my machine's specifications. Adjust to fit.*/ #define MAXEISA 8 /* Just took my machine's specifications. Adjust to fit. */
/* I just saw an ad, and bumped this from 6 to 8 */ /* I just saw an ad, and bumped this from 6 to 8 */
#define SLOTBASE(x) ((x << 12) + 0xc80) #define SLOTBASE(x) ((x << 12) + 0xc80)
#define SLOTSIZE 0x5c #define SLOTSIZE 0x5c
...@@ -124,7 +124,7 @@ struct ecb { /* Enhanced Control Block 6.1 */ ...@@ -124,7 +124,7 @@ struct ecb { /* Enhanced Control Block 6.1 */
dir:1, /* Direction of transfer 1 = datain */ dir:1, /* Direction of transfer 1 = datain */
st:1, /* Suppress Transfer */ st:1, /* Suppress Transfer */
chk:1, /* Calculate Checksum */ chk:1, /* Calculate Checksum */
:2, rec:1, :1; /* Error Recovery */ :2, rec:1,:1; /* Error Recovery */
u16 nil0; /* nothing */ u16 nil0; /* nothing */
u32 dataptr; /* Data or Scatter List ptr */ u32 dataptr; /* Data or Scatter List ptr */
u32 datalen; /* Data or Scatter List len */ u32 datalen; /* Data or Scatter List len */
...@@ -140,7 +140,7 @@ struct ecb { /* Enhanced Control Block 6.1 */ ...@@ -140,7 +140,7 @@ struct ecb { /* Enhanced Control Block 6.1 */
u8 sense[MAX_SENSE]; /* Sense area */ u8 sense[MAX_SENSE]; /* Sense area */
u8 status[MAX_STATUS]; /* Status area */ u8 status[MAX_STATUS]; /* Status area */
Scsi_Cmnd *SCpnt; /* Link to the SCSI Command Block */ Scsi_Cmnd *SCpnt; /* Link to the SCSI Command Block */
void (*done)(Scsi_Cmnd *); /* Completion Function */ void (*done) (Scsi_Cmnd *); /* Completion Function */
}; };
#define AHA1740CMD_NOP 0x00 /* No OP */ #define AHA1740CMD_NOP 0x00 /* No OP */
...@@ -152,32 +152,22 @@ struct ecb { /* Enhanced Control Block 6.1 */ ...@@ -152,32 +152,22 @@ struct ecb { /* Enhanced Control Block 6.1 */
#define AHA1740CMD_RINQ 0x0a /* Read Host Adapter Inquiry Data */ #define AHA1740CMD_RINQ 0x0a /* Read Host Adapter Inquiry Data */
#define AHA1740CMD_TARG 0x10 /* Target SCSI Command */ #define AHA1740CMD_TARG 0x10 /* Target SCSI Command */
int aha1740_detect(Scsi_Host_Template *); static int aha1740_detect(Scsi_Host_Template *);
int aha1740_command(Scsi_Cmnd *); static int aha1740_command(Scsi_Cmnd *);
int aha1740_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); static int aha1740_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
int aha1740_abort(Scsi_Cmnd *); static int aha1740_biosparam(struct scsi_device *, struct block_device *, sector_t, int *);
int aha1740_reset(Scsi_Cmnd *, unsigned int); static int aha1740_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout);
int aha1740_biosparam(struct scsi_device *, struct block_device *,
sector_t, int*);
int aha1740_proc_info(char *buffer, char **start, off_t offset,
int length, int hostno, int inout);
#define AHA1740_ECBS 32 #define AHA1740_ECBS 32
#define AHA1740_SCATTER 16 #define AHA1740_SCATTER 16
#define AHA1740_CMDLUN 1 #define AHA1740_CMDLUN 1
#ifndef NULL
#define NULL 0
#endif
#define AHA1740 { proc_name: "aha1740", \ #define AHA1740 { proc_name: "aha1740", \
proc_info: aha1740_proc_info, \ proc_info: aha1740_proc_info, \
name: "Adaptec 174x (EISA)", \ name: "Adaptec 174x (EISA)", \
detect: aha1740_detect, \ detect: aha1740_detect, \
command: aha1740_command, \ command: aha1740_command, \
queuecommand: aha1740_queuecommand, \ queuecommand: aha1740_queuecommand, \
abort: aha1740_abort, \
reset: aha1740_reset, \
bios_param: aha1740_biosparam, \ bios_param: aha1740_biosparam, \
can_queue: AHA1740_ECBS, \ can_queue: AHA1740_ECBS, \
this_id: 7, \ this_id: 7, \
......
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