blob: 176f71c6addaa58d37bbc5bc225b54c6d24ed622 [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'Connor2c34f412009-05-31 15:25:14 -04007#define SCREEN_IO_START(x,y,p) (((((x)*(y)) | 0x00ff) + 1) * (p))
8#define SCREEN_MEM_START(x,y,p) SCREEN_IO_START(((x)*2),(y),(p))
Kevin O'Connor1f2c3072009-05-06 23:35:59 -04009
Kevin O'Connorca668642009-05-21 23:06:08 -040010struct saveBDAstate {
11 u8 video_mode;
12 u16 video_cols;
13 u16 video_pagesize;
14 u16 crtc_address;
15 u8 video_rows;
16 u16 char_height;
17 u8 video_ctl;
18 u8 video_switches;
19 u8 modeset_ctl;
20 u16 cursor_type;
21 u16 cursor_pos[8];
22 u16 video_pagestart;
23 u8 video_page;
24 /* current font */
Kevin O'Connor9f985422009-09-09 11:34:39 -040025 struct segoff_s font0;
26 struct segoff_s font1;
Kevin O'Connorca668642009-05-21 23:06:08 -040027};
28
Kevin O'Connor821d6b42011-12-31 18:19:22 -050029// Mode flags
30#define MF_GRAYSUM 0x0002
31#define MF_NOPALETTE 0x0008
32#define MF_CUSTOMCRTC 0x0800
33#define MF_LINEARFB 0x4000
34#define MF_NOCLEARMEM 0x8000
35
Kevin O'Connor5727c292009-05-16 17:29:32 -040036// vgatables.c
Kevin O'Connored68e5b2011-12-31 04:15:12 -050037struct vgamode_s;
Kevin O'Connor5727c292009-05-16 17:29:32 -040038struct vgamode_s *find_vga_entry(u8 mode);
Kevin O'Connorf3760372011-12-23 22:41:08 -050039void build_video_param(void);
Kevin O'Connor815e4472011-12-21 09:05:32 -050040extern struct VideoSavePointer_s video_save_pointer_table;
Kevin O'Connor1f2c3072009-05-06 23:35:59 -040041extern u8 static_functionality[];
42
43// vgafonts.c
44extern u8 vgafont8[];
45extern u8 vgafont14[];
46extern u8 vgafont16[];
47extern u8 vgafont14alt[];
48extern u8 vgafont16alt[];
49
Kevin O'Connore1e000b2011-12-31 03:30:40 -050050// vgabios.c
Kevin O'Connor161d2012011-12-31 19:42:21 -050051extern u16 VgaBDF;
Kevin O'Connorf3760372011-12-23 22:41:08 -050052#define SET_VGA(var, val) SET_FARVAR(get_global_seg(), (var), (val))
Kevin O'Connor09262412009-05-25 11:44:11 -040053struct carattr {
Kevin O'Connor0ad77f02009-05-31 20:46:43 -040054 u8 car, attr, use_attr;
Kevin O'Connor09262412009-05-25 11:44:11 -040055};
Kevin O'Connor918b1562009-05-25 11:05:18 -040056struct cursorpos {
57 u8 x, y, page;
58};
Kevin O'Connor821d6b42011-12-31 18:19:22 -050059void modeswitch_set_bda(int mode, int flags, struct vgamode_s *vmode_g);
Kevin O'Connorc0c7df62009-05-17 18:11:33 -040060
61// vgafb.c
Kevin O'Connor217f2bc2009-05-31 00:46:47 -040062void vgafb_scroll(int nblines, int attr
63 , struct cursorpos ul, struct cursorpos lr);
Kevin O'Connord3b38152009-05-26 00:05:37 -040064void vgafb_write_char(struct cursorpos cp, struct carattr ca);
65struct carattr vgafb_read_char(struct cursorpos cp);
Kevin O'Connor227a2bb2009-05-31 22:00:20 -040066void vgafb_write_pixel(u8 color, u16 x, u16 y);
67u8 vgafb_read_pixel(u16 x, u16 y);
Kevin O'Connorc0c7df62009-05-17 18:11:33 -040068
Julian Pidancet87879e22011-12-19 05:08:00 +000069// vbe.c
70#define VBE_OEM_STRING "SeaBIOS VBE(C) 2011"
71#define VBE_VENDOR_STRING "SeaBIOS Developers"
72#define VBE_PRODUCT_STRING "SeaBIOS VBE Adapter"
73#define VBE_REVISION_STRING "Rev. 1"
74
75struct vbe_modeinfo
76{
77 u16 width;
78 u16 height;
79 u8 depth;
80 u16 linesize;
81 u32 phys_base;
82 u32 vram_size;
83};
Kevin O'Connor21079f42009-05-16 21:30:10 -040084
Kevin O'Connor40401952011-12-31 03:43:12 -050085struct bregs;
86void handle_104f(struct bregs *regs);
87
Kevin O'Connore1e000b2011-12-31 03:30:40 -050088#endif // vgabios.h