void gbox_dio_attach(struct device *parent, struct device *self, void *aux) { struct gbox_softc *sc = (struct gbox_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 || gbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) { printf(": can't map framebuffer\n"); return; } } diofb_end_attach(sc, &gbox_accessops, sc->sc_fb, sc->sc_scode == conscode, NULL); }
void gbox_dio_attach(device_t parent, device_t self, void *aux) { struct gbox_softc *sc = device_private(self); struct dio_attach_args *da = aux; bus_space_handle_t bsh; struct diofbreg * fbr; sc->sc_dev = self; 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; if (bus_space_map(da->da_bst, da->da_addr, da->da_size, 0, &bsh)) { aprint_error(": can't map framebuffer\n"); return; } fbr = bus_space_vaddr(da->da_bst, bsh); if (gbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) { aprint_error(": can't reset framebuffer\n"); return; } } diofb_end_attach(self, &gbox_accessops, sc->sc_fb, sc->sc_scode == conscode, NULL); }
void gbox_intio_attach(struct device *parent, struct device *self, void *aux) { struct gbox_softc *sc = (struct gbox_softc *)self; struct diofbreg *fbr; fbr = (struct diofbreg *)IIOV(GRFIADDR); sc->sc_scode = CONSCODE_INTERNAL; if (sc->sc_scode == conscode) { sc->sc_fb = &diofb_cn; } else { sc->sc_fb = &sc->sc_fb_store; gbox_reset(sc->sc_fb, sc->sc_scode, fbr); } diofb_end_attach(sc, &gbox_accessops, sc->sc_fb, sc->sc_scode == conscode, NULL); }
void gbox_intio_attach(device_t parent, device_t self, void *aux) { struct gbox_softc *sc = device_private(self); struct intio_attach_args *ia = aux; struct diofbreg *fbr; sc->sc_dev = self; fbr = (struct diofbreg *)ia->ia_addr; sc->sc_scode = CONSCODE_INTERNAL; if (sc->sc_scode == conscode) { sc->sc_fb = &diofb_cn; } else { sc->sc_fb = &sc->sc_fb_store; gbox_reset(sc->sc_fb, sc->sc_scode, fbr); } diofb_end_attach(self, &gbox_accessops, sc->sc_fb, sc->sc_scode == conscode, NULL); }
/* * Gatorbox console support */ int gboxcnattach(bus_space_tag_t bst, bus_addr_t addr, int scode) { bus_space_handle_t bsh; void *va; struct diofbreg *fbr; struct diofb *fb = &diofb_cn; int size; if (bus_space_map(bst, addr, PAGE_SIZE, 0, &bsh)) return 1; va = bus_space_vaddr(bst, bsh); fbr = va; if (badaddr(va) || (fbr->id != GRFHWID) || (fbr->fbid != GID_GATORBOX)) { bus_space_unmap(bst, bsh, PAGE_SIZE); return 1; } size = DIO_SIZE(scode, va); bus_space_unmap(bst, bsh, PAGE_SIZE); if (bus_space_map(bst, addr, size, 0, &bsh)) return 1; va = bus_space_vaddr(bst, bsh); /* * Initialize the framebuffer hardware. */ conscode = scode; conaddr = va; gbox_reset(fb, conscode, (struct diofbreg *)conaddr); /* * Initialize the terminal emulator. */ diofb_cnattach(fb); return 0; }
void gboxcninit() { gbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr); diofb_cnattach(&diofb_cn); }