Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / arch / i386 / include / ipxe / vesafb.h
1 #ifndef _IPXE_VESAFB_H
2 #define _IPXE_VESAFB_H
3
4 /** @file
5  *
6  * VESA frame buffer console
7  *
8  */
9
10 FILE_LICENCE ( GPL2_OR_LATER );
11
12 #include <stdint.h>
13 #include <realmode.h>
14
15 /** INT 10,4f00: return controller information */
16 #define VBE_CONTROLLER_INFO 0x4f00
17
18 /** VBE controller information */
19 struct vbe_controller_info {
20         /** VBE signature */
21         uint32_t vbe_signature;
22         /** VBE minor version */
23         uint8_t vbe_minor_version;
24         /** VBE major version */
25         uint8_t vbe_major_version;
26         /** Pointer to OEM string */
27         struct segoff oem_string_ptr;
28         /** Capabilities of graphics controller */
29         uint32_t capabilities;
30         /** Pointer to video mode list */
31         struct segoff video_mode_ptr;
32         /** Number of 64kB memory blocks */
33         uint16_t total_memory;
34         /** VBE implementation software revision */
35         uint16_t oem_software_rev;
36         /** Pointer to vendor name string */
37         struct segoff oem_vendor_name_ptr;
38         /** Pointer to product name string */
39         struct segoff oem_product_name_ptr;
40         /** Pointer to product revision string */
41         struct segoff oem_product_rev_ptr;
42         /** Reserved for VBE implementation scratch area */
43         uint8_t reserved[222];
44         /* VBE2.0 defines an additional 256-byte data area for
45          * including the OEM strings inline within the VBE information
46          * block; we omit this to reduce the amount of base memory
47          * required for VBE calls.
48          */
49 } __attribute__ (( packed ));
50
51 /** VBE controller information signature */
52 #define VBE_CONTROLLER_SIGNATURE \
53         ( ( 'V' << 0 ) | ( 'E' << 8 ) | ( 'S' << 16 ) | ( 'A' << 24 ) )
54
55 /** VBE mode list end marker */
56 #define VBE_MODE_END 0xffff
57
58 /** INT 10,4f01: return VBE mode information */
59 #define VBE_MODE_INFO 0x4f01
60
61 /** VBE mode information */
62 struct vbe_mode_info {
63         /** Mode attributes */
64         uint16_t mode_attributes;
65         /** Window A attributes */
66         uint8_t win_a_attributes;
67         /** Window B attributes */
68         uint8_t win_b_attributes;
69         /** Window granularity */
70         uint16_t win_granularity;
71         /** Window size */
72         uint16_t win_size;
73         /** Window A start segment */
74         uint16_t win_a_segment;
75         /** Window B start segment */
76         uint16_t win_b_segment;
77         /** Pointer to window function */
78         struct segoff win_func_ptr;
79         /** Bytes per scan line */
80         uint16_t bytes_per_scan_line;
81         /** Horizontal resolution in pixels or characters */
82         uint16_t x_resolution;
83         /** Vertical resolution in pixels or characters */
84         uint16_t y_resolution;
85         /** Character cell width in pixels */
86         uint8_t x_char_size;
87         /** Character cell height in pixels */
88         uint8_t y_char_size;
89         /** Number of memory planes */
90         uint8_t number_of_planes;
91         /** Bits per pixel */
92         uint8_t bits_per_pixel;
93         /** Number of banks */
94         uint8_t number_of_banks;
95         /** Memory model type */
96         uint8_t memory_model;
97         /** Bank size in kB */
98         uint8_t bank_size;
99         /** Number of images */
100         uint8_t number_of_image_pages;
101         /** Reserved for page function */
102         uint8_t reserved_1;
103         /** Size of direct colour red mask in bits */
104         uint8_t red_mask_size;
105         /** Bit position of LSB of red mask */
106         uint8_t red_field_position;
107         /** Size of direct colour green mask in bits */
108         uint8_t green_mask_size;
109         /** Bit position of LSB of green mask */
110         uint8_t green_field_position;
111         /** Size of direct colour blue mask in bits */
112         uint8_t blue_mask_size;
113         /** Bit position of LSB of blue mask */
114         uint8_t blue_field_position;
115         /** Size of direct colour reserved mask in bits */
116         uint8_t rsvd_mask_size;
117         /** Bit position of LSB of reserved mask */
118         uint8_t rsvd_field_position;
119         /** Direct colour mode attributes */
120         uint8_t direct_colour_mode_info;
121         /** Physical address for flat memory frame buffer */
122         uint32_t phys_base_ptr;
123         /** Pointer to start of off-screen memory */
124         uint32_t off_screen_mem_offset;
125         /** Amount of off-screen memory in 1kB units */
126         uint16_t off_screen_mem_size;
127         /** Reserved */
128         uint8_t reserved_2[206];
129 } __attribute__ (( packed ));
130
131 /** VBE mode attributes */
132 enum vbe_mode_attributes {
133         /** Mode supported in hardware */
134         VBE_MODE_ATTR_SUPPORTED = 0x0001,
135         /** TTY output functions supported by BIOS */
136         VBE_MODE_ATTR_TTY = 0x0004,
137         /** Colour mode */
138         VBE_MODE_ATTR_COLOUR = 0x0008,
139         /** Graphics mode */
140         VBE_MODE_ATTR_GRAPHICS = 0x0010,
141         /** Not a VGA compatible mode */
142         VBE_MODE_ATTR_NOT_VGA = 0x0020,
143         /** VGA compatible windowed memory mode is not available */
144         VBE_MODE_ATTR_NOT_WINDOWED = 0x0040,
145         /** Linear frame buffer mode is available */
146         VBE_MODE_ATTR_LINEAR = 0x0080,
147         /** Double scan mode is available */
148         VBE_MODE_ATTR_DOUBLE = 0x0100,
149         /** Interlaced mode is available */
150         VBE_MODE_ATTR_INTERLACED = 0x0200,
151         /** Hardware triple buffering support */
152         VBE_MODE_ATTR_TRIPLE_BUF = 0x0400,
153         /** Hardware stereoscopic display support */
154         VBE_MODE_ATTR_STEREO = 0x0800,
155         /** Dual display start address support */
156         VBE_MODE_ATTR_DUAL = 0x1000,
157 };
158
159 /** VBE mode memory models */
160 enum vbe_mode_memory_model {
161         /** Text mode */
162         VBE_MODE_MODEL_TEXT = 0x00,
163         /** CGA graphics mode */
164         VBE_MODE_MODEL_CGA = 0x01,
165         /** Hercules graphics mode */
166         VBE_MODE_MODEL_HERCULES = 0x02,
167         /** Planar mode */
168         VBE_MODE_MODEL_PLANAR = 0x03,
169         /** Packed pixel mode */
170         VBE_MODE_MODEL_PACKED_PIXEL = 0x04,
171         /** Non-chain 4, 256 colour mode */
172         VBE_MODE_MODEL_NON_CHAIN_4 = 0x05,
173         /** Direct colour mode */
174         VBE_MODE_MODEL_DIRECT_COLOUR = 0x06,
175         /** YUV mode */
176         VBE_MODE_MODEL_YUV = 0x07,
177 };
178
179 /** INT 10,4f02: set VBE mode */
180 #define VBE_SET_MODE 0x4f02
181
182 /** VBE linear frame buffer mode bit */
183 #define VBE_MODE_LINEAR 0x4000
184
185 /** INT 10,1130: get font information */
186 #define VBE_GET_FONT 0x1130
187
188 /** Font sets */
189 enum vbe_font_set {
190         /** 8x14 character font */
191         VBE_FONT_8x14 = 0x0200,
192         /** 8x8 double dot font */
193         VBE_FONT_8x8_DOUBLE = 0x0300,
194         /** 8x8 double dot font (high 128 characters) */
195         VBE_FONT_8x8_DOUBLE_HIGH = 0x0400,
196         /** 9x14 alpha alternate font */
197         VBE_FONT_9x14_ALPHA_ALT = 0x0500,
198         /** 8x16 font */
199         VBE_FONT_8x16 = 0x0600,
200         /** 9x16 alternate font */
201         VBE_FONT_9x16_ALT = 0x0700,
202 };
203
204 /** INT 10,00: set VGA mode */
205 #define VBE_SET_VGA_MODE 0x0000
206
207 /** INT 10,0f: get VGA mode */
208 #define VBE_GET_VGA_MODE 0x0f00
209
210 #endif /* _IPXE_VESAFB_H */