Home | History | Annotate | Line # | Download | only in pci
if_tlp_pci.c revision 1.1
      1  1.1  thorpej /*	$NetBSD: if_tlp_pci.c,v 1.1 1999/09/01 00:32:42 thorpej Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*-
      4  1.1  thorpej  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
      5  1.1  thorpej  * All rights reserved.
      6  1.1  thorpej  *
      7  1.1  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  thorpej  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  1.1  thorpej  * NASA Ames Research Center.
     10  1.1  thorpej  *
     11  1.1  thorpej  * Redistribution and use in source and binary forms, with or without
     12  1.1  thorpej  * modification, are permitted provided that the following conditions
     13  1.1  thorpej  * are met:
     14  1.1  thorpej  * 1. Redistributions of source code must retain the above copyright
     15  1.1  thorpej  *    notice, this list of conditions and the following disclaimer.
     16  1.1  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     17  1.1  thorpej  *    notice, this list of conditions and the following disclaimer in the
     18  1.1  thorpej  *    documentation and/or other materials provided with the distribution.
     19  1.1  thorpej  * 3. All advertising materials mentioning features or use of this software
     20  1.1  thorpej  *    must display the following acknowledgement:
     21  1.1  thorpej  *	This product includes software developed by the NetBSD
     22  1.1  thorpej  *	Foundation, Inc. and its contributors.
     23  1.1  thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  1.1  thorpej  *    contributors may be used to endorse or promote products derived
     25  1.1  thorpej  *    from this software without specific prior written permission.
     26  1.1  thorpej  *
     27  1.1  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  1.1  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  1.1  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  1.1  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  1.1  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  1.1  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  1.1  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  1.1  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  1.1  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  1.1  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  1.1  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     38  1.1  thorpej  */
     39  1.1  thorpej 
     40  1.1  thorpej /*
     41  1.1  thorpej  * PCI bus front-end for the Digital Semiconductor ``Tulip'' (21x4x)
     42  1.1  thorpej  * Ethernet controller family driver.
     43  1.1  thorpej  */
     44  1.1  thorpej 
     45  1.1  thorpej #include "opt_inet.h"
     46  1.1  thorpej #include "opt_ns.h"
     47  1.1  thorpej #include "bpfilter.h"
     48  1.1  thorpej 
     49  1.1  thorpej #include <sys/param.h>
     50  1.1  thorpej #include <sys/systm.h>
     51  1.1  thorpej #include <sys/mbuf.h>
     52  1.1  thorpej #include <sys/malloc.h>
     53  1.1  thorpej #include <sys/kernel.h>
     54  1.1  thorpej #include <sys/socket.h>
     55  1.1  thorpej #include <sys/ioctl.h>
     56  1.1  thorpej #include <sys/errno.h>
     57  1.1  thorpej #include <sys/device.h>
     58  1.1  thorpej 
     59  1.1  thorpej #include <net/if.h>
     60  1.1  thorpej #include <net/if_dl.h>
     61  1.1  thorpej #include <net/if_media.h>
     62  1.1  thorpej #include <net/if_ether.h>
     63  1.1  thorpej 
     64  1.1  thorpej #if NBPFILTER > 0
     65  1.1  thorpej #include <net/bpf.h>
     66  1.1  thorpej #endif
     67  1.1  thorpej 
     68  1.1  thorpej #ifdef INET
     69  1.1  thorpej #include <netinet/in.h>
     70  1.1  thorpej #include <netinet/if_inarp.h>
     71  1.1  thorpej #endif
     72  1.1  thorpej 
     73  1.1  thorpej #ifdef NS
     74  1.1  thorpej #include <netns/ns.h>
     75  1.1  thorpej #include <netns/ns_if.h>
     76  1.1  thorpej #endif
     77  1.1  thorpej 
     78  1.1  thorpej #include <machine/bus.h>
     79  1.1  thorpej #include <machine/intr.h>
     80  1.1  thorpej 
     81  1.1  thorpej #include <dev/mii/miivar.h>
     82  1.1  thorpej 
     83  1.1  thorpej #include <dev/ic/tulipreg.h>
     84  1.1  thorpej #include <dev/ic/tulipvar.h>
     85  1.1  thorpej 
     86  1.1  thorpej #include <dev/pci/pcivar.h>
     87  1.1  thorpej #include <dev/pci/pcireg.h>
     88  1.1  thorpej #include <dev/pci/pcidevs.h>
     89  1.1  thorpej 
     90  1.1  thorpej /*
     91  1.1  thorpej  * PCI configuration space registers used by the Tulip.
     92  1.1  thorpej  */
     93  1.1  thorpej #define	TULIP_PCI_IOBA		0x10	/* i/o mapped base */
     94  1.1  thorpej #define	TULIP_PCI_MMBA		0x14	/* memory mapped base */
     95  1.1  thorpej 
     96  1.1  thorpej struct tulip_pci_softc {
     97  1.1  thorpej 	struct tulip_softc sc_tulip;	/* real Tulip softc */
     98  1.1  thorpej 
     99  1.1  thorpej 	/* PCI-specific goo. */
    100  1.1  thorpej 	void	*sc_ih;			/* interrupt handle */
    101  1.1  thorpej };
    102  1.1  thorpej 
    103  1.1  thorpej int	tlp_pci_match __P((struct device *, struct cfdata *, void *));
    104  1.1  thorpej void	tlp_pci_attach __P((struct device *, struct device *, void *));
    105  1.1  thorpej 
    106  1.1  thorpej struct cfattach tlp_pci_ca = {
    107  1.1  thorpej 	sizeof(struct tulip_pci_softc), tlp_pci_match, tlp_pci_attach,
    108  1.1  thorpej };
    109  1.1  thorpej 
    110  1.1  thorpej const struct tulip_pci_product {
    111  1.1  thorpej 	u_int32_t	tpp_vendor;	/* PCI vendor ID */
    112  1.1  thorpej 	u_int32_t	tpp_product;	/* PCI product ID */
    113  1.1  thorpej 	tulip_chip_t	tpp_chip;	/* base Tulip chip type */
    114  1.1  thorpej } tlp_pci_products[] = {
    115  1.1  thorpej #if 0
    116  1.1  thorpej 	{ PCI_VENDOR_DEC,		PCI_PRODUCT_DEC_21040,
    117  1.1  thorpej 	  TULIP_CHIP_21040 },
    118  1.1  thorpej 	{ PCI_VENDOR_DEC,		PCI_PRODUCT_DEC_21041,
    119  1.1  thorpej 	  TULIP_CHIP_21041 },
    120  1.1  thorpej 	{ PCI_VENDOR_DEC,		PCI_PRODUCT_DEC_21140,
    121  1.1  thorpej 	  TULIP_CHIP_21140 },
    122  1.1  thorpej 	{ PCI_VENDOR_DEC,		PCI_PRODUCT_DEC_21142,
    123  1.1  thorpej 	  TULIP_CHIP_21142 },
    124  1.1  thorpej #endif
    125  1.1  thorpej 
    126  1.1  thorpej 	{ PCI_VENDOR_LITEON,		PCI_PRODUCT_LITEON_PNIC,
    127  1.1  thorpej 	  TULIP_CHIP_82C168 },
    128  1.1  thorpej 
    129  1.1  thorpej #if 0
    130  1.1  thorpej 	{ PCI_VENDOR_MACRONIX,		PCI_PRODUCT_MACRONIX_MX98713,
    131  1.1  thorpej 	  TULIP_CHIP_MX98713 },
    132  1.1  thorpej 	{ PCI_VENDOR_MACRONIX,		PCI_PRODUCT_MACRONIX_MX987x5,
    133  1.1  thorpej 	  TULIP_CHIP_MX98715 },
    134  1.1  thorpej #endif
    135  1.1  thorpej 
    136  1.1  thorpej 	{ PCI_VENDOR_WINBOND,		PCI_PRODUCT_WINBOND_W89C840F,
    137  1.1  thorpej 	  TULIP_CHIP_WB89C840F },
    138  1.1  thorpej 
    139  1.1  thorpej 	{ 0,				0,
    140  1.1  thorpej 	  TULIP_CHIP_INVALID },
    141  1.1  thorpej };
    142  1.1  thorpej 
    143  1.1  thorpej const char *tlp_pci_chip_names[] = TULIP_CHIP_NAMES;
    144  1.1  thorpej 
    145  1.1  thorpej const struct tulip_pci_product *tlp_pci_lookup
    146  1.1  thorpej     __P((const struct pci_attach_args *));
    147  1.1  thorpej 
    148  1.1  thorpej const struct tulip_pci_product *
    149  1.1  thorpej tlp_pci_lookup(pa)
    150  1.1  thorpej 	const struct pci_attach_args *pa;
    151  1.1  thorpej {
    152  1.1  thorpej 	const struct tulip_pci_product *tpp;
    153  1.1  thorpej 
    154  1.1  thorpej 	for (tpp = tlp_pci_products;
    155  1.1  thorpej 	     tlp_pci_chip_names[tpp->tpp_chip] != NULL;
    156  1.1  thorpej 	     tpp++) {
    157  1.1  thorpej 		if (PCI_VENDOR(pa->pa_id) == tpp->tpp_vendor &&
    158  1.1  thorpej 		    PCI_PRODUCT(pa->pa_id) == tpp->tpp_product)
    159  1.1  thorpej 			return (tpp);
    160  1.1  thorpej 	}
    161  1.1  thorpej 	return (NULL);
    162  1.1  thorpej }
    163  1.1  thorpej 
    164  1.1  thorpej int
    165  1.1  thorpej tlp_pci_match(parent, match, aux)
    166  1.1  thorpej 	struct device *parent;
    167  1.1  thorpej 	struct cfdata *match;
    168  1.1  thorpej 	void *aux;
    169  1.1  thorpej {
    170  1.1  thorpej 	struct pci_attach_args *pa = aux;
    171  1.1  thorpej 
    172  1.1  thorpej 	if (tlp_pci_lookup(pa) != NULL)
    173  1.1  thorpej 		return (10);	/* beat if_de.c */
    174  1.1  thorpej 
    175  1.1  thorpej 	return (0);
    176  1.1  thorpej }
    177  1.1  thorpej 
    178  1.1  thorpej void
    179  1.1  thorpej tlp_pci_attach(parent, self, aux)
    180  1.1  thorpej 	struct device *parent, *self;
    181  1.1  thorpej 	void *aux;
    182  1.1  thorpej {
    183  1.1  thorpej 	struct tulip_pci_softc *psc = (void *) self;
    184  1.1  thorpej 	struct tulip_softc *sc = &psc->sc_tulip;
    185  1.1  thorpej 	struct pci_attach_args *pa = aux;
    186  1.1  thorpej 	pci_chipset_tag_t pc = pa->pa_pc;
    187  1.1  thorpej 	pci_intr_handle_t ih;
    188  1.1  thorpej 	const char *intrstr = NULL;
    189  1.1  thorpej 	bus_space_tag_t iot, memt;
    190  1.1  thorpej 	bus_space_handle_t ioh, memh;
    191  1.1  thorpej 	int ioh_valid, memh_valid, i, j;
    192  1.1  thorpej 	const struct tulip_pci_product *tpp;
    193  1.1  thorpej 	u_int8_t enaddr[ETHER_ADDR_LEN], *romdata;
    194  1.1  thorpej 	u_int16_t rombuf[TULIP_MAX_ROM_SIZE >> 1];
    195  1.1  thorpej 	u_int32_t val;
    196  1.1  thorpej 	const char *name = NULL;
    197  1.1  thorpej 
    198  1.1  thorpej 	/*
    199  1.1  thorpej 	 * Map the device.
    200  1.1  thorpej 	 */
    201  1.1  thorpej 	ioh_valid = (pci_mapreg_map(pa, TULIP_PCI_IOBA,
    202  1.1  thorpej 	    PCI_MAPREG_TYPE_IO, 0,
    203  1.1  thorpej 	    &iot, &ioh, NULL, NULL) == 0);
    204  1.1  thorpej 	memh_valid = (pci_mapreg_map(pa, TULIP_PCI_MMBA,
    205  1.1  thorpej 	    PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0,
    206  1.1  thorpej 	    &memt, &memh, NULL, NULL) == 0);
    207  1.1  thorpej 
    208  1.1  thorpej 	if (memh_valid) {
    209  1.1  thorpej 		sc->sc_st = memt;
    210  1.1  thorpej 		sc->sc_sh = memh;
    211  1.1  thorpej 	} else if (ioh_valid) {
    212  1.1  thorpej 		sc->sc_st = iot;
    213  1.1  thorpej 		sc->sc_sh = ioh;
    214  1.1  thorpej 	} else {
    215  1.1  thorpej 		printf(": unable to map device registers\n");
    216  1.1  thorpej 		return;
    217  1.1  thorpej 	}
    218  1.1  thorpej 
    219  1.1  thorpej 	tpp = tlp_pci_lookup(pa);
    220  1.1  thorpej 	if (tpp == NULL) {
    221  1.1  thorpej 		printf("\n");
    222  1.1  thorpej 		panic("tlp_pci_attach: impossible");
    223  1.1  thorpej 	}
    224  1.1  thorpej 	sc->sc_chip = tpp->tpp_chip;
    225  1.1  thorpej 
    226  1.1  thorpej 	/*
    227  1.1  thorpej 	 * Get revision info, and set some chip-specific variables.
    228  1.1  thorpej 	 */
    229  1.1  thorpej 	sc->sc_rev = PCI_REVISION(pa->pa_class);
    230  1.1  thorpej 	sc->sc_regshift = 0;
    231  1.1  thorpej 	switch (sc->sc_chip) {
    232  1.1  thorpej 	case TULIP_CHIP_21140:
    233  1.1  thorpej 		if (sc->sc_rev >= 0x20)
    234  1.1  thorpej 			sc->sc_chip = TULIP_CHIP_21140A;
    235  1.1  thorpej 		break;
    236  1.1  thorpej 
    237  1.1  thorpej 	case TULIP_CHIP_21142:
    238  1.1  thorpej 		if (sc->sc_rev >= 0x20)
    239  1.1  thorpej 			sc->sc_chip = TULIP_CHIP_21143;
    240  1.1  thorpej 		break;
    241  1.1  thorpej 
    242  1.1  thorpej 	case TULIP_CHIP_82C168:
    243  1.1  thorpej 		if (sc->sc_rev >= 0x20)
    244  1.1  thorpej 			sc->sc_chip = TULIP_CHIP_82C169;
    245  1.1  thorpej 		break;
    246  1.1  thorpej 
    247  1.1  thorpej 	case TULIP_CHIP_MX98713:
    248  1.1  thorpej 		if (sc->sc_rev >= 0x10)
    249  1.1  thorpej 			sc->sc_chip = TULIP_CHIP_MX98713A;
    250  1.1  thorpej 		break;
    251  1.1  thorpej 
    252  1.1  thorpej 	case TULIP_CHIP_MX98715:
    253  1.1  thorpej 		if (sc->sc_rev >= 0x30)
    254  1.1  thorpej 			sc->sc_chip = TULIP_CHIP_MX98725;
    255  1.1  thorpej 		break;
    256  1.1  thorpej 
    257  1.1  thorpej 	case TULIP_CHIP_WB89C840F:
    258  1.1  thorpej 		sc->sc_regshift = 1;
    259  1.1  thorpej 		break;
    260  1.1  thorpej 
    261  1.1  thorpej 	default:
    262  1.1  thorpej 		/* Nothing. */
    263  1.1  thorpej 	}
    264  1.1  thorpej 
    265  1.1  thorpej 	printf(": %s Ethernet, pass %d.%d\n",
    266  1.1  thorpej 	    tlp_pci_chip_names[sc->sc_chip],
    267  1.1  thorpej 	    (sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
    268  1.1  thorpej 
    269  1.1  thorpej 	sc->sc_dmat = pa->pa_dmat;
    270  1.1  thorpej 
    271  1.1  thorpej 	/*
    272  1.1  thorpej 	 * Make sure bus mastering is enabled.
    273  1.1  thorpej 	 */
    274  1.1  thorpej 	pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
    275  1.1  thorpej 	    pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG) |
    276  1.1  thorpej 	    PCI_COMMAND_MASTER_ENABLE);
    277  1.1  thorpej 
    278  1.1  thorpej 	/*
    279  1.1  thorpej 	 * Get the cacheline size.
    280  1.1  thorpej 	 */
    281  1.1  thorpej 	sc->sc_cacheline = PCI_CACHELINE(pci_conf_read(pc, pa->pa_tag,
    282  1.1  thorpej 	    PCI_BHLC_REG));
    283  1.1  thorpej 
    284  1.1  thorpej 	/*
    285  1.1  thorpej 	 * Read the contents of the Ethernet Address ROM/SROM.
    286  1.1  thorpej 	 */
    287  1.1  thorpej 	memset(rombuf, 0, sizeof(rombuf));
    288  1.1  thorpej 	romdata = (u_int8_t *) rombuf;
    289  1.1  thorpej 	switch (sc->sc_chip) {
    290  1.1  thorpej 	case TULIP_CHIP_21040:
    291  1.1  thorpej 		TULIP_WRITE(sc, CSR_MIIROM, MIIROM_SROMCS);
    292  1.1  thorpej 		for (i = 0; i < sizeof(rombuf); i++) {
    293  1.1  thorpej 			for (j = 0; j < 10000; j++) {
    294  1.1  thorpej 				val = TULIP_READ(sc, CSR_MIIROM);
    295  1.1  thorpej 				if ((val & MIIROM_DN) == 0)
    296  1.1  thorpej 					break;
    297  1.1  thorpej 			}
    298  1.1  thorpej 			romdata[i] = val & MIIROM_DATA;
    299  1.1  thorpej 		}
    300  1.1  thorpej 		break;
    301  1.1  thorpej 
    302  1.1  thorpej 	case TULIP_CHIP_82C168:
    303  1.1  thorpej 	case TULIP_CHIP_82C169:
    304  1.1  thorpej 		/*
    305  1.1  thorpej 		 * The Lite-On PNIC stores the Ethernet address in
    306  1.1  thorpej 		 * the first 3 words of the EEPROM.  EEPROM access
    307  1.1  thorpej 		 * is not like the other Tulip chips.
    308  1.1  thorpej 		 */
    309  1.1  thorpej 		for (i = 0; i < 3; i++) {
    310  1.1  thorpej 			TULIP_WRITE(sc, CSR_PNIC_SROMCTL,
    311  1.1  thorpej 			    PNIC_SROMCTL_READ | i);
    312  1.1  thorpej 			for (j = 0; j < 500; j++) {
    313  1.1  thorpej 				delay(2);
    314  1.1  thorpej 				val = TULIP_READ(sc, CSR_MIIROM);
    315  1.1  thorpej 				if ((val & PNIC_MIIROM_BUSY) == 0)
    316  1.1  thorpej 					break;
    317  1.1  thorpej 			}
    318  1.1  thorpej 			if (val & PNIC_MIIROM_BUSY) {
    319  1.1  thorpej 				printf("%s: EEPROM timed out\n",
    320  1.1  thorpej 				    sc->sc_dev.dv_xname);
    321  1.1  thorpej 				return;
    322  1.1  thorpej 			}
    323  1.1  thorpej 			rombuf[i] = (val & PNIC_MIIROM_DATA);
    324  1.1  thorpej 		}
    325  1.1  thorpej 		break;
    326  1.1  thorpej 
    327  1.1  thorpej 	default:
    328  1.1  thorpej 		tlp_read_srom(sc, 0, sizeof(rombuf) >> 1, rombuf);
    329  1.1  thorpej 	}
    330  1.1  thorpej 
    331  1.1  thorpej 	/*
    332  1.1  thorpej 	 * Deal with chip/board quirks.  This includes setting up
    333  1.1  thorpej 	 * the mediasw, and extracting the Ethernet address from
    334  1.1  thorpej 	 * the rombuf.
    335  1.1  thorpej 	 *
    336  1.1  thorpej 	 * XXX Eventually, handle master/slave interrupts on the
    337  1.1  thorpej 	 * XXX multi-port boards which require that.
    338  1.1  thorpej 	 */
    339  1.1  thorpej 	switch (sc->sc_chip) {
    340  1.1  thorpej 	case TULIP_CHIP_82C168:
    341  1.1  thorpej 	case TULIP_CHIP_82C169:
    342  1.1  thorpej 		/*
    343  1.1  thorpej 		 * Lite-On PNIC's Ethernet address is the first 6
    344  1.1  thorpej 		 * bytes of its EEPROM.
    345  1.1  thorpej 		 */
    346  1.1  thorpej 		memcpy(enaddr, romdata, ETHER_ADDR_LEN);
    347  1.1  thorpej 
    348  1.1  thorpej 		/*
    349  1.1  thorpej 		 * Lite-On PNICs always use the same mediasw; we
    350  1.1  thorpej 		 * select MII vs. internal NWAY automatically.
    351  1.1  thorpej 		 */
    352  1.1  thorpej 		sc->sc_mediasw = &tlp_pnic_mediasw;
    353  1.1  thorpej 		break;
    354  1.1  thorpej 
    355  1.1  thorpej 	case TULIP_CHIP_WB89C840F:
    356  1.1  thorpej 		/*
    357  1.1  thorpej 		 * Winbond 89C840F's Ethernet address is the first
    358  1.1  thorpej 		 * 6 bytes of its EEPROM.
    359  1.1  thorpej 		 */
    360  1.1  thorpej 		memcpy(enaddr, romdata, ETHER_ADDR_LEN);
    361  1.1  thorpej 
    362  1.1  thorpej 		/*
    363  1.1  thorpej 		 * Winbond 89C840F has an MII attached to the SIO.
    364  1.1  thorpej 		 */
    365  1.1  thorpej 		sc->sc_mediasw = &tlp_sio_mii_mediasw;
    366  1.1  thorpej 		break;
    367  1.1  thorpej 
    368  1.1  thorpej 	default:
    369  1.1  thorpej 		printf("%s: sorry, unable to handle your board\n",
    370  1.1  thorpej 		    sc->sc_dev.dv_xname);
    371  1.1  thorpej 		return;
    372  1.1  thorpej 	}
    373  1.1  thorpej 
    374  1.1  thorpej 	/*
    375  1.1  thorpej 	 * Map and establish our interrupt.
    376  1.1  thorpej 	 */
    377  1.1  thorpej 	if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,
    378  1.1  thorpej 	    pa->pa_intrline, &ih)) {
    379  1.1  thorpej 		printf("%s: unable to map interrupt\n", sc->sc_dev.dv_xname);
    380  1.1  thorpej 		return;
    381  1.1  thorpej 	}
    382  1.1  thorpej 	intrstr = pci_intr_string(pc, ih);
    383  1.1  thorpej 	psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, tlp_intr, sc);
    384  1.1  thorpej 	if (psc->sc_ih == NULL) {
    385  1.1  thorpej 		printf("%s: unable to establish interrupt",
    386  1.1  thorpej 		    sc->sc_dev.dv_xname);
    387  1.1  thorpej 		if (intrstr != NULL)
    388  1.1  thorpej 			printf(" at %s", intrstr);
    389  1.1  thorpej 		printf("\n");
    390  1.1  thorpej 		return;
    391  1.1  thorpej 	}
    392  1.1  thorpej 	printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, intrstr);
    393  1.1  thorpej 
    394  1.1  thorpej 	/*
    395  1.1  thorpej 	 * Finish off the attach.
    396  1.1  thorpej 	 */
    397  1.1  thorpej 	tlp_attach(sc, name, enaddr);
    398  1.1  thorpej }
    399