Home | History | Annotate | Line # | Download | only in pcmcia
if_ne_pcmcia.c revision 1.22
      1 /*	$NetBSD: if_ne_pcmcia.c,v 1.22 1998/10/31 01:44:17 thorpej Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Marc Horowitz.
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #include <sys/param.h>
     33 #include <sys/systm.h>
     34 #include <sys/select.h>
     35 #include <sys/device.h>
     36 #include <sys/socket.h>
     37 
     38 #include <net/if_types.h>
     39 #include <net/if.h>
     40 #include <net/if_media.h>
     41 #include <net/if_ether.h>
     42 
     43 #include <machine/bus.h>
     44 #include <machine/intr.h>
     45 
     46 #include <dev/pcmcia/pcmciareg.h>
     47 #include <dev/pcmcia/pcmciavar.h>
     48 #include <dev/pcmcia/pcmciadevs.h>
     49 
     50 #include <dev/ic/dp8390reg.h>
     51 #include <dev/ic/dp8390var.h>
     52 
     53 #include <dev/ic/ne2000reg.h>
     54 #include <dev/ic/ne2000var.h>
     55 
     56 #include <dev/ic/rtl80x9reg.h>
     57 #include <dev/ic/rtl80x9var.h>
     58 
     59 int ne_pcmcia_match __P((struct device *, struct cfdata *, void *));
     60 void ne_pcmcia_attach __P((struct device *, struct device *, void *));
     61 
     62 int	ne_pcmcia_enable __P((struct dp8390_softc *));
     63 void	ne_pcmcia_disable __P((struct dp8390_softc *));
     64 
     65 struct ne_pcmcia_softc {
     66 	struct ne2000_softc sc_ne2000;		/* real "ne2000" softc */
     67 
     68 	/* PCMCIA-specific goo */
     69 	struct pcmcia_io_handle sc_pcioh;	/* PCMCIA i/o information */
     70 	int sc_asic_io_window;			/* i/o window for ASIC */
     71 	int sc_nic_io_window;			/* i/o window for NIC */
     72 	struct pcmcia_function *sc_pf;		/* our PCMCIA function */
     73 	void *sc_ih;				/* interrupt handle */
     74 };
     75 
     76 struct cfattach ne_pcmcia_ca = {
     77 	sizeof(struct ne_pcmcia_softc), ne_pcmcia_match, ne_pcmcia_attach
     78 };
     79 
     80 struct ne2000dev {
     81     char *name;
     82     int32_t manufacturer;
     83     int32_t product;
     84     char *cis_info[4];
     85     int function;
     86     int enet_maddr;
     87     unsigned char enet_vendor[3];
     88 } ne2000devs[] = {
     89     { PCMCIA_STR_PREMAX_PE200,
     90       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
     91       PCMCIA_CIS_PREMAX_PE200,
     92       0, 0x07f0, { 0x00, 0x20, 0xe0 } },
     93 
     94     { PCMCIA_STR_DIGITAL_DEPCMXX,
     95       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
     96       PCMCIA_CIS_DIGITAL_DEPCMXX,
     97       0, 0x0ff0, { 0x00, 0x00, 0xe8 } },
     98 
     99     { PCMCIA_STR_PLANET_SMARTCOM2000,
    100       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    101       PCMCIA_CIS_PLANET_SMARTCOM2000,
    102       0, 0xff0, { 0x00, 0x00, 0xe8 } },
    103 
    104     { PCMCIA_STR_DLINK_DE650,
    105       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    106       PCMCIA_CIS_DLINK_DE650,
    107       0, 0x0040, { 0x00, 0x80, 0xc8 } },
    108 
    109     { PCMCIA_STR_DLINK_DE660,
    110       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    111       PCMCIA_CIS_DLINK_DE660,
    112       0, -1, { 0x00, 0x80, 0xc8 } },
    113 
    114     { PCMCIA_STR_RPTI_EP401,
    115       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    116       PCMCIA_CIS_RPTI_EP401,
    117       0, -1, { 0x00, 0x40, 0x95 } },
    118 
    119     { PCMCIA_STR_ACCTON_EN2212,
    120       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    121       PCMCIA_CIS_ACCTON_EN2212,
    122       0, 0x0ff0, { 0x00, 0x00, 0xe8 } },
    123 
    124     /*
    125      * You have to add new entries which contains
    126      * PCMCIA_VENDOR_INVALID and/or PCMCIA_PRODUCT_INVALID
    127      * in front of this comment.
    128      *
    129      * There are cards which use a generic vendor and product id but needs
    130      * a different handling depending on the cis_info, so ne2000_match
    131      * needs a table where the exceptions comes first and then the normal
    132      * product and vendor entries.
    133      */
    134 
    135     { PCMCIA_STR_IBM_INFOMOVER,
    136       PCMCIA_VENDOR_IBM, PCMCIA_PRODUCT_IBM_INFOMOVER,
    137       PCMCIA_CIS_IBM_INFOMOVER,
    138       0, 0x0ff0, { 0x08, 0x00, 0x5a } },
    139 
    140     { PCMCIA_STR_LINKSYS_ECARD_1,
    141       PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_ECARD_1,
    142       PCMCIA_CIS_LINKSYS_ECARD_1,
    143       0, -1, { 0x00, 0x80, 0xc8 } },
    144 
    145     { PCMCIA_STR_LINKSYS_COMBO_ECARD,
    146       PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_COMBO_ECARD,
    147       PCMCIA_CIS_LINKSYS_COMBO_ECARD,
    148       0, -1, { 0x00, 0x80, 0xc8 } },
    149 
    150     { PCMCIA_STR_LINKSYS_TRUST_COMBO_ECARD,
    151       PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_TRUST_COMBO_ECARD,
    152       PCMCIA_CIS_LINKSYS_TRUST_COMBO_ECARD,
    153       0, 0x0120, { 0x20, 0x04, 0x49 } },
    154 
    155     /* Although the comments above say to put VENDOR/PRODUCT INVALID IDs
    156        above this list, we need to keep this one below the ECARD_1, or else
    157        both will match the same more-generic entry rather than the more
    158        specific one above with proper vendor and product IDs. */
    159     { PCMCIA_STR_LINKSYS_ECARD_2,
    160       PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID,
    161       PCMCIA_CIS_LINKSYS_ECARD_2,
    162       0, -1, { 0x00, 0x80, 0xc8 } },
    163 
    164     { PCMCIA_STR_IODATA_PCLAT,
    165       PCMCIA_VENDOR_IODATA, PCMCIA_PRODUCT_IODATA_PCLAT,
    166       PCMCIA_CIS_IODATA_PCLAT,
    167       /* two possible location, 0x01c0 or 0x0ff0 */
    168       0, -1, { 0x00, 0xa0, 0xb0 } },
    169 
    170     { PCMCIA_STR_DAYNA_COMMUNICARD_E_1,
    171       PCMCIA_VENDOR_DAYNA, PCMCIA_PRODUCT_DAYNA_COMMUNICARD_E_1,
    172       PCMCIA_CIS_DAYNA_COMMUNICARD_E_1,
    173       0, 0x0110, { 0x00, 0x80, 0x19 } },
    174 
    175     { PCMCIA_STR_DAYNA_COMMUNICARD_E_2,
    176       PCMCIA_VENDOR_DAYNA, PCMCIA_PRODUCT_DAYNA_COMMUNICARD_E_2,
    177       PCMCIA_CIS_DAYNA_COMMUNICARD_E_2,
    178       0, -1, { 0x00, 0x80, 0x19 } },
    179 #if 0
    180     /* the rest of these are stolen from the linux pcnet pcmcia device
    181        driver.  Since I don't know the manfid or cis info strings for
    182        any of them, they're not compiled in until I do. */
    183     { "Allied Telesis LA-PCM",
    184       0x0000, 0x0000, NULL, NULL, 0,
    185       0x0ff0, { 0x00, 0x00, 0xf4 } },
    186     { "APEX MultiCard",
    187       0x0000, 0x0000, NULL, NULL, 0,
    188       0x03f4, { 0x00, 0x20, 0xe5 } },
    189     { "ASANTE FriendlyNet",
    190       0x0000, 0x0000, NULL, NULL, 0,
    191       0x4910, { 0x00, 0x00, 0x94 } },
    192     { "Danpex EN-6200P2",
    193       0x0000, 0x0000, NULL, NULL, 0,
    194       0x0110, { 0x00, 0x40, 0xc7 } },
    195     { "DataTrek NetCard",
    196       0x0000, 0x0000, NULL, NULL, 0,
    197       0x0ff0, { 0x00, 0x20, 0xe8 } },
    198     { "Dayna CommuniCard E",
    199       0x0000, 0x0000, NULL, NULL, 0,
    200       0x0110, { 0x00, 0x80, 0x19 } },
    201     { "EP-210 Ethernet",
    202       0x0000, 0x0000, NULL, NULL, 0,
    203       0x0110, { 0x00, 0x40, 0x33 } },
    204     { "Epson EEN10B",
    205       0x0000, 0x0000, NULL, NULL, 0,
    206       0x0ff0, { 0x00, 0x00, 0x48 } },
    207     { "ELECOM Laneed LD-CDWA",
    208       0x0000, 0x0000, NULL, NULL, 0,
    209       0x00b8, { 0x08, 0x00, 0x42 } },
    210     { "Grey Cell GCS2220",
    211       0x0000, 0x0000, NULL, NULL, 0,
    212       0x0000, { 0x00, 0x47, 0x43 } },
    213     { "Hypertec Ethernet",
    214       0x0000, 0x0000, NULL, NULL, 0,
    215       0x01c0, { 0x00, 0x40, 0x4c } },
    216     { "IBM CCAE",
    217       0x0000, 0x0000, NULL, NULL, 0,
    218       0x0ff0, { 0x08, 0x00, 0x5a } },
    219     { "IBM CCAE",
    220       0x0000, 0x0000, NULL, NULL, 0,
    221       0x0ff0, { 0x00, 0x04, 0xac } },
    222     { "IBM CCAE",
    223       0x0000, 0x0000, NULL, NULL, 0,
    224       0x0ff0, { 0x00, 0x06, 0x29 } },
    225     { "IBM FME",
    226       0x0000, 0x0000, NULL, NULL, 0,
    227       0x0374, { 0x00, 0x04, 0xac } },
    228     { "IBM FME",
    229       0x0000, 0x0000, NULL, NULL, 0,
    230       0x0374, { 0x08, 0x00, 0x5a } },
    231     { "Katron PE-520",
    232       0x0000, 0x0000, NULL, NULL, 0,
    233       0x0110, { 0x00, 0x40, 0xf6 } },
    234     { "Kingston KNE-PCM/x",
    235       0x0000, 0x0000, NULL, NULL, 0,
    236       0x0ff0, { 0x00, 0xc0, 0xf0 } },
    237     { "Kingston KNE-PCM/x",
    238       0x0000, 0x0000, NULL, NULL, 0,
    239       0x0ff0, { 0xe2, 0x0c, 0x0f } },
    240     { "Kingston KNE-PC2",
    241       0x0000, 0x0000, NULL, NULL, 0,
    242       0x0180, { 0x00, 0xc0, 0xf0 } },
    243     { "Longshine LCS-8534",
    244       0x0000, 0x0000, NULL, NULL, 0,
    245       0x0000, { 0x08, 0x00, 0x00 } },
    246     { "Maxtech PCN2000",
    247       0x0000, 0x0000, NULL, NULL, 0,
    248       0x5000, { 0x00, 0x00, 0xe8 } },
    249     { "NDC Instant-Link",
    250       0x0000, 0x0000, NULL, NULL, 0,
    251       0x003a, { 0x00, 0x80, 0xc6 } },
    252     { "NE2000 Compatible",
    253       0x0000, 0x0000, NULL, NULL, 0,
    254       0x0ff0, { 0x00, 0xa0, 0x0c } },
    255     { "Network General Sniffer",
    256       0x0000, 0x0000, NULL, NULL, 0,
    257       0x0ff0, { 0x00, 0x00, 0x65 } },
    258     { "Panasonic VEL211",
    259       0x0000, 0x0000, NULL, NULL, 0,
    260       0x0ff0, { 0x00, 0x80, 0x45 } },
    261     { "SCM Ethernet",
    262       0x0000, 0x0000, NULL, NULL, 0,
    263       0x0ff0, { 0x00, 0x20, 0xcb } },
    264     { "Socket EA",
    265       0x0000, 0x0000, NULL, NULL, 0,
    266       0x4000, { 0x00, 0xc0, 0x1b } },
    267     { "Volktek NPL-402CT",
    268       0x0000, 0x0000, NULL, NULL, 0,
    269       0x0060, { 0x00, 0x40, 0x05 } },
    270 #endif
    271 };
    272 
    273 #define	NE2000_NDEVS	(sizeof(ne2000devs) / sizeof(ne2000devs[0]))
    274 
    275 #define ne2000_match(card, fct, n) \
    276 ((((((card)->manufacturer != PCMCIA_VENDOR_INVALID) && \
    277     ((card)->manufacturer == ne2000devs[(n)].manufacturer) && \
    278     ((card)->product != PCMCIA_PRODUCT_INVALID) && \
    279     ((card)->product == ne2000devs[(n)].product)) || \
    280    ((ne2000devs[(n)].cis_info[0]) && (ne2000devs[(n)].cis_info[1]) && \
    281     (strcmp((card)->cis1_info[0], ne2000devs[(n)].cis_info[0]) == 0) && \
    282     (strcmp((card)->cis1_info[1], ne2000devs[(n)].cis_info[1]) == 0))) && \
    283   ((fct) == ne2000devs[(n)].function))? \
    284  &ne2000devs[(n)]:NULL)
    285 
    286 int
    287 ne_pcmcia_match(parent, match, aux)
    288 	struct device *parent;
    289 	struct cfdata *match;
    290 	void *aux;
    291 {
    292 	struct pcmcia_attach_args *pa = aux;
    293 	int i;
    294 
    295 	for (i = 0; i < NE2000_NDEVS; i++) {
    296 		if (ne2000_match(pa->card, pa->pf->number, i))
    297 			return (1);
    298 	}
    299 
    300 	return (0);
    301 }
    302 
    303 void
    304 ne_pcmcia_attach(parent, self, aux)
    305 	struct device *parent, *self;
    306 	void *aux;
    307 {
    308 	struct ne_pcmcia_softc *psc = (void *) self;
    309 	struct ne2000_softc *nsc = &psc->sc_ne2000;
    310 	struct dp8390_softc *dsc = &nsc->sc_dp8390;
    311 	struct pcmcia_attach_args *pa = aux;
    312 	struct pcmcia_config_entry *cfe;
    313 	struct ne2000dev *ne_dev;
    314 	struct pcmcia_mem_handle pcmh;
    315 	bus_addr_t offset;
    316 	int i, j, mwindow;
    317 	u_int8_t myea[6], *enaddr = NULL;
    318 	void (*npp_init_media) __P((struct dp8390_softc *, int **,
    319 	    int *, int *));
    320 	int *media, nmedia, defmedia;
    321 	const char *typestr = "";
    322 
    323 	npp_init_media = NULL;
    324 	media = NULL;
    325 	nmedia = defmedia = 0;
    326 
    327 	psc->sc_pf = pa->pf;
    328 	cfe = pa->pf->cfe_head.sqh_first;
    329 
    330 #if 0
    331 	/*
    332 	 * Some ne2000 driver's claim to have memory; others don't.
    333 	 * Since I don't care, I don't check.
    334 	 */
    335 
    336 	if (cfe->num_memspace != 1) {
    337 		printf(": unexpected number of memory spaces "
    338 		    " %d should be 1\n", cfe->num_memspace);
    339 		return;
    340 	}
    341 #endif
    342 
    343 	if (cfe->num_iospace == 1) {
    344 		if (cfe->iospace[0].length != NE2000_NPORTS) {
    345 			printf(": unexpected I/O space configuration\n");
    346 			return;
    347 		}
    348 	} else if (cfe->num_iospace == 2) {
    349 		/*
    350 		 * Some cards report a separate space for NIC and ASIC.
    351 		 * This make some sense, but we must allocate a single
    352 		 * NE2000_NPORTS-sized chunk, due to brain damaged
    353 		 * address decoders on some of these cards.
    354 		 */
    355 		if ((cfe->iospace[0].length + cfe->iospace[1].length) !=
    356 		    NE2000_NPORTS) {
    357 			printf(": unexpected I/O space configuration\n");
    358 			return;
    359 		}
    360 	} else {
    361 		printf(": unexpected number of i/o spaces %d"
    362 		    " should be 1 or 2\n", cfe->num_iospace);
    363 	}
    364 
    365 	if (pcmcia_io_alloc(pa->pf, 0, NE2000_NPORTS, NE2000_NPORTS,
    366 	    &psc->sc_pcioh)) {
    367 		printf(": can't alloc i/o space\n");
    368 		return;
    369 	}
    370 
    371 	dsc->sc_regt = psc->sc_pcioh.iot;
    372 	dsc->sc_regh = psc->sc_pcioh.ioh;
    373 
    374 	nsc->sc_asict = psc->sc_pcioh.iot;
    375 	if (bus_space_subregion(dsc->sc_regt, dsc->sc_regh,
    376 	    NE2000_ASIC_OFFSET, NE2000_ASIC_NPORTS,
    377 	    &nsc->sc_asich)) {
    378 		printf(": can't get subregion for asic\n");
    379 		return;
    380 	}
    381 
    382 	/* Set up power management hooks. */
    383 	dsc->sc_enable = ne_pcmcia_enable;
    384 	dsc->sc_disable = ne_pcmcia_disable;
    385 
    386 	/* Enable the card. */
    387 	pcmcia_function_init(pa->pf, cfe);
    388 	if (pcmcia_function_enable(pa->pf)) {
    389 		printf(": function enable failed\n");
    390 		return;
    391 	}
    392 
    393 	/* some cards claim to be io16, but they're lying. */
    394 	if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO8,
    395 	    NE2000_NIC_OFFSET, NE2000_NIC_NPORTS,
    396 	    &psc->sc_pcioh, &psc->sc_nic_io_window)) {
    397 		printf(": can't map NIC i/o space\n");
    398 		return;
    399 	}
    400 
    401 	if (pcmcia_io_map(pa->pf, PCMCIA_WIDTH_IO16,
    402 	    NE2000_ASIC_OFFSET, NE2000_ASIC_NPORTS,
    403 	    &psc->sc_pcioh, &psc->sc_asic_io_window)) {
    404 		printf(": can't map ASIC i/o space\n");
    405 		return;
    406 	}
    407 
    408 	printf("\n");
    409 
    410 	/*
    411 	 * Read the station address from the board.
    412 	 */
    413 	for (i = 0; i < NE2000_NDEVS; i++) {
    414 		if ((ne_dev = ne2000_match(pa->card, pa->pf->number, i))
    415 		    != NULL) {
    416 			if (ne_dev->enet_maddr >= 0) {
    417 				if (pcmcia_mem_alloc(pa->pf,
    418 				    ETHER_ADDR_LEN * 2, &pcmh)) {
    419 					printf("%s: can't alloc mem for"
    420 					    " enet addr\n",
    421 					    dsc->sc_dev.dv_xname);
    422 					return;
    423 				}
    424 				if (pcmcia_mem_map(pa->pf, PCMCIA_MEM_ATTR,
    425 				    ne_dev->enet_maddr, ETHER_ADDR_LEN * 2,
    426 				    &pcmh, &offset, &mwindow)) {
    427 					printf("%s: can't map mem for"
    428 					    " enet addr\n",
    429 					    dsc->sc_dev.dv_xname);
    430 					return;
    431 				}
    432 				for (j = 0; j < ETHER_ADDR_LEN; j++)
    433 					myea[j] = bus_space_read_1(pcmh.memt,
    434 					    pcmh.memh, offset + (j * 2));
    435 				pcmcia_mem_unmap(pa->pf, mwindow);
    436 				pcmcia_mem_free(pa->pf, &pcmh);
    437 				enaddr = myea;
    438 			}
    439 			break;
    440 		}
    441 	}
    442 
    443 	if (enaddr != NULL) {
    444 		/*
    445 		 * Make sure this is what we expect.
    446 		 */
    447 		if (enaddr[0] != ne_dev->enet_vendor[0] ||
    448 		    enaddr[1] != ne_dev->enet_vendor[1] ||
    449 		    enaddr[2] != ne_dev->enet_vendor[2]) {
    450 			printf("%s: enet addr has incorrect vendor code\n",
    451 			    dsc->sc_dev.dv_xname);
    452 			printf("%s: (%02x:%02x:%02x should be "
    453 			    "%02x:%02x:%02x)\n", dsc->sc_dev.dv_xname,
    454 			    enaddr[0], enaddr[1], enaddr[2],
    455 			    ne_dev->enet_vendor[0],
    456 			    ne_dev->enet_vendor[1],
    457 			    ne_dev->enet_vendor[2]);
    458 			return;
    459 		}
    460 	}
    461 
    462 	/*
    463 	 * Check for a RealTek 8019.
    464 	 */
    465 	bus_space_write_1(dsc->sc_regt, dsc->sc_regh, ED_P0_CR,
    466 	    ED_CR_PAGE_0 | ED_CR_STP);
    467 	if (bus_space_read_1(dsc->sc_regt, dsc->sc_regh, NERTL_RTL0_8019ID0)
    468 		== RTL0_8019ID0 &&
    469 	    bus_space_read_1(dsc->sc_regt, dsc->sc_regh, NERTL_RTL0_8019ID1)
    470 		== RTL0_8019ID1) {
    471 		typestr = " (RTL8019)";
    472 		npp_init_media = rtl80x9_init_media;
    473 		dsc->sc_mediachange = rtl80x9_mediachange;
    474 		dsc->sc_mediastatus = rtl80x9_mediastatus;
    475 		dsc->init_card = rtl80x9_init_card;
    476 	}
    477 
    478 	printf("%s: %s%s Ethernet\n", dsc->sc_dev.dv_xname, ne_dev->name,
    479 	    typestr);
    480 
    481 	/* Initialize media, if we have it. */
    482 	if (npp_init_media != NULL)
    483 		(*npp_init_media)(dsc, &media, &nmedia, &defmedia);
    484 
    485 	ne2000_attach(nsc, enaddr, media, nmedia, defmedia);
    486 
    487 	pcmcia_function_disable(pa->pf);
    488 }
    489 
    490 int
    491 ne_pcmcia_enable(dsc)
    492 	struct dp8390_softc *dsc;
    493 {
    494 	struct ne_pcmcia_softc *psc = (struct ne_pcmcia_softc *)dsc;
    495 
    496 	/* set up the interrupt */
    497 	psc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET, dp8390_intr,
    498 	    dsc);
    499 	if (psc->sc_ih == NULL) {
    500 		printf("%s: couldn't establish interrupt\n",
    501 		    dsc->sc_dev.dv_xname);
    502 		return (1);
    503 	}
    504 
    505 	return (pcmcia_function_enable(psc->sc_pf));
    506 }
    507 
    508 void
    509 ne_pcmcia_disable(dsc)
    510 	struct dp8390_softc *dsc;
    511 {
    512 	struct ne_pcmcia_softc *psc = (struct ne_pcmcia_softc *)dsc;
    513 
    514 	pcmcia_function_disable(psc->sc_pf);
    515 
    516 	pcmcia_intr_disestablish(psc->sc_pf, psc->sc_ih);
    517 }
    518