if (hsc->hsc_ih != NULL) { printf(": %s", intrstr ? intrstr : "unknown interrupt"); } else {
if (hsc->hsc_ih == NULL) {
hmeattach_pci(parent, self, aux)	struct device *parent, *self;	void *aux;{	struct pci_attach_args *pa = aux;	struct hme_pci_softc *hsc = (void *)self;	struct hme_softc *sc = &hsc->hsc_hme;	pci_intr_handle_t intrhandle;	/* XXX the following declarations should be elsewhere */	extern void myetheraddr(u_char *);	pcireg_t csr;	const char *intrstr;	int type, gotenaddr = 0;	/*	 * enable io/memory-space accesses.  this is kinda of gross; but	 * the hme comes up with neither IO space enabled, or memory space.	 */	if (pa->pa_memt)		pa->pa_flags |= PCI_FLAGS_MEM_ENABLED;	if (pa->pa_iot)		pa->pa_flags |= PCI_FLAGS_IO_ENABLED;	csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);	if (pa->pa_memt) {		type = PCI_MAPREG_TYPE_MEM;		csr |= PCI_COMMAND_MEM_ENABLE;		sc->sc_bustag = pa->pa_memt;	} else {		type = PCI_MAPREG_TYPE_IO;		csr |= PCI_COMMAND_IO_ENABLE;		sc->sc_bustag = pa->pa_iot;	}	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,	    csr | PCI_COMMAND_MEM_ENABLE);	sc->sc_dmatag = pa->pa_dmat;	sc->sc_pci = 1; /* XXXXX should all be done in bus_dma. */	/*	 * Map five register banks:	 *	 *	bank 0: HME SEB registers:	+0x0000	 *	bank 1: HME ETX registers:	+0x2000	 *	bank 2: HME ERX registers:	+0x4000	 *	bank 3: HME MAC registers:	+0x6000	 *	bank 4: HME MIF registers:	+0x7000	 *	 */#define PCI_HME_BASEADDR	0x10	if (pci_mapreg_map(pa, PCI_HME_BASEADDR, type, 0,	    &hsc->hsc_memt, &hsc->hsc_memh, NULL, NULL, 0) != 0) {		printf(": could not map hme registers\n");		return;	}	sc->sc_seb = hsc->hsc_memh;	bus_space_subregion(sc->sc_bustag, hsc->hsc_memh, 0x2000, 0x2000,	    &sc->sc_etx);	bus_space_subregion(sc->sc_bustag, hsc->hsc_memh, 0x4000, 0x2000,	    &sc->sc_erx);	bus_space_subregion(sc->sc_bustag, hsc->hsc_memh, 0x6000, 0x1000,	    &sc->sc_mac);	bus_space_subregion(sc->sc_bustag, hsc->hsc_memh, 0x7000, 0x1000,	    &sc->sc_mif);	if (hme_pci_enaddr(sc, pa) == 0)		gotenaddr = 1;#ifdef __sparc__	if (!gotenaddr) {		if (OF_getprop(PCITAG_NODE(pa->pa_tag), "local-mac-address",		    sc->sc_enaddr, ETHER_ADDR_LEN) <= 0)		myetheraddr(sc->sc_enaddr);		gotenaddr = 1;	}#endif#ifdef __powerpc__	if (!gotenaddr) {		pci_ether_hw_addr(pa->pa_pc, sc->sc_enaddr);		gotenaddr = 1;	}#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);	hsc->hsc_ih = pci_intr_establish(pa->pa_pc, intrhandle, IPL_NET,	    hme_intr, sc, self->dv_xname);	if (hsc->hsc_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	 */	hme_config(sc);}