Ejemplo n.º 1
0
int
gdium_cnattach(bus_space_tag_t memt, bus_space_tag_t iot,
    pci_chipset_tag_t pc, pcitag_t tag, pcireg_t id)
{
	struct rasops_info * const ri = &gdium_console_screen.scr_ri;
	long defattr;
	pcireg_t reg;


	/* filter out unrecognized devices */
	switch (id) {
	default:
		return ENODEV;
	case PCI_ID_CODE(PCI_VENDOR_SILMOTION, PCI_PRODUCT_SILMOTION_SM502):
		break;
	}

	wsfont_init();
	
	/* set up rasops */
	ri->ri_width = 1024;
	ri->ri_height = 600;
	ri->ri_depth = 16;
	ri->ri_stride = 0x800;

	/* read the mapping register for the frame buffer */
	reg = pci_conf_read(pc, tag, PCI_MAPREG_START);
	fb_addr = reg;

	ri->ri_bits = (char *)MIPS_PHYS_TO_KSEG1(BONITO_PCILO_BASE + reg);
	ri->ri_flg = RI_CENTER | RI_NO_AUTO;

	memset(ri->ri_bits, 0, 0x200000);

	/* use as much of the screen as the font permits */
	rasops_init(ri, 30, 80);

	rasops_reconfig(ri, ri->ri_height / ri->ri_font->fontheight,
	    ri->ri_width / ri->ri_font->fontwidth);

	gdium_stdscreen.nrows = ri->ri_rows;
	gdium_stdscreen.ncols = ri->ri_cols;
	gdium_stdscreen.textops = &ri->ri_ops;
	gdium_stdscreen.capabilities = ri->ri_caps;

	ri->ri_ops.allocattr(ri, 0, ri->ri_rows - 1, 0, &defattr);

	wsdisplay_preattach(&gdium_stdscreen, ri, 0, 0, defattr);
	
	return 0;

}
Ejemplo n.º 2
0
int
rascons_cnattach(void)
{
    struct rasops_info *ri = &rascons_console_screen.scr_ri;
    long defattr;
    int crow = 0;

    /* get current cursor position */
    OF_interpret("line#", 0, 1, &crow);

    /* move (rom monitor) cursor to the lowest line - 1 */
    OF_interpret("#lines 2 - to line#", 0, 0);

    wsfont_init();
    if (copy_rom_font() == 0) {
        romfont_loaded = 1;
    }

    /* set up rasops */
    rascons_init_rasops(console_node, ri);

    /*
     * no need to clear the screen here when we're mimicing firmware
     * output anyway
     */
#if 0
    if (ri->ri_width >= 1024 && ri->ri_height >= 768) {
        int i, screenbytes = ri->ri_stride * ri->ri_height;

        for (i = 0; i < screenbytes; i += sizeof(u_int32_t))
            *(u_int32_t *)(fbaddr + i) = 0xffffffff;
        crow = 0;
    }
#endif

    rascons_stdscreen.nrows = ri->ri_rows;
    rascons_stdscreen.ncols = ri->ri_cols;
    rascons_stdscreen.textops = &ri->ri_ops;
    rascons_stdscreen.capabilities = ri->ri_caps;

    ri->ri_ops.allocattr(ri, 0, 0, 0, &defattr);
    wsdisplay_preattach(&rascons_stdscreen, ri, 0, max(0,
                        min(crow, ri->ri_rows - 1)), defattr);

#if notyet
    rascons_init_cmap(NULL);
#endif

    return 0;
}