ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-sparc64 / fbio.h
1 #ifndef __LINUX_FBIO_H
2 #define __LINUX_FBIO_H
3
4 /* Constants used for fbio SunOS compatibility */
5 /* (C) 1996 Miguel de Icaza */
6
7 /* Frame buffer types */
8 #define FBTYPE_NOTYPE           -1
9 #define FBTYPE_SUN1BW           0   /* mono */
10 #define FBTYPE_SUN1COLOR        1 
11 #define FBTYPE_SUN2BW           2 
12 #define FBTYPE_SUN2COLOR        3 
13 #define FBTYPE_SUN2GP           4 
14 #define FBTYPE_SUN5COLOR        5 
15 #define FBTYPE_SUN3COLOR        6 
16 #define FBTYPE_MEMCOLOR         7 
17 #define FBTYPE_SUN4COLOR        8 
18  
19 #define FBTYPE_NOTSUN1          9 
20 #define FBTYPE_NOTSUN2          10
21 #define FBTYPE_NOTSUN3          11
22  
23 #define FBTYPE_SUNFAST_COLOR    12  /* cg6 */
24 #define FBTYPE_SUNROP_COLOR     13
25 #define FBTYPE_SUNFB_VIDEO      14
26 #define FBTYPE_SUNGIFB          15
27 #define FBTYPE_SUNGPLAS         16
28 #define FBTYPE_SUNGP3           17
29 #define FBTYPE_SUNGT            18
30 #define FBTYPE_SUNLEO           19      /* zx Leo card */
31 #define FBTYPE_MDICOLOR         20      /* cg14 */
32 #define FBTYPE_TCXCOLOR         21      /* SUNW,tcx card */
33
34 #define FBTYPE_LASTPLUSONE      21      /* This is not last + 1 in fact... */
35
36 /* Does not seem to be listed in the Sun file either */
37 #define FBTYPE_CREATOR          22
38 #define FBTYPE_PCI_IGA1682      23
39 #define FBTYPE_P9100COLOR       24
40
41 #define FBTYPE_PCI_GENERIC      1000
42 #define FBTYPE_PCI_MACH64       1001
43
44 /* fbio ioctls */
45 /* Returned by FBIOGTYPE */
46 struct  fbtype {
47         int     fb_type;        /* fb type, see above */
48         int     fb_height;      /* pixels */
49         int     fb_width;       /* pixels */
50         int     fb_depth;
51         int     fb_cmsize;      /* color map entries */
52         int     fb_size;        /* fb size in bytes */
53 };
54 #define FBIOGTYPE _IOR('F', 0, struct fbtype)
55
56 struct  fbcmap {
57         int             index;          /* first element (0 origin) */
58         int             count;
59         unsigned char   *red;
60         unsigned char   *green;
61         unsigned char   *blue;
62 };
63
64 #ifdef __KERNEL__
65 #define FBIOPUTCMAP_SPARC _IOW('F', 3, struct fbcmap)
66 #define FBIOGETCMAP_SPARC _IOW('F', 4, struct fbcmap)
67 #else
68 #define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
69 #define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
70 #endif
71
72 /* # of device specific values */
73 #define FB_ATTR_NDEVSPECIFIC    8
74 /* # of possible emulations */
75 #define FB_ATTR_NEMUTYPES       4
76  
77 struct fbsattr {
78         int     flags;
79         int     emu_type;       /* -1 if none */
80         int     dev_specific[FB_ATTR_NDEVSPECIFIC];
81 };
82  
83 struct fbgattr {
84         int     real_type;      /* real frame buffer type */
85         int     owner;          /* unknown */
86         struct fbtype fbtype;   /* real frame buffer fbtype */
87         struct fbsattr sattr;   
88         int     emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */
89 };
90 #define FBIOSATTR  _IOW('F', 5, struct fbgattr) /* Unsupported: */
91 #define FBIOGATTR  _IOR('F', 6, struct fbgattr) /* supported */
92
93 #define FBIOSVIDEO _IOW('F', 7, int)
94 #define FBIOGVIDEO _IOR('F', 8, int)
95
96 struct fbcursor {
97         short set;              /* what to set, choose from the list above */
98         short enable;           /* cursor on/off */
99         struct fbcurpos pos;    /* cursor position */
100         struct fbcurpos hot;    /* cursor hot spot */
101         struct fbcmap cmap;     /* color map info */
102         struct fbcurpos size;   /* cursor bit map size */
103         char *image;            /* cursor image bits */
104         char *mask;             /* cursor mask bits */
105 };
106
107 /* set/get cursor attributes/shape */
108 #define FBIOSCURSOR     _IOW('F', 24, struct fbcursor)
109 #define FBIOGCURSOR     _IOWR('F', 25, struct fbcursor)
110  
111 /* set/get cursor position */
112 #define FBIOSCURPOS     _IOW('F', 26, struct fbcurpos)
113 #define FBIOGCURPOS     _IOW('F', 27, struct fbcurpos)
114  
115 /* get max cursor size */
116 #define FBIOGCURMAX     _IOR('F', 28, struct fbcurpos)
117
118 /* wid manipulation */
119 struct fb_wid_alloc {
120 #define FB_WID_SHARED_8         0
121 #define FB_WID_SHARED_24        1
122 #define FB_WID_DBL_8            2
123 #define FB_WID_DBL_24           3
124         __u32   wa_type;
125         __s32   wa_index;       /* Set on return */
126         __u32   wa_count;       
127 };
128 struct fb_wid_item {
129         __u32   wi_type;
130         __s32   wi_index;
131         __u32   wi_attrs;
132         __u32   wi_values[32];
133 };
134 struct fb_wid_list {
135         __u32   wl_flags;
136         __u32   wl_count;
137         struct fb_wid_item      *wl_list;
138 };
139
140 #define FBIO_WID_ALLOC  _IOWR('F', 30, struct fb_wid_alloc)
141 #define FBIO_WID_FREE   _IOW('F', 31, struct fb_wid_alloc)
142 #define FBIO_WID_PUT    _IOW('F', 32, struct fb_wid_list)
143 #define FBIO_WID_GET    _IOWR('F', 33, struct fb_wid_list)
144
145 /* Creator ioctls */
146 #define FFB_IOCTL       ('F'<<8)
147 #define FFB_SYS_INFO            (FFB_IOCTL|80)
148 #define FFB_CLUTREAD            (FFB_IOCTL|81)
149 #define FFB_CLUTPOST            (FFB_IOCTL|82)
150 #define FFB_SETDIAGMODE         (FFB_IOCTL|83)
151 #define FFB_GETMONITORID        (FFB_IOCTL|84)
152 #define FFB_GETVIDEOMODE        (FFB_IOCTL|85)
153 #define FFB_SETVIDEOMODE        (FFB_IOCTL|86)
154 #define FFB_SETSERVER           (FFB_IOCTL|87)
155 #define FFB_SETOVCTL            (FFB_IOCTL|88)
156 #define FFB_GETOVCTL            (FFB_IOCTL|89)
157 #define FFB_GETSAXNUM           (FFB_IOCTL|90)
158 #define FFB_FBDEBUG             (FFB_IOCTL|91)
159
160 /* Cg14 ioctls */
161 #define MDI_IOCTL          ('M'<<8)
162 #define MDI_RESET          (MDI_IOCTL|1)
163 #define MDI_GET_CFGINFO    (MDI_IOCTL|2)
164 #define MDI_SET_PIXELMODE  (MDI_IOCTL|3)
165 #    define MDI_32_PIX     32
166 #    define MDI_16_PIX     16
167 #    define MDI_8_PIX      8
168
169 struct mdi_cfginfo {
170         int     mdi_ncluts;     /* Number of implemented CLUTs in this MDI */
171         int     mdi_type;       /* FBTYPE name */
172         int     mdi_height;     /* height */
173         int     mdi_width;      /* widht */
174         int     mdi_size;       /* available ram */
175         int     mdi_mode;       /* 8bpp, 16bpp or 32bpp */
176         int     mdi_pixfreq;    /* pixel clock (from PROM) */
177 };
178
179 /* SparcLinux specific ioctl for the MDI, should be replaced for
180  * the SET_XLUT/SET_CLUTn ioctls instead
181  */
182 #define MDI_CLEAR_XLUT       (MDI_IOCTL|9)
183
184 /* leo & ffb ioctls */
185 struct fb_clut_alloc {
186         __u32   clutid; /* Set on return */
187         __u32   flag;
188         __u32   index;
189 };
190
191 struct fb_clut {
192 #define FB_CLUT_WAIT    0x00000001      /* Not yet implemented */
193         __u32   flag;
194         __u32   clutid;
195         __u32   offset;
196         __u32   count;
197         char *  red;
198         char *  green;
199         char *  blue;
200 };
201
202 struct fb_clut32 {
203         __u32   flag;
204         __u32   clutid;
205         __u32   offset;
206         __u32   count;
207         __u32   red;
208         __u32   green;
209         __u32   blue;
210 };
211
212 #define LEO_CLUTALLOC   _IOWR('L', 53, struct fb_clut_alloc)
213 #define LEO_CLUTFREE    _IOW('L', 54, struct fb_clut_alloc)
214 #define LEO_CLUTREAD    _IOW('L', 55, struct fb_clut)
215 #define LEO_CLUTPOST    _IOW('L', 56, struct fb_clut)
216 #define LEO_SETGAMMA    _IOW('L', 68, int) /* Not yet implemented */
217 #define LEO_GETGAMMA    _IOR('L', 69, int) /* Not yet implemented */
218
219 #ifdef __KERNEL__
220 /* Addresses on the fd of a cgsix that are mappable */
221 #define CG6_FBC    0x70000000
222 #define CG6_TEC    0x70001000
223 #define CG6_BTREGS 0x70002000
224 #define CG6_FHC    0x70004000
225 #define CG6_THC    0x70005000
226 #define CG6_ROM    0x70006000
227 #define CG6_RAM    0x70016000
228 #define CG6_DHC    0x80000000
229
230 #define CG3_MMAP_OFFSET 0x4000000
231
232 /* Addresses on the fd of a tcx that are mappable */
233 #define TCX_RAM8BIT             0x00000000
234 #define TCX_RAM24BIT            0x01000000
235 #define TCX_UNK3                0x10000000
236 #define TCX_UNK4                0x20000000
237 #define TCX_CONTROLPLANE        0x28000000
238 #define TCX_UNK6                0x30000000
239 #define TCX_UNK7                0x38000000
240 #define TCX_TEC                 0x70000000
241 #define TCX_BTREGS              0x70002000
242 #define TCX_THC                 0x70004000
243 #define TCX_DHC                 0x70008000
244 #define TCX_ALT                 0x7000a000
245 #define TCX_SYNC                0x7000e000
246 #define TCX_UNK2                0x70010000
247
248 /* CG14 definitions */
249
250 /* Offsets into the OBIO space: */
251 #define CG14_REGS        0       /* registers */
252 #define CG14_CURSORREGS  0x1000  /* cursor registers */
253 #define CG14_DACREGS     0x2000  /* DAC registers */
254 #define CG14_XLUT        0x3000  /* X Look Up Table -- ??? */
255 #define CG14_CLUT1       0x4000  /* Color Look Up Table */
256 #define CG14_CLUT2       0x5000  /* Color Look Up Table */
257 #define CG14_CLUT3       0x6000  /* Color Look Up Table */
258 #define CG14_AUTO        0xf000
259
260 #endif /* KERNEL */
261
262 /* These are exported to userland for applications to use */
263 /* Mappable offsets for the cg14: control registers */
264 #define MDI_DIRECT_MAP 0x10000000
265 #define MDI_CTLREG_MAP 0x20000000
266 #define MDI_CURSOR_MAP 0x30000000
267 #define MDI_SHDW_VRT_MAP 0x40000000
268
269 /* Mappable offsets for the cg14: frame buffer resolutions */
270 /* 32 bits */
271 #define MDI_CHUNKY_XBGR_MAP 0x50000000
272 #define MDI_CHUNKY_BGR_MAP 0x60000000
273
274 /* 16 bits */
275 #define MDI_PLANAR_X16_MAP 0x70000000
276 #define MDI_PLANAR_C16_MAP 0x80000000
277
278 /* 8 bit is done as CG3 MMAP offset */
279 /* 32 bits, planar */
280 #define MDI_PLANAR_X32_MAP 0x90000000
281 #define MDI_PLANAR_B32_MAP 0xa0000000
282 #define MDI_PLANAR_G32_MAP 0xb0000000
283 #define MDI_PLANAR_R32_MAP 0xc0000000
284
285 /* Mappable offsets on leo */
286 #define LEO_SS0_MAP            0x00000000
287 #define LEO_LC_SS0_USR_MAP     0x00800000
288 #define LEO_LD_SS0_MAP         0x00801000
289 #define LEO_LX_CURSOR_MAP      0x00802000
290 #define LEO_SS1_MAP            0x00803000
291 #define LEO_LC_SS1_USR_MAP     0x01003000
292 #define LEO_LD_SS1_MAP         0x01004000
293 #define LEO_UNK_MAP            0x01005000
294 #define LEO_LX_KRN_MAP         0x01006000
295 #define LEO_LC_SS0_KRN_MAP     0x01007000
296 #define LEO_LC_SS1_KRN_MAP     0x01008000
297 #define LEO_LD_GBL_MAP         0x01009000
298 #define LEO_UNK2_MAP           0x0100a000
299
300 #endif /* __LINUX_FBIO_H */