printf("feat %08x ", r->brdg_feat);
dinoattach(parent, self, aux)	struct device *parent;	struct device *self;	void *aux;{	struct dino_softc *sc = (struct dino_softc *)self;	struct confargs *ca = (struct confargs *)aux;	struct pcibus_attach_args pba;	volatile struct dino_regs *r;	bus_space_handle_t memh;	bus_addr_t mem_start;	const char *p;	u_int data;	int s, ver;	sc->sc_bt = ca->ca_iot;	sc->sc_dmat = ca->ca_dmatag;	if (bus_space_map(sc->sc_bt, ca->ca_hpa, PAGE_SIZE, 0, &sc->sc_bh)) {		printf(": can't map space\n");		return;	}	sc->sc_regs = r = (volatile struct dino_regs *)sc->sc_bh;	r->pciror = 0;	r->pciwor = 0;	r->io_addr_en = 0;	r->gmask &= ~1;	/* allow GSC bus req */printf("feat %08x ", r->brdg_feat);	r->brdg_feat &= ~0xf00;	r->brdg_feat |= 3;#ifdef notyet_card_mode	r->io_control = 0x80;	r->pamr = 0;	r->papr = 0;	r->io_fbb_en |= 1;	r->damode = 0;	r->brdg_feat = 0xc0000000 XXX;	r->mltim = 0x40;	/* 64 clocks */	r->tltim = 0x8c;	/* 12 clocks */	/* PCI reset */	r->pcicmd = 0x6f;	DELAY(10000);		/* 10ms for reset to settle */#endif	snprintf(sc->sc_ioexname, sizeof(sc->sc_ioexname),	    "%s_io", sc->sc_dv.dv_xname);	if ((sc->sc_ioex = extent_create(sc->sc_ioexname, 0, 0xffff,	    M_DEVBUF, NULL, 0, EX_NOWAIT | EX_MALLOCOK)) == NULL) {		printf(": cannot allocate I/O extent map\n");		bus_space_unmap(sc->sc_bt, sc->sc_bh, PAGE_SIZE);		return;	}	/* TODO reserve dino's pci space ? */	if (dino_memalloc(sc, 0xf0800000, 0xff7fffff, DINO_MEM_WINDOW,	    DINO_MEM_WINDOW, EX_NOBOUNDARY, 0, &mem_start, &memh)) {		printf(": cannot allocate memory window\n");		bus_space_unmap(sc->sc_bt, sc->sc_bh, PAGE_SIZE);		return;	}	snprintf(sc->sc_memexname, sizeof(sc->sc_memexname),	    "%s_mem", sc->sc_dv.dv_xname);	if ((sc->sc_memex = extent_create(sc->sc_memexname, mem_start,	    mem_start + DINO_MEM_WINDOW, M_DEVBUF, NULL, 0,	    EX_NOWAIT | EX_MALLOCOK)) == NULL) {		printf(": cannot allocate MEM extent map\n");		extent_destroy(sc->sc_ioex);		bus_space_unmap(sc->sc_bt, sc->sc_bh, PAGE_SIZE);		bus_space_free(sc->sc_bt, memh, DINO_MEM_WINDOW);		return;	}	s = splhigh();	r->imr = ~0;	data = r->irr0;	data = r->irr1;	r->imr = 0;	__asm __volatile ("" ::: "memory");	r->icr = 0;	r->iar0 = cpu_gethpa(0) | (31 - ca->ca_irq);	splx(s);	sc->sc_ih = cpu_intr_establish(IPL_NESTED, ca->ca_irq,	    dino_intr, (void *)sc->sc_regs, sc->sc_dv.dv_xname);	/* TODO establish the bus error interrupt */	r->iodc = 0;	data = r->iodc;	ver = (ca->ca_type.iodc_model << 4) |	    (ca->ca_type.iodc_revision >> 4);	switch (ver) {	case 0x05d:	p = "Dino";	/* j2240 */	case 0x680:	p = "Dino";		switch (data >> 16) {		case 0x6800:	ver = 0x20;	break;		case 0x6801:	ver = 0x21;	break;		case 0x6802:	ver = 0x30;	break;		case 0x6803:	ver = 0x31;	break;		default:	ver = 0x40;	break;		}		break;	case 0x682:	p = "Cujo";		switch (data >> 16) {		case 0x6820:	ver = 0x10;	break;		case 0x6821:	ver = 0x20;	break;		default:	ver = 0x30;	break;		}		break;	default:	p = "Mojo";		ver = (data >> 16) & 0xff;		break;	}	sc->sc_ver = ver;	printf(": %s V%d.%d\n", p, ver >> 4, ver & 0xf);	sc->sc_iot = dino_iomemt;	sc->sc_iot.hbt_cookie = sc;	sc->sc_iot.hbt_map = dino_iomap;	sc->sc_iot.hbt_alloc = dino_ioalloc;	sc->sc_memt = dino_iomemt;	sc->sc_memt.hbt_cookie = sc;	sc->sc_memt.hbt_map = dino_memmap;	sc->sc_memt.hbt_alloc = dino_memalloc;	sc->sc_pc = dino_pc;	sc->sc_pc._cookie = sc;	sc->sc_dmatag = dino_dmat;	sc->sc_dmatag._cookie = sc;	/* scan for ps2 kbd/ms, serial, and flying toasters */	ca->ca_hpamask = -1;	pdc_scanbus(self, ca, MAXMODBUS);	pba.pba_busname = "pci";	pba.pba_iot = &sc->sc_iot;	pba.pba_memt = &sc->sc_memt;	pba.pba_dmat = &sc->sc_dmatag;	pba.pba_pc = &sc->sc_pc;	pba.pba_bus = 0;	config_found(self, &pba, dinoprint);	/* enable interrupts now that all the devices are there */	r->imr = sc->sc_imr;}