]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] isa_check_signature() finally gone
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Sat, 27 Nov 2004 13:58:05 +0000 (05:58 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 27 Nov 2004 13:58:05 +0000 (05:58 -0800)
last callers of isa_check_signature() switched to ioremap() +
check_signature()

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
13 files changed:
drivers/block/xd.c
drivers/scsi/aha152x.c
drivers/scsi/dtc.c
drivers/scsi/fdomain.c
drivers/scsi/seagate.c
drivers/scsi/t128.c
include/asm-alpha/io.h
include/asm-arm/io.h
include/asm-i386/io.h
include/asm-m32r/io.h
include/asm-mips/io.h
include/asm-ppc/io.h
include/asm-x86_64/io.h

index 5ca834fcdeec705d6586fd60c61ffc0305ef392c..e78a177c22fe43089440c61aacfa4c38b3d3057e 100644 (file)
@@ -266,7 +266,7 @@ Enomem:
 /* xd_detect: scan the possible BIOS ROM locations for the signature strings */
 static u_char __init xd_detect (u_char *controller, unsigned int *address)
 {
-       u_char i,j,found = 0;
+       int i, j;
 
        if (xd_override)
        {
@@ -275,15 +275,23 @@ static u_char __init xd_detect (u_char *controller, unsigned int *address)
                return(1);
        }
 
-       for (i = 0; i < (sizeof(xd_bases) / sizeof(xd_bases[0])) && !found; i++)
-               for (j = 1; j < (sizeof(xd_sigs) / sizeof(xd_sigs[0])) && !found; j++)
-                       if (isa_check_signature(xd_bases[i] + xd_sigs[j].offset,xd_sigs[j].string,strlen(xd_sigs[j].string))) {
+       for (i = 0; i < (sizeof(xd_bases) / sizeof(xd_bases[0])); i++) {
+               void __iomem *p = ioremap(xd_bases[i], 0x2000);
+               if (!p)
+                       continue;
+               for (j = 1; j < (sizeof(xd_sigs) / sizeof(xd_sigs[0])); j++) {
+                       const char *s = xd_sigs[j].string;
+                       if (check_signature(p + xd_sigs[j].offset, s, strlen(s))) {
                                *controller = j;
                                xd_type = j;
                                *address = xd_bases[i];
-                               found++;
+                               iounmap(p);
+                               return 1;
                        }
-       return (found);
+               }
+               iounmap(p);
+       }
+       return 0;
 }
 
 /* do_xd_request: handle an incoming request */
index d11f86948afe2f144bbe9eeb1f30f7518c334b57..50cb2be49e1bb4d74be547b6f95a955819e0893e 100644 (file)
@@ -3830,10 +3830,15 @@ static int __init aha152x_init(void)
        if (setup_count<ARRAY_SIZE(setup)) {
 #if !defined(SKIP_BIOSTEST)
                ok = 0;
-               for (i = 0; i < ARRAY_SIZE(addresses) && !ok; i++)
+               for (i = 0; i < ARRAY_SIZE(addresses) && !ok; i++) {
+                       void __iomem *p = ioremap(addresses[i], 0x4000);
+                       if (!p)
+                               continue;
                        for (j = 0; j<ARRAY_SIZE(signatures) && !ok; j++)
-                               ok = isa_check_signature(addresses[i] + signatures[j].sig_offset,
+                               ok = check_signature(p + signatures[j].sig_offset,
                                                                signatures[j].signature, signatures[j].sig_length);
+                       iounmap(p);
+               }
                if (!ok && setup_count == 0)
                        return 0;
 
index 6611113a2b8731f6cc3292adda25898bfc214455..0febaf43af22a3bf83b49c1e3ccb88c73cb06e8f 100644 (file)
@@ -232,17 +232,25 @@ static int __init dtc_detect(Scsi_Host_Template * tpnt)
                        base = overrides[current_override].address;
                else
                        for (; !base && (current_base < NO_BASES); ++current_base) {
+                               void __iomem *p;
 #if (DTCDEBUG & DTCDEBUG_INIT)
                                printk("scsi-dtc : probing address %08x\n", bases[current_base].address);
 #endif
-                               for (sig = 0; sig < NO_SIGNATURES; ++sig)
-                                       if (!bases[current_base].noauto && isa_check_signature(bases[current_base].address + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) {
+                               if (bases[current_base].noauto)
+                                       continue;
+                               p = ioremap(bases[current_base].address, 0x2000);
+                               if (!p)
+                                       continue;
+                               for (sig = 0; sig < NO_SIGNATURES; ++sig) {
+                                       if (check_signature(p + signatures[sig].offset, signatures[sig].string, strlen(signatures[sig].string))) {
                                                base = bases[current_base].address;
 #if (DTCDEBUG & DTCDEBUG_INIT)
                                                printk("scsi-dtc : detected board.\n");
 #endif
                                                break;
                                        }
+                               }
+                               iounmap(p);
                        }
 
 #if defined(DTCDEBUG) && (DTCDEBUG & DTCDEBUG_INIT)
index 851be61c174f6b626182e8fd704226f55a06d2b5..075312fcc3f47cbbff0a020bc6757ba0fcd1cf27 100644 (file)
@@ -384,6 +384,7 @@ enum out_port_type {
 /* .bss will zero all the static variables below */
 static int               port_base;
 static unsigned long     bios_base;
+static void __iomem *    bios_mem;
 static int               bios_major;
 static int               bios_minor;
 static int               PCI_bus;
@@ -676,12 +677,15 @@ static int fdomain_isa_detect( int *irq, int *iobase )
    printk( "scsi: <fdomain> fdomain_isa_detect:" );
 #endif
 
-   for (i = 0; !bios_base && i < ADDRESS_COUNT; i++) {
+   for (i = 0; i < ADDRESS_COUNT; i++) {
+      void __iomem *p = ioremap(addresses[i], 0x2000);
+      if (!p)
+       continue;
 #if DEBUG_DETECT
       printk( " %lx(%lx),", addresses[i], bios_base );
 #endif
-      for (j = 0; !bios_base && j < SIGNATURE_COUNT; j++) {
-        if (isa_check_signature(addresses[i] + signatures[j].sig_offset,
+      for (j = 0; j < SIGNATURE_COUNT; j++) {
+        if (check_signature(p + signatures[j].sig_offset,
                             signatures[j].signature,
                             signatures[j].sig_length )) {
            bios_major = signatures[j].major_bios_version;
@@ -689,10 +693,14 @@ static int fdomain_isa_detect( int *irq, int *iobase )
            PCI_bus    = (signatures[j].flag == 1);
            Quantum    = (signatures[j].flag > 1) ? signatures[j].flag : 0;
            bios_base  = addresses[i];
+           bios_mem   = p;
+           goto found;
         }
       }
+      iounmap(p);
    }
-   
+found:
    if (bios_major == 2) {
       /* The TMC-1660/TMC-1680 has a RAM area just after the BIOS ROM.
         Assuming the ROM is enabled (otherwise we wouldn't have been
@@ -705,13 +713,13 @@ static int fdomain_isa_detect( int *irq, int *iobase )
       switch (Quantum) {
       case 2:                  /* ISA_200S */
       case 3:                  /* ISA_250MG */
-        base = isa_readb(bios_base + 0x1fa2) + (isa_readb(bios_base + 0x1fa3) << 8);
+        base = readb(bios_mem + 0x1fa2) + (readb(bios_mem + 0x1fa3) << 8);
         break;
       case 4:                  /* ISA_200S (another one) */
-        base = isa_readb(bios_base + 0x1fa3) + (isa_readb(bios_base + 0x1fa4) << 8);
+        base = readb(bios_mem + 0x1fa3) + (readb(bios_mem + 0x1fa4) << 8);
         break;
       default:
-        base = isa_readb(bios_base + 0x1fcc) + (isa_readb(bios_base + 0x1fcd) << 8);
+        base = readb(bios_mem + 0x1fcc) + (readb(bios_mem + 0x1fcd) << 8);
         break;
       }
    
@@ -1611,26 +1619,26 @@ static int fdomain_16x0_biosparam(struct scsi_device *sdev,
       case 2:                  /* ISA_200S */
                                /* The value of 25 has never been verified.
                                   It should probably be 15. */
-        offset = bios_base + 0x1f33 + drive * 25;
+        offset = 0x1f33 + drive * 25;
         break;
       case 3:                  /* ISA_250MG */
-        offset = bios_base + 0x1f36 + drive * 15;
+        offset = 0x1f36 + drive * 15;
         break;
       case 4:                  /* ISA_200S (another one) */
-        offset = bios_base + 0x1f34 + drive * 15;
+        offset = 0x1f34 + drive * 15;
         break;
       default:
-        offset = bios_base + 0x1f31 + drive * 25;
+        offset = 0x1f31 + drive * 25;
         break;
       }
-      isa_memcpy_fromio( &i, offset, sizeof( struct drive_info ) );
+      memcpy_fromio( &i, bios_mem + offset, sizeof( struct drive_info ) );
       info_array[0] = i.heads;
       info_array[1] = i.sectors;
       info_array[2] = i.cylinders;
    } else if (bios_major == 3
              && bios_minor >= 0
              && bios_minor < 4) { /* 3.0 and 3.2 BIOS */
-      memcpy_fromio( &i, bios_base + 0x1f71 + drive * 10,
+      memcpy_fromio( &i, bios_mem + 0x1f71 + drive * 10,
                     sizeof( struct drive_info ) );
       info_array[0] = i.heads + 1;
       info_array[1] = i.sectors;
index 0f2623f18d6734e294279e412756b216912b4e57..ed4d4d5c96cbb1680117076632518c4148daf4d1 100644 (file)
@@ -454,12 +454,18 @@ int __init seagate_st0x_detect (Scsi_Host_Template * tpnt)
  * space for the on-board RAM instead.
  */
 
-               for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i)
-                       for (j = 0; !base_address && j < NUM_SIGNATURES; ++j)
-                               if (isa_check_signature(seagate_bases[i] + signatures[j].offset, signatures[j].signature, signatures[j].length)) {
+               for (i = 0; i < (sizeof (seagate_bases) / sizeof (unsigned int)); ++i) {
+                       void __iomem *p = ioremap(seagate_base[i], 0x2000);
+                       if (!p)
+                               continue;
+                       for (j = 0; j < NUM_SIGNATURES; ++j)
+                               if (check_signature(p + signatures[j].offset, signatures[j].signature, signatures[j].length)) {
                                        base_address = seagate_bases[i];
                                        controller_type = signatures[j].type;
+                                       break;
                                }
+                       iounmap(p);
+               }
 #endif                         /* OVERRIDE */
        }
        /* (! controller_type) */
index 7e73fc2579cc448390fa567f44e6e0277bcf71bb..463c84f31fbdde2b80ccbd8a578258066bcf3692 100644 (file)
@@ -211,13 +211,17 @@ int __init t128_detect(Scsi_Host_Template * tpnt){
            base = overrides[current_override].address;
        else 
            for (; !base && (current_base < NO_BASES); ++current_base) {
+               void __iomem *p;
 #if (TDEBUG & TDEBUG_INIT)
     printk("scsi-t128 : probing address %08x\n", bases[current_base].address);
 #endif
+               if (bases[current_base].noauto)
+                       continue;
+               p = ioremap(bases[current_base].address, 0x2000);
+               if (!p)
+                       continue;
                for (sig = 0; sig < NO_SIGNATURES; ++sig) 
-                   if (!bases[current_base].noauto && 
-                       isa_check_signature(bases[current_base].address +
-                                       signatures[sig].offset,
+                   if (check_signature(p + signatures[sig].offset,
                                        signatures[sig].string,
                                        strlen(signatures[sig].string))) {
                        base = bases[current_base].address;
@@ -226,6 +230,7 @@ int __init t128_detect(Scsi_Host_Template * tpnt){
 #endif
                        break;
                    }
+               iounmap(p);
            }
 
 #if defined(TDEBUG) && (TDEBUG & TDEBUG_INIT)
index 0d76b44cd55be2809ef3c7b4f1d09614220c6549..68907d940af1e8a79f5aa6e43eef9b95cee53bc4 100644 (file)
@@ -631,16 +631,6 @@ isa_memcpy_toio(unsigned long offset, const void *src, long n)
        iounmap(addr);
 }
 
-static inline int
-isa_check_signature(unsigned long offset, const unsigned char *sig, long len)
-{
-       void __iomem *addr = ioremap(offset, len);
-       int ret = check_signature(addr, sig, len);
-       iounmap(addr);
-       return ret;
-}
-
-
 /*
  * The Alpha Jensen hardware for some rather strange reason puts
  * the RTC clock at 0x170 instead of 0x70. Probably due to some
index 114a6d6d0587ac7ec8a0ac9b283efbce83d34dd8..60513375e728e77726cc3978ca9efe6af834a323 100644 (file)
@@ -176,7 +176,7 @@ extern void _memset_io(void __iomem *, int, size_t);
                                eth_copy_and_sum((s),__mem_pci(c),(l),(b))
 
 static inline int
-check_signature(unsigned long io_addr, const unsigned char *signature,
+check_signature(void __iomem *io_addr, const unsigned char *signature,
                int length)
 {
        int retval = 0;
@@ -226,23 +226,6 @@ out:
 #define isa_eth_io_copy_and_sum(a,b,c,d) \
                                eth_copy_and_sum((a),__mem_isa(b),(c),(d))
 
-static inline int
-isa_check_signature(unsigned long io_addr, const unsigned char *signature,
-                   int length)
-{
-       int retval = 0;
-       do {
-               if (isa_readb(io_addr) != *signature)
-                       goto out;
-               io_addr++;
-               signature++;
-               length--;
-       } while (length);
-       retval = 1;
-out:
-       return retval;
-}
-
 #else  /* __mem_isa */
 
 #define isa_readb(addr)                        (__readwrite_bug("isa_readb"),0)
@@ -258,8 +241,6 @@ out:
 #define isa_eth_io_copy_and_sum(a,b,c,d) \
                                __readwrite_bug("isa_eth_io_copy_and_sum")
 
-#define isa_check_signature(io,sig,len)        (0)
-
 #endif /* __mem_isa */
 
 /*
index f3ee4f411f6ff43aafae995a92f1830f323479b6..7b27cf130b1a6589c812824e4519a0b20ec7486e 100644 (file)
@@ -248,36 +248,6 @@ out:
        return retval;
 }
 
-/**
- *     isa_check_signature             -       find BIOS signatures
- *     @io_addr: mmio address to check 
- *     @signature:  signature block
- *     @length: length of signature
- *
- *     Perform a signature comparison with the ISA mmio address io_addr.
- *     Returns 1 on a match.
- *
- *     This function is deprecated. New drivers should use ioremap and
- *     check_signature.
- */
-
-static inline int isa_check_signature(unsigned long io_addr,
-       const unsigned char *signature, int length)
-{
-       int retval = 0;
-       do {
-               if (isa_readb(io_addr) != *signature)
-                       goto out;
-               io_addr++;
-               signature++;
-               length--;
-       } while (length);
-       retval = 1;
-out:
-       return retval;
-}
-
 /*
  *     Cache management
  *
index cab43ebac8fc8c04aceea6d38cc891cdef9bcd04..a5d3abee0ef40563d4f64bae9cc1e92612ff1904 100644 (file)
@@ -167,7 +167,7 @@ static inline void _writel(unsigned long l, unsigned long addr)
 #define flush_write_buffers() do { } while (0)  /* M32R_FIXME */
 
 /**
- *     isa_check_signature             -       find BIOS signatures
+ *     check_signature         -       find BIOS signatures
  *     @io_addr: mmio address to check
  *     @signature:  signature block
  *     @length: length of signature
@@ -179,14 +179,14 @@ static inline void _writel(unsigned long l, unsigned long addr)
  *     check_signature.
  */
 
-static inline int isa_check_signature(unsigned long io_addr,
+static inline int check_signature(void __iomem *io_addr,
         const unsigned char *signature, int length)
 {
         int retval = 0;
 #if 0
-printk("isa_check_signature\n");
+printk("check_signature\n");
         do {
-                if (isa_readb(io_addr) != *signature)
+                if (readb(io_addr) != *signature)
                         goto out;
                 io_addr++;
                 signature++;
index 7575bf5d98e8c707efa0db78883b073a7f680cee..c6bd278c5ea0df73c4a4009e343d21843ac65adc 100644 (file)
@@ -388,20 +388,6 @@ out:
        return retval;
 }
 
-/*
- *     isa_check_signature             -       find BIOS signatures
- *     @io_addr: mmio address to check
- *     @signature:  signature block
- *     @length: length of signature
- *
- *     Perform a signature comparison with the ISA mmio address io_addr.
- *     Returns 1 on a match.
- *
- *     This function is deprecated. New drivers should use ioremap and
- *     check_signature.
- */
-#define isa_check_signature(io, s, l)  check_signature(i,s,l)
-
 static inline void __outb(unsigned char val, unsigned long port)
 {
        port = __swizzle_addr_b(port);
index f8b1cbd055953f0c8563b5d76991906aff7432d0..5946df50a8c7cc34ffba952a5602e149b34db7fd 100644 (file)
@@ -452,13 +452,6 @@ out:
        return retval;
 }
 
-/* Make some pcmcia drivers happy */
-static inline int isa_check_signature(unsigned long io_addr,
-       const unsigned char *signature, int length)
-{
-       return 0;
-}
-
 /*
  * Here comes the ppc implementation of the IOMAP 
  * interfaces.
index 8965a34174bb836e94d64482f7c6a7190e82c78f..c4734243f814d53d1c83995790788cf9edc338b1 100644 (file)
@@ -320,38 +320,6 @@ out:
        return retval;
 }
 
-#ifndef __i386__
-/**
- *     isa_check_signature             -       find BIOS signatures
- *     @io_addr: mmio address to check 
- *     @signature:  signature block
- *     @length: length of signature
- *
- *     Perform a signature comparison with the ISA mmio address io_addr.
- *     Returns 1 on a match.
- *
- *     This function is deprecated. New drivers should use ioremap and
- *     check_signature.
- */
-
-static inline int isa_check_signature(unsigned long io_addr,
-       const unsigned char *signature, int length)
-{
-       int retval = 0;
-       do {
-               if (isa_readb(io_addr) != *signature)
-                       goto out;
-               io_addr++;
-               signature++;
-               length--;
-       } while (length);
-       retval = 1;
-out:
-       return retval;
-}
-#endif
-
 /* Nothing to do */
 
 #define dma_cache_inv(_start,_size)            do { } while (0)