Lines Matching refs:softc

171 #define	VGATEXT_IS_CONSOLE(softc) ((softc)->flags & VGATEXT_FLAG_CONSOLE)  argument
191 static int vgatext_kdsetmode(struct vgatext_softc *softc, int mode);
192 static void vgatext_setfont(struct vgatext_softc *softc);
193 static void vgatext_get_cursor(struct vgatext_softc *softc,
195 static void vgatext_set_cursor(struct vgatext_softc *softc, int row, int col);
196 static void vgatext_hide_cursor(struct vgatext_softc *softc);
197 static void vgatext_save_colormap(struct vgatext_softc *softc);
198 static void vgatext_restore_colormap(struct vgatext_softc *softc);
356 vgatext_check_for_console(dev_info_t *devi, struct vgatext_softc *softc, in vgatext_check_for_console() argument
379 softc->flags |= VGATEXT_FLAG_CONSOLE; in vgatext_check_for_console()
384 if (!(softc->flags & VGATEXT_FLAG_CONSOLE) || !pci_pcie_bus) in vgatext_check_for_console()
426 softc->flags &= ~VGATEXT_FLAG_CONSOLE; in vgatext_check_for_console()
435 struct vgatext_softc *softc; in vgatext_attach() local
469 softc = getsoftc(unit); in vgatext_attach()
472 softc->devi = devi; in vgatext_attach()
473 ddi_set_driver_private(devi, softc); in vgatext_attach()
475 softc->polledio.arg = (struct vis_polledio_arg *)softc; in vgatext_attach()
476 softc->polledio.display = vgatext_polled_display; in vgatext_attach()
477 softc->polledio.copy = vgatext_polled_copy; in vgatext_attach()
478 softc->polledio.cursor = vgatext_polled_cursor; in vgatext_attach()
480 mutex_init(&(softc->lock), NULL, MUTEX_DRIVER, NULL); in vgatext_attach()
498 softc->fb_regno = vgatext_get_isa_reg_index(devi, 0, in vgatext_attach()
500 if (softc->fb_regno < 0) { in vgatext_attach()
518 softc->fb_regno = vgatext_get_pci_reg_index(devi, in vgatext_attach()
522 if (softc->fb_regno < 0) { in vgatext_attach()
539 (caddr_t *)&softc->regs.addr, reg_offset, VGA_REG_SIZE, in vgatext_attach()
540 &dev_attr, &softc->regs.handle); in vgatext_attach()
543 softc->regs.mapped = B_TRUE; in vgatext_attach()
545 softc->fb_size = VGA_MEM_SIZE; in vgatext_attach()
547 error = ddi_regs_map_setup(devi, softc->fb_regno, in vgatext_attach()
548 (caddr_t *)&softc->fb.addr, in vgatext_attach()
549 mem_offset, softc->fb_size, in vgatext_attach()
550 &dev_attr, &softc->fb.handle); in vgatext_attach()
553 softc->fb.mapped = B_TRUE; in vgatext_attach()
555 if (ddi_get8(softc->regs.handle, in vgatext_attach()
556 softc->regs.addr + VGA_MISC_R) & VGA_MISC_IOA_SEL) in vgatext_attach()
557 softc->text_base = (caddr_t)softc->fb.addr + VGA_COLOR_BASE; in vgatext_attach()
559 softc->text_base = (caddr_t)softc->fb.addr + VGA_MONO_BASE; in vgatext_attach()
566 softc->current_base = softc->shadow; in vgatext_attach()
568 softc->current_base = softc->text_base; in vgatext_attach()
572 softc->current_base = softc->text_base; in vgatext_attach()
586 vgatext_check_for_console(devi, softc, pci_pcie_bus); in vgatext_attach()
589 if ((vgatext_silent == 0) && (VGATEXT_IS_CONSOLE(softc))) { in vgatext_attach()
590 vgatext_init(softc); in vgatext_attach()
591 vgatext_save_colormap(softc); in vgatext_attach()
596 softc->pci_cfg_hdlp = (ddi_acc_handle_t *) in vgatext_attach()
598 error = pci_config_setup(devi, softc->pci_cfg_hdlp); in vgatext_attach()
605 (void) agpmaster_attach(softc->devi, &softc->agp_master, in vgatext_attach()
606 *softc->pci_cfg_hdlp, INST2NODE2(unit)); in vgatext_attach()
622 struct vgatext_softc *softc = getsoftc(instance); in vgatext_detach() local
627 if (softc->agp_master != NULL) { /* agp initiated */ in vgatext_detach()
628 agpmaster_detach(&softc->agp_master); in vgatext_detach()
629 pci_config_teardown(softc->pci_cfg_hdlp); in vgatext_detach()
632 if (softc->fb.mapped) in vgatext_detach()
633 ddi_regs_map_free(&softc->fb.handle); in vgatext_detach()
634 if (softc->regs.mapped) in vgatext_detach()
635 ddi_regs_map_free(&softc->regs.handle); in vgatext_detach()
636 mutex_destroy(&(softc->lock)); in vgatext_detach()
676 struct vgatext_softc *softc; in vgatext_info() local
682 softc = getsoftc(instance); in vgatext_info()
686 if (softc == NULL || softc->devi == NULL) { in vgatext_info()
689 *result = (void *) softc->devi; in vgatext_info()
709 struct vgatext_softc *softc = getsoftc(DEV2INST(*devp)); in vgatext_open() local
711 if (softc == NULL || otyp == OTYP_BLK) in vgatext_open()
725 do_gfx_ioctl(int cmd, intptr_t data, int mode, struct vgatext_softc *softc) in do_gfx_ioctl() argument
734 return (vgatext_kdsetmode(softc, (int)data)); in do_gfx_ioctl()
737 kd_mode = softc->mode; in do_gfx_ioctl()
755 err = vgatext_devinit(softc, (struct vis_devinit *)data); in do_gfx_ioctl()
771 vgatext_cons_copy(softc, &pma); in do_gfx_ioctl()
783 vgatext_cons_display(softc, &display_request); in do_gfx_ioctl()
795 vgatext_cons_cursor(softc, &cursor_request); in do_gfx_ioctl()
843 struct vgatext_softc *softc = getsoftc(DEV2INST(dev)); in vgatext_ioctl() local
848 mutex_enter(&(softc->lock)); in vgatext_ioctl()
849 err = do_gfx_ioctl(cmd, data, mode, softc); in vgatext_ioctl()
850 mutex_exit(&(softc->lock)); in vgatext_ioctl()
855 softc->agp_master); in vgatext_ioctl()
866 vgatext_save_text(struct vgatext_softc *softc) in vgatext_save_text() argument
870 for (i = 0; i < sizeof (softc->shadow); i++) in vgatext_save_text()
871 softc->shadow[i] = softc->current_base[i]; in vgatext_save_text()
886 vgatext_kdsettext(struct vgatext_softc *softc) in vgatext_kdsettext() argument
890 vgatext_init(softc); in vgatext_kdsettext()
891 for (i = 0; i < sizeof (softc->shadow); i++) { in vgatext_kdsettext()
892 softc->text_base[i] = softc->shadow[i]; in vgatext_kdsettext()
894 softc->current_base = softc->text_base; in vgatext_kdsettext()
895 if (softc->cursor.visible) { in vgatext_kdsettext()
896 vgatext_set_cursor(softc, in vgatext_kdsettext()
897 softc->cursor.row, softc->cursor.col); in vgatext_kdsettext()
899 vgatext_restore_colormap(softc); in vgatext_kdsettext()
903 vgatext_kdsetgraphics(struct vgatext_softc *softc) in vgatext_kdsetgraphics() argument
906 vgatext_save_text(softc); in vgatext_kdsetgraphics()
907 softc->current_base = softc->shadow; in vgatext_kdsetgraphics()
909 vgatext_init_graphics(softc); in vgatext_kdsetgraphics()
914 vgatext_kdsetmode(struct vgatext_softc *softc, int mode) in vgatext_kdsetmode() argument
916 if ((mode == softc->mode) || (!VGATEXT_IS_CONSOLE(softc))) in vgatext_kdsetmode()
921 vgatext_kdsettext(softc); in vgatext_kdsetmode()
925 vgatext_kdsetgraphics(softc); in vgatext_kdsetmode()
934 if (softc->mode == KD_TEXT && vgatext_silent == 1) { in vgatext_kdsetmode()
936 vgatext_kdsettext(softc); in vgatext_kdsetmode()
943 softc->mode = mode; in vgatext_kdsetmode()
952 struct vgatext_softc *softc; in vgatext_devmap() local
957 softc = getsoftc(DEV2INST(dev)); in vgatext_devmap()
958 if (softc == NULL) { in vgatext_devmap()
964 off < VGA_MMAP_FB_BASE + softc->fb_size)) { in vgatext_devmap()
969 if (off + len > VGA_MMAP_FB_BASE + softc->fb_size) in vgatext_devmap()
970 length = VGA_MMAP_FB_BASE + softc->fb_size - off; in vgatext_devmap()
974 if ((err = devmap_devmem_setup(dhp, softc->devi, NULL, softc->fb_regno, in vgatext_devmap()
987 vgatext_devinit(struct vgatext_softc *softc, struct vis_devinit *data) in vgatext_devinit() argument
996 data->polledio = &softc->polledio; in vgatext_devinit()
1007 vgatext_cons_display(struct vgatext_softc *softc, struct vis_consdisplay *da) in vgatext_cons_display() argument
1036 addr = (struct cgatext *)softc->current_base in vgatext_cons_display()
1058 vgatext_cons_copy(struct vgatext_softc *softc, struct vis_conscopy *ma) in vgatext_cons_copy() argument
1095 base = (unsigned short *)softc->current_base; in vgatext_cons_copy()
1138 vgatext_cons_cursor(struct vgatext_softc *softc, struct vis_conscursor *ca) in vgatext_cons_cursor() argument
1145 softc->cursor.visible = B_FALSE; in vgatext_cons_cursor()
1146 if (softc->current_base == softc->text_base) in vgatext_cons_cursor()
1147 vgatext_hide_cursor(softc); in vgatext_cons_cursor()
1158 softc->cursor.visible = B_TRUE; in vgatext_cons_cursor()
1159 softc->cursor.col = ca->col; in vgatext_cons_cursor()
1160 softc->cursor.row = ca->row; in vgatext_cons_cursor()
1161 if (softc->current_base == softc->text_base) in vgatext_cons_cursor()
1162 vgatext_set_cursor(softc, ca->row, ca->col); in vgatext_cons_cursor()
1165 if (softc->current_base == softc->text_base) { in vgatext_cons_cursor()
1166 vgatext_get_cursor(softc, &ca->row, &ca->col); in vgatext_cons_cursor()
1184 vgatext_hide_cursor(struct vgatext_softc *softc) in vgatext_hide_cursor() argument
1190 vgatext_set_cursor(struct vgatext_softc *softc, int row, int col) in vgatext_set_cursor() argument
1199 vga_set_crtc(&softc->regs, VGA_CRTC_CLAH, addr >> 8); in vgatext_set_cursor()
1200 vga_set_crtc(&softc->regs, VGA_CRTC_CLAL, addr & 0xff); in vgatext_set_cursor()
1206 vgatext_get_cursor(struct vgatext_softc *softc, in vgatext_get_cursor() argument
1211 addr = (vga_get_crtc(&softc->regs, VGA_CRTC_CLAH) << 8) + in vgatext_get_cursor()
1212 vga_get_crtc(&softc->regs, VGA_CRTC_CLAL); in vgatext_get_cursor()
1223 vgatext_set_text(struct vgatext_softc *softc) in vgatext_set_text() argument
1233 vga_set_reg(&softc->regs, VGA_MISC_W, VGA_MISC_TEXT); in vgatext_set_text()
1236 vga_set_seq(&softc->regs, VGA_SEQ_RST_SYN, in vgatext_set_text()
1237 (vga_get_seq(&softc->regs, VGA_SEQ_RST_SYN) & in vgatext_set_text()
1240 vga_set_seq(&softc->regs, i, VGA_SEQ_TEXT[i]); in vgatext_set_text()
1242 vga_set_seq(&softc->regs, VGA_SEQ_RST_SYN, in vgatext_set_text()
1243 (vga_get_seq(&softc->regs, VGA_SEQ_RST_SYN) | in vgatext_set_text()
1248 vga_set_crtc(&softc->regs, VGA_CRTC_VRE, in vgatext_set_text()
1249 (vga_get_crtc(&softc->regs, VGA_CRTC_VRE) & in vgatext_set_text()
1252 vga_set_crtc(&softc->regs, i, VGA_CRTC_TEXT[i]); in vgatext_set_text()
1257 vga_set_grc(&softc->regs, i, VGA_GRC_TEXT[i]); in vgatext_set_text()
1262 vga_set_atr(&softc->regs, i, VGA_ATR_TEXT[i]); in vgatext_set_text()
1267 vga_put_cmap(&softc->regs, i, VGA_TEXT_PALETTES[i][0] << 2, in vgatext_set_text()
1272 vga_put_cmap(&softc->regs, i, 0, 0, 0); in vgatext_set_text()
1275 vgatext_save_colormap(softc); in vgatext_set_text()
1279 vgatext_init(struct vgatext_softc *softc) in vgatext_init() argument
1283 atr_mode = vga_get_atr(&softc->regs, VGA_ATR_MODE); in vgatext_init()
1285 vgatext_set_text(softc); in vgatext_init()
1286 atr_mode = vga_get_atr(&softc->regs, VGA_ATR_MODE); in vgatext_init()
1289 vga_set_atr(&softc->regs, VGA_ATR_MODE, atr_mode); in vgatext_init()
1291 vga_set_atr(&softc->regs, VGA_ATR_BDR_CLR, in vgatext_init()
1292 vga_get_atr(&softc->regs, VGA_BRIGHT_WHITE)); in vgatext_init()
1294 vga_set_atr(&softc->regs, VGA_ATR_BDR_CLR, in vgatext_init()
1295 vga_get_atr(&softc->regs, VGA_BLACK)); in vgatext_init()
1297 vgatext_setfont(softc); /* need selectable font? */ in vgatext_init()
1302 vgatext_init_graphics(struct vgatext_softc *softc) in vgatext_init_graphics() argument
1304 vga_set_atr(&softc->regs, VGA_ATR_BDR_CLR, in vgatext_init_graphics()
1305 vga_get_atr(&softc->regs, VGA_BLACK)); in vgatext_init_graphics()
1312 vgatext_setfont(struct vgatext_softc *softc) in vgatext_setfont() argument
1323 vga_set_seq(&softc->regs, 0x00, 0x01); in vgatext_setfont()
1328 vga_set_seq(&softc->regs, 0x02, 0x04); in vgatext_setfont()
1333 vga_set_seq(&softc->regs, 0x04, 0x07); in vgatext_setfont()
1335 vga_set_seq(&softc->regs, 0x00, 0x03); in vgatext_setfont()
1340 vga_set_grc(&softc->regs, 0x04, 0x02); in vgatext_setfont()
1345 vga_set_grc(&softc->regs, 0x05, 0x00); in vgatext_setfont()
1350 vga_set_grc(&softc->regs, 0x06, 0x00); in vgatext_setfont()
1361 to = (unsigned char *)softc->fb.addr + f_offset + i * 0x20; in vgatext_setfont()
1367 vga_set_seq(&softc->regs, 0x00, 0x01); in vgatext_setfont()
1369 vga_set_seq(&softc->regs, 0x02, 0x03); in vgatext_setfont()
1374 vga_set_seq(&softc->regs, 0x04, 0x03); in vgatext_setfont()
1378 vga_set_seq(&softc->regs, 0x03, fsreg[s]); in vgatext_setfont()
1380 vga_set_seq(&softc->regs, 0x00, 0x03); in vgatext_setfont()
1385 vga_set_grc(&softc->regs, 0x04, 0x00); in vgatext_setfont()
1387 vga_set_grc(&softc->regs, 0x05, 0x10); in vgatext_setfont()
1392 vga_set_grc(&softc->regs, 0x06, 0x0e); in vgatext_setfont()
1394 vga_set_atr(&softc->regs, 0x12, 0x0f); in vgatext_setfont()
1399 vgatext_save_colormap(struct vgatext_softc *softc) in vgatext_save_colormap() argument
1404 softc->attrib_palette[i] = vga_get_atr(&softc->regs, i); in vgatext_save_colormap()
1407 vga_get_cmap(&softc->regs, i, in vgatext_save_colormap()
1408 &softc->colormap[i].red, in vgatext_save_colormap()
1409 &softc->colormap[i].green, in vgatext_save_colormap()
1410 &softc->colormap[i].blue); in vgatext_save_colormap()
1415 vgatext_restore_colormap(struct vgatext_softc *softc) in vgatext_restore_colormap() argument
1420 vga_set_atr(&softc->regs, i, softc->attrib_palette[i]); in vgatext_restore_colormap()
1423 vga_put_cmap(&softc->regs, i, in vgatext_restore_colormap()
1424 softc->colormap[i].red, in vgatext_restore_colormap()
1425 softc->colormap[i].green, in vgatext_restore_colormap()
1426 softc->colormap[i].blue); in vgatext_restore_colormap()