139287Ssos/*-
239643Syokota * Copyright (c) 1998 Michael Smith and Kazutaka YOKOTA
339287Ssos * All rights reserved.
439287Ssos *
539287Ssos * Redistribution and use in source and binary forms, with or without
639287Ssos * modification, are permitted provided that the following conditions
739287Ssos * are met:
839287Ssos * 1. Redistributions of source code must retain the above copyright
939643Syokota *    notice, this list of conditions and the following disclaimer as
1039643Syokota *    the first lines of this file unmodified.
1139287Ssos * 2. Redistributions in binary form must reproduce the above copyright
1239287Ssos *    notice, this list of conditions and the following disclaimer in the
1339287Ssos *    documentation and/or other materials provided with the distribution.
1439287Ssos *
1539643Syokota * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
1639643Syokota * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1739643Syokota * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1839643Syokota * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
1939643Syokota * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2039643Syokota * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2139643Syokota * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2239643Syokota * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2339643Syokota * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2439643Syokota * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2539287Ssos *
2650477Speter * $FreeBSD$
2739287Ssos */
2839287Ssos
29197025Sdelphij#ifndef _DEV_FB_VESA_H_
30197025Sdelphij#define _DEV_FB_VESA_H_
3139287Ssos
3239287Ssosstruct vesa_info
3339287Ssos{
3439287Ssos    /* mandatory fields */
35171382Smjacob    u_int8_t		v_sig[4];	/* VESA */
36171382Smjacob    u_int16_t		v_version;	/* ver in BCD */
37171382Smjacob    u_int32_t		v_oemstr;	/* OEM string */
38171382Smjacob    u_int32_t		v_flags;	/* flags */
3939287Ssos#define V_DAC8		(1<<0)
4039287Ssos#define V_NONVGA	(1<<1)
4139287Ssos#define V_SNOW		(1<<2)
42171382Smjacob    u_int32_t		v_modetable;	/* modes */
43171382Smjacob    u_int16_t		v_memsize;	/* in 64K */
4439287Ssos    /* 2.0 */
45171382Smjacob    u_int16_t		v_revision;	/* software rev */
46171382Smjacob    u_int32_t		v_venderstr;	/* vender */
47171382Smjacob    u_int32_t		v_prodstr;	/* product name */
48171382Smjacob    u_int32_t		v_revstr;	/* product rev */
49197025Sdelphij    u_int8_t		v_strach[222];
50197025Sdelphij    u_int8_t		v_oemdata[256];
51171382Smjacob} __packed;
5239287Ssos
5339287Ssosstruct vesa_mode
5439287Ssos{
5539287Ssos    /* mandatory fields */
5639287Ssos    u_int16_t		v_modeattr;
5739287Ssos#define V_MODESUPP	(1<<0)	/* VESA mode attributes */
5839287Ssos#define V_MODEOPTINFO	(1<<1)
5939287Ssos#define V_MODEBIOSOUT	(1<<2)
6039287Ssos#define V_MODECOLOR	(1<<3)
6139287Ssos#define V_MODEGRAPHICS	(1<<4)
6239287Ssos#define V_MODENONVGA	(1<<5)
6339287Ssos#define V_MODENONBANK	(1<<6)
6439287Ssos#define V_MODELFB	(1<<7)
6539287Ssos#define V_MODEVESA	(1<<16)	/* Private attributes */
6639287Ssos    u_int8_t		v_waattr;
6739287Ssos    u_int8_t		v_wbattr;
6839287Ssos#define V_WATTREXIST	(1<<0)
6939287Ssos#define V_WATTRREAD	(1<<1)
7039287Ssos#define V_WATTRWRITE	(1<<2)
7139287Ssos    u_int16_t		v_wgran;
7239287Ssos    u_int16_t		v_wsize;
7339287Ssos    u_int16_t		v_waseg;
7439287Ssos    u_int16_t		v_wbseg;
7539287Ssos    u_int32_t		v_posfunc;
7639287Ssos    u_int16_t		v_bpscanline;
7739287Ssos    /* fields optional for 1.0/1.1 implementations */
7839287Ssos    u_int16_t		v_width;
7939287Ssos    u_int16_t		v_height;
8039287Ssos    u_int8_t		v_cwidth;
8139287Ssos    u_int8_t		v_cheight;
8239287Ssos    u_int8_t		v_planes;
8339287Ssos    u_int8_t		v_bpp;
8439287Ssos    u_int8_t		v_banks;
8539287Ssos    u_int8_t		v_memmodel;
8639287Ssos#define V_MMTEXT	0
8739287Ssos#define V_MMCGA		1
8839287Ssos#define V_MMHGC		2
8939287Ssos#define V_MMEGA		3
9039287Ssos#define V_MMPACKED	4
9139287Ssos#define V_MMSEQU256	5
9239287Ssos#define V_MMDIRCOLOR	6
9339287Ssos#define V_MMYUV		7
9439287Ssos    u_int8_t		v_banksize;
9539287Ssos    u_int8_t		v_ipages;
9639287Ssos    u_int8_t		v_reserved0;
9739287Ssos    /* fields for 1.2+ implementations */
9839287Ssos    u_int8_t		v_redmasksize;
9939287Ssos    u_int8_t		v_redfieldpos;
10039287Ssos    u_int8_t		v_greenmasksize;
10139287Ssos    u_int8_t		v_greenfieldpos;
10239287Ssos    u_int8_t		v_bluemasksize;
10339287Ssos    u_int8_t		v_bluefieldpos;
10439287Ssos    u_int8_t		v_resmasksize;
10539287Ssos    u_int8_t		v_resfieldpos;
10639287Ssos    u_int8_t		v_dircolormode;
10739287Ssos    /* 2.0 implementations */
10839287Ssos    u_int32_t		v_lfb;
10939287Ssos    u_int32_t		v_offscreen;
11043664Syokota    u_int16_t		v_offscreensize;
111198419Sjkim    /* 3.0 implementations */
112198419Sjkim    u_int16_t		v_linbpscanline;
113198419Sjkim    u_int8_t		v_bankipages;
114198419Sjkim    u_int8_t		v_linipages;
115198419Sjkim    u_int8_t		v_linredmasksize;
116198419Sjkim    u_int8_t		v_linredfieldpos;
117198419Sjkim    u_int8_t		v_lingreenmasksize;
118198419Sjkim    u_int8_t		v_lingreenfieldpos;
119198419Sjkim    u_int8_t		v_linbluemasksize;
120198419Sjkim    u_int8_t		v_linbluefieldpos;
121198419Sjkim    u_int8_t		v_linresmasksize;
122198419Sjkim    u_int8_t		v_linresfieldpos;
123198419Sjkim    u_int32_t		v_maxpixelclock;
124198419Sjkim    u_int8_t		v_reserved1[190];
125198419Sjkim} __packed;
12639287Ssos
12755205Speter#ifdef _KERNEL
12839287Ssos
129231841Sjkim#define VESA_MODE(x)	((x) >= M_VESA_BASE && (x) <= M_VESA_MODE_MAX)
13039287Ssos
13139287Ssosint vesa_load_ioctl(void);
13239287Ssosint vesa_unload_ioctl(void);
13339287Ssos
13455205Speter#endif
13539287Ssos
136197025Sdelphij#endif /* !_DEV_FB_VESA_H_ */
137