blob: 5adbf4b2df44ad57bcf43741f052e5194f2f25a4 [file] [log] [blame]
Kevin O'Connore1e000b2011-12-31 03:30:40 -05001#ifndef __VGABIOS_H
2#define __VGABIOS_H
Kevin O'Connor1f2c3072009-05-06 23:35:59 -04003
4#include "types.h" // u8
Kevin O'Connor9f985422009-09-09 11:34:39 -04005#include "farptr.h" // struct segoff_s
Kevin O'Connor1f2c3072009-05-06 23:35:59 -04006
Kevin O'Connoraad3b692012-01-14 23:15:40 -05007// standard BIOS Video Parameter Table
8struct VideoParam_s {
9 u8 twidth;
10 u8 theightm1;
11 u8 cheight;
12 u16 slength;
13 u8 sequ_regs[4];
14 u8 miscreg;
15 u8 crtc_regs[25];
16 u8 actl_regs[20];
17 u8 grdc_regs[9];
18} PACKED;
19
20extern struct VideoParam_s video_param_table[29];
21
Kevin O'Connorca668642009-05-21 23:06:08 -040022struct saveBDAstate {
Kevin O'Connor2469f892012-02-04 12:40:02 -050023 u16 video_mode;
Kevin O'Connorca668642009-05-21 23:06:08 -040024 u16 video_cols;
25 u16 video_pagesize;
26 u16 crtc_address;
27 u8 video_rows;
28 u16 char_height;
29 u8 video_ctl;
30 u8 video_switches;
31 u8 modeset_ctl;
32 u16 cursor_type;
33 u16 cursor_pos[8];
34 u16 video_pagestart;
35 u8 video_page;
36 /* current font */
Kevin O'Connor9f985422009-09-09 11:34:39 -040037 struct segoff_s font0;
38 struct segoff_s font1;
Kevin O'Connorca668642009-05-21 23:06:08 -040039};
40
Kevin O'Connor821d6b42011-12-31 18:19:22 -050041// Mode flags
Kevin O'Connorb7b92932013-03-09 13:04:47 -050042#define MF_LEGACY 0x0001
Kevin O'Connor821d6b42011-12-31 18:19:22 -050043#define MF_GRAYSUM 0x0002
44#define MF_NOPALETTE 0x0008
45#define MF_CUSTOMCRTC 0x0800
46#define MF_LINEARFB 0x4000
47#define MF_NOCLEARMEM 0x8000
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050048#define MF_VBEFLAGS 0xfe00
Kevin O'Connor821d6b42011-12-31 18:19:22 -050049
Kevin O'Connord4398ad2012-01-01 12:32:53 -050050// Memory model types
51#define MM_TEXT 0x00
52#define MM_CGA 0x01
53#define MM_HERCULES 0x02
54#define MM_PLANAR 0x03
55#define MM_PACKED 0x04
56#define MM_NON_CHAIN_4_256 0x05
57#define MM_DIRECT 0x06
58#define MM_YUV 0x07
59
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050060struct vgamode_s {
61 u8 memmodel;
62 u16 width;
63 u16 height;
64 u8 depth;
65 u8 cwidth;
66 u8 cheight;
67 u16 sstart;
68};
69
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040070// vgafonts.c
71extern u8 vgafont8[];
72extern u8 vgafont14[];
73extern u8 vgafont16[];
74extern u8 vgafont14alt[];
75extern u8 vgafont16alt[];
76
Kevin O'Connor4c85a262012-02-12 11:50:52 -050077// Debug settings
78#define DEBUG_VGA_POST 1
79#define DEBUG_VGA_10 3
80
Kevin O'Connore1e000b2011-12-31 03:30:40 -050081// vgabios.c
Kevin O'Connor8cf8f8e2012-01-16 19:05:27 -050082extern int VgaBDF;
Kevin O'Connorcfd7ef92012-02-02 22:52:17 -050083extern int HaveRunInit;
Kevin O'Connorf3760372011-12-23 22:41:08 -050084#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
Kevin O'Connor09262412009-05-25 11:44:11 -040085struct carattr {
Kevin O'Connor6ee837b2012-02-13 20:09:02 -050086 u8 car, attr, use_attr, pad;
Kevin O'Connor09262412009-05-25 11:44:11 -040087};
Kevin O'Connor918b1562009-05-25 11:05:18 -040088struct cursorpos {
Kevin O'Connor6ee837b2012-02-13 20:09:02 -050089 u8 x, y, page, pad;
Kevin O'Connor918b1562009-05-25 11:05:18 -040090};
Kevin O'Connor3876b532012-01-24 00:07:44 -050091int vga_bpp(struct vgamode_s *vmode_g);
Kevin O'Connor83047be2012-01-07 18:27:19 -050092u16 calc_page_size(u8 memmodel, u16 width, u16 height);
Kevin O'Connor9f857fc2012-02-04 11:59:02 -050093void save_bda_state(u16 seg, struct saveBDAstate *info);
94void restore_bda_state(u16 seg, struct saveBDAstate *info);
Kevin O'Connor4a73f932012-01-21 11:08:35 -050095struct vgamode_s *get_current_mode(void);
Kevin O'Connore6bc4c12012-01-21 11:26:37 -050096int vga_set_mode(int mode, int flags);
Kevin O'Connorc0c7df62009-05-17 18:11:33 -040097
98// vgafb.c
Kevin O'Connor217f2bc2009-05-31 00:46:47 -040099void vgafb_scroll(int nblines, int attr
100 , struct cursorpos ul, struct cursorpos lr);
Kevin O'Connord3b38152009-05-26 00:05:37 -0400101void vgafb_write_char(struct cursorpos cp, struct carattr ca);
102struct carattr vgafb_read_char(struct cursorpos cp);
Kevin O'Connor227a2bb2009-05-31 22:00:20 -0400103void vgafb_write_pixel(u8 color, u16 x, u16 y);
104u8 vgafb_read_pixel(u16 x, u16 y);
Kevin O'Connorc0c7df62009-05-17 18:11:33 -0400105
Julian Pidancet87879e22011-12-19 05:08:00 +0000106// vbe.c
Kevin O'Connor31f67ae2012-01-29 11:37:01 -0500107extern u32 VBE_total_memory;
108extern u32 VBE_capabilities;
109extern u32 VBE_framebuffer;
110extern u16 VBE_win_granularity;
Julian Pidancet87879e22011-12-19 05:08:00 +0000111#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
112#define VBE_VENDOR_STRING "SeaBIOS Developers"
113#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
114#define VBE_REVISION_STRING "Rev. 1"
Kevin O'Connor40401952011-12-31 03:43:12 -0500115struct bregs;
116void handle_104f(struct bregs *regs);
117
Kevin O'Connore1e000b2011-12-31 03:30:40 -0500118#endif // vgabios.h