xref: /freebsd/sys/dev/fb/vesa.h (revision 839f11a4fe18e4ae2dd930766b551fa67e354735)
1 /*-
2  * Copyright (c) 1998 Michael Smith and Kazutaka YOKOTA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer as
10  *    the first lines of this file unmodified.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _DEV_FB_VESA_H_
30 #define _DEV_FB_VESA_H_
31 
32 struct vesa_info
33 {
34     /* mandatory fields */
35     u_int8_t		v_sig[4];	/* VESA */
36     u_int16_t		v_version;	/* ver in BCD */
37     u_int32_t		v_oemstr;	/* OEM string */
38     u_int32_t		v_flags;	/* flags */
39 #define V_DAC8		(1<<0)
40 #define V_NONVGA	(1<<1)
41 #define V_SNOW		(1<<2)
42     u_int32_t		v_modetable;	/* modes */
43     u_int16_t		v_memsize;	/* in 64K */
44     /* 2.0 */
45     u_int16_t		v_revision;	/* software rev */
46     u_int32_t		v_venderstr;	/* vender */
47     u_int32_t		v_prodstr;	/* product name */
48     u_int32_t		v_revstr;	/* product rev */
49     u_int8_t		v_strach[222];
50     u_int8_t		v_oemdata[256];
51 } __packed;
52 
53 struct vesa_mode
54 {
55     /* mandatory fields */
56     u_int16_t		v_modeattr;
57 #define V_MODESUPP	(1<<0)	/* VESA mode attributes */
58 #define V_MODEOPTINFO	(1<<1)
59 #define V_MODEBIOSOUT	(1<<2)
60 #define V_MODECOLOR	(1<<3)
61 #define V_MODEGRAPHICS	(1<<4)
62 #define V_MODENONVGA	(1<<5)
63 #define V_MODENONBANK	(1<<6)
64 #define V_MODELFB	(1<<7)
65 #define V_MODEVESA	(1<<16)	/* Private attributes */
66     u_int8_t		v_waattr;
67     u_int8_t		v_wbattr;
68 #define V_WATTREXIST	(1<<0)
69 #define V_WATTRREAD	(1<<1)
70 #define V_WATTRWRITE	(1<<2)
71     u_int16_t		v_wgran;
72     u_int16_t		v_wsize;
73     u_int16_t		v_waseg;
74     u_int16_t		v_wbseg;
75     u_int32_t		v_posfunc;
76     u_int16_t		v_bpscanline;
77     /* fields optional for 1.0/1.1 implementations */
78     u_int16_t		v_width;
79     u_int16_t		v_height;
80     u_int8_t		v_cwidth;
81     u_int8_t		v_cheight;
82     u_int8_t		v_planes;
83     u_int8_t		v_bpp;
84     u_int8_t		v_banks;
85     u_int8_t		v_memmodel;
86 #define V_MMTEXT	0
87 #define V_MMCGA		1
88 #define V_MMHGC		2
89 #define V_MMEGA		3
90 #define V_MMPACKED	4
91 #define V_MMSEQU256	5
92 #define V_MMDIRCOLOR	6
93 #define V_MMYUV		7
94     u_int8_t		v_banksize;
95     u_int8_t		v_ipages;
96     u_int8_t		v_reserved0;
97     /* fields for 1.2+ implementations */
98     u_int8_t		v_redmasksize;
99     u_int8_t		v_redfieldpos;
100     u_int8_t		v_greenmasksize;
101     u_int8_t		v_greenfieldpos;
102     u_int8_t		v_bluemasksize;
103     u_int8_t		v_bluefieldpos;
104     u_int8_t		v_resmasksize;
105     u_int8_t		v_resfieldpos;
106     u_int8_t		v_dircolormode;
107     /* 2.0 implementations */
108     u_int32_t		v_lfb;
109     u_int32_t		v_offscreen;
110     u_int16_t		v_offscreensize;
111     /* 3.0 implementations */
112     u_int16_t		v_linbpscanline;
113     u_int8_t		v_bankipages;
114     u_int8_t		v_linipages;
115     u_int8_t		v_linredmasksize;
116     u_int8_t		v_linredfieldpos;
117     u_int8_t		v_lingreenmasksize;
118     u_int8_t		v_lingreenfieldpos;
119     u_int8_t		v_linbluemasksize;
120     u_int8_t		v_linbluefieldpos;
121     u_int8_t		v_linresmasksize;
122     u_int8_t		v_linresfieldpos;
123     u_int32_t		v_maxpixelclock;
124     u_int8_t		v_reserved1[190];
125 } __packed;
126 
127 #ifdef _KERNEL
128 
129 #define VESA_MODE(x)	((x) >= M_VESA_BASE && (x) <= M_VESA_MODE_MAX)
130 
131 int vesa_load_ioctl(void);
132 int vesa_unload_ioctl(void);
133 
134 #endif
135 
136 #endif /* !_DEV_FB_VESA_H_ */
137