/* 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)
{
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 */
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;
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)
/* .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;
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;
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
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;
}
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;
* 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) */
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;
#endif
break;
}
+ iounmap(p);
}
#if defined(TDEBUG) && (TDEBUG & TDEBUG_INIT)
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
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;
#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)
#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 */
/*
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
*
#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
* 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++;
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);
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.
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)