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
|
|
|
|
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
|
|
|
|
2005-06-28 21:56:04 +00:00
|
|
|
struct ep_pccard_product
|
1999-09-26 06:42:36 +00:00
|
|
|
{
|
2005-06-28 21:56:04 +00:00
|
|
|
struct pccard_product prod;
|
|
|
|
int chipset;
|
|
|
|
};
|
2003-03-29 21:44:46 +00:00
|
|
|
|
2005-06-28 21:56:04 +00:00
|
|
|
#define EP_CHIP_589 1 /* Classic 3c5x9 chipset */
|
|
|
|
#define EP_CHIP_574 2 /* Roadrunner */
|
|
|
|
|
|
|
|
static const struct ep_pccard_product ep_pccard_products[] = {
|
|
|
|
{ PCMCIA_CARD(3COM, 3C1), EP_CHIP_589 },
|
|
|
|
{ PCMCIA_CARD(3COM, 3C562), EP_CHIP_589 },
|
|
|
|
{ PCMCIA_CARD(3COM, 3C589), EP_CHIP_589 },
|
|
|
|
{ PCMCIA_CARD(3COM, 3CXEM556), EP_CHIP_589 },
|
|
|
|
{ PCMCIA_CARD(3COM, 3CXEM556INT), EP_CHIP_589 },
|
|
|
|
{ PCMCIA_CARD(3COM, 3C574), EP_CHIP_574 },
|
|
|
|
{ PCMCIA_CARD(3COM, 3CCFEM556BI), EP_CHIP_574 },
|
|
|
|
{ { NULL } }
|
|
|
|
};
|
1999-09-26 06:42:36 +00:00
|
|
|
|
2005-06-28 21:56:04 +00:00
|
|
|
static const struct ep_pccard_product *
|
|
|
|
ep_pccard_lookup(device_t dev)
|
1999-10-25 02:52:16 +00:00
|
|
|
{
|
2005-06-28 21:56:04 +00:00
|
|
|
return ((const struct ep_pccard_product *)pccard_product_lookup(dev,
|
|
|
|
(const struct pccard_product *)ep_pccard_products,
|
|
|
|
sizeof(ep_pccard_products[0]), NULL));
|
1999-09-26 06:42:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-06-28 21:56:04 +00:00
|
|
|
ep_pccard_probe(device_t dev)
|
1999-09-26 06:42:36 +00:00
|
|
|
{
|
2005-06-28 21:56:04 +00:00
|
|
|
const struct ep_pccard_product *pp;
|
|
|
|
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);
|
|
|
|
|
|
|
|
/* Check to see if we know about this card */
|
|
|
|
if ((pp = ep_pccard_lookup(dev)) == NULL)
|
|
|
|
return EIO;
|
|
|
|
if (pp->prod.pp_name != NULL)
|
|
|
|
device_set_desc(dev, pp->prod.pp_name);
|
|
|
|
|
|
|
|
return 0;
|
1999-09-26 06:42:36 +00:00
|
|
|
}
|
|
|
|
|
Minor cleanup of ep driver and pccard attachment:
o Grab the MAC address out of the CIS if the card has the special
3Com 0x88 tuple. Most 3Com cards don't have this tuple, but we
prefer it to the eeprom since it only appears to be present when
the eeprom doesn't have the info. So far, I've only observed this
on my 3C362 and 3C362B cards, but the NetBSD driver implies that
the 3C362C also has this tuple, and that some 3C574 cards do too (none
of mine do). ep_pccard_mac was written after looking at the NetBSD
code.
o Store the enet addr in the softc for this device, so we can use the
overridden MAC to set the station address.
o Create a routine to set the station address and use it where we need it.
o setup the cmd shitfs and such before we call ep_alloc(), and remove
setting up the cmd shift value there. It initializes to 0, and those
attachments that need to frob it do so before calling ep_alloc.
o Remove some obsolete comments
o No longer a need to export ep_get_macaddr, so make it static
o ep_alloc already grabs the EEPROM id, so we don't need to grab it again
in ep_pccard_attach.
o eliminate unit, it isn't needed, fix some printfs to be device_printf
instead.
# All my pccards except the 3C1 work now. Didn't test ISA or cbus cards
# that I have: 3C509B-TP or 3C569B-J-TPO
Tested on: 3C589B, 3C589C, 3C589D, 3C589D-TP, 3C562, 3C562B/3C563B,
3C562D/3C563D, 3CCFE574BT, 3CXEM556, 3CCSH572BT, 3C574-TX,
3CCE589EC, 3CXE589EC, 3CCFEM556, 3C1
Approved by: re (scottl)
2005-07-01 04:23:32 +00:00
|
|
|
static int
|
2005-07-01 15:52:50 +00:00
|
|
|
ep_pccard_mac(const struct pccard_tuple *tuple, void *argp)
|
Minor cleanup of ep driver and pccard attachment:
o Grab the MAC address out of the CIS if the card has the special
3Com 0x88 tuple. Most 3Com cards don't have this tuple, but we
prefer it to the eeprom since it only appears to be present when
the eeprom doesn't have the info. So far, I've only observed this
on my 3C362 and 3C362B cards, but the NetBSD driver implies that
the 3C362C also has this tuple, and that some 3C574 cards do too (none
of mine do). ep_pccard_mac was written after looking at the NetBSD
code.
o Store the enet addr in the softc for this device, so we can use the
overridden MAC to set the station address.
o Create a routine to set the station address and use it where we need it.
o setup the cmd shitfs and such before we call ep_alloc(), and remove
setting up the cmd shift value there. It initializes to 0, and those
attachments that need to frob it do so before calling ep_alloc.
o Remove some obsolete comments
o No longer a need to export ep_get_macaddr, so make it static
o ep_alloc already grabs the EEPROM id, so we don't need to grab it again
in ep_pccard_attach.
o eliminate unit, it isn't needed, fix some printfs to be device_printf
instead.
# All my pccards except the 3C1 work now. Didn't test ISA or cbus cards
# that I have: 3C509B-TP or 3C569B-J-TPO
Tested on: 3C589B, 3C589C, 3C589D, 3C589D-TP, 3C562, 3C562B/3C563B,
3C562D/3C563D, 3CCFE574BT, 3CXEM556, 3CCSH572BT, 3C574-TX,
3CCE589EC, 3CXE589EC, 3CCFEM556, 3C1
Approved by: re (scottl)
2005-07-01 04:23:32 +00:00
|
|
|
{
|
|
|
|
uint8_t *enaddr = argp;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Code 0x88 is 3com's special cis node contianing the MAC */
|
|
|
|
if (tuple->code != 0x88)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* Make sure this is a sane node */
|
|
|
|
if (tuple->length < ETHER_ADDR_LEN)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/* Copy the MAC ADDR and return success */
|
|
|
|
for (i = 0; i < ETHER_ADDR_LEN; i += 2) {
|
|
|
|
enaddr[i] = pccard_tuple_read_1(tuple, i + 1);
|
|
|
|
enaddr[i + 1] = pccard_tuple_read_1(tuple, i);
|
|
|
|
}
|
|
|
|
return (1);
|
|
|
|
}
|
|
|
|
|
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;
|
2005-06-28 21:56:04 +00:00
|
|
|
const struct ep_pccard_product *pp;
|
|
|
|
|
|
|
|
if ((pp = ep_pccard_lookup(dev)) == NULL)
|
|
|
|
panic("ep_pccard_attach: can't find product in attach.");
|
1999-10-25 02:52:16 +00:00
|
|
|
|
2005-06-28 21:56:04 +00:00
|
|
|
if (pp->chipset == EP_CHIP_589) {
|
|
|
|
sc->epb.mii_trans = 0;
|
|
|
|
sc->epb.cmd_off = 0;
|
|
|
|
} else {
|
|
|
|
sc->epb.mii_trans = 1;
|
1999-10-27 06:25:16 +00:00
|
|
|
sc->epb.cmd_off = 2;
|
1999-10-25 02:52:16 +00:00
|
|
|
}
|
2005-06-28 21:56:04 +00:00
|
|
|
|
Minor cleanup of ep driver and pccard attachment:
o Grab the MAC address out of the CIS if the card has the special
3Com 0x88 tuple. Most 3Com cards don't have this tuple, but we
prefer it to the eeprom since it only appears to be present when
the eeprom doesn't have the info. So far, I've only observed this
on my 3C362 and 3C362B cards, but the NetBSD driver implies that
the 3C362C also has this tuple, and that some 3C574 cards do too (none
of mine do). ep_pccard_mac was written after looking at the NetBSD
code.
o Store the enet addr in the softc for this device, so we can use the
overridden MAC to set the station address.
o Create a routine to set the station address and use it where we need it.
o setup the cmd shitfs and such before we call ep_alloc(), and remove
setting up the cmd shift value there. It initializes to 0, and those
attachments that need to frob it do so before calling ep_alloc.
o Remove some obsolete comments
o No longer a need to export ep_get_macaddr, so make it static
o ep_alloc already grabs the EEPROM id, so we don't need to grab it again
in ep_pccard_attach.
o eliminate unit, it isn't needed, fix some printfs to be device_printf
instead.
# All my pccards except the 3C1 work now. Didn't test ISA or cbus cards
# that I have: 3C509B-TP or 3C569B-J-TPO
Tested on: 3C589B, 3C589C, 3C589D, 3C589D-TP, 3C562, 3C562B/3C563B,
3C562D/3C563D, 3CCFE574BT, 3CXEM556, 3CCSH572BT, 3C574-TX,
3CCE589EC, 3CXE589EC, 3CCFEM556, 3C1
Approved by: re (scottl)
2005-07-01 04:23:32 +00:00
|
|
|
if ((error = ep_alloc(dev))) {
|
|
|
|
device_printf(dev, "ep_alloc() failed! (%d)\n", error);
|
|
|
|
goto bad;
|
|
|
|
}
|
2003-03-29 21:44:46 +00:00
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
/* ROM size = 0, ROM base = 0 */
|
|
|
|
/* For now, ignore AUTO SELECT feature of 3C589B and later. */
|
2005-06-28 21:56:04 +00:00
|
|
|
error = ep_get_e(sc, EEPROM_ADDR_CFG, &result);
|
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
|
|
|
|
Minor cleanup of ep driver and pccard attachment:
o Grab the MAC address out of the CIS if the card has the special
3Com 0x88 tuple. Most 3Com cards don't have this tuple, but we
prefer it to the eeprom since it only appears to be present when
the eeprom doesn't have the info. So far, I've only observed this
on my 3C362 and 3C362B cards, but the NetBSD driver implies that
the 3C362C also has this tuple, and that some 3C574 cards do too (none
of mine do). ep_pccard_mac was written after looking at the NetBSD
code.
o Store the enet addr in the softc for this device, so we can use the
overridden MAC to set the station address.
o Create a routine to set the station address and use it where we need it.
o setup the cmd shitfs and such before we call ep_alloc(), and remove
setting up the cmd shift value there. It initializes to 0, and those
attachments that need to frob it do so before calling ep_alloc.
o Remove some obsolete comments
o No longer a need to export ep_get_macaddr, so make it static
o ep_alloc already grabs the EEPROM id, so we don't need to grab it again
in ep_pccard_attach.
o eliminate unit, it isn't needed, fix some printfs to be device_printf
instead.
# All my pccards except the 3C1 work now. Didn't test ISA or cbus cards
# that I have: 3C509B-TP or 3C569B-J-TPO
Tested on: 3C589B, 3C589C, 3C589D, 3C589D-TP, 3C562, 3C562B/3C563B,
3C562D/3C563D, 3CCFE574BT, 3CXEM556, 3CCSH572BT, 3C574-TX,
3CCE589EC, 3CXE589EC, 3CCFEM556, 3C1
Approved by: re (scottl)
2005-07-01 04:23:32 +00:00
|
|
|
/*
|
|
|
|
* The 3C562 (a-c revisions) stores the MAC in the CIS in a
|
|
|
|
* way that's unique to 3com. If we have one of these cards,
|
|
|
|
* scan the CIS for that MAC address, and use it if we find
|
|
|
|
* it. The NetBSD driver says that the ROADRUNNER chips also
|
|
|
|
* do this, which may be true, but none of the cards that I
|
|
|
|
* have include this TUPLE. Always prefer the MAC addr in the
|
|
|
|
* CIS tuple to the one returned by the card, as it appears that
|
|
|
|
* only those cards that need it have this special tuple.
|
|
|
|
*/
|
2005-09-13 19:56:07 +00:00
|
|
|
if (pccard_cis_scan(dev, ep_pccard_mac, sc->eaddr))
|
Minor cleanup of ep driver and pccard attachment:
o Grab the MAC address out of the CIS if the card has the special
3Com 0x88 tuple. Most 3Com cards don't have this tuple, but we
prefer it to the eeprom since it only appears to be present when
the eeprom doesn't have the info. So far, I've only observed this
on my 3C362 and 3C362B cards, but the NetBSD driver implies that
the 3C362C also has this tuple, and that some 3C574 cards do too (none
of mine do). ep_pccard_mac was written after looking at the NetBSD
code.
o Store the enet addr in the softc for this device, so we can use the
overridden MAC to set the station address.
o Create a routine to set the station address and use it where we need it.
o setup the cmd shitfs and such before we call ep_alloc(), and remove
setting up the cmd shift value there. It initializes to 0, and those
attachments that need to frob it do so before calling ep_alloc.
o Remove some obsolete comments
o No longer a need to export ep_get_macaddr, so make it static
o ep_alloc already grabs the EEPROM id, so we don't need to grab it again
in ep_pccard_attach.
o eliminate unit, it isn't needed, fix some printfs to be device_printf
instead.
# All my pccards except the 3C1 work now. Didn't test ISA or cbus cards
# that I have: 3C509B-TP or 3C569B-J-TPO
Tested on: 3C589B, 3C589C, 3C589D, 3C589D-TP, 3C562, 3C562B/3C563B,
3C562D/3C563D, 3CCFE574BT, 3CXEM556, 3CCSH572BT, 3C574-TX,
3CCE589EC, 3CXE589EC, 3CCFEM556, 3C1
Approved by: re (scottl)
2005-07-01 04:23:32 +00:00
|
|
|
sc->stat |= F_ENADDR_SKIP;
|
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;
|
|
|
|
}
|
2005-06-28 21:56:04 +00:00
|
|
|
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
|
|
|
|
ep_intr, 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
|
|
|
}
|
|
|
|
|
1999-10-25 02:52:16 +00:00
|
|
|
static device_method_t ep_pccard_methods[] = {
|
|
|
|
/* Device interface */
|
2005-06-28 21:56:04 +00:00
|
|
|
DEVMETHOD(device_probe, ep_pccard_probe),
|
|
|
|
DEVMETHOD(device_attach, ep_pccard_attach),
|
2003-07-17 19:37:56 +00:00
|
|
|
DEVMETHOD(device_detach, ep_detach),
|
1999-09-26 06:42:36 +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);
|