Home | History | Annotate | Line # | Download | only in cardbus
if_tlp_cardbus.c revision 1.8
      1  1.8  mycroft /*	$NetBSD: if_tlp_cardbus.c,v 1.8 2000/01/25 15:29:43 mycroft Exp $	*/
      2  1.1  thorpej 
      3  1.1  thorpej /*-
      4  1.1  thorpej  * Copyright (c) 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  * CardBus 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  * TODO:
     45  1.1  thorpej  *
     46  1.1  thorpej  *	- power management
     47  1.1  thorpej  *	- add support for the Xircom clone
     48  1.1  thorpej  */
     49  1.1  thorpej 
     50  1.1  thorpej #include "opt_inet.h"
     51  1.1  thorpej #include "opt_ns.h"
     52  1.1  thorpej #include "bpfilter.h"
     53  1.1  thorpej 
     54  1.1  thorpej #include <sys/param.h>
     55  1.1  thorpej #include <sys/systm.h>
     56  1.1  thorpej #include <sys/mbuf.h>
     57  1.1  thorpej #include <sys/malloc.h>
     58  1.1  thorpej #include <sys/kernel.h>
     59  1.1  thorpej #include <sys/socket.h>
     60  1.1  thorpej #include <sys/ioctl.h>
     61  1.1  thorpej #include <sys/errno.h>
     62  1.1  thorpej #include <sys/device.h>
     63  1.5  thorpej 
     64  1.5  thorpej #include <machine/endian.h>
     65  1.1  thorpej 
     66  1.1  thorpej #include <net/if.h>
     67  1.1  thorpej #include <net/if_dl.h>
     68  1.1  thorpej #include <net/if_media.h>
     69  1.1  thorpej #include <net/if_ether.h>
     70  1.1  thorpej 
     71  1.1  thorpej #if NBPFILTER > 0
     72  1.1  thorpej #include <net/bpf.h>
     73  1.1  thorpej #endif
     74  1.1  thorpej 
     75  1.1  thorpej #ifdef INET
     76  1.1  thorpej #include <netinet/in.h>
     77  1.1  thorpej #include <netinet/if_inarp.h>
     78  1.1  thorpej #endif
     79  1.1  thorpej 
     80  1.1  thorpej #ifdef NS
     81  1.1  thorpej #include <netns/ns.h>
     82  1.1  thorpej #include <netns/ns_if.h>
     83  1.1  thorpej #endif
     84  1.1  thorpej 
     85  1.1  thorpej #include <machine/bus.h>
     86  1.1  thorpej #include <machine/intr.h>
     87  1.1  thorpej 
     88  1.1  thorpej #include <dev/mii/miivar.h>
     89  1.1  thorpej #include <dev/mii/mii_bitbang.h>
     90  1.1  thorpej 
     91  1.1  thorpej #include <dev/ic/tulipreg.h>
     92  1.1  thorpej #include <dev/ic/tulipvar.h>
     93  1.1  thorpej 
     94  1.1  thorpej #include <dev/pci/pcivar.h>
     95  1.1  thorpej #include <dev/pci/pcireg.h>
     96  1.1  thorpej #include <dev/pci/pcidevs.h>
     97  1.1  thorpej 
     98  1.1  thorpej #include <dev/cardbus/cardbusvar.h>
     99  1.1  thorpej 
    100  1.1  thorpej /*
    101  1.1  thorpej  * PCI configuration space registers used by the Tulip.
    102  1.1  thorpej  */
    103  1.1  thorpej #define	TULIP_PCI_IOBA		0x10	/* i/o mapped base */
    104  1.1  thorpej #define	TULIP_PCI_MMBA		0x14	/* memory mapped base */
    105  1.1  thorpej #define	TULIP_PCI_CFDA		0x40	/* configuration driver area */
    106  1.1  thorpej 
    107  1.1  thorpej #define	CFDA_SLEEP		0x80000000	/* sleep mode */
    108  1.4  thorpej #define	CFDA_SNOOZE		0x40000000	/* snooze mode */
    109  1.1  thorpej 
    110  1.1  thorpej struct tulip_cardbus_softc {
    111  1.1  thorpej 	struct tulip_softc sc_tulip;	/* real Tulip softc */
    112  1.1  thorpej 
    113  1.1  thorpej 	/* CardBus-specific goo. */
    114  1.1  thorpej 	void	*sc_ih;			/* interrupt handle */
    115  1.1  thorpej 
    116  1.1  thorpej 	cardbus_devfunc_t sc_ct;	/* our CardBus devfuncs */
    117  1.1  thorpej 	int	sc_intrline;		/* our interrupt line */
    118  1.1  thorpej 	cardbustag_t sc_tag;
    119  1.1  thorpej 
    120  1.1  thorpej 	int	sc_cbenable;		/* what CardBus access type to enable */
    121  1.1  thorpej 	int	sc_csr;			/* CSR bits */
    122  1.1  thorpej };
    123  1.1  thorpej 
    124  1.1  thorpej int	tlp_cardbus_match __P((struct device *, struct cfdata *, void *));
    125  1.1  thorpej void	tlp_cardbus_attach __P((struct device *, struct device *, void *));
    126  1.1  thorpej 
    127  1.1  thorpej struct cfattach tlp_cardbus_ca = {
    128  1.1  thorpej 	sizeof(struct tulip_cardbus_softc),
    129  1.1  thorpej 	    tlp_cardbus_match, tlp_cardbus_attach,
    130  1.1  thorpej };
    131  1.1  thorpej 
    132  1.1  thorpej const struct tulip_cardbus_product {
    133  1.1  thorpej 	u_int32_t	tcp_vendor;	/* PCI vendor ID */
    134  1.1  thorpej 	u_int32_t	tcp_product;	/* PCI product ID */
    135  1.1  thorpej 	tulip_chip_t	tcp_chip;	/* base Tulip chip type */
    136  1.1  thorpej 	int		tcp_pmreg;	/* power management register offset */
    137  1.1  thorpej } tlp_cardbus_products[] = {
    138  1.1  thorpej 	{ PCI_VENDOR_DEC,		PCI_PRODUCT_DEC_21142,
    139  1.3  thorpej 	  TULIP_CHIP_21142,		0xe0 },
    140  1.1  thorpej 
    141  1.1  thorpej 	{ 0,				0,
    142  1.1  thorpej 	  TULIP_CHIP_INVALID,		0 },
    143  1.1  thorpej };
    144  1.1  thorpej 
    145  1.1  thorpej const char *tlp_cardbus_chip_names[] = TULIP_CHIP_NAMES;
    146  1.1  thorpej 
    147  1.1  thorpej const struct tulip_cardbus_product *tlp_cardbus_lookup
    148  1.1  thorpej     __P((const struct cardbus_attach_args *));
    149  1.1  thorpej 
    150  1.1  thorpej const struct tulip_cardbus_product *
    151  1.1  thorpej tlp_cardbus_lookup(ca)
    152  1.1  thorpej 	const struct cardbus_attach_args *ca;
    153  1.1  thorpej {
    154  1.1  thorpej 	const struct tulip_cardbus_product *tcp;
    155  1.1  thorpej 
    156  1.1  thorpej 	for (tcp = tlp_cardbus_products;
    157  1.1  thorpej 	     tlp_cardbus_chip_names[tcp->tcp_chip] != NULL;
    158  1.1  thorpej 	     tcp++) {
    159  1.1  thorpej 		if (PCI_VENDOR(ca->ca_id) == tcp->tcp_vendor &&
    160  1.1  thorpej 		    PCI_PRODUCT(ca->ca_id) == tcp->tcp_product)
    161  1.1  thorpej 			return (tcp);
    162  1.1  thorpej 	}
    163  1.1  thorpej 	return (NULL);
    164  1.1  thorpej }
    165  1.1  thorpej 
    166  1.1  thorpej int
    167  1.1  thorpej tlp_cardbus_match(parent, match, aux)
    168  1.1  thorpej 	struct device *parent;
    169  1.1  thorpej 	struct cfdata *match;
    170  1.1  thorpej 	void *aux;
    171  1.1  thorpej {
    172  1.1  thorpej 	struct cardbus_attach_args *ca = aux;
    173  1.1  thorpej 
    174  1.1  thorpej 	if (tlp_cardbus_lookup(ca) != NULL)
    175  1.1  thorpej 		return (1);
    176  1.1  thorpej 
    177  1.1  thorpej 	return (0);
    178  1.1  thorpej }
    179  1.1  thorpej 
    180  1.1  thorpej void
    181  1.1  thorpej tlp_cardbus_attach(parent, self, aux)
    182  1.1  thorpej 	struct device *parent, *self;
    183  1.1  thorpej 	void *aux;
    184  1.1  thorpej {
    185  1.1  thorpej 	struct tulip_cardbus_softc *csc = (void *) self;
    186  1.1  thorpej 	struct tulip_softc *sc = &csc->sc_tulip;
    187  1.1  thorpej 	struct cardbus_attach_args *ca = aux;
    188  1.1  thorpej 	cardbus_devfunc_t ct = ca->ca_ct;
    189  1.1  thorpej 	cardbus_chipset_tag_t cc = ct->ct_cc;
    190  1.1  thorpej 	cardbus_function_tag_t cf = ct->ct_cf;
    191  1.1  thorpej 	const struct tulip_cardbus_product *tcp;
    192  1.1  thorpej 	u_int8_t enaddr[ETHER_ADDR_LEN];
    193  1.1  thorpej 	pcireg_t reg;
    194  1.1  thorpej 
    195  1.1  thorpej 	sc->sc_devno = ca->ca_device;
    196  1.1  thorpej 	sc->sc_dmat = ca->ca_dmat;
    197  1.1  thorpej 	csc->sc_ct = ct;
    198  1.1  thorpej 	csc->sc_tag = ca->ca_tag;
    199  1.1  thorpej 	csc->sc_intrline = ca->ca_intrline;
    200  1.1  thorpej 
    201  1.1  thorpej 	tcp = tlp_cardbus_lookup(ca);
    202  1.1  thorpej 	if (tcp == NULL) {
    203  1.1  thorpej 		printf("\n");
    204  1.1  thorpej 		panic("tlp_cardbus_attach: impossible");
    205  1.1  thorpej 	}
    206  1.1  thorpej 	sc->sc_chip = tcp->tcp_chip;
    207  1.1  thorpej 
    208  1.1  thorpej 	/*
    209  1.1  thorpej 	 * By default, Tulip registers are 8 bytes long (4 bytes
    210  1.1  thorpej 	 * followed by a 4 byte pad).
    211  1.1  thorpej 	 */
    212  1.1  thorpej 	sc->sc_regshift = 3;
    213  1.1  thorpej 
    214  1.1  thorpej 	/*
    215  1.1  thorpej 	 * Get revision info, and set some chip-specific variables.
    216  1.1  thorpej 	 */
    217  1.1  thorpej 	sc->sc_rev = PCI_REVISION(ca->ca_class);
    218  1.1  thorpej 	switch (sc->sc_chip) {
    219  1.1  thorpej 	case TULIP_CHIP_21142:
    220  1.1  thorpej 		if (sc->sc_rev >= 0x20)
    221  1.1  thorpej 			sc->sc_chip = TULIP_CHIP_21143;
    222  1.1  thorpej 		break;
    223  1.1  thorpej 
    224  1.1  thorpej 	default:
    225  1.1  thorpej 		/* Nothing. */
    226  1.1  thorpej 	}
    227  1.1  thorpej 
    228  1.1  thorpej 	printf(": %s Ethernet, pass %d.%d\n",
    229  1.1  thorpej 	    tlp_cardbus_chip_names[sc->sc_chip],
    230  1.1  thorpej 	    (sc->sc_rev >> 4) & 0xf, sc->sc_rev & 0xf);
    231  1.2  thorpej 
    232  1.2  thorpej 	/*
    233  1.2  thorpej 	 * Check to see if the device is in power-save mode, and
    234  1.2  thorpej 	 * bring it out if necessary.
    235  1.2  thorpej 	 */
    236  1.2  thorpej 	switch (sc->sc_chip) {
    237  1.2  thorpej 	case TULIP_CHIP_21142:
    238  1.2  thorpej 	case TULIP_CHIP_21143:
    239  1.2  thorpej 		/*
    240  1.2  thorpej 		 * Clear the "sleep mode" bit in the CFDA register.
    241  1.2  thorpej 		 */
    242  1.2  thorpej 		reg = cardbus_conf_read(cc, cf, ca->ca_tag, TULIP_PCI_CFDA);
    243  1.4  thorpej 		if (reg & (CFDA_SLEEP|CFDA_SNOOZE))
    244  1.2  thorpej 			cardbus_conf_write(cc, cf, ca->ca_tag, TULIP_PCI_CFDA,
    245  1.4  thorpej 			    reg & ~(CFDA_SLEEP|CFDA_SNOOZE));
    246  1.2  thorpej 		break;
    247  1.2  thorpej 
    248  1.2  thorpej 	default:
    249  1.2  thorpej 		/* Nothing. */
    250  1.6  thorpej 	}
    251  1.6  thorpej 
    252  1.6  thorpej 	if (cardbus_get_capability(cc, cf, ca->ca_tag, PCI_CAP_PWRMGMT, 0, 0)) {
    253  1.6  thorpej 		if (tcp->tcp_pmreg == 0) {
    254  1.6  thorpej 			printf("%s: don't know location of PMCSR for this "
    255  1.6  thorpej 			    "chip\n", sc->sc_dev.dv_xname);
    256  1.6  thorpej 			return;
    257  1.6  thorpej 		}
    258  1.6  thorpej 		reg = cardbus_conf_read(cc, cf, ca->ca_tag,
    259  1.6  thorpej 		    tcp->tcp_pmreg) & 0x03;
    260  1.6  thorpej #if 1 /* XXX Probably not right for CardBus. */
    261  1.6  thorpej 		if (reg == 3) {
    262  1.6  thorpej 			/*
    263  1.6  thorpej 			 * The card has lost all configuration data in
    264  1.6  thorpej 			 * this state, so punt.
    265  1.6  thorpej 			 */
    266  1.6  thorpej 			printf("%s: unable to wake up from power state D3\n",
    267  1.6  thorpej 			    sc->sc_dev.dv_xname);
    268  1.6  thorpej 			return;
    269  1.6  thorpej 		}
    270  1.6  thorpej #endif
    271  1.6  thorpej 		if (reg != 0) {
    272  1.6  thorpej 			printf("%s: waking up from power state D%d\n",
    273  1.6  thorpej 			    sc->sc_dev.dv_xname, reg);
    274  1.6  thorpej 			cardbus_conf_write(cc, cf, ca->ca_tag,
    275  1.6  thorpej 			    tcp->tcp_pmreg, 0);
    276  1.6  thorpej 		}
    277  1.2  thorpej 	}
    278  1.1  thorpej 
    279  1.1  thorpej 	/*
    280  1.1  thorpej 	 * Map the device.
    281  1.1  thorpej 	 */
    282  1.1  thorpej 	csc->sc_csr = PCI_COMMAND_MASTER_ENABLE;
    283  1.1  thorpej 	if (Cardbus_mapreg_map(csc->sc_ct, TULIP_PCI_MMBA,
    284  1.1  thorpej 	    PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT, 0,
    285  1.1  thorpej 	    &sc->sc_st, &sc->sc_sh, NULL, NULL) == 0) {
    286  1.1  thorpej 		csc->sc_cbenable = CARDBUS_MEM_ENABLE;
    287  1.1  thorpej 		csc->sc_csr |= PCI_COMMAND_MEM_ENABLE;
    288  1.1  thorpej 	} else if (Cardbus_mapreg_map(csc->sc_ct, TULIP_PCI_IOBA,
    289  1.1  thorpej 	    PCI_MAPREG_TYPE_IO, 0, &sc->sc_st, &sc->sc_sh, NULL, NULL) == 0) {
    290  1.1  thorpej 		csc->sc_cbenable = CARDBUS_IO_ENABLE;
    291  1.1  thorpej 		csc->sc_csr |= PCI_COMMAND_IO_ENABLE;
    292  1.1  thorpej 	} else {
    293  1.1  thorpej 		printf("%s: unable to map device registers\n",
    294  1.1  thorpej 		    sc->sc_dev.dv_xname);
    295  1.1  thorpej 		return;
    296  1.1  thorpej 	}
    297  1.1  thorpej 
    298  1.1  thorpej 	/* Make sure the right access type is on the CardBus bridge. */
    299  1.1  thorpej 	(*ct->ct_cf->cardbus_ctrl)(cc, csc->sc_cbenable);
    300  1.8  mycroft 	(*ct->ct_cf->cardbus_ctrl)(cc, CARDBUS_BM_ENABLE);
    301  1.1  thorpej 
    302  1.1  thorpej 	/* Enable the appropriate bits in the PCI CSR. */
    303  1.1  thorpej 	reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG);
    304  1.8  mycroft 	reg &= ~(PCI_COMMAND_IO_ENABLE|PCI_COMMAND_MEM_ENABLE);
    305  1.8  mycroft 	reg |= csc->sc_csr;
    306  1.1  thorpej 	cardbus_conf_write(cc, cf, ca->ca_tag, PCI_COMMAND_STATUS_REG, reg);
    307  1.7  thorpej 
    308  1.7  thorpej 	/*
    309  1.7  thorpej 	 * Make sure the latency timer is set to some reasonable
    310  1.7  thorpej 	 * value.
    311  1.7  thorpej 	 */
    312  1.7  thorpej 	reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_BHLC_REG);
    313  1.7  thorpej 	if (PCI_LATTIMER(reg) < 0x20) {
    314  1.7  thorpej 		reg &= ~(PCI_LATTIMER_MASK << PCI_LATTIMER_SHIFT);
    315  1.7  thorpej 		reg |= (0x20 << PCI_LATTIMER_SHIFT);
    316  1.7  thorpej 		cardbus_conf_write(cc, cf, ca->ca_tag, PCI_BHLC_REG, reg);
    317  1.7  thorpej 	}
    318  1.1  thorpej 
    319  1.1  thorpej 	/*
    320  1.1  thorpej 	 * Read the contents of the Ethernet Address ROM/SROM.  Some
    321  1.1  thorpej 	 * chips have a 128 byte SROM (6 address bits), and some
    322  1.1  thorpej 	 * have a 512 byte SROM (8 address bits).
    323  1.1  thorpej 	 */
    324  1.1  thorpej 	sc->sc_srom_addrbits = 6;
    325  1.1  thorpej  try_again:
    326  1.1  thorpej 	memset(sc->sc_srom, 0, sizeof(sc->sc_srom));
    327  1.1  thorpej 	tlp_read_srom(sc, 0, TULIP_ROM_SIZE(sc->sc_srom_addrbits) >> 1,
    328  1.1  thorpej 	    sc->sc_srom);
    329  1.1  thorpej #if 0
    330  1.1  thorpej 	{
    331  1.1  thorpej 		int i;
    332  1.1  thorpej 
    333  1.1  thorpej 		printf("SROM CONTENTS:");
    334  1.1  thorpej 		for (i = 0; i < TULIP_ROM_SIZE(sc->sc_srom_addrbits); i++) {
    335  1.1  thorpej 			if ((i % 8) == 0)
    336  1.1  thorpej 				printf("\n\t");
    337  1.1  thorpej 			printf("0x%02x ", sc->sc_srom[i]);
    338  1.1  thorpej 		}
    339  1.1  thorpej 		printf("\n");
    340  1.1  thorpej 	}
    341  1.1  thorpej #endif
    342  1.1  thorpej 
    343  1.1  thorpej 	/*
    344  1.1  thorpej 	 * Deal with chip/board quirks.  This includes setting up
    345  1.1  thorpej 	 * the mediasw, and extracting the Ethernet address from
    346  1.1  thorpej 	 * the rombuf.
    347  1.1  thorpej 	 */
    348  1.1  thorpej 	switch (sc->sc_chip) {
    349  1.1  thorpej 	case TULIP_CHIP_21142:
    350  1.1  thorpej 	case TULIP_CHIP_21143:
    351  1.1  thorpej 		/* Check for new format SROM. */
    352  1.1  thorpej 		if (tlp_isv_srom_enaddr(sc, enaddr) == 0) {
    353  1.1  thorpej 			/*
    354  1.1  thorpej 			 * Not an ISV SROM; can't cope, for now.
    355  1.1  thorpej 			 */
    356  1.1  thorpej 			goto cant_cope;
    357  1.1  thorpej 		} else {
    358  1.1  thorpej 			/*
    359  1.1  thorpej 			 * We start out with the 2114x ISV media switch.
    360  1.1  thorpej 			 * When we search for quirks, we may change to
    361  1.1  thorpej 			 * a different switch.
    362  1.1  thorpej 			 */
    363  1.1  thorpej 			sc->sc_mediasw = &tlp_2114x_isv_mediasw;
    364  1.1  thorpej 		}
    365  1.1  thorpej 
    366  1.1  thorpej 		/*
    367  1.1  thorpej 		 * Bail out now if we can't deal with this board.
    368  1.1  thorpej 		 */
    369  1.1  thorpej 		if (sc->sc_mediasw == NULL)
    370  1.1  thorpej 			goto cant_cope;
    371  1.1  thorpej 		break;
    372  1.1  thorpej 
    373  1.1  thorpej 	default:
    374  1.1  thorpej  cant_cope:
    375  1.1  thorpej 		/*
    376  1.1  thorpej 		 * Try reading it again, with larger SROM
    377  1.1  thorpej 		 * size, if we haven't already.
    378  1.1  thorpej 		 */
    379  1.1  thorpej 		if (sc->sc_srom_addrbits != 8) {
    380  1.1  thorpej 			sc->sc_srom_addrbits = 8;
    381  1.1  thorpej 			goto try_again;
    382  1.1  thorpej 		}
    383  1.1  thorpej 
    384  1.1  thorpej 		printf("%s: sorry, unable to handle your board\n",
    385  1.1  thorpej 		    sc->sc_dev.dv_xname);
    386  1.1  thorpej 		return;
    387  1.1  thorpej 	}
    388  1.1  thorpej 
    389  1.1  thorpej 	/*
    390  1.1  thorpej 	 * Map and establish the interrupt.
    391  1.1  thorpej 	 */
    392  1.1  thorpej 	csc->sc_ih = cardbus_intr_establish(cc, cf, ca->ca_intrline, IPL_NET,
    393  1.1  thorpej 	    tlp_intr, sc);
    394  1.1  thorpej 	if (csc->sc_ih == NULL) {
    395  1.1  thorpej 		printf("%s: unable to establish interrupt at %d\n",
    396  1.1  thorpej 		    sc->sc_dev.dv_xname, ca->ca_intrline);
    397  1.1  thorpej 		return;
    398  1.1  thorpej 	}
    399  1.1  thorpej 	printf("%s: interrupting at %d\n", sc->sc_dev.dv_xname,
    400  1.1  thorpej 	    ca->ca_intrline);
    401  1.1  thorpej 
    402  1.1  thorpej 	/*
    403  1.1  thorpej 	 * Finish off the attach.
    404  1.1  thorpej 	 */
    405  1.1  thorpej 	tlp_attach(sc, enaddr);
    406  1.1  thorpej }
    407