Lines Matching refs:sc

178 vga_in_reset(struct vga_softc *sc)  in vga_in_reset()  argument
180 return (((sc->vga_seq.seq_clock_mode & SEQ_CM_SO) != 0) || in vga_in_reset()
181 ((sc->vga_seq.seq_reset & SEQ_RESET_ASYNC) == 0) || in vga_in_reset()
182 ((sc->vga_seq.seq_reset & SEQ_RESET_SYNC) == 0) || in vga_in_reset()
183 ((sc->vga_crtc.crtc_mode_ctrl & CRTC_MC_TE) == 0)); in vga_in_reset()
187 vga_check_size(struct bhyvegc *gc, struct vga_softc *sc) in vga_check_size() argument
191 if (vga_in_reset(sc)) in vga_check_size()
196 old_width = sc->gc_image->width; in vga_check_size()
197 old_height = sc->gc_image->height; in vga_check_size()
205 sc->gc_width = (sc->vga_crtc.crtc_horiz_disp_end + 1) * in vga_check_size()
206 sc->vga_seq.seq_cm_dots; in vga_check_size()
208 sc->gc_height = (sc->vga_crtc.crtc_vert_disp_end | in vga_check_size()
209 (((sc->vga_crtc.crtc_overflow & CRTC_OF_VDE8) >> CRTC_OF_VDE8_SHIFT) << 8) | in vga_check_size()
210 (((sc->vga_crtc.crtc_overflow & CRTC_OF_VDE9) >> CRTC_OF_VDE9_SHIFT) << 9)) + 1; in vga_check_size()
212 if (old_width != sc->gc_width || old_height != sc->gc_height) in vga_check_size()
213 bhyvegc_resize(gc, sc->gc_width, sc->gc_height); in vga_check_size()
217 vga_get_pixel(struct vga_softc *sc, int x, int y) in vga_get_pixel() argument
224 offset = (y * sc->gc_width / 8) + (x / 8); in vga_get_pixel()
227 data = (((sc->vga_ram[offset + 0 * 64*KB] >> bit) & 0x1) << 0) | in vga_get_pixel()
228 (((sc->vga_ram[offset + 1 * 64*KB] >> bit) & 0x1) << 1) | in vga_get_pixel()
229 (((sc->vga_ram[offset + 2 * 64*KB] >> bit) & 0x1) << 2) | in vga_get_pixel()
230 (((sc->vga_ram[offset + 3 * 64*KB] >> bit) & 0x1) << 3); in vga_get_pixel()
232 data &= sc->vga_atc.atc_color_plane_enb; in vga_get_pixel()
234 if (sc->vga_atc.atc_mode & ATC_MC_IPS) { in vga_get_pixel()
235 idx = sc->vga_atc.atc_palette[data] & 0x0f; in vga_get_pixel()
236 idx |= sc->vga_atc.atc_color_select_45; in vga_get_pixel()
238 idx = sc->vga_atc.atc_palette[data]; in vga_get_pixel()
240 idx |= sc->vga_atc.atc_color_select_67; in vga_get_pixel()
242 return (sc->vga_dac.dac_palette_rgb[idx]); in vga_get_pixel()
246 vga_render_graphics(struct vga_softc *sc) in vga_render_graphics() argument
250 for (y = 0; y < sc->gc_height; y++) { in vga_render_graphics()
251 for (x = 0; x < sc->gc_width; x++) { in vga_render_graphics()
254 offset = y * sc->gc_width + x; in vga_render_graphics()
255 sc->gc_image->data[offset] = vga_get_pixel(sc, x, y); in vga_render_graphics()
261 vga_get_text_pixel(struct vga_softc *sc, int x, int y) in vga_get_text_pixel() argument
267 dots = sc->vga_seq.seq_cm_dots; in vga_get_text_pixel()
269 offset = 2 * sc->vga_crtc.crtc_start_addr; in vga_get_text_pixel()
270 offset += (y / 16 * sc->gc_width / dots) * 2 + (x / dots) * 2; in vga_get_text_pixel()
274 ch = sc->vga_ram[offset + 0 * 64*KB]; in vga_get_text_pixel()
275 attr = sc->vga_ram[offset + 1 * 64*KB]; in vga_get_text_pixel()
277 if (sc->vga_crtc.crtc_cursor_on && in vga_get_text_pixel()
278 (offset == (sc->vga_crtc.crtc_cursor_loc * 2)) && in vga_get_text_pixel()
279 ((y % 16) >= (sc->vga_crtc.crtc_cursor_start & CRTC_CS_CS)) && in vga_get_text_pixel()
280 ((y % 16) <= (sc->vga_crtc.crtc_cursor_end & CRTC_CE_CE))) { in vga_get_text_pixel()
281 idx = sc->vga_atc.atc_palette[attr & 0xf]; in vga_get_text_pixel()
282 return (sc->vga_dac.dac_palette_rgb[idx]); in vga_get_text_pixel()
285 if ((sc->vga_seq.seq_mm & SEQ_MM_EM) && in vga_get_text_pixel()
286 sc->vga_seq.seq_cmap_pri_off != sc->vga_seq.seq_cmap_sec_off) { in vga_get_text_pixel()
288 font_offset = sc->vga_seq.seq_cmap_pri_off + in vga_get_text_pixel()
291 font_offset = sc->vga_seq.seq_cmap_sec_off + in vga_get_text_pixel()
298 font = sc->vga_ram[font_offset + 2 * 64*KB]; in vga_get_text_pixel()
301 idx = sc->vga_atc.atc_palette[attr & 0xf]; in vga_get_text_pixel()
303 idx = sc->vga_atc.atc_palette[attr >> 4]; in vga_get_text_pixel()
305 return (sc->vga_dac.dac_palette_rgb[idx]); in vga_get_text_pixel()
309 vga_render_text(struct vga_softc *sc) in vga_render_text() argument
313 for (y = 0; y < sc->gc_height; y++) { in vga_render_text()
314 for (x = 0; x < sc->gc_width; x++) { in vga_render_text()
317 offset = y * sc->gc_width + x; in vga_render_text()
318 sc->gc_image->data[offset] = vga_get_text_pixel(sc, x, y); in vga_render_text()
326 struct vga_softc *sc = arg; in vga_render() local
328 vga_check_size(gc, sc); in vga_render()
330 if (vga_in_reset(sc)) { in vga_render()
331 memset(sc->gc_image->data, 0, in vga_render()
332 sc->gc_image->width * sc->gc_image->height * in vga_render()
337 if (sc->vga_gc.gc_misc_gm && (sc->vga_atc.atc_mode & ATC_MC_GA)) in vga_render()
338 vga_render_graphics(sc); in vga_render()
340 vga_render_text(sc); in vga_render()
346 struct vga_softc *sc = arg1; in vga_mem_rd_handler() local
351 switch (sc->vga_gc.gc_misc_mm) { in vga_mem_rd_handler()
385 sc->vga_gc.gc_latch0 = sc->vga_ram[offset + 0*64*KB]; in vga_mem_rd_handler()
386 sc->vga_gc.gc_latch1 = sc->vga_ram[offset + 1*64*KB]; in vga_mem_rd_handler()
387 sc->vga_gc.gc_latch2 = sc->vga_ram[offset + 2*64*KB]; in vga_mem_rd_handler()
388 sc->vga_gc.gc_latch3 = sc->vga_ram[offset + 3*64*KB]; in vga_mem_rd_handler()
390 if (sc->vga_gc.gc_mode_rm) { in vga_mem_rd_handler()
395 map_sel = sc->vga_gc.gc_read_map_sel; in vga_mem_rd_handler()
396 if (sc->vga_gc.gc_mode_oe) { in vga_mem_rd_handler()
404 return (sc->vga_ram[offset]); in vga_mem_rd_handler()
410 struct vga_softc *sc = arg1; in vga_mem_wr_handler() local
419 switch (sc->vga_gc.gc_misc_mm) { in vga_mem_wr_handler()
452 set_reset = sc->vga_gc.gc_set_reset; in vga_mem_wr_handler()
453 enb_set_reset = sc->vga_gc.gc_enb_set_reset; in vga_mem_wr_handler()
455 c0 = sc->vga_gc.gc_latch0; in vga_mem_wr_handler()
456 c1 = sc->vga_gc.gc_latch1; in vga_mem_wr_handler()
457 c2 = sc->vga_gc.gc_latch2; in vga_mem_wr_handler()
458 c3 = sc->vga_gc.gc_latch3; in vga_mem_wr_handler()
460 switch (sc->vga_gc.gc_mode_wm) { in vga_mem_wr_handler()
463 mask = sc->vga_gc.gc_bit_mask; in vga_mem_wr_handler()
465 val = (val >> sc->vga_gc.gc_rotate) | in vga_mem_wr_handler()
466 (val << (8 - sc->vga_gc.gc_rotate)); in vga_mem_wr_handler()
468 switch (sc->vga_gc.gc_op) { in vga_mem_wr_handler()
525 mask = sc->vga_gc.gc_bit_mask; in vga_mem_wr_handler()
527 switch (sc->vga_gc.gc_op) { in vga_mem_wr_handler()
581 mask = sc->vga_gc.gc_bit_mask & val; in vga_mem_wr_handler()
583 val = (val >> sc->vga_gc.gc_rotate) | in vga_mem_wr_handler()
584 (val << (8 - sc->vga_gc.gc_rotate)); in vga_mem_wr_handler()
586 switch (sc->vga_gc.gc_op) { in vga_mem_wr_handler()
640 if (sc->vga_gc.gc_mode_oe) { in vga_mem_wr_handler()
643 if (sc->vga_seq.seq_map_mask & 2) in vga_mem_wr_handler()
644 sc->vga_ram[offset + 1*64*KB] = c1; in vga_mem_wr_handler()
645 if (sc->vga_seq.seq_map_mask & 8) in vga_mem_wr_handler()
646 sc->vga_ram[offset + 3*64*KB] = c3; in vga_mem_wr_handler()
648 if (sc->vga_seq.seq_map_mask & 1) in vga_mem_wr_handler()
649 sc->vga_ram[offset + 0*64*KB] = c0; in vga_mem_wr_handler()
650 if (sc->vga_seq.seq_map_mask & 4) in vga_mem_wr_handler()
651 sc->vga_ram[offset + 2*64*KB] = c2; in vga_mem_wr_handler()
654 if (sc->vga_seq.seq_map_mask & 1) in vga_mem_wr_handler()
655 sc->vga_ram[offset + 0*64*KB] = c0; in vga_mem_wr_handler()
656 if (sc->vga_seq.seq_map_mask & 2) in vga_mem_wr_handler()
657 sc->vga_ram[offset + 1*64*KB] = c1; in vga_mem_wr_handler()
658 if (sc->vga_seq.seq_map_mask & 4) in vga_mem_wr_handler()
659 sc->vga_ram[offset + 2*64*KB] = c2; in vga_mem_wr_handler()
660 if (sc->vga_seq.seq_map_mask & 8) in vga_mem_wr_handler()
661 sc->vga_ram[offset + 3*64*KB] = c3; in vga_mem_wr_handler()
730 struct vga_softc *sc = arg; in vga_port_in_handler() local
735 *val = sc->vga_crtc.crtc_index; in vga_port_in_handler()
739 switch (sc->vga_crtc.crtc_index) { in vga_port_in_handler()
741 *val = sc->vga_crtc.crtc_horiz_total; in vga_port_in_handler()
744 *val = sc->vga_crtc.crtc_horiz_disp_end; in vga_port_in_handler()
747 *val = sc->vga_crtc.crtc_start_horiz_blank; in vga_port_in_handler()
750 *val = sc->vga_crtc.crtc_end_horiz_blank; in vga_port_in_handler()
753 *val = sc->vga_crtc.crtc_start_horiz_retrace; in vga_port_in_handler()
756 *val = sc->vga_crtc.crtc_end_horiz_retrace; in vga_port_in_handler()
759 *val = sc->vga_crtc.crtc_vert_total; in vga_port_in_handler()
762 *val = sc->vga_crtc.crtc_overflow; in vga_port_in_handler()
765 *val = sc->vga_crtc.crtc_present_row_scan; in vga_port_in_handler()
768 *val = sc->vga_crtc.crtc_max_scan_line; in vga_port_in_handler()
771 *val = sc->vga_crtc.crtc_cursor_start; in vga_port_in_handler()
774 *val = sc->vga_crtc.crtc_cursor_end; in vga_port_in_handler()
777 *val = sc->vga_crtc.crtc_start_addr_high; in vga_port_in_handler()
780 *val = sc->vga_crtc.crtc_start_addr_low; in vga_port_in_handler()
783 *val = sc->vga_crtc.crtc_cursor_loc_high; in vga_port_in_handler()
786 *val = sc->vga_crtc.crtc_cursor_loc_low; in vga_port_in_handler()
789 *val = sc->vga_crtc.crtc_vert_retrace_start; in vga_port_in_handler()
792 *val = sc->vga_crtc.crtc_vert_retrace_end; in vga_port_in_handler()
795 *val = sc->vga_crtc.crtc_vert_disp_end; in vga_port_in_handler()
798 *val = sc->vga_crtc.crtc_offset; in vga_port_in_handler()
801 *val = sc->vga_crtc.crtc_underline_loc; in vga_port_in_handler()
804 *val = sc->vga_crtc.crtc_start_vert_blank; in vga_port_in_handler()
807 *val = sc->vga_crtc.crtc_end_vert_blank; in vga_port_in_handler()
810 *val = sc->vga_crtc.crtc_mode_ctrl; in vga_port_in_handler()
813 *val = sc->vga_crtc.crtc_line_compare; in vga_port_in_handler()
822 *val = sc->vga_atc.atc_index; in vga_port_in_handler()
825 switch (sc->vga_atc.atc_index) { in vga_port_in_handler()
827 *val = sc->vga_atc.atc_palette[sc->vga_atc.atc_index]; in vga_port_in_handler()
830 *val = sc->vga_atc.atc_mode; in vga_port_in_handler()
833 *val = sc->vga_atc.atc_overscan_color; in vga_port_in_handler()
836 *val = sc->vga_atc.atc_color_plane_enb; in vga_port_in_handler()
839 *val = sc->vga_atc.atc_horiz_pixel_panning; in vga_port_in_handler()
842 *val = sc->vga_atc.atc_color_select; in vga_port_in_handler()
851 *val = sc->vga_seq.seq_index; in vga_port_in_handler()
854 switch (sc->vga_seq.seq_index) { in vga_port_in_handler()
856 *val = sc->vga_seq.seq_reset; in vga_port_in_handler()
859 *val = sc->vga_seq.seq_clock_mode; in vga_port_in_handler()
862 *val = sc->vga_seq.seq_map_mask; in vga_port_in_handler()
865 *val = sc->vga_seq.seq_cmap_sel; in vga_port_in_handler()
868 *val = sc->vga_seq.seq_mm; in vga_port_in_handler()
877 *val = sc->vga_dac.dac_palette[3 * sc->vga_dac.dac_rd_index + in vga_port_in_handler()
878 sc->vga_dac.dac_rd_subindex]; in vga_port_in_handler()
879 sc->vga_dac.dac_rd_subindex++; in vga_port_in_handler()
880 if (sc->vga_dac.dac_rd_subindex == 3) { in vga_port_in_handler()
881 sc->vga_dac.dac_rd_index++; in vga_port_in_handler()
882 sc->vga_dac.dac_rd_subindex = 0; in vga_port_in_handler()
886 *val = sc->vga_gc.gc_index; in vga_port_in_handler()
889 switch (sc->vga_gc.gc_index) { in vga_port_in_handler()
891 *val = sc->vga_gc.gc_set_reset; in vga_port_in_handler()
894 *val = sc->vga_gc.gc_enb_set_reset; in vga_port_in_handler()
897 *val = sc->vga_gc.gc_color_compare; in vga_port_in_handler()
900 *val = sc->vga_gc.gc_rotate; in vga_port_in_handler()
903 *val = sc->vga_gc.gc_read_map_sel; in vga_port_in_handler()
906 *val = sc->vga_gc.gc_mode; in vga_port_in_handler()
909 *val = sc->vga_gc.gc_misc; in vga_port_in_handler()
912 *val = sc->vga_gc.gc_color_dont_care; in vga_port_in_handler()
915 *val = sc->vga_gc.gc_bit_mask; in vga_port_in_handler()
924 *val = sc->vga_misc; in vga_port_in_handler()
931 sc->vga_atc.atc_flipflop = 0; in vga_port_in_handler()
933 sc->vga_sts1 = GEN_IS1_VR | GEN_IS1_DE; in vga_port_in_handler()
944 sc->vga_sts1 ^= (GEN_IS1_VR | GEN_IS1_DE); in vga_port_in_handler()
946 *val = sc->vga_sts1; in vga_port_in_handler()
969 struct vga_softc *sc = arg; in vga_port_out_handler() local
974 sc->vga_crtc.crtc_index = val; in vga_port_out_handler()
978 switch (sc->vga_crtc.crtc_index) { in vga_port_out_handler()
980 sc->vga_crtc.crtc_horiz_total = val; in vga_port_out_handler()
983 sc->vga_crtc.crtc_horiz_disp_end = val; in vga_port_out_handler()
986 sc->vga_crtc.crtc_start_horiz_blank = val; in vga_port_out_handler()
989 sc->vga_crtc.crtc_end_horiz_blank = val; in vga_port_out_handler()
992 sc->vga_crtc.crtc_start_horiz_retrace = val; in vga_port_out_handler()
995 sc->vga_crtc.crtc_end_horiz_retrace = val; in vga_port_out_handler()
998 sc->vga_crtc.crtc_vert_total = val; in vga_port_out_handler()
1001 sc->vga_crtc.crtc_overflow = val; in vga_port_out_handler()
1004 sc->vga_crtc.crtc_present_row_scan = val; in vga_port_out_handler()
1007 sc->vga_crtc.crtc_max_scan_line = val; in vga_port_out_handler()
1010 sc->vga_crtc.crtc_cursor_start = val; in vga_port_out_handler()
1011 sc->vga_crtc.crtc_cursor_on = (val & CRTC_CS_CO) == 0; in vga_port_out_handler()
1014 sc->vga_crtc.crtc_cursor_end = val; in vga_port_out_handler()
1017 sc->vga_crtc.crtc_start_addr_high = val; in vga_port_out_handler()
1018 sc->vga_crtc.crtc_start_addr &= 0x00ff; in vga_port_out_handler()
1019 sc->vga_crtc.crtc_start_addr |= (val << 8); in vga_port_out_handler()
1022 sc->vga_crtc.crtc_start_addr_low = val; in vga_port_out_handler()
1023 sc->vga_crtc.crtc_start_addr &= 0xff00; in vga_port_out_handler()
1024 sc->vga_crtc.crtc_start_addr |= (val & 0xff); in vga_port_out_handler()
1027 sc->vga_crtc.crtc_cursor_loc_high = val; in vga_port_out_handler()
1028 sc->vga_crtc.crtc_cursor_loc &= 0x00ff; in vga_port_out_handler()
1029 sc->vga_crtc.crtc_cursor_loc |= (val << 8); in vga_port_out_handler()
1032 sc->vga_crtc.crtc_cursor_loc_low = val; in vga_port_out_handler()
1033 sc->vga_crtc.crtc_cursor_loc &= 0xff00; in vga_port_out_handler()
1034 sc->vga_crtc.crtc_cursor_loc |= (val & 0xff); in vga_port_out_handler()
1037 sc->vga_crtc.crtc_vert_retrace_start = val; in vga_port_out_handler()
1040 sc->vga_crtc.crtc_vert_retrace_end = val; in vga_port_out_handler()
1043 sc->vga_crtc.crtc_vert_disp_end = val; in vga_port_out_handler()
1046 sc->vga_crtc.crtc_offset = val; in vga_port_out_handler()
1049 sc->vga_crtc.crtc_underline_loc = val; in vga_port_out_handler()
1052 sc->vga_crtc.crtc_start_vert_blank = val; in vga_port_out_handler()
1055 sc->vga_crtc.crtc_end_vert_blank = val; in vga_port_out_handler()
1058 sc->vga_crtc.crtc_mode_ctrl = val; in vga_port_out_handler()
1061 sc->vga_crtc.crtc_line_compare = val; in vga_port_out_handler()
1070 if (sc->vga_atc.atc_flipflop == 0) { in vga_port_out_handler()
1071 if (sc->vga_atc.atc_index & 0x20) in vga_port_out_handler()
1073 sc->vga_atc.atc_index = val & ATC_IDX_MASK; in vga_port_out_handler()
1075 switch (sc->vga_atc.atc_index) { in vga_port_out_handler()
1077 sc->vga_atc.atc_palette[sc->vga_atc.atc_index] = val & 0x3f; in vga_port_out_handler()
1080 sc->vga_atc.atc_mode = val; in vga_port_out_handler()
1083 sc->vga_atc.atc_overscan_color = val; in vga_port_out_handler()
1086 sc->vga_atc.atc_color_plane_enb = val; in vga_port_out_handler()
1089 sc->vga_atc.atc_horiz_pixel_panning = val; in vga_port_out_handler()
1092 sc->vga_atc.atc_color_select = val; in vga_port_out_handler()
1093 sc->vga_atc.atc_color_select_45 = in vga_port_out_handler()
1095 sc->vga_atc.atc_color_select_67 = in vga_port_out_handler()
1104 sc->vga_atc.atc_flipflop ^= 1; in vga_port_out_handler()
1109 sc->vga_seq.seq_index = val & 0x1f; in vga_port_out_handler()
1112 switch (sc->vga_seq.seq_index) { in vga_port_out_handler()
1114 sc->vga_seq.seq_reset = val; in vga_port_out_handler()
1117 sc->vga_seq.seq_clock_mode = val; in vga_port_out_handler()
1118 sc->vga_seq.seq_cm_dots = (val & SEQ_CM_89) ? 8 : 9; in vga_port_out_handler()
1121 sc->vga_seq.seq_map_mask = val; in vga_port_out_handler()
1124 sc->vga_seq.seq_cmap_sel = val; in vga_port_out_handler()
1126sc->vga_seq.seq_cmap_pri_off = ((((val & SEQ_CMS_SA) >> SEQ_CMS_SA_SHIFT) * 2) + ((val & SEQ_CMS_S… in vga_port_out_handler()
1127sc->vga_seq.seq_cmap_sec_off = ((((val & SEQ_CMS_SB) >> SEQ_CMS_SB_SHIFT) * 2) + ((val & SEQ_CMS_S… in vga_port_out_handler()
1130 sc->vga_seq.seq_mm = val; in vga_port_out_handler()
1143 sc->vga_dac.dac_rd_index = val; in vga_port_out_handler()
1144 sc->vga_dac.dac_rd_subindex = 0; in vga_port_out_handler()
1147 sc->vga_dac.dac_wr_index = val; in vga_port_out_handler()
1148 sc->vga_dac.dac_wr_subindex = 0; in vga_port_out_handler()
1151 sc->vga_dac.dac_palette[3 * sc->vga_dac.dac_wr_index + in vga_port_out_handler()
1152 sc->vga_dac.dac_wr_subindex] = val; in vga_port_out_handler()
1153 sc->vga_dac.dac_wr_subindex++; in vga_port_out_handler()
1154 if (sc->vga_dac.dac_wr_subindex == 3) { in vga_port_out_handler()
1155 sc->vga_dac.dac_palette_rgb[sc->vga_dac.dac_wr_index] = in vga_port_out_handler()
1156 ((((sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 0] << 2) | in vga_port_out_handler()
1157 ((sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 0] & 0x1) << 1) | in vga_port_out_handler()
1158 (sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 0] & 0x1)) << 16) | in vga_port_out_handler()
1159 (((sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 1] << 2) | in vga_port_out_handler()
1160 ((sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 1] & 0x1) << 1) | in vga_port_out_handler()
1161 (sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 1] & 0x1)) << 8) | in vga_port_out_handler()
1162 (((sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 2] << 2) | in vga_port_out_handler()
1163 ((sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 2] & 0x1) << 1) | in vga_port_out_handler()
1164 (sc->vga_dac.dac_palette[3*sc->vga_dac.dac_wr_index + 2] & 0x1)) << 0)); in vga_port_out_handler()
1166 sc->vga_dac.dac_wr_index++; in vga_port_out_handler()
1167 sc->vga_dac.dac_wr_subindex = 0; in vga_port_out_handler()
1171 sc->vga_gc.gc_index = val; in vga_port_out_handler()
1174 switch (sc->vga_gc.gc_index) { in vga_port_out_handler()
1176 sc->vga_gc.gc_set_reset = val; in vga_port_out_handler()
1179 sc->vga_gc.gc_enb_set_reset = val; in vga_port_out_handler()
1182 sc->vga_gc.gc_color_compare = val; in vga_port_out_handler()
1185 sc->vga_gc.gc_rotate = val; in vga_port_out_handler()
1186 sc->vga_gc.gc_op = (val >> 3) & 0x3; in vga_port_out_handler()
1189 sc->vga_gc.gc_read_map_sel = val; in vga_port_out_handler()
1192 sc->vga_gc.gc_mode = val; in vga_port_out_handler()
1193 sc->vga_gc.gc_mode_c4 = (val & GC_MODE_C4) != 0; in vga_port_out_handler()
1194 assert(!sc->vga_gc.gc_mode_c4); in vga_port_out_handler()
1195 sc->vga_gc.gc_mode_oe = (val & GC_MODE_OE) != 0; in vga_port_out_handler()
1196 sc->vga_gc.gc_mode_rm = (val >> 3) & 0x1; in vga_port_out_handler()
1197 sc->vga_gc.gc_mode_wm = val & 0x3; in vga_port_out_handler()
1199 if (sc->gc_image) in vga_port_out_handler()
1200 sc->gc_image->vgamode = 1; in vga_port_out_handler()
1203 sc->vga_gc.gc_misc = val; in vga_port_out_handler()
1204 sc->vga_gc.gc_misc_gm = val & GC_MISC_GM; in vga_port_out_handler()
1205 sc->vga_gc.gc_misc_mm = (val & GC_MISC_MM) >> in vga_port_out_handler()
1209 sc->vga_gc.gc_color_dont_care = val; in vga_port_out_handler()
1212 sc->vga_gc.gc_bit_mask = val; in vga_port_out_handler()
1222 sc->vga_misc = val; in vga_port_out_handler()
1294 struct vga_softc *sc; in vga_init() local
1297 sc = calloc(1, sizeof(struct vga_softc)); in vga_init()
1306 iop.arg = sc; in vga_init()
1312 sc->gc_image = console_get_image(); in vga_init()
1316 return(sc); in vga_init()
1318 sc->mr.name = "VGA memory"; in vga_init()
1319 sc->mr.flags = MEM_F_RW; in vga_init()
1320 sc->mr.base = 640 * KB; in vga_init()
1321 sc->mr.size = 128 * KB; in vga_init()
1322 sc->mr.handler = vga_mem_handler; in vga_init()
1323 sc->mr.arg1 = sc; in vga_init()
1324 error = register_mem_fallback(&sc->mr); in vga_init()
1327 sc->vga_ram = malloc(256 * KB); in vga_init()
1328 memset(sc->vga_ram, 0, 256 * KB); in vga_init()
1339 memcpy(sc->vga_dac.dac_palette, palette, 16 * 3 * sizeof (uint8_t)); in vga_init()
1341 sc->vga_dac.dac_palette_rgb[i] = in vga_init()
1342 ((((sc->vga_dac.dac_palette[3*i + 0] << 2) | in vga_init()
1343 ((sc->vga_dac.dac_palette[3*i + 0] & 0x1) << 1) | in vga_init()
1344 (sc->vga_dac.dac_palette[3*i + 0] & 0x1)) << 16) | in vga_init()
1345 (((sc->vga_dac.dac_palette[3*i + 1] << 2) | in vga_init()
1346 ((sc->vga_dac.dac_palette[3*i + 1] & 0x1) << 1) | in vga_init()
1347 (sc->vga_dac.dac_palette[3*i + 1] & 0x1)) << 8) | in vga_init()
1348 (((sc->vga_dac.dac_palette[3*i + 2] << 2) | in vga_init()
1349 ((sc->vga_dac.dac_palette[3*i + 2] & 0x1) << 1) | in vga_init()
1350 (sc->vga_dac.dac_palette[3*i + 2] & 0x1)) << 0)); in vga_init()
1354 return (sc); in vga_init()