void rbox_dio_attach(struct device *parent, struct device *self, void *aux) { struct rbox_softc *sc = (struct rbox_softc *)self; struct dio_attach_args *da = aux; struct diofbreg *fbr; sc->sc_scode = da->da_scode; if (sc->sc_scode == conscode) { fbr = (struct diofbreg *)conaddr; /* already mapped */ sc->sc_fb = &diofb_cn; } else { sc->sc_fb = &sc->sc_fb_store; fbr = (struct diofbreg *) iomap(dio_scodetopa(sc->sc_scode), da->da_size); if (fbr == NULL || rbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) { printf(": can't map framebuffer\n"); return; } } diofb_end_attach(sc, &rbox_accessops, sc->sc_fb, sc->sc_scode == conscode, NULL); }
static int dio_scode_probe(int scode, int (*func)(bus_space_tag_t, bus_addr_t, int)) { struct bus_space_tag tag; bus_space_tag_t bst; void *pa, *va; bst = &tag; memset(bst, 0, sizeof(struct bus_space_tag)); bst->bustype = HP300_BUS_SPACE_DIO; pa = dio_scodetopa(scode); va = iomap(pa, PAGE_SIZE); if (va == 0) return 1; if (badaddr(va)) { iounmap(va, PAGE_SIZE); return 1; } iounmap(va, PAGE_SIZE); return (*func)(bst, (bus_addr_t)pa, scode); }