From c864a1a7e870b618a215996c78b70ddcd44f0a82 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 28 Oct 1999 06:12:58 +0000 Subject: [PATCH] Fix identify code. This also fixes the eeprom messages. pccard attachments must activate the resources they want to access. ep didn't do this, so of course thee eeprom came back as busy. ed and sio already did this. It was only due to a bug in the logic that the probe succeeded. These problems have been fixed. --- sys/dev/ep/if_ep_pccard.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sys/dev/ep/if_ep_pccard.c b/sys/dev/ep/if_ep_pccard.c index fb373d0e6863..8255634e8366 100644 --- a/sys/dev/ep/if_ep_pccard.c +++ b/sys/dev/ep/if_ep_pccard.c @@ -73,18 +73,13 @@ ep_pccard_probe(device_t dev) { struct ep_softc * sc = device_get_softc(dev); struct ep_board * epb = &sc->epb; - u_long port_start; - u_long port_count; const char * desc; int error; - error = bus_get_resource(dev, SYS_RES_IOPORT, 0, - &port_start, &port_count); - if (error != 0) + error = ep_alloc(dev); + if (error) return error; - sc->ep_io_addr = port_start; - /* * XXX - Certain (newer?) 3Com cards need epb->cmd_off == * 2. Sadly, you need to have a correct cmd_off in order to @@ -101,13 +96,15 @@ ep_pccard_probe(device_t dev) "failed (nonfatal)\n"); epb->cmd_off = 2; epb->prod_id = get_e(sc, EEPROM_PROD_ID); - if ((desc = ep_pccard_identify(epb->prod_id))) { + if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) { device_printf(dev, "Unit failed to come ready or " "product ID unknown! (id 0x%x)\n", epb->prod_id); + ep_free(dev); return (ENXIO); } } - + device_set_desc(dev, desc); + ep_free(dev); return (0); } @@ -119,14 +116,14 @@ ep_pccard_identify(u_short id) case 0x6055: /* 3C556 */ return ("3Com 3C556"); case 0x4057: /* 3C574 */ - return("3Com 3C574"); + return ("3Com 3C574"); case 0x4b57: /* 3C574B */ - return("3Com 3C574B, Megahertz 3CCFE574BT or " + return ("3Com 3C574B, Megahertz 3CCFE574BT or " "Fast Etherlink 3C574-TX"); case 0x9058: /* 3C589 */ - return("3Com Etherlink III 3C589[B/C/D]"); + return ("3Com Etherlink III 3C589"); } - return (0); + return (NULL); } static int @@ -161,6 +158,8 @@ ep_pccard_attach(device_t dev) goto bad; } + sc->epb.cmd_off = 0; + sc->epb.prod_id = get_e(sc, EEPROM_PROD_ID); if (!ep_pccard_card_attach(&sc->epb)) { sc->epb.cmd_off = 2; sc->epb.prod_id = get_e(sc, EEPROM_PROD_ID);