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