[tulip] mii taints kernel, big EEPROM patch, missing tulip.txt
Pavel Roskin
proski@gnu.org
Sat Jan 26 01:25:00 2002
Hi, Jeff!
In Linux-2.4.18-pre7, the module mii has no license. Also having a
description would be nice.
==========================
--- linux.orig/drivers/net/mii.c
+++ linux/drivers/net/mii.c
@@ -168,6 +168,10 @@ int mii_nway_restart (struct mii_if_info
return r;
}
+MODULE_AUTHOR ("Jeff Garzik <jgarzik@mandrakesoft.com>");
+MODULE_DESCRIPTION ("Kernel part of Ethtool");
+MODULE_LICENSE("GPL");
+
EXPORT_SYMBOL(mii_link_ok);
EXPORT_SYMBOL(mii_nway_restart);
EXPORT_SYMBOL(mii_ethtool_gset);
==========================
By the way, I have finally made a working driver for Conexant, but I
didn't have time to send it from the office today and forgot to copy it to
an external site. I'll send it on Monday.
Basically it's the patch that I already sent, but with EEPROM_SIZE changed
to 512. That's because RS7112 keeps the MAC address near the end of
EEPROM. I feel uneasy that ee_data is now quite big for the stack (512
bytes) in tulip_init_one(), but it works.
Why doesn't tulip_init_one() use tp->eeprom immediately? tp->eeprom is
allocated in the kernel memory. Ok, I just made a patch that makes
exactly that and will make it easier to increase EEPROM_SIZE. I tested it
on my Linksys card, which is determined by the driver as
eth0: ADMtek Comet rev 17 at 0xd800, 00:04:5A:43:9C:F0, IRQ 11.
and listed by lspci as
00:08.0 Ethernet controller: Bridgecom, Inc: Unknown device 0985 (rev 11)
This message will be sent through the patched driver :-)
===========================
--- linux.orig/drivers/net/tulip/tulip_core.c
+++ linux/drivers/net/tulip/tulip_core.c
@@ -1354,7 +1354,6 @@ static int __devinit tulip_init_one (str
u8 chip_rev;
int i, irq;
unsigned short sum;
- u8 ee_data[EEPROM_SIZE];
struct net_device *dev;
long ioaddr;
static int board_idx = -1;
@@ -1573,17 +1572,17 @@ static int __devinit tulip_init_one (str
int sa_offset = 0;
int ee_addr_size = tulip_read_eeprom(ioaddr, 0xff, 8) & 0x40000 ? 8 : 6;
- for (i = 0; i < sizeof(ee_data)/2; i++)
- ((u16 *)ee_data)[i] =
+ for (i = 0; i < sizeof(tp->eeprom)/2; i++)
+ ((u16 *)tp->eeprom)[i] =
le16_to_cpu(tulip_read_eeprom(ioaddr, i, ee_addr_size));
/* DEC now has a specification (see Notes) but early board makers
just put the address in the first EEPROM locations. */
/* This does memcmp(eedata, eedata+16, 8) */
for (i = 0; i < 8; i ++)
- if (ee_data[i] != ee_data[16+i])
+ if (tp->eeprom[i] != tp->eeprom[16+i])
sa_offset = 20;
- if (ee_data[0] == 0xff && ee_data[1] == 0xff && ee_data[2] == 0) {
+ if (tp->eeprom[0] == 0xff && tp->eeprom[1] == 0xff && tp->eeprom[2] == 0) {
sa_offset = 2; /* Grrr, damn Matrox boards. */
multiport_cnt = 4;
}
@@ -1604,8 +1603,8 @@ static int __devinit tulip_init_one (str
}
#endif
for (i = 0; i < 6; i ++) {
- dev->dev_addr[i] = ee_data[i + sa_offset];
- sum += ee_data[i + sa_offset];
+ dev->dev_addr[i] = tp->eeprom[i + sa_offset];
+ sum += tp->eeprom[i + sa_offset];
}
}
/* Lite-On boards have the address byte-swapped. */
@@ -1676,8 +1675,6 @@ static int __devinit tulip_init_one (str
}
if (tp->flags & HAS_MEDIA_TABLE) {
- memcpy(tp->eeprom, ee_data, sizeof(tp->eeprom));
-
sprintf(dev->name, "tulip%d", board_idx); /* hack */
tulip_parse_eeprom(dev);
strcpy(dev->name, "eth%d"); /* un-hack */
===========================
The last thing. Documentation/networking/00-INDEX in Linux-2.4.18-pre7
mentions tulip.txt, but there is no such file in the kernel sources.
Please add it if you have it.
--
Regards,
Pavel Roskin