1/*	$NetBSD: grfvar.h,v 1.11 2009/01/17 10:02:23 isaki Exp $	*/
2
3/*
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1990, 1993
6 *	The Regents of the University of California.  All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in the
19 *    documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 *    may be used to endorse or promote products derived from this software
22 *    without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * from: Utah $Hdr: grfvar.h 1.11 93/08/13$
37 *
38 *	@(#)grfvar.h	8.2 (Berkeley) 9/9/93
39 */
40
41/* internal structure of lock page */
42#define GRFMAXLCK	256
43struct	grf_lockpage {
44	u_char	gl_locks[GRFMAXLCK];
45};
46#define gl_lockslot gl_locks[0]
47
48struct grf_softc;
49
50/*
51 * Static configuration info for display types
52 */
53struct	grfsw {
54	int	gd_hwid;	/* id returned by hardware */
55	int	gd_swid;	/* id to be returned by software */
56	const char *gd_desc;	/* description printed at config time */
57	int	(*gd_init)(struct grf_softc *, void *);
58	int	(*gd_mode)(struct grf_softc *, u_long, void *);
59};
60
61/* per display info */
62struct	grf_softc {
63	device_t g_device;		/* for config */
64	int	g_flags;		/* software flags */
65	int	g_cfaddr;		/* "addr" locator */
66	struct  grfsw *g_sw;		/* static configuration info */
67	void *	g_regkva;		/* KVA of registers */
68	void *	g_fbkva;		/* KVA of framebuffer */
69	struct	grfinfo g_display;	/* hardware description (for ioctl) */
70	void *	g_data;			/* device dependent data */
71};
72
73/* flags */
74#define	GF_ALIVE	0x01
75#define GF_OPEN		0x02
76#define GF_EXCLUDE	0x04
77#define GF_WANTED	0x08
78
79/* requests to mode routine */
80#define GM_GRFON	1
81#define GM_GRFOFF	2
82#define GM_GRFOVON	3
83#define GM_GRFOVOFF	4
84#define GM_DESCRIBE	5
85#define GM_MAP		6
86#define GM_UNMAP	7
87
88#define GM_GRFCONFIG	8
89#define GM_GRFGETVMODE	9
90#define GM_GRFSETVMODE	10
91#define GM_GRFGETNUMVM	11
92#define GM_GRFGETBANK	12
93#define GM_GRFSETBANK	13
94#define GM_GRFGETCURBANK 14
95#define GM_GRFIOCTL	15
96
97/* minor device interpretation */
98#define GRFUNIT(d)	minor(d)
99
100#ifdef _KERNEL
101extern	struct grfsw grfsw[];
102extern	int ngrfsw;
103#endif
104