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