blob: d0af248b9503c13ce7bf73fd883d9125d3942e65 [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'Connorca668642009-05-21 23:06:08 -04007struct saveBDAstate {
8 u8 video_mode;
9 u16 video_cols;
10 u16 video_pagesize;
11 u16 crtc_address;
12 u8 video_rows;
13 u16 char_height;
14 u8 video_ctl;
15 u8 video_switches;
16 u8 modeset_ctl;
17 u16 cursor_type;
18 u16 cursor_pos[8];
19 u16 video_pagestart;
20 u8 video_page;
21 /* current font */
Kevin O'Connor9f985422009-09-09 11:34:39 -040022 struct segoff_s font0;
23 struct segoff_s font1;
Kevin O'Connorca668642009-05-21 23:06:08 -040024};
25
Kevin O'Connor821d6b42011-12-31 18:19:22 -050026// Mode flags
27#define MF_GRAYSUM 0x0002
28#define MF_NOPALETTE 0x0008
29#define MF_CUSTOMCRTC 0x0800
30#define MF_LINEARFB 0x4000
31#define MF_NOCLEARMEM 0x8000
32
Kevin O'Connord4398ad2012-01-01 12:32:53 -050033// Memory model types
34#define MM_TEXT 0x00
35#define MM_CGA 0x01
36#define MM_HERCULES 0x02
37#define MM_PLANAR 0x03
38#define MM_PACKED 0x04
39#define MM_NON_CHAIN_4_256 0x05
40#define MM_DIRECT 0x06
41#define MM_YUV 0x07
42
Kevin O'Connor10dff3d2012-01-09 19:19:44 -050043struct vgamode_s {
44 u8 memmodel;
45 u16 width;
46 u16 height;
47 u8 depth;
48 u8 cwidth;
49 u8 cheight;
50 u16 sstart;
51};
52
Kevin O'Connor5727c292009-05-16 17:29:32 -040053// vgatables.c
Kevin O'Connorf3760372011-12-23 22:41:08 -050054void build_video_param(void);
Kevin O'Connor815e4472011-12-21 09:05:32 -050055extern struct VideoSavePointer_s video_save_pointer_table;
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040056extern u8 static_functionality[];
57
58// vgafonts.c
59extern u8 vgafont8[];
60extern u8 vgafont14[];
61extern u8 vgafont16[];
62extern u8 vgafont14alt[];
63extern u8 vgafont16alt[];
64
Kevin O'Connore1e000b2011-12-31 03:30:40 -050065// vgabios.c
Kevin O'Connor161d2012011-12-31 19:42:21 -050066extern u16 VgaBDF;
Kevin O'Connorf3760372011-12-23 22:41:08 -050067#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
Kevin O'Connor09262412009-05-25 11:44:11 -040068struct carattr {
Kevin O'Connor0ad77f02009-05-31 20:46:43 -040069 u8 car, attr, use_attr;
Kevin O'Connor09262412009-05-25 11:44:11 -040070};
Kevin O'Connor918b1562009-05-25 11:05:18 -040071struct cursorpos {
72 u8 x, y, page;
73};
Kevin O'Connor83047be2012-01-07 18:27:19 -050074u16 calc_page_size(u8 memmodel, u16 width, u16 height);
Kevin O'Connor821d6b42011-12-31 18:19:22 -050075void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
Kevin O'Connorc0c7df62009-05-17 18:11:33 -040076
77// vgafb.c
Kevin O'Connor217f2bc2009-05-31 00:46:47 -040078void vgafb_scroll(int nblines, int attr
79 , struct cursorpos ul, struct cursorpos lr);
Kevin O'Connord3b38152009-05-26 00:05:37 -040080void vgafb_write_char(struct cursorpos cp, struct carattr ca);
81struct carattr vgafb_read_char(struct cursorpos cp);
Kevin O'Connor227a2bb2009-05-31 22:00:20 -040082void vgafb_write_pixel(u8 color, u16 x, u16 y);
83u8 vgafb_read_pixel(u16 x, u16 y);
Kevin O'Connorc0c7df62009-05-17 18:11:33 -040084
Julian Pidancet87879e22011-12-19 05:08:00 +000085// vbe.c
Kevin O'Connor3339c052012-01-13 20:00:35 -050086int VBE_enabled;
87u32 VBE_total_memory;
88u32 VBE_capabilities;
89u32 VBE_framebuffer;
Kevin O'Connor643290f2012-01-13 22:08:52 -050090u16 VBE_win_granularity;
Julian Pidancet87879e22011-12-19 05:08:00 +000091#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
92#define VBE_VENDOR_STRING "SeaBIOS Developers"
93#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
94#define VBE_REVISION_STRING "Rev. 1"
Kevin O'Connor40401952011-12-31 03:43:12 -050095struct bregs;
96void handle_104f(struct bregs *regs);
97
Kevin O'Connore1e000b2011-12-31 03:30:40 -050098#endif // vgabios.h