Re: 8390s and Alphas (esp. 3c503)

Paul Gortmaker (gpg109@rsphy1.anu.edu.au)
Sun, 30 Jul 1995 03:52:33 +1000 (EST)


There were still a couple of direct memory dereferences in the 3c503
driver that I missed. The fatal one that Mikael Nykvist hit was fairly
obvious. The others were in the ifdef EL2MEMEST, which isn't used by
default. However it may be useful in debugging, so it now uses the
approriate readl/writel() calls as well. Adding a "#define EL2MEMTEST"
at the top of 3c503.c may prove useful in testing things on an Alpha.
If the memory test fails, the driver falls back to using the card in
PIO mode, similar to a ne2k.

Paul.

--- /foo/linux/drivers/net/3c503.c Fri Jul 28 19:43:59 1995
+++ 3c503.c Sun Jul 30 03:06:32 1995
@@ -92,7 +92,7 @@

for (addr = addrs; *addr; addr++) {
int i;
- unsigned int base_bits = *(unsigned char *)*addr;
+ unsigned int base_bits = readb(addr);
/* Find first set bit. */
for(i = 7; i >= 0; i--, base_bits >>= 1)
if (base_bits & 0x1)
@@ -218,19 +218,19 @@
#ifdef EL2MEMTEST
/* This has never found an error, but someone might care. */
{ /* Check the card's memory. */
- int *mem_base = (int *)dev->mem_start;
- int memtest_value = 0xbbadf00d;
- mem_base[0] = 0xba5eba5e;
- for (i = 1; i < EL2_MEMSIZE/sizeof(mem_base[0]); i++) {
- mem_base[i] = memtest_value;
- if (mem_base[0] != 0xba5eba5e
- || mem_base[i] != memtest_value) {
+ unsigned long mem_base = dev->mem_start;
+ unsigned int test_val = 0xbbadf00d;
+ writel(0xba5eba5e, mem_base);
+ for (i = sizeof(test_val); i < EL2_MEMSIZE; i+=sizeof(test_val)) {
+ writel(test_val, mem_base + i);
+ if (readl(mem_base) != 0xba5eba5e
+ || readl(mem_base + i) != test_val) {
printk(" memory failure or memory address conflict.\n");
dev->mem_start = 0;
break;
}
- memtest_value += 0x55555555;
- mem_base[i] = 0;
+ test_val += 0x55555555;
+ writel(0, mem_base + i);
}
}
#endif /* EL2MEMTEST */