void mq200_attach(struct mq200_softc *sc) { unsigned long regval; struct hpcfb_attach_args ha; int console = (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) ? 0 : 1; printf(": "); if (mq200_fbinit(&sc->sc_fbconf) != 0) { /* just return so that hpcfb will not be attached */ return; } sc->sc_fbconf.hf_baseaddr = (u_long)bootinfo->fb_addr; sc->sc_fbconf.hf_offset = (u_long)sc->sc_fbconf.hf_baseaddr - MIPS_PHYS_TO_KSEG1(mips_ptob(mips_btop(sc->sc_baseaddr))); DPRINTF("hf_baseaddr=%lx\n", sc->sc_fbconf.hf_baseaddr); DPRINTF("hf_offset=%lx\n", sc->sc_fbconf.hf_offset); regval = mq200_read(sc, MQ200_PC08R); printf("MQ200 Rev.%02lx video controller", regval & 0xff); if (console) { printf(", console"); } printf("\n"); printf("%s: framebuffer address: 0x%08lx\n", device_xname(sc->sc_dev), (u_long)bootinfo->fb_addr); /* * setup registers */ sc->sc_flags = 0; sc->sc_baseclock = 12288; /* 12.288 MHz */ #ifdef MQ200_DEBUG if (bootverbose) { /* dump current setting */ mq200_dump_all(sc); mq200_dump_pll(sc); } #endif mq200_setup_regctx(sc); mq200_mdsetup(sc); if (sc->sc_md) { int mode; switch (sc->sc_fbconf.hf_pixel_width) { case 1: mode = MQ200_GCC_1BPP; break; case 2: mode = MQ200_GCC_2BPP; break; case 4: mode = MQ200_GCC_4BPP; break; case 8: mode = MQ200_GCC_8BPP; break; case 16: mode = MQ200_GCC_16BPP_DIRECT; break; default: printf("%s: %dbpp isn't supported\n", device_xname(sc->sc_dev), sc->sc_fbconf.hf_pixel_width); return; } if (sc->sc_md->md_flags & MQ200_MD_HAVEFP) { sc->sc_flags |= MQ200_SC_GC2_ENABLE; /* FP */ } #if MQ200_USECRT if (sc->sc_md->md_flags & MQ200_MD_HAVECRT) { int i; sc->sc_flags |= MQ200_SC_GC1_ENABLE; /* CRT */ for (i = 0; i < mq200_crt_nparams; i++) { sc->sc_crt = &mq200_crt_params[i]; if (sc->sc_md->md_fp_width <= mq200_crt_params[i].width && sc->sc_md->md_fp_height <= mq200_crt_params[i].height) break; } } #endif mq200_setup(sc); if (sc->sc_flags & MQ200_SC_GC2_ENABLE) /* FP */ mq200_win_enable(sc, MQ200_GC2, mode, sc->sc_fbconf.hf_baseaddr, sc->sc_fbconf.hf_width, sc->sc_fbconf.hf_height, sc->sc_fbconf.hf_bytes_per_plane); if (sc->sc_flags & MQ200_SC_GC1_ENABLE) /* CRT */ mq200_win_enable(sc, MQ200_GC1, mode, sc->sc_fbconf.hf_baseaddr, sc->sc_fbconf.hf_width, sc->sc_fbconf.hf_height, sc->sc_fbconf.hf_bytes_per_plane); } #ifdef MQ200_DEBUG if (sc->sc_md == NULL || bootverbose) { mq200_dump_pll(sc); } #endif /* Add a power hook to power saving */ sc->sc_mq200pwstate = MQ200_POWERSTATE_D0; sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), mq200_power, sc); if (sc->sc_powerhook == NULL) printf("%s: WARNING: unable to establish power hook\n", device_xname(sc->sc_dev)); /* Add a hard power hook to power saving */ sc->sc_hardpowerhook = config_hook(CONFIG_HOOK_PMEVENT, CONFIG_HOOK_PMEVENT_HARDPOWER, CONFIG_HOOK_SHARE, mq200_hardpower, sc); if (sc->sc_hardpowerhook == NULL) printf("%s: WARNING: unable to establish hard power hook\n", device_xname(sc->sc_dev)); /* initialize backlight brightness and lcd contrast */ sc->sc_lcd_inited = 0; mq200_init_brightness(sc, 1); mq200_init_contrast(sc, 1); mq200_init_backlight(sc, 1); if (console && hpcfb_cnattach(&sc->sc_fbconf) != 0) { panic("mq200_attach: can't init fb console"); } ha.ha_console = console; ha.ha_accessops = &mq200_ha; ha.ha_accessctx = sc; ha.ha_curfbconf = 0; ha.ha_nfbconf = 1; ha.ha_fbconflist = &sc->sc_fbconf; ha.ha_curdspconf = 0; ha.ha_ndspconf = 1; ha.ha_dspconflist = &sc->sc_dspconf; config_found(sc->sc_dev, &ha, hpcfbprint); #if NBIVIDEO > 0 /* * bivideo is no longer need */ bivideo_dont_attach = 1; #endif /* NBIVIDEO > 0 */ }
void consinit() { if (initialized) return; /* select console */ disable_console(); switch (bootinfo->bi_cnuse) { case BI_CNUSE_BUILTIN: #if NBICONSDEV > 0 enable_bicons(); #endif break; case BI_CNUSE_HD64461VIDEO: #if NHD64461VIDEO > 0 CN_ENABLE(hd64461video_); attach_kbd = 1; #endif break; case BI_CNUSE_SCIF: #if NSCIF > 0 CN_ENABLE(scif); #endif break; case BI_CNUSE_HD64461COM: #if NHD64461UART > 0 CN_ENABLE(hd64461uart); #endif break; case BI_CNUSE_HD64465COM: #if NHD64465UART > 0 CN_ENABLE(hd64465uart); #endif break; } #if NBICONSDEV > 0 if (!initialized) { /* use builtin console instead */ enable_bicons(); } #endif if (initialized) { cninit(); } #if NPFCKBD > 0 if (attach_kbd) pfckbd_cnattach(); #endif #if NHPCFB > 0 && NBICONSDEV > 0 if (cn_tab->cn_putc == biconscnputc) hpcfb_cnattach(0); #endif #ifdef KGDB #if NSCIF > 0 scif_kgdb_init(); #endif #if NHD64461UART > 0 hd64461uart_kgdb_init(); #endif #if NHD64465UART > 0 hd64465uart_kgdb_init(); #endif #endif /* KGDB */ }
static void sed1356_attach(struct device *parent, struct device *self, void *aux) { struct sed1356_softc *sc = (struct sed1356_softc *)self; struct hpcfb_attach_args ha; int console = (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) ? 0 : 1; if (attach_flag) { panic("%s(%d): sed1356 attached twice", __FILE__, __LINE__); } attach_flag = 1; if (sed1356_init(&sc->sc_fbconf) != 0) { /* just return so that hpcfb will not be attached */ return; } printf("\n"); sc->sc_iot = &sa11x0_bs_tag; sc->sc_parent = (struct sa11x0_softc *)parent; if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr & ~0x3fffff, 0x200, 0, &sc->sc_regh)) { printf("%s: unable to map register\n", sc->sc_dev.dv_xname); return; } printf("%s: Epson SED1356", sc->sc_dev.dv_xname); if (console) { printf(", console"); } printf("\n"); printf("%s: framebuffer address: 0x%08lx\n", sc->sc_dev.dv_xname, (u_long)bootinfo->fb_addr); /* Add a suspend hook to power saving */ sc->sc_powerstate = 0; sc->sc_powerhook = powerhook_establish(self->dv_xname, sed1356_power, sc); if (sc->sc_powerhook == NULL) printf("%s: WARNING: unable to establish power hook\n", sc->sc_dev.dv_xname); /* Initialize backlight brightness and lcd contrast */ sc->sc_lcd_inited = 0; sed1356_init_brightness(sc, 1); sed1356_init_contrast(sc, 1); sed1356_init_backlight(sc, 1); if (console && hpcfb_cnattach(&sc->sc_fbconf) != 0) panic("sed1356_attach: cannot init fb console"); ha.ha_console = console; ha.ha_accessops = &sed1356_ha; ha.ha_accessctx = sc; ha.ha_curfbconf = 0; ha.ha_nfbconf = 1; ha.ha_fbconflist = &sc->sc_fbconf; ha.ha_curdspconf = 0; ha.ha_ndspconf = 1; ha.ha_dspconflist = &sc->sc_dspconf; /* XXX */ if (platid_match(&platid, &platid_mask_MACH_HP_JORNADA_7XX)) { config_hook(CONFIG_HOOK_POWERCONTROL, CONFIG_HOOK_POWERCONTROL_LCDLIGHT, CONFIG_HOOK_SHARE, j720lcd_power, sc); } config_found(self, &ha, hpcfbprint); }
void tx3912video_attach(device_t parent, device_t self, void *aux) { struct tx3912video_softc *sc = device_private(self); struct video_chip *chip; static const char *const depth_print[] = { [TX3912_VIDEOCTRL1_BITSEL_MONOCHROME] = "monochrome", [TX3912_VIDEOCTRL1_BITSEL_2BITGREYSCALE] = "2bit greyscale", [TX3912_VIDEOCTRL1_BITSEL_4BITGREYSCALE] = "4bit greyscale", [TX3912_VIDEOCTRL1_BITSEL_8BITCOLOR] = "8bit color" }; struct hpcfb_attach_args ha; tx_chipset_tag_t tc; txreg_t val; int console; sc->sc_dev = self; sc->sc_console = console = cn_tab ? 0 : 1; sc->sc_chip = chip = &tx3912video_chip; /* print video module information */ printf(": %s, frame buffer 0x%08x-0x%08x\n", depth_print[(ffs(chip->vc_fbdepth) - 1) & 0x3], (unsigned)chip->vc_fbpaddr, (unsigned)(chip->vc_fbpaddr + chip->vc_fbsize)); /* don't inverse VDAT[3:0] signal */ tc = chip->vc_v; val = tx_conf_read(tc, TX3912_VIDEOCTRL1_REG); val &= ~TX3912_VIDEOCTRL1_INVVID; tx_conf_write(tc, TX3912_VIDEOCTRL1_REG, val); /* install default CLUT */ tx3912video_clut_init(sc); /* if serial console, power off video module */ tx3912video_power(sc, 0, 0, (void *) (console ? PWR_RESUME : PWR_SUSPEND)); /* Add a hard power hook to power saving */ sc->sc_powerhook = config_hook(CONFIG_HOOK_PMEVENT, CONFIG_HOOK_PMEVENT_HARDPOWER, CONFIG_HOOK_SHARE, tx3912video_power, sc); if (sc->sc_powerhook == 0) printf("WARNING unable to establish hard power hook"); #ifdef TX3912VIDEO_DEBUG /* attach debug draw routine (debugging use) */ video_attach_drawfunc(sc->sc_chip); tx_conf_register_video(tc, sc->sc_chip); #endif /* Attach frame buffer device */ tx3912video_hpcfbinit(sc); if (console && hpcfb_cnattach(&sc->sc_fbconf) != 0) { panic("tx3912video_attach: can't init fb console"); } ha.ha_console = console; ha.ha_accessops = &tx3912video_ha; ha.ha_accessctx = sc; ha.ha_curfbconf = 0; ha.ha_nfbconf = 1; ha.ha_fbconflist = &sc->sc_fbconf; ha.ha_curdspconf = 0; ha.ha_ndspconf = 1; ha.ha_dspconflist = &sc->sc_dspconf; config_found(self, &ha, hpcfbprint); #if NBIVIDEO > 0 /* bivideo is no longer need */ bivideo_dont_attach = 1; #endif /* NBIVIDEO > 0 */ }
void ite8181_attach(struct ite8181_softc *sc) { unsigned long regval; struct hpcfb_attach_args ha; int console = (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) ? 0 : 1; printf(": "); if (ite8181_fbinit(&sc->sc_fbconf) != 0) { /* just return so that hpcfb will not be attached */ return; } regval = ite8181_config_read_4(sc->sc_iot, sc->sc_ioh, ITE8181_CLASS); printf("ITE8181 Rev.%02lx", regval & ITE8181_REV_MASK); if (console) { printf(", console"); } printf("\n"); printf("%s: framebuffer address: 0x%08lx\n", sc->sc_dev.dv_xname, (u_long)bootinfo->fb_addr); if (ite8181_lcd_control_disable) printf("%s: ite8181 lcd control is DISABLED.\n", sc->sc_dev.dv_xname); /* set base offsets */ sc->sc_mba = ite8181_config_read_4(sc->sc_iot, sc->sc_ioh, ITE8181_MBA); DPRINTFN(1, ("ite8181: Memory base offset %08x\n", sc->sc_mba)); sc->sc_gba = ite8181_config_read_4(sc->sc_iot, sc->sc_ioh, ITE8181_GBA); DPRINTFN(1, ("ite8181: GUI base offset %08x\n", sc->sc_gba)); sc->sc_sba = ite8181_config_read_4(sc->sc_iot, sc->sc_ioh, ITE8181_SBA); DPRINTFN(1, ("ite8181: Graphics base offset %08x\n", sc->sc_sba)); /* assume lcd is on */ sc->sc_lcd = 1; /* erase wince cursor */ ite8181_erase_cursor(sc); /* Add a power hook to power saving */ sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, ite8181_power, sc); if (sc->sc_powerhook == NULL) printf("%s: WARNING: unable to establish power hook\n", sc->sc_dev.dv_xname); /* Add a hard power hook to power saving */ sc->sc_hardpowerhook = config_hook(CONFIG_HOOK_PMEVENT, CONFIG_HOOK_PMEVENT_HARDPOWER, CONFIG_HOOK_SHARE, ite8181_hardpower, sc); if (sc->sc_hardpowerhook == NULL) printf("%s: WARNING: unable to establish hard power hook\n", sc->sc_dev.dv_xname); /* initialize backlight brightness and lcd contrast */ sc->sc_lcd_inited = 0; ite8181_init_brightness(sc, 1); ite8181_init_contrast(sc, 1); ite8181_init_backlight(sc, 1); if (console && hpcfb_cnattach(&sc->sc_fbconf) != 0) { panic("ite8181_attach: can't init fb console"); } ha.ha_console = console; ha.ha_accessops = &ite8181_ha; ha.ha_accessctx = sc; ha.ha_curfbconf = 0; ha.ha_nfbconf = 1; ha.ha_fbconflist = &sc->sc_fbconf; ha.ha_curdspconf = 0; ha.ha_ndspconf = 1; ha.ha_dspconflist = &sc->sc_dspconf; config_found(&sc->sc_dev, &ha, hpcfbprint); #if NBIVIDEO > 0 /* * bivideo is no longer need */ bivideo_dont_attach = 1; #endif /* NBIVIDEO > 0 */ }