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