14890 unix: dboot should use efi memory map if present
[illumos-gate.git] / usr / src / uts / common / sys / fbio.h
blob11debf4c95d106e1539d871d84ea62ae769dd3f0
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1986,1997-1998 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _SYS_FBIO_H
28 #define _SYS_FBIO_H
30 #include <sys/types.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #ifndef ASM
38 * Frame buffer descriptor.
39 * Returned by FBIOGTYPE ioctl on frame buffer devices.
41 struct fbtype {
42 int fb_type; /* as defined below */
43 int fb_height; /* in pixels */
44 int fb_width; /* in pixels */
45 int fb_depth; /* bits per pixel */
46 int fb_cmsize; /* size of color map (entries) */
47 int fb_size; /* total size in bytes */
50 #define FIOC ('F'<<8)
51 #define FBIOGTYPE (FIOC|0)
53 #ifdef _KERNEL
54 struct fbpixrect {
55 struct pixrect *fbpr_pixrect; /* Pixrect of dev returned here */
58 #define FBIOGPIXRECT (FIOC|1)
59 #endif /* _KERNEL */
62 * General purpose structure for passing info in and out of frame buffers
63 * (used for gp1)
65 struct fbinfo {
66 int fb_physaddr; /* physical frame buffer address */
67 int fb_hwwidth; /* fb board width */
68 int fb_hwheight; /* fb board height */
69 int fb_addrdelta; /* phys addr diff between boards */
70 unsigned char *fb_ropaddr; /* fb va thru kernelmap */
71 int fb_unit; /* minor devnum of fb */
74 #define FBIOGINFO (FIOC|2)
77 * Color map I/O. See also fbcmap_i below.
79 struct fbcmap {
80 int index; /* first element (0 origin) */
81 int count; /* number of elements */
82 unsigned char *red; /* red color map elements */
83 unsigned char *green; /* green color map elements */
84 unsigned char *blue; /* blue color map elements */
87 #ifdef _SYSCALL32
89 struct fbcmap32 {
90 int32_t index; /* first element (0 origin) */
91 int32_t count; /* number of elements */
92 caddr32_t red; /* red color map elements */
93 caddr32_t green; /* green color map elements */
94 caddr32_t blue; /* blue color map elements */
97 #endif /* _SYSCALL32 */
99 #define FBIOPUTCMAP (FIOC|3)
100 #define FBIOGETCMAP (FIOC|4)
103 * Set/Get attributes
105 #define FB_ATTR_NDEVSPECIFIC 8 /* no. of device specific values */
106 #define FB_ATTR_NEMUTYPES 4 /* no. of emulation types */
108 struct fbsattr {
109 int flags; /* misc flags */
110 #define FB_ATTR_AUTOINIT 1 /* emulation auto init flag */
111 #define FB_ATTR_DEVSPECIFIC 2 /* dev. specific stuff valid flag */
112 int emu_type; /* emulation type (-1 if unused) */
113 int dev_specific[FB_ATTR_NDEVSPECIFIC]; /* catchall */
116 struct fbgattr {
117 int real_type; /* real device type */
118 int owner; /* PID of owner, 0 if myself */
119 struct fbtype fbtype; /* fbtype info for real device */
120 struct fbsattr sattr; /* see above */
121 int emu_types[FB_ATTR_NEMUTYPES]; /* possible emulations */
122 /* (-1 if unused) */
125 #define FBIOSATTR (FIOC|5)
126 #define FBIOGATTR (FIOC|6)
130 * Video control
131 * (the unused bits are reserved for future use)
133 #define FBVIDEO_OFF 0
134 #define FBVIDEO_ON 1
136 #define FBIOSVIDEO (FIOC|7)
137 #define FBIOGVIDEO (FIOC|8)
139 /* Vertical retrace support. */
140 #define FBIOVERTICAL (FIOC|9)
141 #define GRABPAGEALLOC (FIOC|10)
142 #define GRABPAGEFREE (FIOC|11)
143 #define GRABATTACH (FIOC|12)
145 #define FBIOGPLNGRP (FIOC|13)
146 #define FBIOGCMSIZE (FIOC|14)
147 #define FBIOSCMSIZE (FIOC|15)
148 #define FBIOSCMS (FIOC|16)
149 #define FBIOAVAILPLNGRP (FIOC|17)
153 * Structure to pass double buffering state back and forth the device.
156 /* used in devstate */
157 #define FBDBL_AVAIL 0x80000000
158 #define FBDBL_DONT_BLOCK 0x40000000
159 #define FBDBL_AVAIL_PG 0x20000000
161 /* used in read/write/display */
162 #define FBDBL_A 0x1
163 #define FBDBL_B 0x2
164 #define FBDBL_BOTH (FBDBL_A | FBDBL_B)
165 #define FBDBL_NONE 0x4
167 struct fbdblinfo {
168 unsigned int dbl_devstate;
169 unsigned int dbl_read;
170 unsigned int dbl_write;
171 unsigned int dbl_display;
172 int dbl_depth;
173 char dbl_wid;
176 #define FBIODBLGINFO (FIOC|18)
177 #define FBIODBLSINFO (FIOC|19)
179 /* 8-bit emulation in 24-bit ioctls */
181 #define FBIOSWINFD (FIOC|20)
182 #define FBIOSAVWINFD (FIOC|21)
183 #define FBIORESWINFD (FIOC|22)
184 #define FBIOSRWINFD (FIOC|23)
187 * hardware cursor control
190 struct fbcurpos {
191 short x, y;
194 struct fbcursor {
195 short set; /* what to set */
196 #define FB_CUR_SETCUR 0x01
197 #define FB_CUR_SETPOS 0x02
198 #define FB_CUR_SETHOT 0x04
199 #define FB_CUR_SETCMAP 0x08
200 #define FB_CUR_SETSHAPE 0x10
201 #define FB_CUR_SETALL 0x1F
202 short enable; /* cursor on/off */
203 struct fbcurpos pos; /* cursor position */
204 struct fbcurpos hot; /* cursor hot spot */
205 struct fbcmap cmap; /* color map info */
206 struct fbcurpos size; /* cursor bit map size */
207 char *image; /* cursor image bits */
208 char *mask; /* cursor mask bits */
211 #ifdef _SYSCALL32
212 struct fbcursor32 {
213 short set; /* what to set */
214 short enable; /* cursor on/off */
215 struct fbcurpos pos; /* cursor position */
216 struct fbcurpos hot; /* cursor hot spot */
217 struct fbcmap32 cmap; /* color map info */
218 struct fbcurpos size; /* cursor bit map size */
219 caddr32_t image; /* cursor image bits */
220 caddr32_t mask; /* cursor mask bits */
222 #endif /* _SYSCALL32 */
224 /* set/get cursor attributes/shape */
225 #define FBIOSCURSOR (FIOC|24)
226 #define FBIOGCURSOR (FIOC|25)
228 /* set/get cursor position */
229 #define FBIOSCURPOS (FIOC|26)
230 #define FBIOGCURPOS (FIOC|27)
232 /* get max cursor size */
233 #define FBIOGCURMAX (FIOC|28)
235 /* Window Grabber info ioctl */
236 #define GRABLOCKINFO (FIOC|29)
239 * Window Identification (wid) defines, structures, and ioctls.
241 * Some wids need to be unique when used for things such as double
242 * buffering or rendering clipping. Some wids can be shared when
243 * used for display attributes only. What can be shared and how
244 * may be device dependent. The fb_wid_alloc.wa_type and fb_wid_item
245 * structure members will be left to device specific interpretation.
248 #define FB_WID_SHARED_8 0
249 #define FB_WID_SHARED_24 1
250 #define FB_WID_DBL_8 2
251 #define FB_WID_DBL_24 3
253 struct fb_wid_alloc {
254 unsigned int wa_type; /* special attributes */
255 int wa_index; /* base wid returned */
256 unsigned int wa_count; /* how many contiguous wids */
259 struct fb_wid_item {
260 unsigned int wi_type; /* special attributes */
261 int wi_index; /* which lut */
262 unsigned int wi_attrs; /* which attributes */
263 unsigned int wi_values[NBBY*sizeof (int)]; /* the attr values */
266 struct fb_wid_list {
267 unsigned int wl_flags;
268 unsigned int wl_count;
269 struct fb_wid_item *wl_list;
272 #ifdef _SYSCALL32
274 struct fb_wid_list32 {
275 uint32_t wl_flags;
276 uint32_t wl_count;
277 caddr32_t wl_list;
280 #endif /* _SYSCALL32 */
282 struct fb_wid_dbl_info {
283 struct fb_wid_alloc dbl_wid;
284 char dbl_fore;
285 char dbl_back;
286 char dbl_read_state;
287 char dbl_write_state;
290 #define FBIO_WID_ALLOC (FIOC|30)
291 #define FBIO_WID_FREE (FIOC|31)
292 #define FBIO_WID_PUT (FIOC|32)
293 #define FBIO_WID_GET (FIOC|33)
295 #define FBIO_DEVID (FIOC|34)
296 #define FBIO_U_RST (FIOC|35)
297 #define FBIO_FULLSCREEN_ELIMINATION_GROUPS (FIOC|36)
298 #define FBIO_WID_DBL_SET (FIOC|37)
299 #define FBIOVRTOFFSET (FIOC|38)
301 struct gfxfb_info {
302 uint16_t terminal_origin_x;
303 uint16_t terminal_origin_y;
304 uint32_t pitch;
305 uint16_t font_width;
306 uint16_t font_height;
307 uint8_t red_mask_size;
308 uint8_t red_field_position;
309 uint8_t green_mask_size;
310 uint8_t green_field_position;
311 uint8_t blue_mask_size;
312 uint8_t blue_field_position;
315 struct cg6_info {
316 ushort_t accessible_width; /* accessible bytes in scanline */
317 ushort_t accessible_height; /* number of accessible scanlines */
318 ushort_t line_bytes; /* number of bytes/scanline */
319 ushort_t hdb_capable; /* can this thing hardware db? */
320 ushort_t vmsize; /* this is Mb of video memory */
321 uchar_t boardrev; /* board revision # */
322 uchar_t slot; /* sbus slot # */
323 uint_t pad1; /* expansion */
326 struct s3_info {
327 ushort_t accessible_width; /* accessible bytes in scanline */
328 ushort_t accessible_height; /* number of accessible scanlines */
329 ushort_t line_bytes; /* number of bytes/scanline */
330 ushort_t hdb_capable; /* can this thing hardware db? */
331 ushort_t vmsize; /* this is Mb of video memory */
332 uchar_t boardrev; /* board revision # */
333 uchar_t slot; /* sbus slot # */
334 uint_t pad1; /* expansion */
337 struct p9000_info {
338 ushort_t accessible_width; /* accessible bytes in scanline */
339 ushort_t accessible_height; /* number of accessible scanlines */
340 ushort_t line_bytes; /* number of bytes/scanline */
341 ushort_t hdb_capable; /* can this thing hardware db? */
342 ushort_t vmsize; /* this is Mb of video memory */
343 uchar_t boardrev; /* board revision # */
344 uchar_t slot; /* sbus slot # */
345 uint_t pad1; /* expansion */
348 struct p9100_info {
349 ushort_t accessible_width; /* accessible bytes in scanline */
350 ushort_t accessible_height; /* number of accessible scanlines */
351 ushort_t line_bytes; /* number of bytes/scanline */
352 ushort_t hdb_capable; /* can this thing hardware db? */
353 ushort_t vmsize; /* this is Mb of video memory */
354 uchar_t boardrev; /* board revision # */
355 uchar_t slot; /* sbus slot # */
356 uint_t pad1; /* expansion */
359 struct wd90c24a2_info {
360 ushort_t accessible_width; /* accessible bytes in scanline */
361 ushort_t accessible_height; /* number of accessible scanlines */
362 ushort_t line_bytes; /* number of bytes/scanline */
363 ushort_t hdb_capable; /* can this thing hardware db? */
364 ushort_t vmsize; /* this is Mb of video memory */
365 uchar_t boardrev; /* board revision # */
366 uchar_t slot; /* sbus slot # */
367 uint_t pad1; /* expansion */
370 #define MON_TYPE_STEREO 0x8 /* stereo display */
371 #define MON_TYPE_0_OFFSET 0x4 /* black level 0 ire instead of 7.5 */
372 #define MON_TYPE_OVERSCAN 0x2 /* overscan */
373 #define MON_TYPE_GRAY 0x1 /* greyscale monitor */
375 struct mon_info {
376 uint_t mon_type; /* bit array: defined above */
377 uint_t pixfreq; /* pixel frequency in Hz */
378 uint_t hfreq; /* horizontal freq in Hz */
379 uint_t vfreq; /* vertical freq in Hz */
380 uint_t vsync; /* vertical sync in scanlines */
381 uint_t hsync; /* horizontal sync in pixels */
382 /* these are in pixel units */
383 ushort_t hfporch; /* horizontal front porch */
384 ushort_t hbporch; /* horizontal back porch */
385 ushort_t vfporch; /* vertical front porch */
386 ushort_t vbporch; /* vertical back porch */
390 #define FBIOGXINFO (FIOC|39)
391 #define FBIOMONINFO (FIOC|40)
394 * Color map I/O.
396 struct fbcmap_i {
397 unsigned int flags; /* see below */
398 int id; /* colormap id for multiple cmaps */
399 int index; /* first element (0 origin) */
400 int count; /* number of elements */
401 unsigned char *red; /* red color map elements */
402 unsigned char *green; /* green color map elements */
403 unsigned char *blue; /* blue color map elements */
406 #ifdef _SYSCALL32
408 struct fbcmap_i32 {
409 uint32_t flags; /* see below */
410 int32_t id; /* colormap id for multiple cmaps */
411 int32_t index; /* first element (0 origin) */
412 int32_t count; /* number of elements */
413 caddr32_t red; /* red color map elements */
414 caddr32_t green; /* green color map elements */
415 caddr32_t blue; /* blue color map elements */
418 #endif /* _SYSCALL32 */
420 #define FB_CMAP_BLOCK 0x1 /* wait for vrt before returning */
421 #define FB_CMAP_KERNEL 0x2 /* called within kernel */
423 #define FBIOPUTCMAPI (FIOC|41)
424 #define FBIOGETCMAPI (FIOC|42)
426 /* assigning a given window id to a pixrect - special for PHIGS */
427 #define FBIO_ASSIGNWID (FIOC|43)
429 /* assigning a given window to be stereo */
430 #define FBIO_STEREO (FIOC|44)
431 #define FB_WIN_STEREO 0x2
433 #endif /* !ASM */
435 /* frame buffer type codes */
436 #define FBTYPE_NOTYPE (-1) /* for backwards compatibility */
437 #define FBTYPE_SUN1BW 0 /* Multibus mono */
438 #define FBTYPE_SUN1COLOR 1 /* Multibus color */
439 #define FBTYPE_SUN2BW 2 /* memory mono */
440 #define FBTYPE_SUN2COLOR 3 /* color w/rasterop chips */
441 #define FBTYPE_SUN2GP 4 /* GP1/GP2 */
442 #define FBTYPE_SUN5COLOR 5 /* RoadRunner accelerator */
443 #define FBTYPE_SUN3COLOR 6 /* memory color */
444 #define FBTYPE_MEMCOLOR 7 /* memory 24-bit */
445 #define FBTYPE_SUN4COLOR 8 /* memory color w/overlay */
447 #define FBTYPE_NOTSUN1 9 /* reserved for customer */
448 #define FBTYPE_NOTSUN2 10 /* reserved for customer */
449 #define FBTYPE_NOTSUN3 11 /* reserved for customer */
451 #define FBTYPE_SUNFAST_COLOR 12 /* accelerated 8bit */
452 #define FBTYPE_SUNROP_COLOR 13 /* MEMCOLOR with rop h/w */
453 #define FBTYPE_SUNFB_VIDEO 14 /* Simple video mixing */
454 #define FBTYPE_SUNGIFB 15 /* medical image */
455 #define FBTYPE_SUNGPLAS 16 /* plasma panel */
456 #define FBTYPE_SUNGP3 17 /* cg12 running gpsi microcode */
457 #define FBTYPE_SUNGT 18 /* gt graphics accelerator */
458 #define FBTYPE_SUNLEO 19 /* zx graphics accelerator */
459 #define FBTYPE_MDICOLOR 20 /* cgfourteen framebuffer */
461 #define FBTYPE_LASTPLUSONE 21 /* max number of fbs (change as add) */
463 #ifdef __cplusplus
465 #endif
467 #endif /* _SYS_FBIO_H */