Lines Matching +full:mode +full:- +full:xxx

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
5 * Copyright (c) 1992-1998 Søren Schmidt
39 #include "opt_syscons.h" /* should be removed in the future, XXX */
68 /* XXX machine/pc/bios.h has got too much i386-specific stuff in it */
83 error = (*sw->probe)(unit, &adp, NULL, flags); in vga_probe_unit()
100 error = (*sw->probe)(unit, &sc->adp, NULL, flags); in vga_attach_unit()
103 return (*sw->init)(unit, sc->adp, flags); in vga_attach_unit()
106 /* LOW-LEVEL */
113 #define probe_done(adp) ((adp)->va_flags & V_ADP_PROBED)
114 #define init_done(adp) ((adp)->va_flags & V_ADP_INITIALIZED)
115 #define config_done(adp) ((adp)->va_flags & V_ADP_REGISTERED)
161 * will perform address conversion at run-time.
266 #define EOT (-1)
267 #define NA (-2)
405 static int map_mode_num(int mode);
407 static int map_gen_mode_num(int type, int color, int mode);
409 static u_char *get_mode_param(int mode);
459 (((pa) <= (u_long)0x1000 - (width)) \
460 || ((pa) >= ISA_HOLE_START && (pa) <= 0x100000 - (width)))
463 if (!vga_init_done || !((adp)->va_flags & (flag))) \
492 /* construct the mode parameter map */
524 /* map the non-standard video mode to a known mode number */
526 map_mode_num(int mode) in map_mode_num() argument
557 if (mode_map[i].from == mode) in map_mode_num()
560 return mode; in map_mode_num()
564 /* map a generic video mode to a known mode number */
566 map_gen_mode_num(int type, int color, int mode) in map_gen_mode_num() argument
580 if (mode == M_TEXT_80x25) { in map_gen_mode_num()
602 return M_EGAMONO80x25; /* XXX: this name is confusing */ in map_gen_mode_num()
605 return -1; in map_gen_mode_num()
610 if (mode_map[i].from == mode) in map_gen_mode_num()
613 return mode; in map_gen_mode_num()
616 /* turn the BIOS video number into our video mode number */
635 M_ENHMONOAPA2, /* XXX: video momery > 64K */ in map_bios_mode_num()
636 M_ENH_CG640, /* XXX: video momery > 64K */ in map_bios_mode_num()
682 return M_EGAMONO80x25; /* XXX: this name is confusing */ in map_bios_mode_num()
687 return -1; in map_bios_mode_num()
692 *get_mode_param(int mode) in get_mode_param() argument
695 if (mode >= V_MODE_MAP_SIZE) in get_mode_param()
696 mode = map_mode_num(mode); in get_mode_param()
698 if ((mode >= 0) && (mode < V_MODE_MAP_SIZE)) in get_mode_param()
699 return mode_map[mode]; in get_mode_param()
745 buf = BIOS_PADDRTOVADDR(adp->va_window); in verify_adapter()
752 switch (adp->va_type) { in verify_adapter()
755 outb(adp->va_crtc_addr, 7); in verify_adapter()
756 if (inb(adp->va_crtc_addr) == 7) { in verify_adapter()
757 adp->va_type = KD_VGA; in verify_adapter()
758 adp->va_name = "vga"; in verify_adapter()
759 adp->va_flags |= V_ADP_STATESAVE | V_ADP_PALETTE; in verify_adapter()
761 adp->va_flags |= V_ADP_STATELOAD | V_ADP_BORDER; in verify_adapter()
762 /* the color adapter may be in the 40x25 mode... XXX */ in verify_adapter()
765 /* get the BIOS video mode pointer */ in verify_adapter()
778 adp->va_flags |= V_ADP_COLOR | V_ADP_BORDER; in verify_adapter()
779 /* may be in the 40x25 mode... XXX */ in verify_adapter()
781 /* get the BIOS video mode pointer */ in verify_adapter()
790 /* get the BIOS video mode pointer */ in verify_adapter()
804 adp->va_flags &= ~V_ADP_COLOR; in update_adapter_info()
805 adp->va_flags |= in update_adapter_info()
806 (info->vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0; in update_adapter_info()
807 adp->va_crtc_addr = in update_adapter_info()
808 (adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC; in update_adapter_info()
809 adp->va_window = BIOS_PADDRTOVADDR(info->vi_window); in update_adapter_info()
810 adp->va_window_size = info->vi_window_size; in update_adapter_info()
811 adp->va_window_gran = info->vi_window_gran; in update_adapter_info()
812 adp->va_window_orig = 0; in update_adapter_info()
813 /* XXX */ in update_adapter_info()
814 adp->va_buffer = info->vi_buffer; in update_adapter_info()
815 adp->va_buffer_size = info->vi_buffer_size; in update_adapter_info()
816 adp->va_flags &= ~V_ADP_CWIDTH9; in update_adapter_info()
817 if (info->vi_flags & V_INFO_CWIDTH9) in update_adapter_info()
818 adp->va_flags |= V_ADP_CWIDTH9; in update_adapter_info()
819 if (info->vi_mem_model == V_INFO_MM_VGAX) { in update_adapter_info()
820 adp->va_line_width = info->vi_width/2; in update_adapter_info()
821 } else if (info->vi_flags & V_INFO_GRAPHICS) { in update_adapter_info()
822 switch (info->vi_depth/info->vi_planes) { in update_adapter_info()
824 adp->va_line_width = info->vi_width/8; in update_adapter_info()
827 adp->va_line_width = info->vi_width/4; in update_adapter_info()
830 adp->va_line_width = info->vi_width/2; in update_adapter_info()
834 adp->va_line_width = info->vi_width; in update_adapter_info()
838 adp->va_line_width = info->vi_width; in update_adapter_info()
840 adp->va_disp_start.x = 0; in update_adapter_info()
841 adp->va_disp_start.y = 0; in update_adapter_info()
842 bcopy(info, &adp->va_info, sizeof(adp->va_info)); in update_adapter_info()
924 * XXX: we don't use BIOSDATA_EQUIPMENT, since it is not a dead in probe_adapters()
944 /* FIXME: switch to the 80x25 mode? XXX */ in probe_adapters()
961 /* assume EGA/VGA? XXX */ in probe_adapters()
977 biosadapter[V_ADP_SECONDARY].va_type = -1; in probe_adapters()
986 biosadapter[V_ADP_PRIMARY].va_initial_bios_mode = 3; /* XXX */ in probe_adapters()
995 biosadapter[V_ADP_SECONDARY].va_type = -1; in probe_adapters()
1031 /* the video mode parameter table in EGA/VGA BIOS */ in probe_adapters()
1046 if (adp->va_type == KD_VGA) { in probe_adapters()
1049 mode_map[adp->va_initial_mode] = adpstate.regs; in probe_adapters()
1053 mode_map[adp->va_initial_mode] = adpstate.regs; in probe_adapters()
1058 mp = get_mode_param(adp->va_initial_mode); in probe_adapters()
1069 * whose BIOS video mode table entry has the actual # in probe_adapters()
1071 * manufacturers store the # of rows - 1 there. XXX in probe_adapters()
1073 rows_offset = adpstate.regs[1] + 1 - mp[1]; in probe_adapters()
1080 * for the initial mode and other modes which are in probe_adapters()
1081 * based on the initial mode. in probe_adapters()
1083 mode_map[adp->va_initial_mode] = adpstate.regs; in probe_adapters()
1084 rows_offset = adpstate.regs[1] + 1 - mp[1]; in probe_adapters()
1085 adpstate.regs[1] -= rows_offset - 1; in probe_adapters()
1092 * even the BIOS doesn't use it for the initial mode. in probe_adapters()
1099 mode_map[adp->va_initial_mode] = adpstate.regs; in probe_adapters()
1102 width = height = -1; in probe_adapters()
1104 if (bios_vmode[i].vi_mode == adp->va_initial_mode) { in probe_adapters()
1111 if (bios_vmode[i].vi_mode != adp->va_initial_mode && in probe_adapters()
1113 adp->va_initial_mode && in probe_adapters()
1125 adp->va_flags |= V_ADP_MODECHANGE; in probe_adapters()
1128 adp->va_flags |= V_ADP_FONT; in probe_adapters()
1130 } else if (adp->va_type == KD_EGA) { in probe_adapters()
1138 /* XXX how can one validate the EGA table... */ in probe_adapters()
1139 mp = get_mode_param(adp->va_initial_mode); in probe_adapters()
1141 adp->va_flags |= V_ADP_MODECHANGE; in probe_adapters()
1143 adp->va_flags |= V_ADP_FONT; in probe_adapters()
1180 * Attempt to determine the real character width for each mode. 9 wide in probe_adapters()
1181 * is supposed to be standard for EGA mono mode and most VGA text modes, in probe_adapters()
1187 * about 1.2 in all standard 9-wide modes and should be about 9/8 larger in probe_adapters()
1188 * again in similar 8-wide modes; in practice it is usually about 1.4 in probe_adapters()
1204 info.vi_flags &= ~V_INFO_LINEAR; /* XXX */ in probe_adapters()
1210 info.vi_flags &= ~V_INFO_LINEAR; /* XXX */ in probe_adapters()
1215 * XXX: we should verify the following values for the primary adapter... in probe_adapters()
1237 if ((adp->va_type != KD_VGA) && (adp->va_type != KD_EGA)) in set_line_length()
1239 mp = get_mode_param(adp->va_mode); in set_line_length()
1243 switch (adp->va_info.vi_mem_model) { in set_line_length()
1245 ppw = 16/(adp->va_info.vi_depth/adp->va_info.vi_planes); in set_line_length()
1261 if (mp[10 + 0x17] & 0x40) /* CRTC mode control reg */ in set_line_length()
1262 count *= 2; /* byte mode */ in set_line_length()
1263 outb(adp->va_crtc_addr, 0x13); in set_line_length()
1264 outb(adp->va_crtc_addr + 1, count); in set_line_length()
1265 adp->va_line_width = bpl; in set_line_length()
1273 int off; /* byte offset (graphics mode)/word offset (text mode) */ in set_display_start()
1278 if ((adp->va_type != KD_VGA) && (adp->va_type != KD_EGA)) in set_display_start()
1280 if (adp->va_info.vi_flags & V_INFO_GRAPHICS) { in set_display_start()
1281 ppb = 8/(adp->va_info.vi_depth/adp->va_info.vi_planes); in set_display_start()
1282 off = y*adp->va_line_width + x/ppb; in set_display_start()
1286 if ((adp->va_type == KD_VGA) || (adp->va_type == KD_EGA)) { in set_display_start()
1295 off = y/adp->va_info.vi_cheight*adp->va_line_width + x/ppb; in set_display_start()
1296 roff = y%adp->va_info.vi_cheight; in set_display_start()
1297 /* FIXME: is this correct? XXX */ in set_display_start()
1305 outb(adp->va_crtc_addr, 0xc); /* high */ in set_display_start()
1306 outb(adp->va_crtc_addr + 1, off >> 8); in set_display_start()
1307 outb(adp->va_crtc_addr, 0xd); /* low */ in set_display_start()
1308 outb(adp->va_crtc_addr + 1, off & 0xff); in set_display_start()
1311 if ((adp->va_type == KD_VGA) || (adp->va_type == KD_EGA)) { in set_display_start()
1312 inb(adp->va_crtc_addr + 6); in set_display_start()
1315 inb(adp->va_crtc_addr + 6); in set_display_start()
1320 outb(adp->va_crtc_addr, 8); in set_display_start()
1321 outb(adp->va_crtc_addr + 1, roff); in set_display_start()
1323 adp->va_disp_start.x = x; in set_display_start()
1324 adp->va_disp_start.y = y; in set_display_start()
1329 #if defined(__i386__) || defined(__amd64__) /* XXX */
1335 while (size-- > 0) in fill()
1343 while (size-- > 0) { in filll_io()
1386 adp->va_flags |= V_ADP_INITIALIZED; in vga_init()
1392 adp->va_flags |= V_ADP_REGISTERED; in vga_init()
1402 * Return the video_info structure of the requested video mode.
1407 vga_get_info(video_adapter_t *adp, int mode, video_info_t *info) in vga_get_info() argument
1414 mode = map_gen_mode_num(adp->va_type, adp->va_flags & V_ADP_COLOR, mode); in vga_get_info()
1416 if (adp->va_flags & V_ADP_MODECHANGE) { in vga_get_info()
1418 * If the parameter table entry for this mode is not found, in vga_get_info()
1419 * the mode is not supported... in vga_get_info()
1421 if (get_mode_param(mode) == NULL) in vga_get_info()
1427 * Even if we don't support video mode switching on this adapter, in vga_get_info()
1428 * the information on the initial (thus current) video mode in vga_get_info()
1431 if (mode != adp->va_initial_mode) in vga_get_info()
1438 if (mode == bios_vmode[i].vi_mode) { in vga_get_info()
1440 /* XXX */ in vga_get_info()
1441 info->vi_buffer_size = info->vi_window_size*info->vi_planes; in vga_get_info()
1450 * Find a video mode matching the requested parameters.
1468 if ((info->vi_width != 0) in vga_query_mode()
1469 && (info->vi_width != bios_vmode[i].vi_width)) in vga_query_mode()
1471 if ((info->vi_height != 0) in vga_query_mode()
1472 && (info->vi_height != bios_vmode[i].vi_height)) in vga_query_mode()
1474 if ((info->vi_cwidth != 0) in vga_query_mode()
1475 && (info->vi_cwidth != bios_vmode[i].vi_cwidth)) in vga_query_mode()
1477 if ((info->vi_cheight != 0) in vga_query_mode()
1478 && (info->vi_cheight != bios_vmode[i].vi_cheight)) in vga_query_mode()
1480 if ((info->vi_depth != 0) in vga_query_mode()
1481 && (info->vi_depth != bios_vmode[i].vi_depth)) in vga_query_mode()
1483 if ((info->vi_planes != 0) in vga_query_mode()
1484 && (info->vi_planes != bios_vmode[i].vi_planes)) in vga_query_mode()
1486 /* XXX: should check pixel format, memory model */ in vga_query_mode()
1487 if ((info->vi_flags != 0) in vga_query_mode()
1488 && (info->vi_flags != bios_vmode[i].vi_flags)) in vga_query_mode()
1491 /* verify if this mode is supported on this adapter */ in vga_query_mode()
1501 * Change the video mode.
1515 params->regs[5] |= 1; /* toggle 8 pixel wide fonts */ in set_width90()
1516 params->regs[10+0x0] = 0x6b; in set_width90()
1517 params->regs[10+0x1] = 0x59; in set_width90()
1518 params->regs[10+0x2] = 0x5a; in set_width90()
1519 params->regs[10+0x3] = 0x8e; in set_width90()
1520 params->regs[10+0x4] = 0x5e; in set_width90()
1521 params->regs[10+0x5] = 0x8a; in set_width90()
1522 params->regs[10+0x13] = 45; in set_width90()
1523 params->regs[35+0x13] = 0; in set_width90()
1529 vga_set_mode(video_adapter_t *adp, int mode) in vga_set_mode() argument
1537 mode = map_gen_mode_num(adp->va_type, in vga_set_mode()
1538 adp->va_flags & V_ADP_COLOR, mode); in vga_set_mode()
1539 if (vga_get_info(adp, mode, &info)) in vga_set_mode()
1543 printf("vga_set_mode(): setting mode %d\n", mode); in vga_set_mode()
1547 bcopy(get_mode_param(mode), params.regs, sizeof(params.regs)); in vga_set_mode()
1549 switch (mode) { in vga_set_mode()
1615 /* "unchain" the VGA mode */ in vga_set_mode()
1616 params.regs[5-1+0x04] &= 0xf7; in vga_set_mode()
1617 params.regs[5-1+0x04] |= 0x04; in vga_set_mode()
1618 /* turn off doubleword mode */ in vga_set_mode()
1650 adp->va_mode = mode; in vga_set_mode()
1651 info.vi_flags &= ~V_INFO_LINEAR; /* XXX */ in vga_set_mode()
1655 vidd_set_hw_cursor(adp, -1, -1); in vga_set_mode()
1674 if (adp->va_type == KD_VGA) { in set_font_mode()
1680 inb(adp->va_crtc_addr + 6); in set_font_mode()
1682 } else /* if (adp->va_type == KD_EGA) */ { in set_font_mode()
1684 * EGA cannot be read; copy parameters from the mode parameter in set_font_mode()
1687 mp = get_mode_param(adp->va_mode); in set_font_mode()
1688 buf[0] = mp[5 + 0x02 - 1]; in set_font_mode()
1689 buf[1] = mp[5 + 0x04 - 1]; in set_font_mode()
1697 inb(adp->va_crtc_addr + 6); /* reset flip-flop */ in set_font_mode()
1699 inb(adp->va_crtc_addr + 6); /* reset flip-flop */ in set_font_mode()
1738 /* setup vga for normal operation mode again */ in set_normal_mode()
1739 inb(adp->va_crtc_addr + 6); /* reset flip-flop */ in set_normal_mode()
1741 inb(adp->va_crtc_addr + 6); /* reset flip-flop */ in set_normal_mode()
1755 if (adp->va_crtc_addr == MONO_CRTC) { in set_normal_mode()
1771 if (adp->va_crtc_addr == MONO_CRTC) in set_normal_mode()
1820 segment -= 0xe000; in vga_save_font()
1823 if (adp->va_type == KD_VGA) { /* what about EGA? XXX */ in vga_save_font()
1837 for (c = ch; count > 0; ++c, --count) { in vga_save_font()
1845 if (adp->va_type == KD_VGA) { in vga_save_font()
1864 * the font page other than 0... XXX
1900 segment -= 0xe000; in vga_load_font()
1903 if (adp->va_type == KD_VGA) { /* what about EGA? XXX */ in vga_load_font()
1917 for (c = ch; count > 0; ++c, --count) { in vga_load_font()
1925 if (adp->va_type == KD_VGA) { in vga_load_font()
1944 * the font page other than 0... XXX
1988 bits = (adp->va_flags & V_ADP_DAC8) != 0 ? 0 : 2; in vga_save_palette()
1991 inb(adp->va_crtc_addr + 6); /* reset flip/flop */ in vga_save_palette()
2005 bits = (adp->va_flags & V_ADP_DAC8) != 0 ? 0 : 2; in vga_save_palette2()
2011 inb(adp->va_crtc_addr + 6); /* reset flip/flop */ in vga_save_palette2()
2031 bits = (adp->va_flags & V_ADP_DAC8) != 0 ? 0 : 2; in vga_load_palette()
2034 inb(adp->va_crtc_addr + 6); /* reset flip/flop */ in vga_load_palette()
2050 bits = (adp->va_flags & V_ADP_DAC8) != 0 ? 0 : 2; in vga_load_palette2()
2056 inb(adp->va_crtc_addr + 6); /* reset flip/flop */ in vga_load_palette2()
2072 switch (adp->va_type) { in vga_set_border()
2075 inb(adp->va_crtc_addr + 6); /* reset flip-flop */ in vga_set_border()
2079 outb(adp->va_crtc_addr + 5, color & 0x0f); /* color select register */ in vga_set_border()
2116 ((adp_state_t *)p)->sig = V_STATE_SIG; in vga_save_state()
2117 buf = ((adp_state_t *)p)->regs; in vga_save_state()
2119 crtc_addr = adp->va_crtc_addr; in vga_save_state()
2128 buf[9] = inb(MISC + 10); /* dot-clock */ in vga_save_state()
2136 inb(crtc_addr + 6); /* reset flip-flop */ in vga_save_state()
2144 inb(crtc_addr + 6); /* reset flip-flop */ in vga_save_state()
2150 if (vga_get_info(adp, adp->va_mode, &info) == 0) { in vga_save_state()
2153 buf[1] = info.vi_height/info.vi_cheight - 1; /* ROWS */ in vga_save_state()
2156 buf[1] = info.vi_height - 1; /* ROWS */ in vga_save_state()
2188 if (((adp_state_t *)p)->sig != V_STATE_SIG) in vga_load_state()
2191 buf = ((adp_state_t *)p)->regs; in vga_load_state()
2192 crtc_addr = adp->va_crtc_addr; in vga_load_state()
2205 outb(MISC, buf[9]); /* set dot-clock */ in vga_load_state()
2213 inb(crtc_addr+6); /* reset flip-flop */ in vga_load_state()
2222 inb(crtc_addr + 6); /* reset flip-flop */ in vga_load_state()
2225 #ifdef notyet /* a temporary workaround for kernel panic, XXX */ in vga_load_state()
2227 if (adp->va_unit == V_ADP_PRIMARY) { in vga_load_state()
2229 writeb(BIOS_PADDRTOVADDR(0x484), buf[1] + rows_offset - 1); /* ROWS */ in vga_load_state()
2272 if (adp->va_info.vi_flags & V_INFO_GRAPHICS) in vga_read_hw_cursor()
2276 outb(adp->va_crtc_addr, 14); in vga_read_hw_cursor()
2277 off = inb(adp->va_crtc_addr + 1); in vga_read_hw_cursor()
2278 outb(adp->va_crtc_addr, 15); in vga_read_hw_cursor()
2279 off = (off << 8) | inb(adp->va_crtc_addr + 1); in vga_read_hw_cursor()
2282 *row = off / adp->va_info.vi_width; in vga_read_hw_cursor()
2283 *col = off % adp->va_info.vi_width; in vga_read_hw_cursor()
2290 * Move the hardware text cursor. If col and row are both -1,
2304 if ((col == -1) && (row == -1)) { in vga_set_hw_cursor()
2305 off = -1; in vga_set_hw_cursor()
2307 if (adp->va_info.vi_flags & V_INFO_GRAPHICS) in vga_set_hw_cursor()
2309 off = row*adp->va_info.vi_width + col; in vga_set_hw_cursor()
2313 outb(adp->va_crtc_addr, 14); in vga_set_hw_cursor()
2314 outb(adp->va_crtc_addr + 1, off >> 8); in vga_set_hw_cursor()
2315 outb(adp->va_crtc_addr, 15); in vga_set_hw_cursor()
2316 outb(adp->va_crtc_addr + 1, off & 0x00ff); in vga_set_hw_cursor()
2339 switch (adp->va_type) { in vga_set_hw_cursor_shape()
2347 outb(adp->va_crtc_addr, 10); in vga_set_hw_cursor_shape()
2348 outb(adp->va_crtc_addr + 1, 32); in vga_set_hw_cursor_shape()
2349 outb(adp->va_crtc_addr, 11); in vga_set_hw_cursor_shape()
2350 outb(adp->va_crtc_addr + 1, 0); in vga_set_hw_cursor_shape()
2352 outb(adp->va_crtc_addr, 10); in vga_set_hw_cursor_shape()
2353 outb(adp->va_crtc_addr + 1, celsize - base - height); in vga_set_hw_cursor_shape()
2354 outb(adp->va_crtc_addr, 11); in vga_set_hw_cursor_shape()
2355 outb(adp->va_crtc_addr + 1, celsize - base - 1); in vga_set_hw_cursor_shape()
2361 outb(adp->va_crtc_addr, 10); in vga_set_hw_cursor_shape()
2362 outb(adp->va_crtc_addr + 1, celsize); in vga_set_hw_cursor_shape()
2363 outb(adp->va_crtc_addr, 11); in vga_set_hw_cursor_shape()
2364 outb(adp->va_crtc_addr + 1, 0); in vga_set_hw_cursor_shape()
2366 outb(adp->va_crtc_addr, 10); in vga_set_hw_cursor_shape()
2367 outb(adp->va_crtc_addr + 1, celsize - base - height); in vga_set_hw_cursor_shape()
2368 outb(adp->va_crtc_addr, 11); in vga_set_hw_cursor_shape()
2369 outb(adp->va_crtc_addr + 1, celsize - base); in vga_set_hw_cursor_shape()
2380 * Put the display in power save/power off mode.
2385 vga_blank_display(video_adapter_t *adp, int mode) in vga_blank_display() argument
2391 switch (adp->va_type) { in vga_blank_display()
2393 switch (mode) { in vga_blank_display()
2400 outb(adp->va_crtc_addr, 0x17); in vga_blank_display()
2401 val = inb(adp->va_crtc_addr + 1); in vga_blank_display()
2402 outb(adp->va_crtc_addr + 1, val & ~0x80); in vga_blank_display()
2415 outb(adp->va_crtc_addr, 0x17); in vga_blank_display()
2416 val = inb(adp->va_crtc_addr + 1); in vga_blank_display()
2417 outb(adp->va_crtc_addr + 1, val | 0x80); in vga_blank_display()
2428 switch (mode) { in vga_blank_display()
2432 outb(adp->va_crtc_addr + 4, 0x25); in vga_blank_display()
2435 outb(adp->va_crtc_addr + 4, 0x2d); in vga_blank_display()
2442 switch (mode) { in vga_blank_display()
2446 outb(adp->va_crtc_addr + 4, 0x21); in vga_blank_display()
2449 outb(adp->va_crtc_addr + 4, 0x29); in vga_blank_display()
2471 if (adp->va_info.vi_flags & V_INFO_LINEAR) in vga_mmap_buf()
2472 return -1; in vga_mmap_buf()
2476 (uintmax_t)adp->va_info.vi_window, (uintmax_t)offset); in vga_mmap_buf()
2479 /* XXX: is this correct? */ in vga_mmap_buf()
2480 if (offset > adp->va_window_size - PAGE_SIZE) in vga_mmap_buf()
2481 return -1; in vga_mmap_buf()
2483 *paddr = adp->va_info.vi_window + offset; in vga_mmap_buf()
2496 outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ in planar_fill()
2502 length = adp->va_line_width*adp->va_info.vi_height; in planar_fill()
2504 l = imin(length, adp->va_window_size); in planar_fill()
2506 bzero_io(adp->va_window, l); in planar_fill()
2507 length -= l; in planar_fill()
2522 length = adp->va_line_width*adp->va_info.vi_height; in packed_fill()
2524 l = imin(length, adp->va_window_size); in packed_fill()
2526 fill_io(val, adp->va_window, l); in packed_fill()
2527 length -= l; in packed_fill()
2540 length = adp->va_line_width*adp->va_info.vi_height; in direct_fill()
2542 l = imin(length, adp->va_window_size); in direct_fill()
2544 switch (adp->va_info.vi_pixel_size) { in direct_fill()
2546 fillw_io(val, adp->va_window, l/sizeof(u_int16_t)); in direct_fill()
2552 filll_io(val, adp->va_window, l/sizeof(u_int32_t)); in direct_fill()
2555 length -= l; in direct_fill()
2563 switch (adp->va_info.vi_mem_model) { in vga_clear()
2565 /* do nothing? XXX */ in vga_clear()
2591 outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ in planar_fill_rect()
2597 banksize = adp->va_window_size; in planar_fill_rect()
2598 bank = -1; in planar_fill_rect()
2600 pos = adp->va_line_width*y + x/8; in planar_fill_rect()
2606 bx = (x + cx)/8 - x/8; in planar_fill_rect()
2609 writeb(adp->va_window + offset, 0); in planar_fill_rect()
2611 --bx; in planar_fill_rect()
2621 bzero_io(adp->va_window + offset, l); in planar_fill_rect()
2623 bx -= l; in planar_fill_rect()
2632 writeb(adp->va_window + offset, 0); in planar_fill_rect()
2642 --cy; in planar_fill_rect()
2659 banksize = adp->va_window_size; in packed_fill_rect()
2660 bank = -1; in packed_fill_rect()
2661 cx *= adp->va_info.vi_pixel_size; in packed_fill_rect()
2663 pos = adp->va_line_width*y + x*adp->va_info.vi_pixel_size; in packed_fill_rect()
2670 fill_io(val, adp->va_window + offset, in packed_fill_rect()
2671 (end - offset)/adp->va_info.vi_pixel_size); in packed_fill_rect()
2676 end = offset + cx - banksize; in packed_fill_rect()
2677 fill_io(val, adp->va_window, end/adp->va_info.vi_pixel_size); in packed_fill_rect()
2680 --cy; in packed_fill_rect()
2694 * XXX: the function assumes that banksize is a muliple of in direct_fill_rect16()
2697 banksize = adp->va_window_size; in direct_fill_rect16()
2698 bank = -1; in direct_fill_rect16()
2701 pos = adp->va_line_width*y + x*sizeof(u_int16_t); in direct_fill_rect16()
2708 fillw_io(val, adp->va_window + offset, in direct_fill_rect16()
2709 (end - offset)/sizeof(u_int16_t)); in direct_fill_rect16()
2714 end = offset + cx - banksize; in direct_fill_rect16()
2715 fillw_io(val, adp->va_window, end/sizeof(u_int16_t)); in direct_fill_rect16()
2718 --cy; in direct_fill_rect16()
2737 banksize = adp->va_window_size; in direct_fill_rect24()
2738 bank = -1; in direct_fill_rect24()
2741 pos = adp->va_line_width*y + x*3; in direct_fill_rect24()
2749 writeb(adp->va_window + j, b[i]); in direct_fill_rect24()
2756 end = offset + cx - banksize; in direct_fill_rect24()
2758 writeb(adp->va_window + j, b[i]); in direct_fill_rect24()
2762 --cy; in direct_fill_rect24()
2776 * XXX: the function assumes that banksize is a muliple of in direct_fill_rect32()
2779 banksize = adp->va_window_size; in direct_fill_rect32()
2780 bank = -1; in direct_fill_rect32()
2783 pos = adp->va_line_width*y + x*sizeof(u_int32_t); in direct_fill_rect32()
2790 filll_io(val, adp->va_window + offset, in direct_fill_rect32()
2791 (end - offset)/sizeof(u_int32_t)); in direct_fill_rect32()
2796 end = offset + cx - banksize; in direct_fill_rect32()
2797 filll_io(val, adp->va_window, end/sizeof(u_int32_t)); in direct_fill_rect32()
2800 --cy; in direct_fill_rect32()
2807 switch (adp->va_info.vi_mem_model) { in vga_fill_rect()
2809 /* do nothing? XXX */ in vga_fill_rect()
2818 switch (adp->va_info.vi_pixel_size) { in vga_fill_rect()
2930 ((video_display_start_t *)arg)->x, in vga_dev_ioctl()
2931 ((video_display_start_t *)arg)->y) in vga_dev_ioctl()
2938 return get_palette(adp, ((video_color_palette_t *)arg)->index, in vga_dev_ioctl()
2939 ((video_color_palette_t *)arg)->count, in vga_dev_ioctl()
2940 ((video_color_palette_t *)arg)->red, in vga_dev_ioctl()
2941 ((video_color_palette_t *)arg)->green, in vga_dev_ioctl()
2942 ((video_color_palette_t *)arg)->blue, in vga_dev_ioctl()
2943 ((video_color_palette_t *)arg)->transparent); in vga_dev_ioctl()
2946 return set_palette(adp, ((video_color_palette_t *)arg)->index, in vga_dev_ioctl()
2947 ((video_color_palette_t *)arg)->count, in vga_dev_ioctl()
2948 ((video_color_palette_t *)arg)->red, in vga_dev_ioctl()
2949 ((video_color_palette_t *)arg)->green, in vga_dev_ioctl()
2950 ((video_color_palette_t *)arg)->blue, in vga_dev_ioctl()
2951 ((video_color_palette_t *)arg)->transparent); in vga_dev_ioctl()
2954 ((struct fbtype *)arg)->fb_type = fb_type(adp->va_type); in vga_dev_ioctl()
2955 ((struct fbtype *)arg)->fb_height = adp->va_info.vi_height; in vga_dev_ioctl()
2956 ((struct fbtype *)arg)->fb_width = adp->va_info.vi_width; in vga_dev_ioctl()
2957 ((struct fbtype *)arg)->fb_depth = adp->va_info.vi_depth; in vga_dev_ioctl()
2958 if ((adp->va_info.vi_depth <= 1) || (adp->va_info.vi_depth > 8)) in vga_dev_ioctl()
2959 ((struct fbtype *)arg)->fb_cmsize = 0; in vga_dev_ioctl()
2961 ((struct fbtype *)arg)->fb_cmsize = 1 << adp->va_info.vi_depth; in vga_dev_ioctl()
2962 ((struct fbtype *)arg)->fb_size = adp->va_buffer_size; in vga_dev_ioctl()
2966 return get_palette(adp, ((struct fbcmap *)arg)->index, in vga_dev_ioctl()
2967 ((struct fbcmap *)arg)->count, in vga_dev_ioctl()
2968 ((struct fbcmap *)arg)->red, in vga_dev_ioctl()
2969 ((struct fbcmap *)arg)->green, in vga_dev_ioctl()
2970 ((struct fbcmap *)arg)->blue, NULL); in vga_dev_ioctl()
2973 return set_palette(adp, ((struct fbcmap *)arg)->index, in vga_dev_ioctl()
2974 ((struct fbcmap *)arg)->count, in vga_dev_ioctl()
2975 ((struct fbcmap *)arg)->red, in vga_dev_ioctl()
2976 ((struct fbcmap *)arg)->green, in vga_dev_ioctl()
2977 ((struct fbcmap *)arg)->blue, NULL); in vga_dev_ioctl()
3037 if (adp->va_flags & V_ADP_MODECHANGE) { in vga_diag()
3046 vga_get_info(adp, adp->va_initial_mode, &info); /* shouldn't fail */ in vga_diag()
3051 if ((adp->va_type != KD_EGA) && (adp->va_type != KD_VGA)) in vga_diag()
3055 printf("vga%d: %s: WARNING: video mode switching is not " in vga_diag()
3057 adp->va_unit, adp->va_name); in vga_diag()
3062 if (adp->va_type == KD_VGA) { in vga_diag()
3063 printf("VGA parameters upon power-up\n"); in vga_diag()
3065 printf("VGA parameters in BIOS for mode %d\n", adp->va_initial_mode); in vga_diag()
3069 mp = get_mode_param(adp->va_initial_mode); in vga_diag()
3072 printf("EGA/VGA parameters to be used for mode %d\n", adp->va_initial_mode); in vga_diag()