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); }