xref: /netbsd-src/sys/arch/x68k/dev/grfvar.h (revision 9b6bd2d968e3623e57a9a376b7fc0ae125709789)
1*9b6bd2d9Srmind /*	$NetBSD: grfvar.h,v 1.12 2011/02/08 20:20:25 rmind Exp $	*/
2320e7320Soki 
3320e7320Soki /*
4*9b6bd2d9Srmind  * Copyright (c) 1988 University of Utah.
5320e7320Soki  * Copyright (c) 1990, 1993
6320e7320Soki  *	The Regents of the University of California.  All rights reserved.
7320e7320Soki  *
8320e7320Soki  * This code is derived from software contributed to Berkeley by
9320e7320Soki  * the Systems Programming Group of the University of Utah Computer
10320e7320Soki  * Science Department.
11320e7320Soki  *
12320e7320Soki  * Redistribution and use in source and binary forms, with or without
13320e7320Soki  * modification, are permitted provided that the following conditions
14320e7320Soki  * are met:
15320e7320Soki  * 1. Redistributions of source code must retain the above copyright
16320e7320Soki  *    notice, this list of conditions and the following disclaimer.
17320e7320Soki  * 2. Redistributions in binary form must reproduce the above copyright
18320e7320Soki  *    notice, this list of conditions and the following disclaimer in the
19320e7320Soki  *    documentation and/or other materials provided with the distribution.
20aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
21aad01611Sagc  *    may be used to endorse or promote products derived from this software
22aad01611Sagc  *    without specific prior written permission.
23aad01611Sagc  *
24aad01611Sagc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25aad01611Sagc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26aad01611Sagc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27aad01611Sagc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28aad01611Sagc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29aad01611Sagc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30aad01611Sagc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31aad01611Sagc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32aad01611Sagc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33aad01611Sagc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34aad01611Sagc  * SUCH DAMAGE.
35aad01611Sagc  *
36aad01611Sagc  * from: Utah $Hdr: grfvar.h 1.11 93/08/13$
37aad01611Sagc  *
38aad01611Sagc  *	@(#)grfvar.h	8.2 (Berkeley) 9/9/93
39aad01611Sagc  */
40320e7320Soki 
41320e7320Soki /* internal structure of lock page */
42320e7320Soki #define GRFMAXLCK	256
43320e7320Soki struct	grf_lockpage {
44320e7320Soki 	u_char	gl_locks[GRFMAXLCK];
45320e7320Soki };
46320e7320Soki #define gl_lockslot gl_locks[0]
47320e7320Soki 
4815d57c44Soki struct grf_softc;
4915d57c44Soki 
50320e7320Soki /*
51320e7320Soki  * Static configuration info for display types
52320e7320Soki  */
53320e7320Soki struct	grfsw {
54320e7320Soki 	int	gd_hwid;	/* id returned by hardware */
55320e7320Soki 	int	gd_swid;	/* id to be returned by software */
5688f0cd47She 	const char *gd_desc;	/* description printed at config time */
5753524e44Schristos 	int	(*gd_init)(struct grf_softc *, void *);
5853524e44Schristos 	int	(*gd_mode)(struct grf_softc *, u_long, void *);
59320e7320Soki };
60320e7320Soki 
61320e7320Soki /* per display info */
62320e7320Soki struct	grf_softc {
6360e2f026Sisaki 	device_t g_device;		/* for config */
64320e7320Soki 	int	g_flags;		/* software flags */
658b1c7b2eSchs 	int	g_cfaddr;		/* "addr" locator */
66320e7320Soki 	struct  grfsw *g_sw;		/* static configuration info */
6753524e44Schristos 	void *	g_regkva;		/* KVA of registers */
6853524e44Schristos 	void *	g_fbkva;		/* KVA of framebuffer */
69320e7320Soki 	struct	grfinfo g_display;	/* hardware description (for ioctl) */
7053524e44Schristos 	void *	g_data;			/* device dependent data */
71320e7320Soki };
72320e7320Soki 
73320e7320Soki /* flags */
74320e7320Soki #define	GF_ALIVE	0x01
75320e7320Soki #define GF_OPEN		0x02
76320e7320Soki #define GF_EXCLUDE	0x04
77320e7320Soki #define GF_WANTED	0x08
78320e7320Soki 
79320e7320Soki /* requests to mode routine */
80320e7320Soki #define GM_GRFON	1
81320e7320Soki #define GM_GRFOFF	2
82320e7320Soki #define GM_GRFOVON	3
83320e7320Soki #define GM_GRFOVOFF	4
84320e7320Soki #define GM_DESCRIBE	5
85320e7320Soki #define GM_MAP		6
86320e7320Soki #define GM_UNMAP	7
87320e7320Soki 
88320e7320Soki #define GM_GRFCONFIG	8
89320e7320Soki #define GM_GRFGETVMODE	9
90320e7320Soki #define GM_GRFSETVMODE	10
91320e7320Soki #define GM_GRFGETNUMVM	11
92320e7320Soki #define GM_GRFGETBANK	12
93320e7320Soki #define GM_GRFSETBANK	13
94320e7320Soki #define GM_GRFGETCURBANK 14
95320e7320Soki #define GM_GRFIOCTL	15
96320e7320Soki 
97320e7320Soki /* minor device interpretation */
98873a493dSminoura #define GRFUNIT(d)	minor(d)
99320e7320Soki 
100320e7320Soki #ifdef _KERNEL
101320e7320Soki extern	struct grfsw grfsw[];
102320e7320Soki extern	int ngrfsw;
103320e7320Soki #endif
104