vesa.h revision 39643
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 *
2639643Syokota * $Id: vesa.h,v 1.1 1998/09/15 18:16:37 sos Exp $
2739287Ssos */
2839287Ssos
2939287Ssos#ifndef _MACHINE_PC_VESA_H
3039287Ssos#define _MACHINE_PC_VESA_H
3139287Ssos
3239287Ssosstruct vesa_info
3339287Ssos{
3439287Ssos    /* mandatory fields */
3539287Ssos    u_int8_t		v_sig[4] __attribute__ ((packed));	/* VESA */
3639287Ssos    u_int16_t		v_version __attribute__ ((packed));	/* ver in BCD */
3739287Ssos    u_int32_t		v_oemstr __attribute__ ((packed));	/* OEM string */
3839287Ssos    u_int32_t		v_flags __attribute__ ((packed));	/* flags */
3939287Ssos#define V_DAC8		(1<<0)
4039287Ssos#define V_NONVGA	(1<<1)
4139287Ssos#define V_SNOW		(1<<2)
4239287Ssos    u_int32_t		v_modetable __attribute__ ((packed));	/* modes */
4339287Ssos    u_int16_t		v_memsize __attribute__ ((packed));	/* in 64K */
4439287Ssos    /* 2.0 */
4539287Ssos    u_int16_t		v_revision __attribute__ ((packed));	/* software rev */
4639287Ssos    u_int32_t		v_venderstr __attribute__ ((packed));	/* vender */
4739287Ssos    u_int32_t		v_prodstr __attribute__ ((packed));	/* product name */
4839287Ssos    u_int32_t		v_revstr __attribute__ ((packed));	/* product rev */
4939287Ssos};
5039287Ssos
5139287Ssosstruct vesa_mode
5239287Ssos{
5339287Ssos    /* mandatory fields */
5439287Ssos    u_int16_t		v_modeattr;
5539287Ssos#define V_MODESUPP	(1<<0)	/* VESA mode attributes */
5639287Ssos#define V_MODEOPTINFO	(1<<1)
5739287Ssos#define V_MODEBIOSOUT	(1<<2)
5839287Ssos#define V_MODECOLOR	(1<<3)
5939287Ssos#define V_MODEGRAPHICS	(1<<4)
6039287Ssos#define V_MODENONVGA	(1<<5)
6139287Ssos#define V_MODENONBANK	(1<<6)
6239287Ssos#define V_MODELFB	(1<<7)
6339287Ssos#define V_MODEVESA	(1<<16)	/* Private attributes */
6439287Ssos    u_int8_t		v_waattr;
6539287Ssos    u_int8_t		v_wbattr;
6639287Ssos#define V_WATTREXIST	(1<<0)
6739287Ssos#define V_WATTRREAD	(1<<1)
6839287Ssos#define V_WATTRWRITE	(1<<2)
6939287Ssos    u_int16_t		v_wgran;
7039287Ssos    u_int16_t		v_wsize;
7139287Ssos    u_int16_t		v_waseg;
7239287Ssos    u_int16_t		v_wbseg;
7339287Ssos    u_int32_t		v_posfunc;
7439287Ssos    u_int16_t		v_bpscanline;
7539287Ssos    /* fields optional for 1.0/1.1 implementations */
7639287Ssos    u_int16_t		v_width;
7739287Ssos    u_int16_t		v_height;
7839287Ssos    u_int8_t		v_cwidth;
7939287Ssos    u_int8_t		v_cheight;
8039287Ssos    u_int8_t		v_planes;
8139287Ssos    u_int8_t		v_bpp;
8239287Ssos    u_int8_t		v_banks;
8339287Ssos    u_int8_t		v_memmodel;
8439287Ssos#define V_MMTEXT	0
8539287Ssos#define V_MMCGA		1
8639287Ssos#define V_MMHGC		2
8739287Ssos#define V_MMEGA		3
8839287Ssos#define V_MMPACKED	4
8939287Ssos#define V_MMSEQU256	5
9039287Ssos#define V_MMDIRCOLOR	6
9139287Ssos#define V_MMYUV		7
9239287Ssos    u_int8_t		v_banksize;
9339287Ssos    u_int8_t		v_ipages;
9439287Ssos    u_int8_t		v_reserved0;
9539287Ssos    /* fields for 1.2+ implementations */
9639287Ssos    u_int8_t		v_redmasksize;
9739287Ssos    u_int8_t		v_redfieldpos;
9839287Ssos    u_int8_t		v_greenmasksize;
9939287Ssos    u_int8_t		v_greenfieldpos;
10039287Ssos    u_int8_t		v_bluemasksize;
10139287Ssos    u_int8_t		v_bluefieldpos;
10239287Ssos    u_int8_t		v_resmasksize;
10339287Ssos    u_int8_t		v_resfieldpos;
10439287Ssos    u_int8_t		v_dircolormode;
10539287Ssos    /* 2.0 implementations */
10639287Ssos    u_int32_t		v_lfb;
10739287Ssos    u_int32_t		v_offscreen;
10839287Ssos    u_int8_t		v_offscreensize;
10939287Ssos};
11039287Ssos
11139287Ssos#ifdef KERNEL
11239287Ssos
11339287Ssos#define VESA_MODE(x)	((x) >= M_VESA_BASE)
11439287Ssos
11539287Ssosint vesa_load_ioctl(void);
11639287Ssosint vesa_unload_ioctl(void);
11739287Ssos
11839287Ssos#ifndef VESA_MODULE
11939287Ssosint vesa_load(void);
12039287Ssos#endif
12139287Ssos
12239287Ssos#endif /* KERNEL */
12339287Ssos
12439287Ssos#endif /* !_MACHINE_PC_VESA_H */
125