2005-01-06 01:43:34 +00:00
|
|
|
/*-
|
1999-09-26 06:42:36 +00:00
|
|
|
* Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Herb Peyerl.
|
|
|
|
* 4. The name of Herb Peyerl may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Pccard support for 3C589 by:
|
|
|
|
* HAMADA Naoki
|
|
|
|
* nao@tom-yam.or.jp
|
|
|
|
*/
|
|
|
|
|
2003-07-17 19:37:56 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1999-09-26 06:42:36 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1999-10-27 06:25:16 +00:00
|
|
|
#include <sys/kernel.h>
|
1999-09-26 06:42:36 +00:00
|
|
|
#include <sys/socket.h>
|
1999-10-27 06:25:16 +00:00
|
|
|
#include <sys/module.h>
|
1999-10-25 02:52:16 +00:00
|
|
|
#include <sys/bus.h>
|
1999-10-27 06:25:16 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/resource.h>
|
2003-07-17 19:37:56 +00:00
|
|
|
|
2000-07-13 22:54:34 +00:00
|
|
|
#include <net/ethernet.h>
|
2003-07-17 19:37:56 +00:00
|
|
|
#include <net/if.h>
|
1999-10-27 06:25:16 +00:00
|
|
|
#include <net/if_arp.h>
|
|
|
|
#include <net/if_media.h>
|
1999-09-26 06:42:36 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
#include <dev/ep/if_epreg.h>
|
|
|
|
#include <dev/ep/if_epvar.h>
|
|
|
|
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
#include <dev/pccard/pccardvar.h>
|
2005-01-20 19:37:22 +00:00
|
|
|
#include <dev/pccard/pccard_cis.h>
|
2003-07-17 19:37:56 +00:00
|
|
|
|
2002-05-31 01:08:49 +00:00
|
|
|
#include "card_if.h"
|
2004-05-27 03:49:45 +00:00
|
|
|
#include "pccarddevs.h"
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
static const char *ep_pccard_identify(u_short id);
|
1999-09-26 06:42:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the device - called from Slot manager.
|
|
|
|
*/
|
|
|
|
static int
|
1999-10-25 02:52:16 +00:00
|
|
|
ep_pccard_probe(device_t dev)
|
1999-09-26 06:42:36 +00:00
|
|
|
{
|
2003-07-17 19:37:56 +00:00
|
|
|
struct ep_softc *sc = device_get_softc(dev);
|
|
|
|
struct ep_board *epb = &sc->epb;
|
|
|
|
const char *desc;
|
2005-01-20 19:39:33 +00:00
|
|
|
uint16_t result;
|
2003-07-17 19:37:56 +00:00
|
|
|
int error;
|
1999-10-25 02:52:16 +00:00
|
|
|
|
1999-10-28 06:12:58 +00:00
|
|
|
error = ep_alloc(dev);
|
|
|
|
if (error)
|
2003-07-17 19:37:56 +00:00
|
|
|
return (error);
|
1999-10-27 06:25:16 +00:00
|
|
|
|
2003-10-18 15:22:43 +00:00
|
|
|
/*
|
|
|
|
* It appears that the eeprom comes in two sizes. There's
|
|
|
|
* a 512 byte eeprom and a 2k eeprom. Bit 13 of the eeprom
|
|
|
|
* command register is supposed to contain the size of the
|
|
|
|
* eeprom.
|
|
|
|
*/
|
1999-10-25 02:52:16 +00:00
|
|
|
/*
|
|
|
|
* XXX - Certain (newer?) 3Com cards need epb->cmd_off ==
|
|
|
|
* 2. Sadly, you need to have a correct cmd_off in order to
|
|
|
|
* identify the card. So we have to hit it with both and
|
|
|
|
* cross our virtual fingers. There's got to be a better way
|
2003-07-17 19:37:56 +00:00
|
|
|
* to do this. jyoung@accessus.net 09/11/1999
|
1999-10-25 02:52:16 +00:00
|
|
|
*/
|
1999-09-26 06:42:36 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
epb->cmd_off = 0;
|
2003-03-29 21:44:46 +00:00
|
|
|
|
2003-08-30 08:10:58 +00:00
|
|
|
/* XXX check return */
|
|
|
|
error = get_e(sc, EEPROM_PROD_ID, &result);
|
2003-03-29 21:44:46 +00:00
|
|
|
epb->prod_id = result;
|
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) {
|
2003-07-17 19:37:56 +00:00
|
|
|
if (bootverbose)
|
1999-10-25 02:52:16 +00:00
|
|
|
device_printf(dev, "Pass 1 of 2 detection "
|
2000-09-13 03:57:37 +00:00
|
|
|
"failed (nonfatal) id 0x%x\n", epb->prod_id);
|
1999-10-25 02:52:16 +00:00
|
|
|
epb->cmd_off = 2;
|
2003-08-30 08:10:58 +00:00
|
|
|
/* XXX check return */
|
|
|
|
error = get_e(sc, EEPROM_PROD_ID, &result);
|
2003-03-29 21:44:46 +00:00
|
|
|
epb->prod_id = result;
|
1999-10-28 06:12:58 +00:00
|
|
|
if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) {
|
1999-10-25 02:52:16 +00:00
|
|
|
device_printf(dev, "Unit failed to come ready or "
|
|
|
|
"product ID unknown! (id 0x%x)\n", epb->prod_id);
|
1999-10-28 06:12:58 +00:00
|
|
|
ep_free(dev);
|
1999-10-25 02:52:16 +00:00
|
|
|
return (ENXIO);
|
|
|
|
}
|
1999-09-26 06:42:36 +00:00
|
|
|
}
|
1999-10-28 06:12:58 +00:00
|
|
|
device_set_desc(dev, desc);
|
2000-01-15 05:21:43 +00:00
|
|
|
|
|
|
|
/*
|
2003-11-02 20:13:39 +00:00
|
|
|
* Newer cards supported by this device need to have their
|
|
|
|
* MAC address set.
|
2000-01-15 05:21:43 +00:00
|
|
|
*/
|
2003-03-29 21:44:46 +00:00
|
|
|
error = ep_get_macaddr(sc, (u_char *)&sc->arpcom.ac_enaddr);
|
2000-01-15 05:21:43 +00:00
|
|
|
|
1999-10-28 06:12:58 +00:00
|
|
|
ep_free(dev);
|
1999-10-25 02:52:16 +00:00
|
|
|
return (0);
|
|
|
|
}
|
1999-09-26 06:42:36 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
static const char *
|
|
|
|
ep_pccard_identify(u_short id)
|
|
|
|
{
|
|
|
|
/* Determine device type and associated MII capabilities */
|
|
|
|
switch (id) {
|
2003-11-02 20:13:39 +00:00
|
|
|
case 0x6055: /* 3C556 */
|
1999-10-25 02:52:16 +00:00
|
|
|
return ("3Com 3C556");
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x4057: /* 3C574 */
|
1999-10-28 06:12:58 +00:00
|
|
|
return ("3Com 3C574");
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x4b57: /* 3C574B */
|
1999-10-28 06:12:58 +00:00
|
|
|
return ("3Com 3C574B, Megahertz 3CCFE574BT or "
|
1999-10-25 02:52:16 +00:00
|
|
|
"Fast Etherlink 3C574-TX");
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x2b57: /* 3CXSH572BT */
|
2000-01-10 02:32:43 +00:00
|
|
|
return ("3Com OfficeConnect 572BT");
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x9058: /* 3C589 */
|
1999-10-28 06:12:58 +00:00
|
|
|
return ("3Com Etherlink III 3C589");
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x2056: /* 3C562/3C563 */
|
1999-10-29 06:27:07 +00:00
|
|
|
return ("3Com 3C562D/3C563D");
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x0010: /* 3C1 */
|
2000-09-13 03:57:37 +00:00
|
|
|
return ("3Com Megahertz C1");
|
2003-11-02 20:13:39 +00:00
|
|
|
case 0x0035:
|
|
|
|
return ("3Com 3CCEM556");
|
2003-07-17 19:37:56 +00:00
|
|
|
default:
|
|
|
|
return (NULL);
|
1999-10-25 02:52:16 +00:00
|
|
|
}
|
1999-09-26 06:42:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2003-07-17 19:37:56 +00:00
|
|
|
ep_pccard_card_attach(struct ep_board * epb)
|
1999-09-26 06:42:36 +00:00
|
|
|
{
|
1999-10-25 02:52:16 +00:00
|
|
|
/* Determine device type and associated MII capabilities */
|
|
|
|
switch (epb->prod_id) {
|
2003-10-18 15:22:43 +00:00
|
|
|
case 0x6055: /* 3C556 */
|
|
|
|
case 0x2b57: /* 3C572BT */
|
2005-01-20 20:36:59 +00:00
|
|
|
case 0x4057: /* 3C574, 3C574-TX */
|
2003-10-18 15:22:43 +00:00
|
|
|
case 0x4b57: /* 3C574B */
|
1999-10-25 02:52:16 +00:00
|
|
|
epb->mii_trans = 1;
|
|
|
|
return (1);
|
2003-07-17 19:37:56 +00:00
|
|
|
case 0x2056: /* 3C562D/3C563D */
|
|
|
|
case 0x9058: /* 3C589 */
|
2003-10-18 15:22:43 +00:00
|
|
|
case 0x0010: /* 3C1 */
|
2003-11-02 20:13:39 +00:00
|
|
|
case 0x0035: /* 3C[XC]EM556 */
|
1999-10-25 02:52:16 +00:00
|
|
|
epb->mii_trans = 0;
|
|
|
|
return (1);
|
2003-07-17 19:37:56 +00:00
|
|
|
default:
|
|
|
|
return (0);
|
1999-10-25 02:52:16 +00:00
|
|
|
}
|
1999-09-26 06:42:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
1999-10-25 02:52:16 +00:00
|
|
|
ep_pccard_attach(device_t dev)
|
1999-09-26 06:42:36 +00:00
|
|
|
{
|
2003-07-17 19:37:56 +00:00
|
|
|
struct ep_softc *sc = device_get_softc(dev);
|
2005-01-20 19:39:33 +00:00
|
|
|
uint16_t result;
|
2003-07-17 19:37:56 +00:00
|
|
|
int error = 0;
|
1999-10-25 02:52:16 +00:00
|
|
|
|
1999-10-28 05:06:14 +00:00
|
|
|
if ((error = ep_alloc(dev))) {
|
1999-10-27 06:25:16 +00:00
|
|
|
device_printf(dev, "ep_alloc() failed! (%d)\n", error);
|
1999-10-25 02:52:16 +00:00
|
|
|
goto bad;
|
1999-10-27 06:25:16 +00:00
|
|
|
}
|
1999-10-28 06:12:58 +00:00
|
|
|
sc->epb.cmd_off = 0;
|
2003-03-29 21:44:46 +00:00
|
|
|
|
2003-08-30 08:10:58 +00:00
|
|
|
/* XXX check return */
|
|
|
|
error = get_e(sc, EEPROM_PROD_ID, &result);
|
2003-03-29 21:44:46 +00:00
|
|
|
sc->epb.prod_id = result;
|
|
|
|
|
1999-10-27 06:25:16 +00:00
|
|
|
if (!ep_pccard_card_attach(&sc->epb)) {
|
|
|
|
sc->epb.cmd_off = 2;
|
2003-03-29 21:44:46 +00:00
|
|
|
error = get_e(sc, EEPROM_PROD_ID, &result);
|
|
|
|
sc->epb.prod_id = result;
|
|
|
|
error = get_e(sc, EEPROM_RESOURCE_CFG, &result);
|
|
|
|
sc->epb.res_cfg = result;
|
1999-10-27 06:25:16 +00:00
|
|
|
if (!ep_pccard_card_attach(&sc->epb)) {
|
1999-10-25 02:52:16 +00:00
|
|
|
device_printf(dev,
|
|
|
|
"Probe found ID, attach failed so ignore card!\n");
|
1999-10-27 06:25:16 +00:00
|
|
|
error = ENXIO;
|
|
|
|
goto bad;
|
1999-10-25 02:52:16 +00:00
|
|
|
}
|
|
|
|
}
|
2003-03-29 21:44:46 +00:00
|
|
|
error = get_e(sc, EEPROM_ADDR_CFG, &result);
|
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
/* ROM size = 0, ROM base = 0 */
|
|
|
|
/* For now, ignore AUTO SELECT feature of 3C589B and later. */
|
2003-10-25 04:09:49 +00:00
|
|
|
CSR_WRITE_2(sc, EP_W0_ADDRESS_CFG, result & 0xc000);
|
2003-11-02 20:13:39 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Fake IRQ must be 3 for 3C589 and 3C589B. 3C589D and newer
|
|
|
|
* ignore this value. 3C589C is unknown, as are the other
|
|
|
|
* cards supported by this driver, but it appears to never hurt
|
|
|
|
* and always helps.
|
|
|
|
*/
|
2003-10-26 22:28:20 +00:00
|
|
|
SET_IRQ(sc, 3);
|
2003-10-25 04:09:49 +00:00
|
|
|
CSR_WRITE_2(sc, EP_W0_PRODUCT_ID, sc->epb.prod_id);
|
1999-10-25 02:52:16 +00:00
|
|
|
|
1999-10-27 06:25:16 +00:00
|
|
|
if (sc->epb.mii_trans) {
|
1999-10-25 02:52:16 +00:00
|
|
|
/*
|
|
|
|
* turn on the MII transciever
|
|
|
|
*/
|
2003-10-26 22:28:20 +00:00
|
|
|
GO_WINDOW(sc, 3);
|
2003-10-25 04:09:49 +00:00
|
|
|
CSR_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
|
1999-10-25 02:52:16 +00:00
|
|
|
DELAY(1000);
|
2003-10-25 04:09:49 +00:00
|
|
|
CSR_WRITE_2(sc, EP_W3_OPTIONS, 0xc040);
|
|
|
|
CSR_WRITE_2(sc, EP_COMMAND, RX_RESET);
|
|
|
|
CSR_WRITE_2(sc, EP_COMMAND, TX_RESET);
|
2003-10-25 21:28:40 +00:00
|
|
|
EP_BUSY_WAIT(sc);
|
1999-10-25 02:52:16 +00:00
|
|
|
DELAY(1000);
|
2003-10-25 04:09:49 +00:00
|
|
|
CSR_WRITE_2(sc, EP_W3_OPTIONS, 0x8040);
|
2003-07-17 19:37:56 +00:00
|
|
|
} else
|
1999-10-27 06:25:16 +00:00
|
|
|
ep_get_media(sc);
|
1999-10-25 02:52:16 +00:00
|
|
|
|
1999-10-27 06:25:16 +00:00
|
|
|
if ((error = ep_attach(sc))) {
|
|
|
|
device_printf(dev, "ep_attach() failed! (%d)\n", error);
|
1999-10-25 02:52:16 +00:00
|
|
|
goto bad;
|
|
|
|
}
|
2003-10-25 04:09:49 +00:00
|
|
|
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, ep_intr,
|
2003-07-17 19:37:56 +00:00
|
|
|
sc, &sc->ep_intrhand))) {
|
1999-10-27 06:25:16 +00:00
|
|
|
device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
|
1999-10-25 02:52:16 +00:00
|
|
|
goto bad;
|
|
|
|
}
|
1999-10-27 06:25:16 +00:00
|
|
|
return (0);
|
1999-10-25 02:52:16 +00:00
|
|
|
bad:
|
1999-10-28 05:06:14 +00:00
|
|
|
ep_free(dev);
|
1999-10-27 06:25:16 +00:00
|
|
|
return (error);
|
1999-09-26 06:42:36 +00:00
|
|
|
}
|
|
|
|
|
2001-01-07 21:24:41 +00:00
|
|
|
static const struct pccard_product ep_pccard_products[] = {
|
2001-11-15 07:57:38 +00:00
|
|
|
PCMCIA_CARD(3COM, 3C1, 0),
|
|
|
|
PCMCIA_CARD(3COM, 3C562, 0),
|
2003-07-17 19:37:56 +00:00
|
|
|
PCMCIA_CARD(3COM, 3C574, 0), /* ROADRUNNER */
|
2001-11-15 07:52:49 +00:00
|
|
|
PCMCIA_CARD(3COM, 3C589, 0),
|
2001-11-15 07:57:38 +00:00
|
|
|
PCMCIA_CARD(3COM, 3CCFEM556BI, 0), /* ROADRUNNER */
|
2001-11-15 07:52:49 +00:00
|
|
|
PCMCIA_CARD(3COM, 3CXEM556, 0),
|
|
|
|
PCMCIA_CARD(3COM, 3CXEM556INT, 0),
|
2003-07-17 19:37:56 +00:00
|
|
|
{NULL}
|
2001-01-07 21:24:41 +00:00
|
|
|
};
|
|
|
|
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
static int
|
|
|
|
ep_pccard_match(device_t dev)
|
|
|
|
{
|
2001-01-07 21:24:41 +00:00
|
|
|
const struct pccard_product *pp;
|
2005-01-20 19:37:22 +00:00
|
|
|
int error;
|
|
|
|
uint32_t fcn = PCCARD_FUNCTION_UNSPEC;
|
|
|
|
|
|
|
|
/* Make sure we're a network function */
|
|
|
|
error = pccard_get_function(dev, &fcn);
|
|
|
|
if (error != 0)
|
|
|
|
return (error);
|
|
|
|
if (fcn != PCCARD_FUNCTION_NETWORK)
|
|
|
|
return (ENXIO);
|
2001-01-07 21:24:41 +00:00
|
|
|
|
|
|
|
if ((pp = pccard_product_lookup(dev, ep_pccard_products,
|
2003-07-17 19:37:56 +00:00
|
|
|
sizeof(ep_pccard_products[0]), NULL)) != NULL) {
|
2003-04-10 04:36:02 +00:00
|
|
|
if (pp->pp_name != NULL)
|
|
|
|
device_set_desc(dev, pp->pp_name);
|
2001-01-07 21:24:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
return EIO;
|
|
|
|
}
|
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
static device_method_t ep_pccard_methods[] = {
|
|
|
|
/* Device interface */
|
2003-07-17 19:37:56 +00:00
|
|
|
DEVMETHOD(device_probe, pccard_compat_probe),
|
|
|
|
DEVMETHOD(device_attach, pccard_compat_attach),
|
|
|
|
DEVMETHOD(device_detach, ep_detach),
|
1999-09-26 06:42:36 +00:00
|
|
|
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
/* Card interface */
|
2003-07-17 19:37:56 +00:00
|
|
|
DEVMETHOD(card_compat_match, ep_pccard_match),
|
|
|
|
DEVMETHOD(card_compat_probe, ep_pccard_probe),
|
|
|
|
DEVMETHOD(card_compat_attach, ep_pccard_attach),
|
Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +00:00
|
|
|
|
2003-07-17 19:37:56 +00:00
|
|
|
{0, 0}
|
1999-10-25 02:52:16 +00:00
|
|
|
};
|
1999-09-26 06:42:36 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
static driver_t ep_pccard_driver = {
|
|
|
|
"ep",
|
|
|
|
ep_pccard_methods,
|
1999-10-27 06:25:16 +00:00
|
|
|
sizeof(struct ep_softc),
|
1999-10-25 02:52:16 +00:00
|
|
|
};
|
1999-09-26 06:42:36 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
extern devclass_t ep_devclass;
|
|
|
|
|
|
|
|
DRIVER_MODULE(ep, pccard, ep_pccard_driver, ep_devclass, 0, 0);
|