diff options
author | imp <imp@FreeBSD.org> | 2005-06-26 04:19:45 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2005-06-26 04:19:45 +0000 |
commit | 77c5d7a36d189d1c4f1b1d55847443a0cc46a001 (patch) | |
tree | 5035c08dd3f927e7b0ee6df0b81b0ebc2a05b11e /sys/dev/ep/if_ep_pccard.c | |
parent | 991a0a96327d5811129df168ecd42872b043cd28 (diff) | |
download | FreeBSD-src-77c5d7a36d189d1c4f1b1d55847443a0cc46a001.zip FreeBSD-src-77c5d7a36d189d1c4f1b1d55847443a0cc46a001.tar.gz |
o When calling ep_get_macaddr(), provide it a local buffer. Add a comment
that says why we do this (or rather, explains that it is some voodoo magic
that's poorly understood). The local buffer fixes the crash on attach.
o Rename get_e() to ep_get_e() to avoid namespace pollution.
Submitted by: mux
Approved by: re (scottl)
Diffstat (limited to 'sys/dev/ep/if_ep_pccard.c')
-rw-r--r-- | sys/dev/ep/if_ep_pccard.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c index f86fe61..3e5e6a7 100644 --- a/sys/dev/ep/if_ep_pccard.c +++ b/sys/dev/ep/if_ep_pccard.c @@ -73,6 +73,7 @@ ep_pccard_probe(device_t dev) struct ep_board *epb = &sc->epb; const char *desc; uint16_t result; + uint8_t enaddr[6]; int error; error = ep_alloc(dev); @@ -96,7 +97,7 @@ ep_pccard_probe(device_t dev) epb->cmd_off = 0; /* XXX check return */ - error = get_e(sc, EEPROM_PROD_ID, &result); + error = ep_get_e(sc, EEPROM_PROD_ID, &result); epb->prod_id = result; if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) { @@ -105,7 +106,7 @@ ep_pccard_probe(device_t dev) "failed (nonfatal) id 0x%x\n", epb->prod_id); epb->cmd_off = 2; /* XXX check return */ - error = get_e(sc, EEPROM_PROD_ID, &result); + error = ep_get_e(sc, EEPROM_PROD_ID, &result); epb->prod_id = result; if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) { device_printf(dev, "Unit failed to come ready or " @@ -114,14 +115,16 @@ ep_pccard_probe(device_t dev) return (ENXIO); } } - device_set_desc(dev, desc); - /* - * Newer cards supported by this device need to have their - * MAC address set. + * For reasons unknown, getting the MAC address here makes the + * 3C574 and 3C556 families get the right MAC address later. + * otherwise, the ID field is used for each of the words of the + * MAC address instead of the proper one. It is unclear why + * ep_get_macaddr would have this side effect, or even what + * that side effect really is. */ - error = ep_get_macaddr(sc, (u_char *)&IFP2ENADDR(sc->ifp)); - + ep_get_macaddr(sc, enaddr); + device_set_desc(dev, desc); ep_free(dev); return (0); } @@ -189,14 +192,14 @@ ep_pccard_attach(device_t dev) sc->epb.cmd_off = 0; /* XXX check return */ - error = get_e(sc, EEPROM_PROD_ID, &result); + error = ep_get_e(sc, EEPROM_PROD_ID, &result); sc->epb.prod_id = result; if (!ep_pccard_card_attach(&sc->epb)) { sc->epb.cmd_off = 2; - error = get_e(sc, EEPROM_PROD_ID, &result); + error = ep_get_e(sc, EEPROM_PROD_ID, &result); sc->epb.prod_id = result; - error = get_e(sc, EEPROM_RESOURCE_CFG, &result); + error = ep_get_e(sc, EEPROM_RESOURCE_CFG, &result); sc->epb.res_cfg = result; if (!ep_pccard_card_attach(&sc->epb)) { device_printf(dev, @@ -205,7 +208,7 @@ ep_pccard_attach(device_t dev) goto bad; } } - error = get_e(sc, EEPROM_ADDR_CFG, &result); + error = ep_get_e(sc, EEPROM_ADDR_CFG, &result); /* ROM size = 0, ROM base = 0 */ /* For now, ignore AUTO SELECT feature of 3C589B and later. */ |