aboutsummaryrefslogtreecommitdiffstats
path: root/include/video/uvesafb.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/video/uvesafb.h')
-rw-r--r--include/video/uvesafb.h193
1 files changed, 193 insertions, 0 deletions
diff --git a/include/video/uvesafb.h b/include/video/uvesafb.h
new file mode 100644
index 000000000000..95bcef193954
--- /dev/null
+++ b/include/video/uvesafb.h
@@ -0,0 +1,193 @@
1#ifndef _UVESAFB_H
2#define _UVESAFB_H
3
4struct v86_regs {
5 __u32 ebx;
6 __u32 ecx;
7 __u32 edx;
8 __u32 esi;
9 __u32 edi;
10 __u32 ebp;
11 __u32 eax;
12 __u32 eip;
13 __u32 eflags;
14 __u32 esp;
15 __u16 cs;
16 __u16 ss;
17 __u16 es;
18 __u16 ds;
19 __u16 fs;
20 __u16 gs;
21};
22
23/* Task flags */
24#define TF_VBEIB 0x01
25#define TF_BUF_ESDI 0x02
26#define TF_BUF_ESBX 0x04
27#define TF_BUF_RET 0x08
28#define TF_EXIT 0x10
29
30struct uvesafb_task {
31 __u8 flags;
32 int buf_len;
33 struct v86_regs regs;
34};
35
36/* Constants for the capabilities field
37 * in vbe_ib */
38#define VBE_CAP_CAN_SWITCH_DAC 0x01
39#define VBE_CAP_VGACOMPAT 0x02
40
41/* The VBE Info Block */
42struct vbe_ib {
43 char vbe_signature[4];
44 __u16 vbe_version;
45 __u32 oem_string_ptr;
46 __u32 capabilities;
47 __u32 mode_list_ptr;
48 __u16 total_memory;
49 __u16 oem_software_rev;
50 __u32 oem_vendor_name_ptr;
51 __u32 oem_product_name_ptr;
52 __u32 oem_product_rev_ptr;
53 __u8 reserved[222];
54 char oem_data[256];
55 char misc_data[512];
56} __attribute__ ((packed));
57
58#ifdef __KERNEL__
59
60/* VBE CRTC Info Block */
61struct vbe_crtc_ib {
62 u16 horiz_total;
63 u16 horiz_start;
64 u16 horiz_end;
65 u16 vert_total;
66 u16 vert_start;
67 u16 vert_end;
68 u8 flags;
69 u32 pixel_clock;
70 u16 refresh_rate;
71 u8 reserved[40];
72} __attribute__ ((packed));
73
74#define VBE_MODE_VGACOMPAT 0x20
75#define VBE_MODE_COLOR 0x08
76#define VBE_MODE_SUPPORTEDHW 0x01
77#define VBE_MODE_GRAPHICS 0x10
78#define VBE_MODE_LFB 0x80
79
80#define VBE_MODE_MASK (VBE_MODE_COLOR | VBE_MODE_SUPPORTEDHW | \
81 VBE_MODE_GRAPHICS | VBE_MODE_LFB)
82
83/* VBE Mode Info Block */
84struct vbe_mode_ib {
85 /* for all VBE revisions */
86 u16 mode_attr;
87 u8 winA_attr;
88 u8 winB_attr;
89 u16 win_granularity;
90 u16 win_size;
91 u16 winA_seg;
92 u16 winB_seg;
93 u32 win_func_ptr;
94 u16 bytes_per_scan_line;
95
96 /* for VBE 1.2+ */
97 u16 x_res;
98 u16 y_res;
99 u8 x_char_size;
100 u8 y_char_size;
101 u8 planes;
102 u8 bits_per_pixel;
103 u8 banks;
104 u8 memory_model;
105 u8 bank_size;
106 u8 image_pages;
107 u8 reserved1;
108
109 /* Direct color fields for direct/6 and YUV/7 memory models. */
110 /* Offsets are bit positions of lsb in the mask. */
111 u8 red_len;
112 u8 red_off;
113 u8 green_len;
114 u8 green_off;
115 u8 blue_len;
116 u8 blue_off;
117 u8 rsvd_len;
118 u8 rsvd_off;
119 u8 direct_color_info; /* direct color mode attributes */
120
121 /* for VBE 2.0+ */
122 u32 phys_base_ptr;
123 u8 reserved2[6];
124
125 /* for VBE 3.0+ */
126 u16 lin_bytes_per_scan_line;
127 u8 bnk_image_pages;
128 u8 lin_image_pages;
129 u8 lin_red_len;
130 u8 lin_red_off;
131 u8 lin_green_len;
132 u8 lin_green_off;
133 u8 lin_blue_len;
134 u8 lin_blue_off;
135 u8 lin_rsvd_len;
136 u8 lin_rsvd_off;
137 u32 max_pixel_clock;
138 u16 mode_id;
139 u8 depth;
140} __attribute__ ((packed));
141
142#define UVESAFB_DEFAULT_MODE "640x480-16"
143
144/* How long to wait for a reply from userspace [ms] */
145#define UVESAFB_TIMEOUT 5000
146
147/* Max number of concurrent tasks */
148#define UVESAFB_TASKS_MAX 16
149
150#define dac_reg (0x3c8)
151#define dac_val (0x3c9)
152
153struct uvesafb_pal_entry {
154 u_char blue, green, red, pad;
155} __attribute__ ((packed));
156
157struct uvesafb_ktask {
158 struct uvesafb_task t;
159 void *buf;
160 struct completion *done;
161 u32 ack;
162};
163
164static int uvesafb_exec(struct uvesafb_ktask *tsk);
165
166#define UVESAFB_EXACT_RES 1
167#define UVESAFB_EXACT_DEPTH 2
168
169struct uvesafb_par {
170 struct vbe_ib vbe_ib; /* VBE Info Block */
171 struct vbe_mode_ib *vbe_modes; /* list of supported VBE modes */
172 int vbe_modes_cnt;
173
174 u8 nocrtc;
175 u8 ypan; /* 0 - nothing, 1 - ypan, 2 - ywrap */
176 u8 pmi_setpal; /* PMI for palette changes */
177 u16 *pmi_base; /* protected mode interface location */
178 void *pmi_start;
179 void *pmi_pal;
180 u8 *vbe_state_orig; /*
181 * original hardware state, before the
182 * driver was loaded
183 */
184 u8 *vbe_state_saved; /* state saved by fb_save_state */
185 int vbe_state_size;
186 atomic_t ref_count;
187
188 int mode_idx;
189 struct vbe_crtc_ib crtc;
190};
191
192#endif /* __KERNEL__ */
193#endif /* _UVESAFB_H */