01f28877076239331ee7688c39baaa35bf3cb647
[coreboot.git] / src / drivers / ati / ragexl / fb.h
1 #ifndef _LINUX_FB_H
2 #define _LINUX_FB_H
3
4 #define u32 uint32_t
5 #define u16 uint16_t
6 #define u8      uint8_t
7 #define s16     short
8
9 /* Definitions of frame buffers                                         */
10
11 #define FB_MAJOR                29
12 #define FB_MAX                  32      /* sufficient for now */
13
14 /* ioctls
15    0x46 is 'F'                                                          */
16 #define FBIOGET_VSCREENINFO     0x4600
17 #define FBIOPUT_VSCREENINFO     0x4601
18 #define FBIOGET_FSCREENINFO     0x4602
19 #define FBIOGETCMAP             0x4604
20 #define FBIOPUTCMAP             0x4605
21 #define FBIOPAN_DISPLAY         0x4606
22 /* 0x4607-0x460B are defined below */
23 /* #define FBIOGET_MONITORSPEC  0x460C */
24 /* #define FBIOPUT_MONITORSPEC  0x460D */
25 /* #define FBIOSWITCH_MONIBIT   0x460E */
26 #define FBIOGET_CON2FBMAP       0x460F
27 #define FBIOPUT_CON2FBMAP       0x4610
28 #define FBIOBLANK               0x4611          /* arg: 0 or vesa level + 1 */
29 #define FBIOGET_VBLANK          _IOR('F', 0x12, struct fb_vblank)
30 #define FBIO_ALLOC              0x4613
31 #define FBIO_FREE               0x4614
32 #define FBIOGET_GLYPH           0x4615
33 #define FBIOGET_HWCINFO         0x4616
34 #define FBIOPUT_MODEINFO        0x4617
35 #define FBIOGET_DISPINFO        0x4618
36
37
38 #define FB_TYPE_PACKED_PIXELS           0       /* Packed Pixels        */
39 #define FB_TYPE_PLANES                  1       /* Non interleaved planes */
40 #define FB_TYPE_INTERLEAVED_PLANES      2       /* Interleaved planes   */
41 #define FB_TYPE_TEXT                    3       /* Text/attributes      */
42 #define FB_TYPE_VGA_PLANES              4       /* EGA/VGA planes       */
43
44 #define FB_AUX_TEXT_MDA         0       /* Monochrome text */
45 #define FB_AUX_TEXT_CGA         1       /* CGA/EGA/VGA Color text */
46 #define FB_AUX_TEXT_S3_MMIO     2       /* S3 MMIO fasttext */
47 #define FB_AUX_TEXT_MGA_STEP16  3       /* MGA Millenium I: text, attr, 14 reserved bytes */
48 #define FB_AUX_TEXT_MGA_STEP8   4       /* other MGAs:      text, attr,  6 reserved bytes */
49
50 #define FB_AUX_VGA_PLANES_VGA4          0       /* 16 color planes (EGA/VGA) */
51 #define FB_AUX_VGA_PLANES_CFB4          1       /* CFB4 in planes (VGA) */
52 #define FB_AUX_VGA_PLANES_CFB8          2       /* CFB8 in planes (VGA) */
53
54 #define FB_VISUAL_MONO01                0       /* Monochr. 1=Black 0=White */
55 #define FB_VISUAL_MONO10                1       /* Monochr. 1=White 0=Black */
56 #define FB_VISUAL_TRUECOLOR             2       /* True color   */
57 #define FB_VISUAL_PSEUDOCOLOR           3       /* Pseudo color (like atari) */
58 #define FB_VISUAL_DIRECTCOLOR           4       /* Direct color */
59 #define FB_VISUAL_STATIC_PSEUDOCOLOR    5       /* Pseudo color readonly */
60
61 #define FB_ACCEL_NONE           0       /* no hardware accelerator      */
62 #define FB_ACCEL_ATARIBLITT     1       /* Atari Blitter                */
63 #define FB_ACCEL_AMIGABLITT     2       /* Amiga Blitter                */
64 #define FB_ACCEL_S3_TRIO64      3       /* Cybervision64 (S3 Trio64)    */
65 #define FB_ACCEL_NCR_77C32BLT   4       /* RetinaZ3 (NCR 77C32BLT)      */
66 #define FB_ACCEL_S3_VIRGE       5       /* Cybervision64/3D (S3 ViRGE)  */
67 #define FB_ACCEL_ATI_MACH64GX   6       /* ATI Mach 64GX family         */
68 #define FB_ACCEL_DEC_TGA        7       /* DEC 21030 TGA                */
69 #define FB_ACCEL_ATI_MACH64CT   8       /* ATI Mach 64CT family         */
70 #define FB_ACCEL_ATI_MACH64VT   9       /* ATI Mach 64CT family VT class */
71 #define FB_ACCEL_ATI_MACH64GT   10      /* ATI Mach 64CT family GT class */
72 #define FB_ACCEL_SUN_CREATOR    11      /* Sun Creator/Creator3D        */
73 #define FB_ACCEL_SUN_CGSIX      12      /* Sun cg6                      */
74 #define FB_ACCEL_SUN_LEO        13      /* Sun leo/zx                   */
75 #define FB_ACCEL_IMS_TWINTURBO  14      /* IMS Twin Turbo               */
76 #define FB_ACCEL_3DLABS_PERMEDIA2 15    /* 3Dlabs Permedia 2            */
77 #define FB_ACCEL_MATROX_MGA2064W 16     /* Matrox MGA2064W (Millenium)  */
78 #define FB_ACCEL_MATROX_MGA1064SG 17    /* Matrox MGA1064SG (Mystique)  */
79 #define FB_ACCEL_MATROX_MGA2164W 18     /* Matrox MGA2164W (Millenium II) */
80 #define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
81 #define FB_ACCEL_MATROX_MGAG100 20      /* Matrox G100 (Productiva G100) */
82 #define FB_ACCEL_MATROX_MGAG200 21      /* Matrox G200 (Myst, Mill, ...) */
83 #define FB_ACCEL_SUN_CG14       22      /* Sun cgfourteen                */
84 #define FB_ACCEL_SUN_BWTWO      23      /* Sun bwtwo                    */
85 #define FB_ACCEL_SUN_CGTHREE    24      /* Sun cgthree                  */
86 #define FB_ACCEL_SUN_TCX        25      /* Sun tcx                      */
87 #define FB_ACCEL_MATROX_MGAG400 26      /* Matrox G400                  */
88 #define FB_ACCEL_NV3            27      /* nVidia RIVA 128              */
89 #define FB_ACCEL_NV4            28      /* nVidia RIVA TNT              */
90 #define FB_ACCEL_NV5            29      /* nVidia RIVA TNT2             */
91 #define FB_ACCEL_CT_6555x       30      /* C&T 6555x                    */
92 #define FB_ACCEL_3DFX_BANSHEE   31      /* 3Dfx Banshee                 */
93 #define FB_ACCEL_ATI_RAGE128    32      /* ATI Rage128 family           */
94 #define FB_ACCEL_IGS_CYBER2000  33      /* CyberPro 2000                */
95 #define FB_ACCEL_IGS_CYBER2010  34      /* CyberPro 2010                */
96 #define FB_ACCEL_IGS_CYBER5000  35      /* CyberPro 5000                */
97 #define FB_ACCEL_SIS_GLAMOUR    36      /* SiS 300/630/540              */
98 #define FB_ACCEL_3DLABS_PERMEDIA3 37    /* 3Dlabs Permedia 3            */
99 #define FB_ACCEL_ATI_RADEON     38      /* ATI Radeon family            */
100 #define FB_ACCEL_SIS_GLAMOUR_2  40      /* SiS 315, 650, 740            */
101 #define FB_ACCEL_SIS_XABRE      41      /* SiS 330 ("Xabre")            */
102
103 #define FB_ACCEL_NEOMAGIC_NM2070 90     /* NeoMagic NM2070              */
104 #define FB_ACCEL_NEOMAGIC_NM2090 91     /* NeoMagic NM2090              */
105 #define FB_ACCEL_NEOMAGIC_NM2093 92     /* NeoMagic NM2093              */
106 #define FB_ACCEL_NEOMAGIC_NM2097 93     /* NeoMagic NM2097              */
107 #define FB_ACCEL_NEOMAGIC_NM2160 94     /* NeoMagic NM2160              */
108 #define FB_ACCEL_NEOMAGIC_NM2200 95     /* NeoMagic NM2200              */
109 #define FB_ACCEL_NEOMAGIC_NM2230 96     /* NeoMagic NM2230              */
110 #define FB_ACCEL_NEOMAGIC_NM2360 97     /* NeoMagic NM2360              */
111 #define FB_ACCEL_NEOMAGIC_NM2380 98     /* NeoMagic NM2380              */
112
113 #if 0
114
115 struct fb_fix_screeninfo {
116         char id[16];                    /* identification string eg "TT Builtin" */
117         unsigned long smem_start;       /* Start of frame buffer mem */
118                                         /* (physical address) */
119         u32 smem_len;                   /* Length of frame buffer mem */
120         u32 type;                       /* see FB_TYPE_*                */
121         u32 type_aux;                   /* Interleave for interleaved Planes */
122         u32 visual;                     /* see FB_VISUAL_*              */ 
123         u16 xpanstep;                   /* zero if no hardware panning  */
124         u16 ypanstep;                   /* zero if no hardware panning  */
125         u16 ywrapstep;          /* zero if no hardware ywrap    */
126         u32 line_length;                /* length of a line in bytes    */
127         unsigned long mmio_start;       /* Start of Memory Mapped I/O   */
128                                         /* (physical address) */
129         u32 mmio_len;                   /* Length of Memory Mapped I/O  */
130         u32 accel;                      /* Type of acceleration available */
131         u16 reserved[3];                /* Reserved for future compatibility */
132 };
133
134 #endif
135
136 /* Interpretation of offset for color fields: All offsets are from the right,
137  * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
138  * can use the offset as right argument to <<). A pixel afterwards is a bit
139  * stream and is written to video memory as that unmodified. This implies
140  * big-endian byte order if bits_per_pixel is greater than 8.
141  */
142 struct fb_bitfield {
143         u32 offset;                     /* beginning of bitfield        */
144         u32 length;                     /* length of bitfield           */
145         u32 msb_right;          /* != 0 : Most significant bit is */ 
146                                         /* right */ 
147 };
148
149 #define FB_NONSTD_HAM           1       /* Hold-And-Modify (HAM)        */
150
151 #define FB_ACTIVATE_NOW         0       /* set values immediately (or vbl)*/
152 #define FB_ACTIVATE_NXTOPEN     1       /* activate on next open        */
153 #define FB_ACTIVATE_TEST        2       /* don't set, round up impossible */
154 #define FB_ACTIVATE_MASK       15
155                                         /* values                       */
156 #define FB_ACTIVATE_VBL        16       /* activate values on next vbl  */
157 #define FB_CHANGE_CMAP_VBL     32       /* change colormap on vbl       */
158 #define FB_ACTIVATE_ALL        64       /* change all VCs on this fb    */
159
160 #define FB_ACCELF_TEXT          1       /* text mode acceleration */
161
162 #define FB_SYNC_HOR_HIGH_ACT    1       /* horizontal sync high active  */
163 #define FB_SYNC_VERT_HIGH_ACT   2       /* vertical sync high active    */
164 #define FB_SYNC_EXT             4       /* external sync                */
165 #define FB_SYNC_COMP_HIGH_ACT   8       /* composite sync high active   */
166 #define FB_SYNC_BROADCAST       16      /* broadcast video timings      */
167                                         /* vtotal = 144d/288n/576i => PAL  */
168                                         /* vtotal = 121d/242n/484i => NTSC */
169 #define FB_SYNC_ON_GREEN        32      /* sync on green */
170
171 #define FB_VMODE_NONINTERLACED  0       /* non interlaced */
172 #define FB_VMODE_INTERLACED     1       /* interlaced   */
173 #define FB_VMODE_DOUBLE         2       /* double scan */
174 #define FB_VMODE_MASK           255
175
176 #define FB_VMODE_YWRAP          256     /* ywrap instead of panning     */
177 #define FB_VMODE_SMOOTH_XPAN    512     /* smooth xpan possible (internally used) */
178 #define FB_VMODE_CONUPDATE      512     /* don't update x/yoffset       */
179
180 struct fb_var_screeninfo {
181         u32 xres;                       /* visible resolution           */
182         u32 yres;
183         u32 xres_virtual;               /* virtual resolution           */
184         u32 yres_virtual;
185         u32 xoffset;                    /* offset from virtual to visible */
186         u32 yoffset;                    /* resolution                   */
187
188         u32 bits_per_pixel;             /* guess what                   */
189         u32 grayscale;          /* != 0 Graylevels instead of colors */
190
191         struct fb_bitfield red;         /* bitfield in fb mem if true color, */
192         struct fb_bitfield green;       /* else only length is significant */
193         struct fb_bitfield blue;
194         struct fb_bitfield transp;      /* transparency                 */      
195
196         u32 nonstd;                     /* != 0 Non standard pixel format */
197
198         u32 activate;                   /* see FB_ACTIVATE_*            */
199
200         u32 height;                     /* height of picture in mm    */
201         u32 width;                      /* width of picture in mm     */
202
203         u32 accel_flags;                /* acceleration flags (hints)   */
204
205         /* Timing: All values in pixclocks, except pixclock (of course) */
206         u32 pixclock;                   /* pixel clock in ps (pico seconds) */
207         u32 left_margin;                /* time from sync to picture    */
208         u32 right_margin;               /* time from picture to sync    */
209         u32 upper_margin;               /* time from sync to picture    */
210         u32 lower_margin;
211         u32 hsync_len;          /* length of horizontal sync    */
212         u32 vsync_len;          /* length of vertical sync      */
213         u32 sync;                       /* see FB_SYNC_*                */
214         u32 vmode;                      /* see FB_VMODE_*               */
215         u32 reserved[6];                /* Reserved for future compatibility */
216 };
217
218 struct fb_cmap {
219         u32 start;                      /* First entry  */
220         u32 len;                        /* Number of entries */
221         u16 *red;                       /* Red values   */
222         u16 *green;
223         u16 *blue;
224         u16 *transp;                    /* transparency, can be NULL */
225 };
226
227 struct fb_con2fbmap {
228         u32 console;
229         u32 framebuffer;
230 };
231
232 /* VESA Blanking Levels */
233 #define VESA_NO_BLANKING        0
234 #define VESA_VSYNC_SUSPEND      1
235 #define VESA_HSYNC_SUSPEND      2
236 #define VESA_POWERDOWN          3
237
238 struct fb_monspecs {
239         u32 hfmin;                      /* hfreq lower limit (Hz) */
240         u32 hfmax;                      /* hfreq upper limit (Hz) */
241         u16 vfmin;                      /* vfreq lower limit (Hz) */
242         u16 vfmax;                      /* vfreq upper limit (Hz) */
243         unsigned dpms : 1;              /* supports DPMS */
244 };
245
246 #define FB_VBLANK_VBLANKING     0x001   /* currently in a vertical blank */
247 #define FB_VBLANK_HBLANKING     0x002   /* currently in a horizontal blank */
248 #define FB_VBLANK_HAVE_VBLANK   0x004   /* vertical blanks can be detected */
249 #define FB_VBLANK_HAVE_HBLANK   0x008   /* horizontal blanks can be detected */
250 #define FB_VBLANK_HAVE_COUNT    0x010   /* global retrace counter is available */
251 #define FB_VBLANK_HAVE_VCOUNT   0x020   /* the vcount field is valid */
252 #define FB_VBLANK_HAVE_HCOUNT   0x040   /* the hcount field is valid */
253 #define FB_VBLANK_VSYNCING      0x080   /* currently in a vsync */
254 #define FB_VBLANK_HAVE_VSYNC    0x100   /* verical syncs can be detected */
255
256 struct fb_vblank {
257         u32 flags;                      /* FB_VBLANK flags */
258         u32 count;                      /* counter of retraces since boot */
259         u32 vcount;                     /* current scanline position */
260         u32 hcount;                     /* current scandot position */
261         u32 reserved[4];                /* reserved for future compatibility */
262 };
263
264
265 #if 1
266
267 #define FBCMD_GET_CURRENTPAR    0xDEAD0005
268 #define FBCMD_SET_CURRENTPAR    0xDEAD8005
269
270 #endif
271
272
273
274    /*
275     *    Hardware Cursor
276     */
277
278 #define FBIOGET_FCURSORINFO     0x4607
279 #define FBIOGET_VCURSORINFO     0x4608
280 #define FBIOPUT_VCURSORINFO     0x4609
281 #define FBIOGET_CURSORSTATE     0x460A
282 #define FBIOPUT_CURSORSTATE     0x460B
283
284
285 struct fb_fix_cursorinfo {
286         u16 crsr_width;         /* width and height of the cursor in */
287         u16 crsr_height;                /* pixels (zero if no cursor)   */
288         u16 crsr_xsize;         /* cursor size in display pixels */
289         u16 crsr_ysize;
290         u16 crsr_color1;                /* colormap entry for cursor color1 */
291         u16 crsr_color2;                /* colormap entry for cursor color2 */
292 };
293
294 struct fb_var_cursorinfo {
295         u16 width;
296         u16 height;
297         u16 xspot;
298         u16 yspot;
299         u8 data[1];                     /* field with [height][width]        */
300 };
301
302 struct fb_cursorstate {
303         s16 xoffset;
304         s16 yoffset;
305         u16 mode;
306 };
307
308
309 struct fb_info {
310    char modename[40];                   /* default video mode */
311 //   kdev_t node;
312    int flags;
313    int open;                            /* Has this been open already ? */
314    struct fb_var_screeninfo var;        /* Current var */
315 #if 0
316    struct fb_fix_screeninfo fix;        /* Current fix */
317 #endif
318    struct fb_monspecs monspecs;         /* Current Monitor specs */
319    struct fb_cmap cmap;                 /* Current cmap */
320 //   struct fb_ops *fbops;
321    char *screen_base;                   /* Virtual address */
322    struct display *disp;                /* initial display variable */
323 //   struct vc_data *display_fg;          /* Console visible on this display */
324    char fontname[40];                   /* default font name */
325 #if 0
326    devfs_handle_t devfs_handle;         /* Devfs handle for new name         */
327    devfs_handle_t devfs_lhandle;        /* Devfs handle for compat. symlink  */
328    int (*changevar)(int);               /* tell console var has changed */
329    int (*switch_con)(int, struct fb_info*); 
330                                         /* tell fb to switch consoles */
331    int (*updatevar)(int, struct fb_info*);
332                                         /* tell fb to update the vars */
333    void (*blank)(int, struct fb_info*); /* tell fb to (un)blank the screen */
334                                         /* arg = 0: unblank */
335                                         /* arg > 0: VESA level (arg-1) */
336 #endif
337    void *pseudo_palette;                /* Fake palette of 16 colors and
338                                            the cursor's color for non
339                                            palette mode */
340    /* From here on everything is device dependent */
341    void *par;   
342 };  
343
344 #endif /* _LINUX_FB_H */