intrhandle, IPL_NET, gem_intr, sc, self->dv_xname); if (gsc->gsc_ih != NULL) { printf(": %s", intrstr ? intrstr : "unknown interrupt"); } else {
ih, IPL_NET, gem_intr, sc, self->dv_xname); if (gsc->gsc_ih == NULL) {
gem_attach_pci(parent, self, aux)	struct device *parent, *self;	void *aux;{	struct pci_attach_args *pa = aux;	struct gem_pci_softc *gsc = (void *)self;	struct gem_softc *sc = &gsc->gsc_gem;	pci_intr_handle_t intrhandle;#ifdef __sparc64__	/* XXX the following declarations should be elsewhere */	extern void myetheraddr(u_char *);#endif	const char *intrstr;	int type;	if (pa->pa_memt) {		type = PCI_MAPREG_TYPE_MEM;		sc->sc_bustag = pa->pa_memt;	} else {		type = PCI_MAPREG_TYPE_IO;		sc->sc_bustag = pa->pa_iot;	}	sc->sc_dmatag = pa->pa_dmat;	sc->sc_pci = 1; /* XXXXX should all be done in bus_dma. */	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_GEMNETWORK)		sc->sc_variant = GEM_SUN_GEM;	else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_ERINETWORK)		sc->sc_variant = GEM_SUN_ERI;	else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_K2_GMAC)		sc->sc_variant = GEM_APPLE_K2_GMAC;	else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_PANGEA_GMAC)		sc->sc_variant = GEM_APPLE_PANGEA_GMAC;	else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_SHASTA_GMAC)		sc->sc_variant = GEM_APPLE_SHASTA_GMAC;	else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_UNINORTHGMAC)		sc->sc_variant = GEM_APPLE_UNINORTHGMAC;	else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_UNINORTH2GMAC)		sc->sc_variant = GEM_APPLE_UNINORTH2GMAC;#define PCI_GEM_BASEADDR	0x10	if (pci_mapreg_map(pa, PCI_GEM_BASEADDR, type, 0,	    &gsc->gsc_memt, &gsc->gsc_memh, NULL, NULL, 0) != 0)	{		printf(": could not map gem registers\n");		return;	}	sc->sc_bustag = gsc->gsc_memt;	sc->sc_h = gsc->gsc_memh;#ifdef __sparc64__	if (OF_getprop(PCITAG_NODE(pa->pa_tag), "local-mac-address",	    sc->sc_enaddr, ETHER_ADDR_LEN) <= 0)		myetheraddr(sc->sc_enaddr);#endif#ifdef __powerpc__         pci_ether_hw_addr(pa->pa_pc, sc->sc_enaddr);#endif	sc->sc_burst = 16;	/* XXX */	if (pci_intr_map(pa, &intrhandle) != 0) {		printf(": couldn't map interrupt\n");		return;	/* bus_unmap ? */	}	intrstr = pci_intr_string(pa->pa_pc, intrhandle);	gsc->gsc_ih = pci_intr_establish(pa->pa_pc,	    intrhandle, IPL_NET, gem_intr, sc, self->dv_xname);	if (gsc->gsc_ih != NULL) {		printf(": %s", intrstr ? intrstr : "unknown interrupt");	} else {		printf(": couldn't establish interrupt");		if (intrstr != NULL)			printf(" at %s", intrstr);		printf("\n");		return;	/* bus_unmap ? */	}	/*	 * call the main configure	 */	gem_config(sc);}