blob: 47395f2bc1b139abab83dc00ca85d24637f57ec5 [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'Connor5727c292009-05-16 17:29:32 -04008#include "vgatables.h" // struct VideoParamTableEntry_s
9#include "biosvar.h" // GET_GLOBAL
Kevin O'Connorf3760372011-12-23 22:41:08 -050010#include "util.h" // memcpy_far
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040011
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040012
Kevin O'Connor5727c292009-05-16 17:29:32 -040013/****************************************************************
14 * Video parameter table
15 ****************************************************************/
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040016
Kevin O'Connorf3760372011-12-23 22:41:08 -050017// Standard Video Save Pointer Table
18struct VideoSavePointer_s {
19 struct segoff_s videoparam;
20 struct segoff_s paramdynamicsave;
21 struct segoff_s textcharset;
22 struct segoff_s graphcharset;
23 struct segoff_s secsavepointer;
24 u8 reserved[8];
25} PACKED;
26
Kevin O'Connor815e4472011-12-21 09:05:32 -050027struct VideoSavePointer_s video_save_pointer_table VAR16;
28
Kevin O'Connorf3760372011-12-23 22:41:08 -050029// standard BIOS Video Parameter Table
30struct VideoParam_s {
31 u8 twidth;
32 u8 theightm1;
33 u8 cheight;
34 u16 slength;
35 u8 sequ_regs[4];
36 u8 miscreg;
37 u8 crtc_regs[25];
38 u8 actl_regs[20];
39 u8 grdc_regs[9];
40} PACKED;
41
42struct VideoParam_s video_param_table[29] VAR16;
43
44void
45build_video_param(void)
46{
47 static u8 parammodes[ARRAY_SIZE(video_param_table)] VAR16 = {
48 0, 0, 0, 0, 0x04, 0x05, 0x06, 0x07,
49 0, 0, 0, 0, 0, 0x0d, 0x0e, 0,
50 0, 0x0f, 0x10, 0, 0, 0, 0, 0x01,
51 0x03, 0x07, 0x11, 0x12, 0x13
52 };
53
54 int i;
55 for (i=0; i<ARRAY_SIZE(parammodes); i++) {
56 u8 mode = GET_GLOBAL(parammodes[i]);
57 if (! mode)
58 continue;
59 struct VideoParam_s *vparam_g = &video_param_table[i];
60 struct vgamode_s *vmode_g = find_vga_entry(mode);
61 if (!vmode_g)
62 continue;
63 SET_VGA(vparam_g->twidth, GET_GLOBAL(vmode_g->twidth));
64 SET_VGA(vparam_g->theightm1, GET_GLOBAL(vmode_g->theight)-1);
65 SET_VGA(vparam_g->cheight, GET_GLOBAL(vmode_g->cheight));
66 SET_VGA(vparam_g->slength, GET_GLOBAL(vmode_g->slength));
67 memcpy_far(get_global_seg(), vparam_g->sequ_regs
68 , get_global_seg(), GET_GLOBAL(vmode_g->sequ_regs)
69 , ARRAY_SIZE(vparam_g->sequ_regs));
70 SET_VGA(vparam_g->miscreg, GET_GLOBAL(vmode_g->miscreg));
71 memcpy_far(get_global_seg(), vparam_g->crtc_regs
72 , get_global_seg(), GET_GLOBAL(vmode_g->crtc_regs)
73 , ARRAY_SIZE(vparam_g->crtc_regs));
74 memcpy_far(get_global_seg(), vparam_g->actl_regs
75 , get_global_seg(), GET_GLOBAL(vmode_g->actl_regs)
76 , ARRAY_SIZE(vparam_g->actl_regs));
77 memcpy_far(get_global_seg(), vparam_g->grdc_regs
78 , get_global_seg(), GET_GLOBAL(vmode_g->grdc_regs)
79 , ARRAY_SIZE(vparam_g->grdc_regs));
80 }
81
82 SET_VGA(video_save_pointer_table.videoparam
83 , SEGOFF(get_global_seg(), (u32)video_param_table));
84}
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040085
Kevin O'Connor5727c292009-05-16 17:29:32 -040086
87/****************************************************************
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -050088 * Register definitions
Kevin O'Connor5727c292009-05-16 17:29:32 -040089 ****************************************************************/
90
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040091/* Mono */
Kevin O'Connor5727c292009-05-16 17:29:32 -040092static u8 palette0[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -040093 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
94 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
95 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
96 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
97 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
98 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
99 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
100 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
101 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
102 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
103 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
104 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
105 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
106 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a, 0x2a,0x2a,0x2a,
107 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f,
108 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f, 0x3f,0x3f,0x3f
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400109};
110
Kevin O'Connor5727c292009-05-16 17:29:32 -0400111static u8 palette1[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400112 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
113 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
114 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
115 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
116 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
117 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
118 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
119 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
120 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
121 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
122 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
123 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
124 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
125 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
126 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
127 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400128};
129
Kevin O'Connor5727c292009-05-16 17:29:32 -0400130static u8 palette2[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400131 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
132 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x2a,0x00, 0x2a,0x2a,0x2a,
133 0x00,0x00,0x15, 0x00,0x00,0x3f, 0x00,0x2a,0x15, 0x00,0x2a,0x3f,
134 0x2a,0x00,0x15, 0x2a,0x00,0x3f, 0x2a,0x2a,0x15, 0x2a,0x2a,0x3f,
135 0x00,0x15,0x00, 0x00,0x15,0x2a, 0x00,0x3f,0x00, 0x00,0x3f,0x2a,
136 0x2a,0x15,0x00, 0x2a,0x15,0x2a, 0x2a,0x3f,0x00, 0x2a,0x3f,0x2a,
137 0x00,0x15,0x15, 0x00,0x15,0x3f, 0x00,0x3f,0x15, 0x00,0x3f,0x3f,
138 0x2a,0x15,0x15, 0x2a,0x15,0x3f, 0x2a,0x3f,0x15, 0x2a,0x3f,0x3f,
139 0x15,0x00,0x00, 0x15,0x00,0x2a, 0x15,0x2a,0x00, 0x15,0x2a,0x2a,
140 0x3f,0x00,0x00, 0x3f,0x00,0x2a, 0x3f,0x2a,0x00, 0x3f,0x2a,0x2a,
141 0x15,0x00,0x15, 0x15,0x00,0x3f, 0x15,0x2a,0x15, 0x15,0x2a,0x3f,
142 0x3f,0x00,0x15, 0x3f,0x00,0x3f, 0x3f,0x2a,0x15, 0x3f,0x2a,0x3f,
143 0x15,0x15,0x00, 0x15,0x15,0x2a, 0x15,0x3f,0x00, 0x15,0x3f,0x2a,
144 0x3f,0x15,0x00, 0x3f,0x15,0x2a, 0x3f,0x3f,0x00, 0x3f,0x3f,0x2a,
145 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
146 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400147};
148
Kevin O'Connor5727c292009-05-16 17:29:32 -0400149static u8 palette3[] VAR16 = {
Kevin O'Connora959aa12009-05-25 00:12:18 -0400150 0x00,0x00,0x00, 0x00,0x00,0x2a, 0x00,0x2a,0x00, 0x00,0x2a,0x2a,
151 0x2a,0x00,0x00, 0x2a,0x00,0x2a, 0x2a,0x15,0x00, 0x2a,0x2a,0x2a,
152 0x15,0x15,0x15, 0x15,0x15,0x3f, 0x15,0x3f,0x15, 0x15,0x3f,0x3f,
153 0x3f,0x15,0x15, 0x3f,0x15,0x3f, 0x3f,0x3f,0x15, 0x3f,0x3f,0x3f,
154 0x00,0x00,0x00, 0x05,0x05,0x05, 0x08,0x08,0x08, 0x0b,0x0b,0x0b,
155 0x0e,0x0e,0x0e, 0x11,0x11,0x11, 0x14,0x14,0x14, 0x18,0x18,0x18,
156 0x1c,0x1c,0x1c, 0x20,0x20,0x20, 0x24,0x24,0x24, 0x28,0x28,0x28,
157 0x2d,0x2d,0x2d, 0x32,0x32,0x32, 0x38,0x38,0x38, 0x3f,0x3f,0x3f,
158 0x00,0x00,0x3f, 0x10,0x00,0x3f, 0x1f,0x00,0x3f, 0x2f,0x00,0x3f,
159 0x3f,0x00,0x3f, 0x3f,0x00,0x2f, 0x3f,0x00,0x1f, 0x3f,0x00,0x10,
160 0x3f,0x00,0x00, 0x3f,0x10,0x00, 0x3f,0x1f,0x00, 0x3f,0x2f,0x00,
161 0x3f,0x3f,0x00, 0x2f,0x3f,0x00, 0x1f,0x3f,0x00, 0x10,0x3f,0x00,
162 0x00,0x3f,0x00, 0x00,0x3f,0x10, 0x00,0x3f,0x1f, 0x00,0x3f,0x2f,
163 0x00,0x3f,0x3f, 0x00,0x2f,0x3f, 0x00,0x1f,0x3f, 0x00,0x10,0x3f,
164 0x1f,0x1f,0x3f, 0x27,0x1f,0x3f, 0x2f,0x1f,0x3f, 0x37,0x1f,0x3f,
165 0x3f,0x1f,0x3f, 0x3f,0x1f,0x37, 0x3f,0x1f,0x2f, 0x3f,0x1f,0x27,
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400166
Kevin O'Connora959aa12009-05-25 00:12:18 -0400167 0x3f,0x1f,0x1f, 0x3f,0x27,0x1f, 0x3f,0x2f,0x1f, 0x3f,0x37,0x1f,
168 0x3f,0x3f,0x1f, 0x37,0x3f,0x1f, 0x2f,0x3f,0x1f, 0x27,0x3f,0x1f,
169 0x1f,0x3f,0x1f, 0x1f,0x3f,0x27, 0x1f,0x3f,0x2f, 0x1f,0x3f,0x37,
170 0x1f,0x3f,0x3f, 0x1f,0x37,0x3f, 0x1f,0x2f,0x3f, 0x1f,0x27,0x3f,
171 0x2d,0x2d,0x3f, 0x31,0x2d,0x3f, 0x36,0x2d,0x3f, 0x3a,0x2d,0x3f,
172 0x3f,0x2d,0x3f, 0x3f,0x2d,0x3a, 0x3f,0x2d,0x36, 0x3f,0x2d,0x31,
173 0x3f,0x2d,0x2d, 0x3f,0x31,0x2d, 0x3f,0x36,0x2d, 0x3f,0x3a,0x2d,
174 0x3f,0x3f,0x2d, 0x3a,0x3f,0x2d, 0x36,0x3f,0x2d, 0x31,0x3f,0x2d,
175 0x2d,0x3f,0x2d, 0x2d,0x3f,0x31, 0x2d,0x3f,0x36, 0x2d,0x3f,0x3a,
176 0x2d,0x3f,0x3f, 0x2d,0x3a,0x3f, 0x2d,0x36,0x3f, 0x2d,0x31,0x3f,
177 0x00,0x00,0x1c, 0x07,0x00,0x1c, 0x0e,0x00,0x1c, 0x15,0x00,0x1c,
178 0x1c,0x00,0x1c, 0x1c,0x00,0x15, 0x1c,0x00,0x0e, 0x1c,0x00,0x07,
179 0x1c,0x00,0x00, 0x1c,0x07,0x00, 0x1c,0x0e,0x00, 0x1c,0x15,0x00,
180 0x1c,0x1c,0x00, 0x15,0x1c,0x00, 0x0e,0x1c,0x00, 0x07,0x1c,0x00,
181 0x00,0x1c,0x00, 0x00,0x1c,0x07, 0x00,0x1c,0x0e, 0x00,0x1c,0x15,
182 0x00,0x1c,0x1c, 0x00,0x15,0x1c, 0x00,0x0e,0x1c, 0x00,0x07,0x1c,
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400183
Kevin O'Connora959aa12009-05-25 00:12:18 -0400184 0x0e,0x0e,0x1c, 0x11,0x0e,0x1c, 0x15,0x0e,0x1c, 0x18,0x0e,0x1c,
185 0x1c,0x0e,0x1c, 0x1c,0x0e,0x18, 0x1c,0x0e,0x15, 0x1c,0x0e,0x11,
186 0x1c,0x0e,0x0e, 0x1c,0x11,0x0e, 0x1c,0x15,0x0e, 0x1c,0x18,0x0e,
187 0x1c,0x1c,0x0e, 0x18,0x1c,0x0e, 0x15,0x1c,0x0e, 0x11,0x1c,0x0e,
188 0x0e,0x1c,0x0e, 0x0e,0x1c,0x11, 0x0e,0x1c,0x15, 0x0e,0x1c,0x18,
189 0x0e,0x1c,0x1c, 0x0e,0x18,0x1c, 0x0e,0x15,0x1c, 0x0e,0x11,0x1c,
190 0x14,0x14,0x1c, 0x16,0x14,0x1c, 0x18,0x14,0x1c, 0x1a,0x14,0x1c,
191 0x1c,0x14,0x1c, 0x1c,0x14,0x1a, 0x1c,0x14,0x18, 0x1c,0x14,0x16,
192 0x1c,0x14,0x14, 0x1c,0x16,0x14, 0x1c,0x18,0x14, 0x1c,0x1a,0x14,
193 0x1c,0x1c,0x14, 0x1a,0x1c,0x14, 0x18,0x1c,0x14, 0x16,0x1c,0x14,
194 0x14,0x1c,0x14, 0x14,0x1c,0x16, 0x14,0x1c,0x18, 0x14,0x1c,0x1a,
195 0x14,0x1c,0x1c, 0x14,0x1a,0x1c, 0x14,0x18,0x1c, 0x14,0x16,0x1c,
196 0x00,0x00,0x10, 0x04,0x00,0x10, 0x08,0x00,0x10, 0x0c,0x00,0x10,
197 0x10,0x00,0x10, 0x10,0x00,0x0c, 0x10,0x00,0x08, 0x10,0x00,0x04,
198 0x10,0x00,0x00, 0x10,0x04,0x00, 0x10,0x08,0x00, 0x10,0x0c,0x00,
199 0x10,0x10,0x00, 0x0c,0x10,0x00, 0x08,0x10,0x00, 0x04,0x10,0x00,
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400200
Kevin O'Connora959aa12009-05-25 00:12:18 -0400201 0x00,0x10,0x00, 0x00,0x10,0x04, 0x00,0x10,0x08, 0x00,0x10,0x0c,
202 0x00,0x10,0x10, 0x00,0x0c,0x10, 0x00,0x08,0x10, 0x00,0x04,0x10,
203 0x08,0x08,0x10, 0x0a,0x08,0x10, 0x0c,0x08,0x10, 0x0e,0x08,0x10,
204 0x10,0x08,0x10, 0x10,0x08,0x0e, 0x10,0x08,0x0c, 0x10,0x08,0x0a,
205 0x10,0x08,0x08, 0x10,0x0a,0x08, 0x10,0x0c,0x08, 0x10,0x0e,0x08,
206 0x10,0x10,0x08, 0x0e,0x10,0x08, 0x0c,0x10,0x08, 0x0a,0x10,0x08,
207 0x08,0x10,0x08, 0x08,0x10,0x0a, 0x08,0x10,0x0c, 0x08,0x10,0x0e,
208 0x08,0x10,0x10, 0x08,0x0e,0x10, 0x08,0x0c,0x10, 0x08,0x0a,0x10,
209 0x0b,0x0b,0x10, 0x0c,0x0b,0x10, 0x0d,0x0b,0x10, 0x0f,0x0b,0x10,
210 0x10,0x0b,0x10, 0x10,0x0b,0x0f, 0x10,0x0b,0x0d, 0x10,0x0b,0x0c,
211 0x10,0x0b,0x0b, 0x10,0x0c,0x0b, 0x10,0x0d,0x0b, 0x10,0x0f,0x0b,
212 0x10,0x10,0x0b, 0x0f,0x10,0x0b, 0x0d,0x10,0x0b, 0x0c,0x10,0x0b,
213 0x0b,0x10,0x0b, 0x0b,0x10,0x0c, 0x0b,0x10,0x0d, 0x0b,0x10,0x0f,
214 0x0b,0x10,0x10, 0x0b,0x0f,0x10, 0x0b,0x0d,0x10, 0x0b,0x0c,0x10,
215 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
216 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400217};
218
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500219static u8 sequ_01[] VAR16 = { 0x08, 0x03, 0x00, 0x02 };
220static u8 crtc_01[] VAR16 = {
221 0x2d, 0x27, 0x28, 0x90, 0x2b, 0xa0, 0xbf, 0x1f,
222 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
223 0x9c, 0x8e, 0x8f, 0x14, 0x1f, 0x96, 0xb9, 0xa3,
224 0xff };
225static u8 actl_01[] VAR16 = {
226 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
227 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
228 0x0c, 0x00, 0x0f, 0x08 };
229static u8 grdc_01[] VAR16 = {
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff };
231static u8 sequ_03[] VAR16 = { 0x00, 0x03, 0x00, 0x02 };
232static u8 crtc_03[] VAR16 = {
233 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
234 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
235 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
236 0xff };
237static u8 sequ_04[] VAR16 = { 0x09, 0x03, 0x00, 0x02 };
238static u8 crtc_04[] VAR16 = {
239 0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
240 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
241 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xa2,
242 0xff };
243static u8 actl_04[] VAR16 = {
244 0x00, 0x13, 0x15, 0x17, 0x02, 0x04, 0x06, 0x07,
245 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
246 0x01, 0x00, 0x03, 0x00 };
247static u8 grdc_04[] VAR16 = {
248 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x0f, 0xff };
249static u8 sequ_06[] VAR16 = { 0x01, 0x01, 0x00, 0x06 };
250static u8 crtc_06[] VAR16 = {
251 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
252 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
253 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xc2,
254 0xff };
255static u8 actl_06[] VAR16 = {
256 0x00, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
257 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
258 0x01, 0x00, 0x01, 0x00 };
259static u8 grdc_06[] VAR16 = {
260 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x0f, 0xff };
261static u8 crtc_07[] VAR16 = {
262 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
263 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
264 0x9c, 0x8e, 0x8f, 0x28, 0x0f, 0x96, 0xb9, 0xa3,
265 0xff };
266static u8 actl_07[] VAR16 = {
267 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
268 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
269 0x0e, 0x00, 0x0f, 0x08 };
270static u8 grdc_07[] VAR16 = {
271 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0a, 0x0f, 0xff };
272static u8 sequ_0d[] VAR16 = { 0x09, 0x0f, 0x00, 0x06 };
273static u8 crtc_0d[] VAR16 = {
274 0x2d, 0x27, 0x28, 0x90, 0x2b, 0x80, 0xbf, 0x1f,
275 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276 0x9c, 0x8e, 0x8f, 0x14, 0x00, 0x96, 0xb9, 0xe3,
277 0xff };
278static u8 actl_0d[] VAR16 = {
279 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
280 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
281 0x01, 0x00, 0x0f, 0x00 };
282static u8 grdc_0d[] VAR16 = {
283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0xff };
284static u8 sequ_0e[] VAR16 = { 0x01, 0x0f, 0x00, 0x06 };
285static u8 crtc_0e[] VAR16 = {
286 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
287 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x9c, 0x8e, 0x8f, 0x28, 0x00, 0x96, 0xb9, 0xe3,
289 0xff };
290static u8 crtc_0f[] VAR16 = {
291 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
292 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 0x83, 0x85, 0x5d, 0x28, 0x0f, 0x63, 0xba, 0xe3,
294 0xff };
295static u8 actl_0f[] VAR16 = {
296 0x00, 0x08, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00,
297 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
298 0x01, 0x00, 0x01, 0x00 };
299static u8 actl_10[] VAR16 = {
300 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07,
301 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
302 0x01, 0x00, 0x0f, 0x00 };
303static u8 crtc_11[] VAR16 = {
304 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
305 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306 0xea, 0x8c, 0xdf, 0x28, 0x00, 0xe7, 0x04, 0xe3,
307 0xff };
308static u8 actl_11[] VAR16 = {
309 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
310 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f,
311 0x01, 0x00, 0x0f, 0x00 };
312static u8 sequ_13[] VAR16 = { 0x01, 0x0f, 0x00, 0x0e };
313static u8 crtc_13[] VAR16 = {
314 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0xbf, 0x1f,
315 0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316 0x9c, 0x8e, 0x8f, 0x28, 0x40, 0x96, 0xb9, 0xa3,
317 0xff };
318static u8 actl_13[] VAR16 = {
319 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
320 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
321 0x41, 0x00, 0x0f, 0x00 };
322static u8 grdc_13[] VAR16 = {
323 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, 0xff };
324static u8 crtc_6A[] VAR16 = {
325 0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
326 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327 0x59, 0x8d, 0x57, 0x32, 0x00, 0x57, 0x73, 0xe3,
328 0xff };
329
Kevin O'Connor5727c292009-05-16 17:29:32 -0400330
331/****************************************************************
332 * Video mode list
333 ****************************************************************/
334
335#define PAL(x) x, sizeof(x)
336#define VPARAM(x) &video_param_table[x]
337
338static struct vgamode_s vga_modes[] VAR16 = {
Kevin O'Connor87233e92011-12-23 21:40:34 -0500339 //mode model tx ty ch bits sstart slength
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500340 // pelm dac sequ misc crtc actl grdc
Kevin O'Connor87233e92011-12-23 21:40:34 -0500341 {0x00, CTEXT, 40, 25, 16, 4, SEG_CTEXT, 0x0800
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500342 , 0xFF, PAL(palette2), sequ_01, 0x67, crtc_01, actl_01, grdc_01 },
Kevin O'Connor87233e92011-12-23 21:40:34 -0500343 {0x01, CTEXT, 40, 25, 16, 4, SEG_CTEXT, 0x0800
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500344 , 0xFF, PAL(palette2), sequ_01, 0x67, crtc_01, actl_01, grdc_01 },
Kevin O'Connor87233e92011-12-23 21:40:34 -0500345 {0x02, CTEXT, 80, 25, 16, 4, SEG_CTEXT, 0x1000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500346 , 0xFF, PAL(palette2), sequ_03, 0x67, crtc_03, actl_01, grdc_01 },
Kevin O'Connor87233e92011-12-23 21:40:34 -0500347 {0x03, CTEXT, 80, 25, 16, 4, SEG_CTEXT, 0x1000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500348 , 0xFF, PAL(palette2), sequ_03, 0x67, crtc_03, actl_01, grdc_01 },
Kevin O'Connor87233e92011-12-23 21:40:34 -0500349 {0x04, CGA, 40, 25, 8, 2, SEG_CTEXT, 0x0800
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500350 , 0xFF, PAL(palette1), sequ_04, 0x63, crtc_04, actl_04, grdc_04},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500351 {0x05, CGA, 40, 25, 8, 2, SEG_CTEXT, 0x0800
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500352 , 0xFF, PAL(palette1), sequ_04, 0x63, crtc_04, actl_04, grdc_04},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500353 {0x06, CGA, 80, 25, 8, 1, SEG_CTEXT, 0x1000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500354 , 0xFF, PAL(palette1), sequ_06, 0x63, crtc_06, actl_06, grdc_06},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500355 {0x07, MTEXT, 80, 25, 16, 4, SEG_MTEXT, 0x1000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500356 , 0xFF, PAL(palette0), sequ_03, 0x66, crtc_07, actl_07, grdc_07},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500357 {0x0D, PLANAR4, 40, 25, 8, 4, SEG_GRAPH, 0x2000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500358 , 0xFF, PAL(palette1), sequ_0d, 0x63, crtc_0d, actl_0d, grdc_0d},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500359 {0x0E, PLANAR4, 80, 25, 8, 4, SEG_GRAPH, 0x4000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500360 , 0xFF, PAL(palette1), sequ_0e, 0x63, crtc_0e, actl_0d, grdc_0d},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500361 {0x0F, PLANAR1, 80, 25, 14, 1, SEG_GRAPH, 0x8000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500362 , 0xFF, PAL(palette0), sequ_0e, 0xa3, crtc_0f, actl_0f, grdc_0d},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500363 {0x10, PLANAR4, 80, 25, 14, 4, SEG_GRAPH, 0x8000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500364 , 0xFF, PAL(palette2), sequ_0e, 0xa3, crtc_0f, actl_10, grdc_0d},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500365 {0x11, PLANAR1, 80, 30, 16, 1, SEG_GRAPH, 0x0000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500366 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_11, actl_11, grdc_0d},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500367 {0x12, PLANAR4, 80, 30, 16, 4, SEG_GRAPH, 0x0000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500368 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_11, actl_10, grdc_0d},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500369 {0x13, LINEAR8, 40, 25, 8, 8, SEG_GRAPH, 0x0000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500370 , 0xFF, PAL(palette3), sequ_13, 0x63, crtc_13, actl_13, grdc_13},
Kevin O'Connor87233e92011-12-23 21:40:34 -0500371 {0x6A, PLANAR4, 100, 37, 16, 4, SEG_GRAPH, 0x0000
Kevin O'Connor0c7d4d02011-12-23 21:20:09 -0500372 , 0xFF, PAL(palette2), sequ_0e, 0xe3, crtc_6A, actl_10, grdc_0d},
Kevin O'Connor5727c292009-05-16 17:29:32 -0400373};
374
375struct vgamode_s *
376find_vga_entry(u8 mode)
377{
378 int i;
379 for (i = 0; i < ARRAY_SIZE(vga_modes); i++) {
380 struct vgamode_s *vmode_g = &vga_modes[i];
381 if (GET_GLOBAL(vmode_g->svgamode) == mode)
382 return vmode_g;
383 }
384 return NULL;
385}
386
Kevin O'Connor5727c292009-05-16 17:29:32 -0400387
388/****************************************************************
389 * Static functionality table
390 ****************************************************************/
391
Kevin O'Connor1f2c3072009-05-06 23:35:59 -0400392u8 static_functionality[0x10] VAR16 = {
393 /* 0 */ 0xff, // All modes supported #1
394 /* 1 */ 0xe0, // All modes supported #2
395 /* 2 */ 0x0f, // All modes supported #3
396 /* 3 */ 0x00, 0x00, 0x00, 0x00, // reserved
397 /* 7 */ 0x07, // 200, 350, 400 scan lines
398 /* 8 */ 0x02, // mamimum number of visible charsets in text mode
399 /* 9 */ 0x08, // total number of charset blocks in text mode
400 /* a */ 0xe7, // Change to add new functions
401 /* b */ 0x0c, // Change to add new functions
402 /* c */ 0x00, // reserved
403 /* d */ 0x00, // reserved
404 /* e */ 0x00, // Change to add new functions
405 /* f */ 0x00 // reserved
406};