Commit e3e092b7 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] seagate iomem annotations, cleanup and isa_-ectomy

 * switched to ioremap()
 * switched to normal iomem operations
 * killed a bunch of phys_to_virt()
 * killed open-coded (and inferior) instances of memcpy_toio()/memcpy_fromio().
 * fixed a dumb typo introduced in "kill off isa_check_signature()"
   patch (sorry - missed the fact that it was not covered by
   allmodconfig and didn't verify until after sending the patch in
   question ;-/). 
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c11e5992
...@@ -237,13 +237,13 @@ static unsigned int base_address = 0; /* Where the card ROM starts, used to ...@@ -237,13 +237,13 @@ static unsigned int base_address = 0; /* Where the card ROM starts, used to
calculate memory mapped register calculate memory mapped register
location. */ location. */
static unsigned long st0x_cr_sr; /* control register write, status static void __iomem *st0x_cr_sr; /* control register write, status
register read. 256 bytes in register read. 256 bytes in
length. length.
Read is status of SCSI BUS, as per Read is status of SCSI BUS, as per
STAT masks. */ STAT masks. */
static unsigned long st0x_dr; /* data register, read write 256 static void __iomem *st0x_dr; /* data register, read write 256
bytes in length. */ bytes in length. */
static volatile int st0x_aborted = 0; /* set when we are aborted, ie by a static volatile int st0x_aborted = 0; /* set when we are aborted, ie by a
...@@ -261,10 +261,10 @@ MODULE_LICENSE("GPL"); ...@@ -261,10 +261,10 @@ MODULE_LICENSE("GPL");
#define retcode(result) (((result) << 16) | (message << 8) | status) #define retcode(result) (((result) << 16) | (message << 8) | status)
#define STATUS ((u8) isa_readb(st0x_cr_sr)) #define STATUS ((u8) readb(st0x_cr_sr))
#define DATA ((u8) isa_readb(st0x_dr)) #define DATA ((u8) readb(st0x_dr))
#define WRITE_CONTROL(d) { isa_writeb((d), st0x_cr_sr); } #define WRITE_CONTROL(d) { writeb((d), st0x_cr_sr); }
#define WRITE_DATA(d) { isa_writeb((d), st0x_dr); } #define WRITE_DATA(d) { writeb((d), st0x_dr); }
#ifndef OVERRIDE #ifndef OVERRIDE
static unsigned int seagate_bases[] = { static unsigned int seagate_bases[] = {
...@@ -420,6 +420,7 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt) ...@@ -420,6 +420,7 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt)
{ {
struct Scsi_Host *instance; struct Scsi_Host *instance;
int i, j; int i, j;
unsigned long cr, dr;
tpnt->proc_name = "seagate"; tpnt->proc_name = "seagate";
/* /*
...@@ -455,7 +456,7 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt) ...@@ -455,7 +456,7 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt)
*/ */
for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i) { for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i) {
void __iomem *p = ioremap(seagate_base[i], 0x2000); void __iomem *p = ioremap(seagate_bases[i], 0x2000);
if (!p) if (!p)
continue; continue;
for (j = 0; j < NUM_SIGNATURES; ++j) for (j = 0; j < NUM_SIGNATURES; ++j)
...@@ -477,11 +478,13 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt) ...@@ -477,11 +478,13 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt)
return 0; return 0;
} }
st0x_cr_sr = base_address + (controller_type == SEAGATE ? 0x1a00 : 0x1c00); cr = base_address + (controller_type == SEAGATE ? 0x1a00 : 0x1c00);
st0x_dr = st0x_cr_sr + 0x200; dr = cr + 0x200;
st0x_cr_sr = ioremap(cr, 0x100);
st0x_dr = ioremap(dr, 0x100);
DANY("%s detected. Base address = %x, cr = %x, dr = %x\n", DANY("%s detected. Base address = %x, cr = %x, dr = %x\n",
tpnt->name, base_address, st0x_cr_sr, st0x_dr); tpnt->name, base_address, cr, dr);
/* /*
* At all times, we will use IRQ 5. Should also check for IRQ3 * At all times, we will use IRQ 5. Should also check for IRQ3
...@@ -1146,7 +1149,7 @@ static int internal_command (unsigned char target, unsigned char lun, ...@@ -1146,7 +1149,7 @@ static int internal_command (unsigned char target, unsigned char lun,
#endif #endif
"loop 1b;" "loop 1b;"
/* output */ : /* output */ :
/* input */ :"D" (phys_to_virt (st0x_dr)), /* input */ :"D" (st0x_dr),
"S" "S"
(data), (data),
"c" (SCint->transfersize) "c" (SCint->transfersize)
...@@ -1154,19 +1157,7 @@ static int internal_command (unsigned char target, unsigned char lun, ...@@ -1154,19 +1157,7 @@ static int internal_command (unsigned char target, unsigned char lun,
: "eax", "ecx", : "eax", "ecx",
"esi"); "esi");
#else /* SEAGATE_USE_ASM */ #else /* SEAGATE_USE_ASM */
{ memcpy_toio(st0x_dr, data, transfersize);
#ifdef FAST32
unsigned int *iop = phys_to_virt (st0x_dr);
const unsigned int *dp =(unsigned int *) data;
int xferlen = transfersize >> 2;
#else
unsigned char *iop = phys_to_virt (st0x_dr);
const unsigned char *dp = data;
int xferlen = transfersize;
#endif
for (; xferlen; --xferlen)
*iop = *dp++;
}
#endif /* SEAGATE_USE_ASM */ #endif /* SEAGATE_USE_ASM */
/* SJT: End */ /* SJT: End */
len -= transfersize; len -= transfersize;
...@@ -1218,10 +1209,8 @@ static int internal_command (unsigned char target, unsigned char lun, ...@@ -1218,10 +1209,8 @@ static int internal_command (unsigned char target, unsigned char lun,
"=D" (__dummy_2) "=D" (__dummy_2)
/* input */ /* input */
: "0" (data), "1" (len), : "0" (data), "1" (len),
"2" (phys_to_virt "2" (st0x_cr_sr),
(st0x_cr_sr)), "3" (st0x_dr)
"3" (phys_to_virt
(st0x_dr))
/* clobbered */ /* clobbered */
: "eax"); : "eax");
#else /* SEAGATE_USE_ASM */ #else /* SEAGATE_USE_ASM */
...@@ -1298,7 +1287,7 @@ static int internal_command (unsigned char target, unsigned char lun, ...@@ -1298,7 +1287,7 @@ static int internal_command (unsigned char target, unsigned char lun,
#endif #endif
"loop 1b\n\t" "loop 1b\n\t"
/* output */ : /* output */ :
/* input */ :"S" (phys_to_virt (st0x_dr)), /* input */ :"S" (st0x_dr),
"D" "D"
(data), (data),
"c" (SCint->transfersize) "c" (SCint->transfersize)
...@@ -1306,22 +1295,7 @@ static int internal_command (unsigned char target, unsigned char lun, ...@@ -1306,22 +1295,7 @@ static int internal_command (unsigned char target, unsigned char lun,
: "eax", "ecx", : "eax", "ecx",
"edi"); "edi");
#else /* SEAGATE_USE_ASM */ #else /* SEAGATE_USE_ASM */
{ memcpy_fromio(data, st0x_dr, len);
#ifdef FAST32
const unsigned int *iop =
phys_to_virt (st0x_dr);
unsigned int *dp =
(unsigned int *) data;
int xferlen = len >> 2;
#else
const unsigned char *iop =
phys_to_virt (st0x_dr);
unsigned char *dp = data;
int xferlen = len;
#endif
for (; xferlen; --xferlen)
*dp++ = *iop;
}
#endif /* SEAGATE_USE_ASM */ #endif /* SEAGATE_USE_ASM */
/* SJT: End */ /* SJT: End */
len -= transfersize; len -= transfersize;
...@@ -1387,10 +1361,8 @@ static int internal_command (unsigned char target, unsigned char lun, ...@@ -1387,10 +1361,8 @@ static int internal_command (unsigned char target, unsigned char lun,
"=b" (__dummy_4) "=b" (__dummy_4)
/* input */ /* input */
: "0" (data), "1" (len), : "0" (data), "1" (len),
"2" (phys_to_virt "2" (st0x_cr_sr),
(st0x_cr_sr)), "3" (st0x_dr)
"3" (phys_to_virt
(st0x_dr))
/* clobbered */ /* clobbered */
: "eax"); : "eax");
#else /* SEAGATE_USE_ASM */ #else /* SEAGATE_USE_ASM */
......
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