4 #include "types.h" // u8
5 #include "farptr.h" // struct segoff_s
12 #define VGAREG_ACTL_ADDRESS 0x3c0
13 #define VGAREG_ACTL_WRITE_DATA 0x3c0
14 #define VGAREG_ACTL_READ_DATA 0x3c1
16 #define VGAREG_INPUT_STATUS 0x3c2
17 #define VGAREG_WRITE_MISC_OUTPUT 0x3c2
18 #define VGAREG_VIDEO_ENABLE 0x3c3
19 #define VGAREG_SEQU_ADDRESS 0x3c4
20 #define VGAREG_SEQU_DATA 0x3c5
22 #define VGAREG_PEL_MASK 0x3c6
23 #define VGAREG_DAC_STATE 0x3c7
24 #define VGAREG_DAC_READ_ADDRESS 0x3c7
25 #define VGAREG_DAC_WRITE_ADDRESS 0x3c8
26 #define VGAREG_DAC_DATA 0x3c9
28 #define VGAREG_READ_FEATURE_CTL 0x3ca
29 #define VGAREG_READ_MISC_OUTPUT 0x3cc
31 #define VGAREG_GRDC_ADDRESS 0x3ce
32 #define VGAREG_GRDC_DATA 0x3cf
34 #define VGAREG_MDA_CRTC_ADDRESS 0x3b4
35 #define VGAREG_MDA_CRTC_DATA 0x3b5
36 #define VGAREG_VGA_CRTC_ADDRESS 0x3d4
37 #define VGAREG_VGA_CRTC_DATA 0x3d5
39 #define VGAREG_MDA_WRITE_FEATURE_CTL 0x3ba
40 #define VGAREG_VGA_WRITE_FEATURE_CTL 0x3da
41 #define VGAREG_ACTL_RESET 0x3da
43 #define VGAREG_MDA_MODECTL 0x3b8
44 #define VGAREG_CGA_MODECTL 0x3d8
45 #define VGAREG_CGA_PALETTE 0x3d9
48 #define SEG_GRAPH 0xA000
49 #define SEG_CTEXT 0xB800
50 #define SEG_MTEXT 0xB000
53 * Tables of default values for each mode
57 #define CTEXT (0x00 | TEXT)
58 #define MTEXT (0x01 | TEXT)
70 #define SCREEN_IO_START(x,y,p) (((((x)*(y)) | 0x00ff) + 1) * (p))
71 #define SCREEN_MEM_START(x,y,p) SCREEN_IO_START(((x)*2),(y),(p))
73 // Standard Video Save Pointer Table
74 struct VideoSavePointer_s {
75 struct segoff_s videoparam;
76 struct segoff_s paramdynamicsave;
77 struct segoff_s textcharset;
78 struct segoff_s graphcharset;
79 struct segoff_s secsavepointer;
83 /* standard BIOS Video Parameter Table */
98 struct VideoParam_s *vparam;
99 u8 memmodel; /* CTEXT,MTEXT,CGA,PL1,PL2,PL4,P8,P15,P16,P24,P32 */
107 struct saveVideoHardware {
122 struct saveBDAstate {
137 struct segoff_s font0;
138 struct segoff_s font1;
141 struct saveDACcolors {
150 struct vgamode_s *find_vga_entry(u8 mode);
151 extern struct VideoSavePointer_s video_save_pointer_table;
152 extern struct VideoParam_s video_param_table[];
153 extern u8 static_functionality[];
156 extern u8 vgafont8[];
157 extern u8 vgafont14[];
158 extern u8 vgafont16[];
159 extern u8 vgafont14alt[];
160 extern u8 vgafont16alt[];
164 u8 car, attr, use_attr;
169 void vga_set_mode(u8 mode, u8 noclearmem);
172 void clear_screen(struct vgamode_s *vmode_g);
173 void vgafb_scroll(int nblines, int attr
174 , struct cursorpos ul, struct cursorpos lr);
175 void vgafb_write_char(struct cursorpos cp, struct carattr ca);
176 struct carattr vgafb_read_char(struct cursorpos cp);
177 void vgafb_write_pixel(u8 color, u16 x, u16 y);
178 u8 vgafb_read_pixel(u16 x, u16 y);
179 void vgafb_load_font(u16 seg, void *src_far, u16 count
180 , u16 start, u8 destflags, u8 fontsize);
183 void vgahw_screen_disable(void);
184 void vgahw_screen_enable(void);
185 void vgahw_set_border_color(u8 color);
186 void vgahw_set_overscan_border_color(u8 color);
187 u8 vgahw_get_overscan_border_color(void);
188 void vgahw_set_palette(u8 palid);
189 void vgahw_set_single_palette_reg(u8 reg, u8 val);
190 u8 vgahw_get_single_palette_reg(u8 reg);
191 void vgahw_set_all_palette_reg(u16 seg, u8 *data_far);
192 void vgahw_get_all_palette_reg(u16 seg, u8 *data_far);
193 void vgahw_toggle_intensity(u8 flag);
194 void vgahw_select_video_dac_color_page(u8 flag, u8 data);
195 void vgahw_read_video_dac_state(u8 *pmode, u8 *curpage);
196 void vgahw_set_dac_regs(u16 seg, u8 *data_far, u8 start, int count);
197 void vgahw_get_dac_regs(u16 seg, u8 *data_far, u8 start, int count);
198 void vgahw_set_pel_mask(u8 val);
199 u8 vgahw_get_pel_mask(void);
200 void vgahw_save_dac_state(u16 seg, struct saveDACcolors *info);
201 void vgahw_restore_dac_state(u16 seg, struct saveDACcolors *info);
202 void vgahw_sequ_write(u8 index, u8 value);
203 void vgahw_grdc_write(u8 index, u8 value);
204 void vgahw_set_text_block_specifier(u8 spec);
205 void get_font_access(void);
206 void release_font_access(void);
207 void vgahw_set_cursor_shape(u8 start, u8 end);
208 void vgahw_set_active_page(u16 address);
209 void vgahw_set_cursor_pos(u16 address);
210 void vgahw_set_scan_lines(u8 lines);
211 u16 vgahw_get_vde(void);
212 void vgahw_save_state(u16 seg, struct saveVideoHardware *info);
213 void vgahw_restore_state(u16 seg, struct saveVideoHardware *info);
214 void vgahw_set_mode(struct VideoParam_s *vparam_g);
215 void vgahw_enable_video_addressing(u8 disable);
216 void vgahw_init(void);
219 int cirrus_set_video_mode(u8 mode, u8 noclearmem);
220 void cirrus_init(void);
223 #define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
224 #define VBE_VENDOR_STRING "SeaBIOS Developers"
225 #define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
226 #define VBE_REVISION_STRING "Rev. 1"
237 int vbe_init(u8 bus, u8 devfn);
238 int vbe_enabled(void);
239 u16 vbe_total_mem(void);
240 int vbe_list_modes(u16 seg, u16 ptr);
241 int vbe_mode_info(u16 mode, struct vbe_modeinfo *info);
242 void vbe_hires_enable(int enable);
243 void vbe_set_mode(u16 mode, struct vbe_modeinfo *info);
244 void vbe_clear_scr(void);
245 int vbe_hires_enabled(void);
246 u16 vbe_curr_mode(void);
248 #endif // vgatables.h