From: ? <uns...@us...> - 2002-05-23 17:20:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv30771 Modified Files: vaxsgec.c Log Message: Split the ESAR reading to a separate function and try to make it work properly for different machines. Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vaxsgec.c 23 May 2002 16:20:44 -0000 1.2 +++ vaxsgec.c 23 May 2002 17:20:08 -0000 1.3 @@ -691,6 +691,32 @@ sgec_set_multicast(dev); } +static int read_esar(unsigned char dev_addr[]) +{ + unsigned int *esar; + unsigned long esar_phys_addr; + int shiftage; + int i; + + if(!strcmp(mv->cpu_type_str(),"VXT2000")) { /* erm */ + esar_phys_addr=VXT_NISA_ROM; + shiftage=0; + } else { + esar_phys_addr=QBUS_NISA_ROM; + shiftage=8; + } + + esar=(unsigned int *)ioremap(esar_phys_addr, 0x80); + if(esar == NULL) + return -1; + + for (i = 0; i < 6; i++) + dev_addr[i] = (esar[i] >> shiftage) & 0xff; + + iounmap(esar); + return 0; +} + static volatile void *base_addr=NULL; static int __init vax_sgec_init(struct net_device *dev) @@ -698,17 +724,13 @@ static unsigned version_printed = 0; struct sgec_private *lp; volatile struct sgec_regs *regs; - int i, ret; - unsigned char *esar; + int ret; unsigned long sgec_phys_addr; - unsigned long esar_phys_addr; if(!strcmp(mv->cpu_type_str(),"VXT2000")) { /* erm */ sgec_phys_addr=VXT_SGECADDR; - esar_phys_addr=VXT_NISA_ROM; } else { sgec_phys_addr=SGECADDR; - esar_phys_addr=QBUS_NISA_ROM; } if (version_printed++ == 0) @@ -755,23 +777,11 @@ regs = (struct sgec_regs *) base_addr; - /* FIXME: deal with failure here */ - esar=ioremap(esar_phys_addr, 0x80); - - /* 3rd byte contains address part in 3100/85 -RB */ - /* Note that 660 board types use a different position */ - /* Copy the ethernet address to the device structure, later to the - * sgec initialization block so the card gets it every time it's - * (re)initialized. - */ - printk("Ethernet address in ROM: "); - for (i = 0; i < 6; i++) { - dev->dev_addr[i] = esar[i*4]; /* uh. this is right for the vxt but wrong for other machines. fix it later */ - printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); - } - - /* Don't need this any more */ - iounmap(esar); + if(read_esar(dev->dev_addr) != 0) + printk("vaxsgec: read_esar failed\n"); + printk("Ethernet address in ROM: %02X:%02X:%02X:%02X:%02X:%02X\n", + dev->dev_addr[0],dev->dev_addr[1],dev->dev_addr[2], + dev->dev_addr[3],dev->dev_addr[4],dev->dev_addr[5]); #ifdef VAX_SGEC_AUTOPROBE_IRQ #ifndef CONFIG_VAX_4000HC |