blob: 11e20e4ef5f4234f0e9cb612e749496b80b50a02 [file] [log] [blame]
Kevin O'Connor1f2c3072009-05-06 23:35:59 -04001// Tables used by VGA bios
2//
3// Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net>
4// Copyright (C) 2001-2008 the LGPL VGABios developers Team
5//
6// This file may be distributed under the terms of the GNU LGPLv3 license.
7
Kevin O'Connore1e000b2011-12-31 03:30:40 -05008#include "vgabios.h" // struct VideoParamTableEntry_s
Kevin O'Connor5727c292009-05-16 17:29:32 -04009#include "biosvar.h" // GET_GLOBAL
Kevin O'Connorf3760372011-12-23 22:41:08 -050010#include "util.h" // memcpy_far
Kevin O'Connored68e5b2011-12-31 04:15:12 -050011#include "stdvga.h" // struct vgamode_s
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040012
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040013
Kevin O'Connor5727c292009-05-16 17:29:32 -040014/****************************************************************
15 * Video parameter table
16 ****************************************************************/
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040017
Kevin O'Connorf3760372011-12-23 22:41:08 -050018// Standard Video Save Pointer Table
19struct VideoSavePointer_s {
20 struct segoff_s videoparam;
21 struct segoff_s paramdynamicsave;
22 struct segoff_s textcharset;
23 struct segoff_s graphcharset;
24 struct segoff_s secsavepointer;
25 u8 reserved[8];
26} PACKED;
27
Kevin O'Connor815e4472011-12-21 09:05:32 -050028struct VideoSavePointer_s video_save_pointer_table VAR16;
29
Kevin O'Connorf3760372011-12-23 22:41:08 -050030// standard BIOS Video Parameter Table
31struct VideoParam_s {
32 u8 twidth;
33 u8 theightm1;
34 u8 cheight;
35 u16 slength;
36 u8 sequ_regs[4];
37 u8 miscreg;
38 u8 crtc_regs[25];
39 u8 actl_regs[20];
40 u8 grdc_regs[9];
41} PACKED;
42
43struct VideoParam_s video_param_table[29] VAR16;
44
45void
46build_video_param(void)
47{
48 static u8 parammodes[ARRAY_SIZE(video_param_table)] VAR16 = {
49 0, 0, 0, 0, 0x04, 0x05, 0x06, 0x07,
50 0, 0, 0, 0, 0, 0x0d, 0x0e, 0,
51 0, 0x0f, 0x10, 0, 0, 0, 0, 0x01,
52 0x03, 0x07, 0x11, 0x12, 0x13
53 };
54
55 int i;
56 for (i=0; i<ARRAY_SIZE(parammodes); i++) {
Kevin O'Connor80da87d2012-01-02 11:13:14 -050057 int mode = GET_GLOBAL(parammodes[i]);
Kevin O'Connorf3760372011-12-23 22:41:08 -050058 if (! mode)
59 continue;
60 struct VideoParam_s *vparam_g = &video_param_table[i];
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050061 struct vgamode_s *vmode_g = stdvga_find_mode(mode);
Kevin O'Connorf3760372011-12-23 22:41:08 -050062 if (!vmode_g)
63 continue;
Kevin O'Connor80da87d2012-01-02 11:13:14 -050064 int width = GET_GLOBAL(vmode_g->width);
65 int height = GET_GLOBAL(vmode_g->height);
Kevin O'Connor83047be2012-01-07 18:27:19 -050066 u8 memmodel = GET_GLOBAL(vmode_g->memmodel);
Kevin O'Connor80da87d2012-01-02 11:13:14 -050067 int cheight = GET_GLOBAL(vmode_g->cheight);
Kevin O'Connor83047be2012-01-07 18:27:19 -050068 if (memmodel == MM_TEXT) {
Kevin O'Connor80da87d2012-01-02 11:13:14 -050069 SET_VGA(vparam_g->twidth, width);
70 SET_VGA(vparam_g->theightm1, height-1);
71 } else {
72 int cwidth = GET_GLOBAL(vmode_g->cwidth);
73 SET_VGA(vparam_g->twidth, width / cwidth);
74 SET_VGA(vparam_g->theightm1, (height / cheight) - 1);
75 }
76 SET_VGA(vparam_g->cheight, cheight);
Kevin O'Connor83047be2012-01-07 18:27:19 -050077 SET_VGA(vparam_g->slength, calc_page_size(memmodel, width, height));
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050078 struct stdvga_mode_s *stdmode_g = container_of(
79 vmode_g, struct stdvga_mode_s, info);
Kevin O'Connorf3760372011-12-23 22:41:08 -050080 memcpy_far(get_global_seg(), vparam_g->sequ_regs
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050081 , get_global_seg(), GET_GLOBAL(stdmode_g->sequ_regs)
Kevin O'Connorf3760372011-12-23 22:41:08 -050082 , ARRAY_SIZE(vparam_g->sequ_regs));
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050083 SET_VGA(vparam_g->miscreg, GET_GLOBAL(stdmode_g->miscreg));
Kevin O'Connorf3760372011-12-23 22:41:08 -050084 memcpy_far(get_global_seg(), vparam_g->crtc_regs
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050085 , get_global_seg(), GET_GLOBAL(stdmode_g->crtc_regs)
Kevin O'Connorf3760372011-12-23 22:41:08 -050086 , ARRAY_SIZE(vparam_g->crtc_regs));
87 memcpy_far(get_global_seg(), vparam_g->actl_regs
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050088 , get_global_seg(), GET_GLOBAL(stdmode_g->actl_regs)
Kevin O'Connorf3760372011-12-23 22:41:08 -050089 , ARRAY_SIZE(vparam_g->actl_regs));
90 memcpy_far(get_global_seg(), vparam_g->grdc_regs
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050091 , get_global_seg(), GET_GLOBAL(stdmode_g->grdc_regs)
Kevin O'Connorf3760372011-12-23 22:41:08 -050092 , ARRAY_SIZE(vparam_g->grdc_regs));
93 }
94
95 SET_VGA(video_save_pointer_table.videoparam
96 , SEGOFF(get_global_seg(), (u32)video_param_table));
97}
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040098
Kevin O'Connor5727c292009-05-16 17:29:32 -040099
100/****************************************************************
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500101 * Register definitions
Kevin O'Connor5727c292009-05-16 17:29:32 -0400102 ****************************************************************/
103
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400104/* Mono */
Kevin O'Connor5727c292009-05-16 17:29:32 -0400105static u8 palette0[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400106 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
107 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
108 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
109 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
110 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
111 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
112 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
113 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
114 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
115 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
116 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
117 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
118 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
119 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
120 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
121 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400122};
123
Kevin O'Connor5727c292009-05-16 17:29:32 -0400124static u8 palette1[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400125 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
126 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
127 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
128 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
129 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
130 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
131 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
132 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
133 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
134 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
135 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
136 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
137 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
138 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
139 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
140 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400141};
142
Kevin O'Connor5727c292009-05-16 17:29:32 -0400143static u8 palette2[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400144 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
145 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x2a,0x00, 0x2a,0x2a,0x2a,
146 0x00,0x00,0x15, 0x00,0x00,0x3f, 0x00,0x2a,0x15, 0x00,0x2a,0x3f,
147 0x2a,0x00,0x15, 0x2a,0x00,0x3f, 0x2a,0x2a,0x15, 0x2a,0x2a,0x3f,
148 0x00,0x15,0x00, 0x00,0x15,0x2a, 0x00,0x3f,0x00, 0x00,0x3f,0x2a,
149 0x2a,0x15,0x00, 0x2a,0x15,0x2a, 0x2a,0x3f,0x00, 0x2a,0x3f,0x2a,
150 0x00,0x15,0x15, 0x00,0x15,0x3f, 0x00,0x3f,0x15, 0x00,0x3f,0x3f,
151 0x2a,0x15,0x15, 0x2a,0x15,0x3f, 0x2a,0x3f,0x15, 0x2a,0x3f,0x3f,
152 0x15,0x00,0x00, 0x15,0x00,0x2a, 0x15,0x2a,0x00, 0x15,0x2a,0x2a,
153 0x3f,0x00,0x00, 0x3f,0x00,0x2a, 0x3f,0x2a,0x00, 0x3f,0x2a,0x2a,
154 0x15,0x00,0x15, 0x15,0x00,0x3f, 0x15,0x2a,0x15, 0x15,0x2a,0x3f,
155 0x3f,0x00,0x15, 0x3f,0x00,0x3f, 0x3f,0x2a,0x15, 0x3f,0x2a,0x3f,
156 0x15,0x15,0x00, 0x15,0x15,0x2a, 0x15,0x3f,0x00, 0x15,0x3f,0x2a,
157 0x3f,0x15,0x00, 0x3f,0x15,0x2a, 0x3f,0x3f,0x00, 0x3f,0x3f,0x2a,
158 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
159 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400160};
161
Kevin O'Connor5727c292009-05-16 17:29:32 -0400162static u8 palette3[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400163 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
164 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
165 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
166 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
167 0x00,0x00,0x00, 0x05,0x05,0x05, 0x08,0x08,0x08, 0x0b,0x0b,0x0b,
168 0x0e,0x0e,0x0e, 0x11,0x11,0x11, 0x14,0x14,0x14, 0x18,0x18,0x18,
169 0x1c,0x1c,0x1c, 0x20,0x20,0x20, 0x24,0x24,0x24, 0x28,0x28,0x28,
170 0x2d,0x2d,0x2d, 0x32,0x32,0x32, 0x38,0x38,0x38, 0x3f,0x3f,0x3f,
171 0x00,0x00,0x3f, 0x10,0x00,0x3f, 0x1f,0x00,0x3f, 0x2f,0x00,0x3f,
172 0x3f,0x00,0x3f, 0x3f,0x00,0x2f, 0x3f,0x00,0x1f, 0x3f,0x00,0x10,
173 0x3f,0x00,0x00, 0x3f,0x10,0x00, 0x3f,0x1f,0x00, 0x3f,0x2f,0x00,
174 0x3f,0x3f,0x00, 0x2f,0x3f,0x00, 0x1f,0x3f,0x00, 0x10,0x3f,0x00,
175 0x00,0x3f,0x00, 0x00,0x3f,0x10, 0x00,0x3f,0x1f, 0x00,0x3f,0x2f,
176 0x00,0x3f,0x3f, 0x00,0x2f,0x3f, 0x00,0x1f,0x3f, 0x00,0x10,0x3f,
177 0x1f,0x1f,0x3f, 0x27,0x1f,0x3f, 0x2f,0x1f,0x3f, 0x37,0x1f,0x3f,
178 0x3f,0x1f,0x3f, 0x3f,0x1f,0x37, 0x3f,0x1f,0x2f, 0x3f,0x1f,0x27,
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400179
Kevin O'Connora959aa12009-05-25 00:12:18 -0400180 0x3f,0x1f,0x1f, 0x3f,0x27,0x1f, 0x3f,0x2f,0x1f, 0x3f,0x37,0x1f,
181 0x3f,0x3f,0x1f, 0x37,0x3f,0x1f, 0x2f,0x3f,0x1f, 0x27,0x3f,0x1f,
182 0x1f,0x3f,0x1f, 0x1f,0x3f,0x27, 0x1f,0x3f,0x2f, 0x1f,0x3f,0x37,
183 0x1f,0x3f,0x3f, 0x1f,0x37,0x3f, 0x1f,0x2f,0x3f, 0x1f,0x27,0x3f,
184 0x2d,0x2d,0x3f, 0x31,0x2d,0x3f, 0x36,0x2d,0x3f, 0x3a,0x2d,0x3f,
185 0x3f,0x2d,0x3f, 0x3f,0x2d,0x3a, 0x3f,0x2d,0x36, 0x3f,0x2d,0x31,
186 0x3f,0x2d,0x2d, 0x3f,0x31,0x2d, 0x3f,0x36,0x2d, 0x3f,0x3a,0x2d,
187 0x3f,0x3f,0x2d, 0x3a,0x3f,0x2d, 0x36,0x3f,0x2d, 0x31,0x3f,0x2d,
188 0x2d,0x3f,0x2d, 0x2d,0x3f,0x31, 0x2d,0x3f,0x36, 0x2d,0x3f,0x3a,
189 0x2d,0x3f,0x3f, 0x2d,0x3a,0x3f, 0x2d,0x36,0x3f, 0x2d,0x31,0x3f,
190 0x00,0x00,0x1c, 0x07,0x00,0x1c, 0x0e,0x00,0x1c, 0x15,0x00,0x1c,
191 0x1c,0x00,0x1c, 0x1c,0x00,0x15, 0x1c,0x00,0x0e, 0x1c,0x00,0x07,
192 0x1c,0x00,0x00, 0x1c,0x07,0x00, 0x1c,0x0e,0x00, 0x1c,0x15,0x00,
193 0x1c,0x1c,0x00, 0x15,0x1c,0x00, 0x0e,0x1c,0x00, 0x07,0x1c,0x00,
194 0x00,0x1c,0x00, 0x00,0x1c,0x07, 0x00,0x1c,0x0e, 0x00,0x1c,0x15,
195 0x00,0x1c,0x1c, 0x00,0x15,0x1c, 0x00,0x0e,0x1c, 0x00,0x07,0x1c,
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400196
Kevin O'Connora959aa12009-05-25 00:12:18 -0400197 0x0e,0x0e,0x1c, 0x11,0x0e,0x1c, 0x15,0x0e,0x1c, 0x18,0x0e,0x1c,
198 0x1c,0x0e,0x1c, 0x1c,0x0e,0x18, 0x1c,0x0e,0x15, 0x1c,0x0e,0x11,
199 0x1c,0x0e,0x0e, 0x1c,0x11,0x0e, 0x1c,0x15,0x0e, 0x1c,0x18,0x0e,
200 0x1c,0x1c,0x0e, 0x18,0x1c,0x0e, 0x15,0x1c,0x0e, 0x11,0x1c,0x0e,
201 0x0e,0x1c,0x0e, 0x0e,0x1c,0x11, 0x0e,0x1c,0x15, 0x0e,0x1c,0x18,
202 0x0e,0x1c,0x1c, 0x0e,0x18,0x1c, 0x0e,0x15,0x1c, 0x0e,0x11,0x1c,
203 0x14,0x14,0x1c, 0x16,0x14,0x1c, 0x18,0x14,0x1c, 0x1a,0x14,0x1c,
204 0x1c,0x14,0x1c, 0x1c,0x14,0x1a, 0x1c,0x14,0x18, 0x1c,0x14,0x16,
205 0x1c,0x14,0x14, 0x1c,0x16,0x14, 0x1c,0x18,0x14, 0x1c,0x1a,0x14,
206 0x1c,0x1c,0x14, 0x1a,0x1c,0x14, 0x18,0x1c,0x14, 0x16,0x1c,0x14,
207 0x14,0x1c,0x14, 0x14,0x1c,0x16, 0x14,0x1c,0x18, 0x14,0x1c,0x1a,
208 0x14,0x1c,0x1c, 0x14,0x1a,0x1c, 0x14,0x18,0x1c, 0x14,0x16,0x1c,
209 0x00,0x00,0x10, 0x04,0x00,0x10, 0x08,0x00,0x10, 0x0c,0x00,0x10,
210 0x10,0x00,0x10, 0x10,0x00,0x0c, 0x10,0x00,0x08, 0x10,0x00,0x04,
211 0x10,0x00,0x00, 0x10,0x04,0x00, 0x10,0x08,0x00, 0x10,0x0c,0x00,
212 0x10,0x10,0x00, 0x0c,0x10,0x00, 0x08,0x10,0x00, 0x04,0x10,0x00,
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400213
Kevin O'Connora959aa12009-05-25 00:12:18 -0400214 0x00,0x10,0x00, 0x00,0x10,0x04, 0x00,0x10,0x08, 0x00,0x10,0x0c,
215 0x00,0x10,0x10, 0x00,0x0c,0x10, 0x00,0x08,0x10, 0x00,0x04,0x10,
216 0x08,0x08,0x10, 0x0a,0x08,0x10, 0x0c,0x08,0x10, 0x0e,0x08,0x10,
217 0x10,0x08,0x10, 0x10,0x08,0x0e, 0x10,0x08,0x0c, 0x10,0x08,0x0a,
218 0x10,0x08,0x08, 0x10,0x0a,0x08, 0x10,0x0c,0x08, 0x10,0x0e,0x08,
219 0x10,0x10,0x08, 0x0e,0x10,0x08, 0x0c,0x10,0x08, 0x0a,0x10,0x08,
220 0x08,0x10,0x08, 0x08,0x10,0x0a, 0x08,0x10,0x0c, 0x08,0x10,0x0e,
221 0x08,0x10,0x10, 0x08,0x0e,0x10, 0x08,0x0c,0x10, 0x08,0x0a,0x10,
222 0x0b,0x0b,0x10, 0x0c,0x0b,0x10, 0x0d,0x0b,0x10, 0x0f,0x0b,0x10,
223 0x10,0x0b,0x10, 0x10,0x0b,0x0f, 0x10,0x0b,0x0d, 0x10,0x0b,0x0c,
224 0x10,0x0b,0x0b, 0x10,0x0c,0x0b, 0x10,0x0d,0x0b, 0x10,0x0f,0x0b,
225 0x10,0x10,0x0b, 0x0f,0x10,0x0b, 0x0d,0x10,0x0b, 0x0c,0x10,0x0b,
226 0x0b,0x10,0x0b, 0x0b,0x10,0x0c, 0x0b,0x10,0x0d, 0x0b,0x10,0x0f,
227 0x0b,0x10,0x10, 0x0b,0x0f,0x10, 0x0b,0x0d,0x10, 0x0b,0x0c,0x10,
228 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
229 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400230};
231
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500232static u8 sequ_01[] VAR16 = { 0x08, 0x03, 0x00, 0x02 };
233static u8 crtc_01[] VAR16 = {
234 0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f,
235 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
236 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3,
237 0xff };
238static u8 actl_01[] VAR16 = {
239 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
240 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
241 0x0c, 0x00, 0x0f, 0x08 };
242static u8 grdc_01[] VAR16 = {
243 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff };
244static u8 sequ_03[] VAR16 = { 0x00, 0x03, 0x00, 0x02 };
245static u8 crtc_03[] VAR16 = {
246 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
247 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
248 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
249 0xff };
250static u8 sequ_04[] VAR16 = { 0x09, 0x03, 0x00, 0x02 };
251static u8 crtc_04[] VAR16 = {
252 0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
253 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
254 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2,
255 0xff };
256static u8 actl_04[] VAR16 = {
257 0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07,
258 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
259 0x01, 0x00, 0x03, 0x00 };
260static u8 grdc_04[] VAR16 = {
261 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x0f, 0xff };
262static u8 sequ_06[] VAR16 = { 0x01, 0x01, 0x00, 0x06 };
263static u8 crtc_06[] VAR16 = {
264 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
265 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
266 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2,
267 0xff };
268static u8 actl_06[] VAR16 = {
269 0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
270 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
271 0x01, 0x00, 0x01, 0x00 };
272static u8 grdc_06[] VAR16 = {
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0f, 0xff };
274static u8 crtc_07[] VAR16 = {
275 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
276 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
277 0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3,
278 0xff };
279static u8 actl_07[] VAR16 = {
280 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
281 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
282 0x0e, 0x00, 0x0f, 0x08 };
283static u8 grdc_07[] VAR16 = {
284 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x0f, 0xff };
285static u8 sequ_0d[] VAR16 = { 0x09, 0x0f, 0x00, 0x06 };
286static u8 crtc_0d[] VAR16 = {
287 0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
288 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3,
290 0xff };
291static u8 actl_0d[] VAR16 = {
292 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
293 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
294 0x01, 0x00, 0x0f, 0x00 };
295static u8 grdc_0d[] VAR16 = {
296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff };
297static u8 sequ_0e[] VAR16 = { 0x01, 0x0f, 0x00, 0x06 };
298static u8 crtc_0e[] VAR16 = {
299 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
300 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3,
302 0xff };
303static u8 crtc_0f[] VAR16 = {
304 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
305 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306 0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3,
307 0xff };
308static u8 actl_0f[] VAR16 = {
309 0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
310 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
311 0x01, 0x00, 0x01, 0x00 };
312static u8 actl_10[] VAR16 = {
313 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
314 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
315 0x01, 0x00, 0x0f, 0x00 };
316static u8 crtc_11[] VAR16 = {
317 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
318 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
320 0xff };
321static u8 actl_11[] VAR16 = {
322 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
323 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
324 0x01, 0x00, 0x0f, 0x00 };
325static u8 sequ_13[] VAR16 = { 0x01, 0x0f, 0x00, 0x0e };
326static u8 crtc_13[] VAR16 = {
327 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
328 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329 0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3,
330 0xff };
331static u8 actl_13[] VAR16 = {
332 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
333 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
334 0x41, 0x00, 0x0f, 0x00 };
335static u8 grdc_13[] VAR16 = {
336 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, 0xff };
337static u8 crtc_6A[] VAR16 = {
338 0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
339 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x59, 0x8d, 0x57, 0x32, 0x00, 0x57, 0x73, 0xe3,
341 0xff };
342
Kevin O'Connor5727c292009-05-16 17:29:32 -0400343
344/****************************************************************
345 * Video mode list
346 ****************************************************************/
347
348#define PAL(x) x, sizeof(x)
349#define VPARAM(x) &video_param_table[x]
350
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500351static struct stdvga_mode_s vga_modes[] VAR16 = {
352 //mode { model tx ty bpp cw ch sstart }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500353 // pelm dac sequ misc crtc actl grdc
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500354 {0x00, { MM_TEXT, 40, 25, 4, 9, 16, SEG_CTEXT }
Kevin O'Connord4398ad2012-01-01 12:32:53 -0500355 , 0xFF, PAL(palette2), sequ_01, 0x67, crtc_01, actl_01, grdc_01},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500356 {0x01, { MM_TEXT, 40, 25, 4, 9, 16, SEG_CTEXT }
Kevin O'Connord4398ad2012-01-01 12:32:53 -0500357 , 0xFF, PAL(palette2), sequ_01, 0x67, crtc_01, actl_01, grdc_01},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500358 {0x02, { MM_TEXT, 80, 25, 4, 9, 16, SEG_CTEXT }
Kevin O'Connord4398ad2012-01-01 12:32:53 -0500359 , 0xFF, PAL(palette2), sequ_03, 0x67, crtc_03, actl_01, grdc_01},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500360 {0x03, { MM_TEXT, 80, 25, 4, 9, 16, SEG_CTEXT }
Kevin O'Connord4398ad2012-01-01 12:32:53 -0500361 , 0xFF, PAL(palette2), sequ_03, 0x67, crtc_03, actl_01, grdc_01},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500362 {0x04, { MM_CGA, 320, 200, 2, 8, 8, SEG_CTEXT }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500363 , 0xFF, PAL(palette1), sequ_04, 0x63, crtc_04, actl_04, grdc_04},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500364 {0x05, { MM_CGA, 320, 200, 2, 8, 8, SEG_CTEXT }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500365 , 0xFF, PAL(palette1), sequ_04, 0x63, crtc_04, actl_04, grdc_04},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500366 {0x06, { MM_CGA, 640, 200, 1, 8, 8, SEG_CTEXT }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500367 , 0xFF, PAL(palette1), sequ_06, 0x63, crtc_06, actl_06, grdc_06},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500368 {0x07, { MM_TEXT, 80, 25, 4, 9, 16, SEG_MTEXT }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500369 , 0xFF, PAL(palette0), sequ_03, 0x66, crtc_07, actl_07, grdc_07},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500370 {0x0D, { MM_PLANAR, 320, 200, 4, 8, 8, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500371 , 0xFF, PAL(palette1), sequ_0d, 0x63, crtc_0d, actl_0d, grdc_0d},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500372 {0x0E, { MM_PLANAR, 640, 200, 4, 8, 8, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500373 , 0xFF, PAL(palette1), sequ_0e, 0x63, crtc_0e, actl_0d, grdc_0d},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500374 {0x0F, { MM_PLANAR, 640, 350, 1, 8, 14, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500375 , 0xFF, PAL(palette0), sequ_0e, 0xa3, crtc_0f, actl_0f, grdc_0d},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500376 {0x10, { MM_PLANAR, 640, 350, 4, 8, 14, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500377 , 0xFF, PAL(palette2), sequ_0e, 0xa3, crtc_0f, actl_10, grdc_0d},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500378 {0x11, { MM_PLANAR, 640, 480, 1, 8, 16, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500379 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_11, actl_11, grdc_0d},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500380 {0x12, { MM_PLANAR, 640, 480, 4, 8, 16, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500381 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_11, actl_10, grdc_0d},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500382 {0x13, { MM_PACKED, 320, 200, 8, 8, 8, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500383 , 0xFF, PAL(palette3), sequ_13, 0x63, crtc_13, actl_13, grdc_13},
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500384 {0x6A, { MM_PLANAR, 800, 600, 4, 8, 16, SEG_GRAPH }
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500385 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_6A, actl_10, grdc_0d},
Kevin O'Connor5727c292009-05-16 17:29:32 -0400386};
387
388struct vgamode_s *
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500389stdvga_find_mode(int mode)
Kevin O'Connor5727c292009-05-16 17:29:32 -0400390{
391 int i;
392 for (i = 0; i < ARRAY_SIZE(vga_modes); i++) {
Kevin O'Connor10dff3d2012-01-09 19:19:44 -0500393 struct stdvga_mode_s *stdmode_g = &vga_modes[i];
394 if (GET_GLOBAL(stdmode_g->mode) == mode)
395 return &stdmode_g->info;
Kevin O'Connor5727c292009-05-16 17:29:32 -0400396 }
397 return NULL;
398}