Lines Matching refs:vc
323 egavga_getfont(struct vga_config *vc, struct vgascreen *scr, const char *name, in egavga_getfont() argument
330 TAILQ_FOREACH(f, &vc->vc_fontlist, next) { in egavga_getfont()
368 TAILQ_INSERT_TAIL(&vc->vc_fontlist, f, next); in egavga_getfont()
380 egavga_unreffont(struct vga_config *vc, struct egavga_font *f) in egavga_unreffont() argument
388 TAILQ_REMOVE(&vc->vc_fontlist, f, next); in egavga_unreffont()
390 KASSERT(vc->vc_fonts[f->slot] == f); in egavga_unreffont()
391 vc->vc_fonts[f->slot] = 0; in egavga_unreffont()
402 vga_selectfont(struct vga_config *vc, struct vgascreen *scr, const char *name1, in vga_selectfont() argument
408 f1 = egavga_getfont(vc, scr, name1, 1); in vga_selectfont()
413 f2 = egavga_getfont(vc, scr, name2, 0); in vga_selectfont()
415 egavga_unreffont(vc, f1); in vga_selectfont()
432 egavga_unreffont(vc, scr->fontset1); in vga_selectfont()
435 egavga_unreffont(vc, scr->fontset2); in vga_selectfont()
441 vga_init_screen(struct vga_config *vc, struct vgascreen *scr, in vga_init_screen() argument
447 scr->cfg = vc; in vga_init_screen()
448 scr->pcs.hdl = (struct pcdisplay_handle *)&vc->hdl; in vga_init_screen()
452 if (vc->vc_quirks & VGA_QUIRK_NOFASTSCROLL) in vga_init_screen()
458 vc->active = scr; in vga_init_screen()
460 cpos = vga_6845_read(&vc->hdl, cursorh) << 8; in vga_init_screen()
461 cpos |= vga_6845_read(&vc->hdl, cursorl); in vga_init_screen()
467 scr->pcs.dispoffset = vga_6845_read(&vc->hdl, startadrh) << 9; in vga_init_screen()
468 scr->pcs.dispoffset |= vga_6845_read(&vc->hdl, startadrl) << 1; in vga_init_screen()
475 if (type != vc->currenttype) { in vga_init_screen()
476 vga_setscreentype(&vc->hdl, type); in vga_init_screen()
477 vc->currenttype = type; in vga_init_screen()
492 if (!vc->hdl.vh_mono) in vga_init_screen()
513 if (vga_selectfont(vc, scr, 0, 0)) { in vga_init_screen()
520 vga_setfont(vc, scr); in vga_init_screen()
522 vc->nscreens++; in vga_init_screen()
523 LIST_INSERT_HEAD(&vc->screens, scr, next); in vga_init_screen()
527 vga_init(struct vga_config *vc, bus_space_tag_t iot, bus_space_tag_t memt) in vga_init() argument
529 struct vga_handle *vh = &vc->hdl; in vga_init()
555 vc->nscreens = 0; in vga_init()
556 LIST_INIT(&vc->screens); in vga_init()
557 vc->active = NULL; in vga_init()
558 vc->currenttype = vh->vh_mono ? &vga_25lscreen_mono : &vga_25lscreen; in vga_init()
559 callout_init(&vc->vc_switch_callout, 0); in vga_init()
570 vga_loadchars(&vc->hdl, 0, wf->firstchar, wf->numchars, in vga_init()
576 vc->vc_fonts[0] = &vga_builtinfont; in vga_init()
578 vc->vc_fonts[i] = 0; in vga_init()
579 TAILQ_INIT(&vc->vc_fontlist); in vga_init()
580 TAILQ_INSERT_HEAD(&vc->vc_fontlist, &vga_builtinfont, next); in vga_init()
582 vc->currentfontset1 = vc->currentfontset2 = 0; in vga_init()
587 vga_save_palette(vc); in vga_init()
596 struct vga_config *vc; in vga_common_attach() local
602 vc = &vga_console_vc; in vga_common_attach()
605 vc = malloc(sizeof(struct vga_config), M_DEVBUF, M_WAITOK); in vga_common_attach()
606 vga_init(vc, iot, memt); in vga_common_attach()
610 vc->vc_nfontslots = 1; in vga_common_attach()
619 vc->vc_nfontslots = 8; in vga_common_attach()
643 vga_readoutchars(&vc->hdl, BUILTINFONTLOC, 0, 256, in vga_common_attach()
648 vc->vc_type = type; in vga_common_attach()
649 vc->vc_funcs = vf; in vga_common_attach()
650 vc->vc_quirks = quirks; in vga_common_attach()
652 sc->sc_vc = vc; in vga_common_attach()
653 vc->softc = sc; in vga_common_attach()
656 aa.scrdata = (vc->hdl.vh_mono ? &vga_screenlist_mono : &vga_screenlist); in vga_common_attach()
658 aa.accesscookie = vc; in vga_common_attach()
715 struct vga_config *vc; in vga_cndetach() local
718 vc = &vga_console_vc; in vga_cndetach()
719 vh = &vc->hdl; in vga_cndetach()
749 vga_get_video(struct vga_config *vc) in vga_get_video() argument
752 return (vga_ts_read(&vc->hdl, mode) & VGA_TS_MODE_BLANK) == 0; in vga_get_video()
756 vga_set_video(struct vga_config *vc, int state) in vga_set_video() argument
760 vga_ts_write(&vc->hdl, syncreset, 0x01); in vga_set_video()
762 val = vga_ts_read(&vc->hdl, mode); in vga_set_video()
763 vga_ts_write(&vc->hdl, mode, val & ~VGA_TS_MODE_BLANK); in vga_set_video()
765 val = vga_6845_read(&vc->hdl, mode); in vga_set_video()
766 vga_6845_write(&vc->hdl, mode, val | 0x80); in vga_set_video()
769 val = vga_ts_read(&vc->hdl, mode); in vga_set_video()
770 vga_ts_write(&vc->hdl, mode, val | VGA_TS_MODE_BLANK); in vga_set_video()
772 val = vga_6845_read(&vc->hdl, mode); in vga_set_video()
773 vga_6845_write(&vc->hdl, mode, val & ~0x80); in vga_set_video()
776 vga_ts_write(&vc->hdl, syncreset, 0x03); in vga_set_video()
782 struct vga_config *vc = v; in vga_ioctl() local
784 const struct vga_funcs *vf = vc->vc_funcs; in vga_ioctl()
789 vga_restore_palette(vc); in vga_ioctl()
793 *(int *)data = vc->vc_type; in vga_ioctl()
801 *(int *)data = (vga_get_video(vc) ? in vga_ioctl()
806 vga_set_video(vc, *(int *)data == WSDISPLAYIO_VIDEO_ON); in vga_ioctl()
821 return (vga_getborder(vc, (u_int *)data)); in vga_ioctl()
824 return (vga_setborder(vc, *(u_int *)data)); in vga_ioctl()
838 if (vc->vc_funcs == NULL) in vga_ioctl()
850 struct vga_config *vc = v; in vga_mmap() local
851 const struct vga_funcs *vf = vc->vc_funcs; in vga_mmap()
853 if (vc->vc_funcs == NULL) in vga_mmap()
866 struct vga_config *vc = v; in vga_alloc_screen() local
869 if (vc->nscreens == 1) { in vga_alloc_screen()
870 struct vgascreen *scr1 = vc->screens.lh_first; in vga_alloc_screen()
882 vga_init_screen(vc, scr, type, vc->nscreens == 0, defattrp); in vga_alloc_screen()
884 if (vc->nscreens > 1) { in vga_alloc_screen()
901 struct vga_config *vc = vs->cfg; in vga_free_screen() local
904 vc->nscreens--; in vga_free_screen()
906 egavga_unreffont(vc, vs->fontset1); in vga_free_screen()
908 egavga_unreffont(vc, vs->fontset2); in vga_free_screen()
915 if (vc->active == vs) in vga_free_screen()
916 vc->active = 0; in vga_free_screen()
922 vga_usefont(struct vga_config *vc, struct egavga_font *f) in vga_usefont() argument
930 for (slot = 0; slot < vc->vc_nfontslots; slot++) { in vga_usefont()
931 if (!vc->vc_fonts[slot]) in vga_usefont()
936 TAILQ_FOREACH(of, &vc->vc_fontlist, next) { in vga_usefont()
938 KASSERT(vc->vc_fonts[of->slot] == of); in vga_usefont()
947 vga_loadchars(&vc->hdl, slot, f->wsfont->firstchar, in vga_usefont()
950 vc->vc_fonts[slot] = f; in vga_usefont()
953 TAILQ_REMOVE(&vc->vc_fontlist, f, next); in vga_usefont()
954 TAILQ_INSERT_TAIL(&vc->vc_fontlist, f, next); in vga_usefont()
958 vga_setfont(struct vga_config *vc, struct vgascreen *scr) in vga_setfont() argument
963 vga_usefont(vc, scr->fontset1); in vga_setfont()
965 vga_usefont(vc, scr->fontset2); in vga_setfont()
969 if (vc->currentfontset1 != fontslot1 || in vga_setfont()
970 vc->currentfontset2 != fontslot2) { in vga_setfont()
971 vga_setfontset(&vc->hdl, fontslot1, fontslot2); in vga_setfont()
972 vc->currentfontset1 = fontslot1; in vga_setfont()
973 vc->currentfontset2 = fontslot2; in vga_setfont()
982 struct vga_config *vc = scr->cfg; in vga_show_screen() local
984 oldscr = vc->active; /* can be NULL! */ in vga_show_screen()
989 vc->wantedscreen = cookie; in vga_show_screen()
990 vc->switchcb = cb; in vga_show_screen()
991 vc->switchcbarg = cbarg; in vga_show_screen()
993 callout_reset(&vc->vc_switch_callout, 0, in vga_show_screen()
994 (void(*)(void *))vga_doswitch, vc); in vga_show_screen()
998 vga_doswitch(vc); in vga_show_screen()
1003 vga_doswitch(struct vga_config *vc) in vga_doswitch() argument
1006 struct vga_handle *vh = &vc->hdl; in vga_doswitch()
1009 scr = vc->wantedscreen; in vga_doswitch()
1012 (*vc->switchcb)(vc->switchcbarg, EIO, 0); in vga_doswitch()
1016 oldscr = vc->active; /* can be NULL! */ in vga_doswitch()
1021 if (oldscr->pcs.type != vc->currenttype) in vga_doswitch()
1042 if (vc->currenttype != type) { in vga_doswitch()
1044 vc->currenttype = type; in vga_doswitch()
1047 vga_setfont(vc, scr); in vga_doswitch()
1048 vga_restore_palette(vc); in vga_doswitch()
1060 vc->active = scr; in vga_doswitch()
1065 vc->wantedscreen = 0; in vga_doswitch()
1066 if (vc->switchcb) in vga_doswitch()
1067 (*vc->switchcb)(vc->switchcbarg, 0, 0); in vga_doswitch()
1073 struct vga_config *vc = v; in vga_load_font() local
1085 res = vga_selectfont(vc, scr, data->name, name2); in vga_load_font()
1087 vga_setfont(vc, scr); in vga_load_font()
1098 struct vga_config *vc = scr->cfg; in vga_allocattr() local
1104 if (vc->hdl.vh_mono) { in vga_allocattr()
1459 struct vga_config *vc = v; in vga_scroll() local
1461 struct vga_handle *vh = &vc->hdl; in vga_scroll()
1507 vga_getborder(struct vga_config *vc, u_int *valuep) in vga_getborder() argument
1509 struct vga_handle *vh = &vc->hdl; in vga_getborder()
1527 vga_setborder(struct vga_config *vc, u_int value) in vga_setborder() argument
1529 struct vga_handle *vh = &vc->hdl; in vga_setborder()
1555 vga_save_palette(struct vga_config *vc) in vga_save_palette() argument
1557 struct vga_handle *vh = &vc->hdl; in vga_save_palette()
1559 uint8_t *palette = vc->palette; in vga_save_palette()
1566 for (i = 0; i < sizeof(vc->palette); i++) in vga_save_palette()
1573 vga_restore_palette(struct vga_config *vc) in vga_restore_palette() argument
1575 struct vga_handle *vh = &vc->hdl; in vga_restore_palette()
1577 uint8_t *palette = vc->palette; in vga_restore_palette()
1584 for (i = 0; i < sizeof(vc->palette); i++) in vga_restore_palette()