1 /*	$OpenBSD: pfourreg.h,v 1.5 2003/06/02 18:47:58 deraadt Exp $	*/
2 /*	$NetBSD: pfourreg.h,v 1.1 1996/02/27 22:09:36 thorpej Exp $	*/
3 
4 /*
5  * Copyright (c) 1996 Jason R. Thorpe.  All rights reserved.
6  * Copyright (c) 1995 Theo de Raadt
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 4. The name of the author may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * pfour framebuffer registers.
34  */
35 
36 /* Offset of bwtwo framebuffer from pfour register */
37 #define PFOUR_BW_OFF		0x00100000
38 
39 /* Offsets for color framebuffers */
40 #define PFOUR_COLOR_OFF_OVERLAY	0x00100000
41 #define PFOUR_COLOR_OFF_ENABLE	0x00300000
42 #define PFOUR_COLOR_OFF_COLOR	0x00500000
43 #define PFOUR_COLOR_OFF_END	0x00700000
44 #define PFOUR_COLOR_OFF_CMAP	0xfff00000	/* (-0x00100000) */
45 
46 #define PFOUR_REG_DIAG		0x80
47 #define PFOUR_REG_READBACKCLR	0x40
48 #define PFOUR_REG_VIDEO		0x20
49 #define PFOUR_REG_SYNC		0x10
50 #define PFOUR_REG_VTRACE	0x08
51 #define PFOUR_REG_INT		0x04
52 #define PFOUR_REG_INTCLR	0x04
53 #define PFOUR_REG_INTEN		0x02
54 #define PFOUR_REG_FIRSTHALF	0x01
55 #define PFOUR_REG_RESET		0x01
56 
57 #define PFOUR_FBTYPE_MASK	0x7f000000
58 #define	PFOUR_FBTYPE(x)		((x) >> 24)
59 
60 #define	PFOUR_ID_MASK		0xf0
61 #define PFOUR_ID(x)		(PFOUR_FBTYPE((x)) == PFOUR_ID_COLOR24 ? \
62 				    PFOUR_ID_COLOR24 : \
63 				    PFOUR_FBTYPE((x)) & PFOUR_ID_MASK)
64 #define PFOUR_ID_BW		0x00	/* monochrome */
65 #define PFOUR_ID_FASTCOLOR	0x60	/* accelerated 8-bit color */
66 #define PFOUR_ID_COLOR8P1	0x40	/* 8-bit color + overlay */
67 #define PFOUR_ID_COLOR24	0x45	/* 24-bit color + overlay */
68 
69 #define PFOUR_SIZE_MASK		0x0f
70 #define PFOUR_SIZE(x)		(PFOUR_FBTYPE((x)) & PFOUR_SIZE_MASK)
71 #define PFOUR_SIZE_1152X900	0x01
72 #define PFOUR_SIZE_1024X1024	0x02
73 #define PFOUR_SIZE_1280X1024	0x03
74 #define PFOUR_SIZE_1600X1280	0x00
75 #define PFOUR_SIZE_1440X1440	0x04
76 #define PFOUR_SIZE_640X480	0x05
77 
78 #define PFOUR_NOTPFOUR		-1
79