/* * Early console support. Only used on hp300. */ int sti_cnattach(struct sti_rom *rom, struct sti_screen *scr, bus_space_tag_t memt, bus_addr_t *bases, u_int codebase) { bus_space_handle_t romh; u_int romend; int error; long defattr; if ((error = bus_space_map(memt, bases[0], PAGE_SIZE, 0, &romh)) != 0) return error; /* * Compute real PROM size */ romend = sti_rom_size(memt, romh); bus_space_unmap(memt, romh, PAGE_SIZE); if ((error = bus_space_map(memt, bases[0], romend, 0, &romh)) != 0) return error; bases[0] = romh; if (sti_rom_setup(rom, memt, memt, romh, bases, codebase) != 0) return -1; scr->scr_rom = rom; if (sti_screen_setup(scr, STI_CLEARSCR) != 0) return -1; sti_alloc_attr(scr, 0, 0, 0, &defattr); wsdisplay_cnattach(&scr->scr_wsd, scr, 0, 0, defattr); return 0; }
static void sti_sgc_attach(device_t parent, device_t self, void *aux) { struct sti_softc *sc = device_private(self); struct sgc_attach_args *saa = aux; bus_space_handle_t romh; bus_addr_t base; u_int romend; int i; sc->sc_dev = self; if (saa->saa_slot == sticonslot) { sc->sc_flags |= STI_CONSOLE | STI_ATTACHED; sc->sc_rom = &sticn_rom; sc->sc_scr = &sticn_scr; memcpy(sc->bases, sticn_bases, sizeof(sc->bases)); sti_describe(sc); } else { base = (bus_addr_t)sgc_slottopa(saa->saa_slot); if (bus_space_map(saa->saa_iot, base, PAGE_SIZE, 0, &romh)) { aprint_error(": can't map ROM"); return; } /* * Compute real PROM size */ romend = sti_rom_size(saa->saa_iot, romh); bus_space_unmap(saa->saa_iot, romh, PAGE_SIZE); if (bus_space_map(saa->saa_iot, base, romend, 0, &romh)) { aprint_error(": can't map frame buffer"); return; } sc->bases[0] = romh; for (i = 0; i < STI_REGION_MAX; i++) sc->bases[i] = base; if (sti_attach_common(sc, saa->saa_iot, saa->saa_iot, romh, STI_CODEBASE_ALT) != 0) return; } /* * Note on 425e sti(4) framebuffer bitmap memory can be accessed at * (sgc_slottopa(saa->saa_slot) + 0x200000) * but the mmap function to map bitmap display is not provided yet. */ sti_end_attach(sc); }
void sti_sgc_attach(struct device *parent, struct device *self, void *aux) { struct sti_softc *sc = (void *)self; struct sgc_attach_args *saa = aux; bus_addr_t base; bus_space_handle_t ioh; u_int romend; int i; /* * If we already probed it succesfully as a console device, go ahead, * since we will not be able to bus_space_map() again. */ if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode) { sc->sc_flags |= STI_CONSOLE | STI_ATTACHED; sc->sc_scr = &stifb_cn; bcopy(stifb_cn_bases, sc->bases, sizeof(sc->bases)); sti_describe(sc); } else { base = (bus_addr_t)sgc_slottopa(saa->saa_slot); if (bus_space_map(saa->saa_iot, base, PAGE_SIZE, 0, &ioh)) { printf(": can't map frame buffer"); return; } /* * Compute real PROM size */ romend = sti_rom_size(saa->saa_iot, ioh); bus_space_unmap(saa->saa_iot, ioh, PAGE_SIZE); if (bus_space_map(saa->saa_iot, base, romend, 0, &ioh)) { printf(": can't map frame buffer"); return; } sc->memt = sc->iot = saa->saa_iot; sc->romh = ioh; sc->bases[0] = sc->romh; for (i = 1; i < STI_REGION_MAX; i++) sc->bases[i] = base; if (sti_attach_common(sc, STI_CODEBASE_M68K) != 0) return; } sti_end_attach(sc); }