cg14.h revision 1a3e96b4
1/*
2 * CG14 framebuffer - defines.
3 *
4 * Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h,v 1.2 2001/03/03 22:41:33 tsi Exp $ */
24
25#ifndef CG14_H
26#define CG14_H
27
28#include "xf86.h"
29#include "xf86_OSproc.h"
30#include "xf86RamDac.h"
31#include <X11/Xmd.h>
32#include "gcstruct.h"
33#include "xf86sbusBus.h"
34
35/* Various offsets in virtual (ie. mmap()) spaces Linux and Solaris support. */
36#define CG14_REGS_VOFF		0x00000000	/* registers */
37#define CG14_XLUT_VOFF		0x00003000	/* X Look Up Table */
38#define CG14_CLUT1_VOFF		0x00004000	/* Color Look Up Table */
39#define CG14_CLUT2_VOFF		0x00005000	/* Color Look Up Table */
40#define CG14_CLUT3_VOFF		0x00006000	/* Color Look Up Table */
41#define CG14_DIRECT_VOFF	0x10000000
42#define CG14_CTLREG_VOFF	0x20000000
43#define CG14_CURSOR_VOFF	0x30000000
44#define CG14_SHDW_VRT_VOFF	0x40000000
45#define CG14_XBGR_VOFF		0x50000000
46#define CG14_BGR_VOFF		0x60000000
47#define CG14_X16_VOFF		0x70000000
48#define CG14_C16_VOFF		0x80000000
49#define CG14_X32_VOFF		0x90000000
50#define CG14_B32_VOFF		0xa0000000
51#define CG14_G32_VOFF		0xb0000000
52#define CG14_R32_VOFF		0xc0000000
53
54/* Hardware cursor map */
55#define CG14_CURS_SIZE		32
56struct cg14curs {
57	volatile uint32_t	curs_plane0[CG14_CURS_SIZE];	/* plane 0 */
58	volatile uint32_t	curs_plane1[CG14_CURS_SIZE];
59	volatile uint8_t	curs_ctl;	/* control register */
60#define CG14_CURS_ENABLE	0x4
61#define CG14_CURS_DOUBLEBUFFER	0x2 		/* use X-channel for curs */
62	volatile uint8_t	pad0[3];
63	volatile uint16_t	curs_x;		/* x position */
64	volatile uint16_t	curs_y;		/* y position */
65	volatile uint32_t	curs_color1;	/* color register 1 */
66	volatile uint32_t	curs_color2;	/* color register 2 */
67	volatile uint32_t	pad[444];	/* pad to 2KB boundary */
68	volatile uint32_t	curs_plane0incr[CG14_CURS_SIZE]; /* autoincr */
69	volatile uint32_t	curs_plane1incr[CG14_CURS_SIZE]; /* autoincr */
70};
71
72typedef struct {
73	unsigned char	*fb;
74	unsigned char	*x32;
75	unsigned char	*xlut;
76	struct cg14curs	*curs;
77	int		width;
78	int		height;
79	int		use_shadow;
80	int		HWCursor;
81	void *		shadow;
82	sbusDevicePtr	psdp;
83	CloseScreenProcPtr CloseScreen;
84	CreateScreenResourcesProcPtr CreateScreenResources;
85	OptionInfoPtr	Options;
86	xf86CursorInfoPtr	CursorInfoRec;
87} Cg14Rec, *Cg14Ptr;
88
89Bool CG14SetupCursor(ScreenPtr);
90
91#define GET_CG14_FROM_SCRN(p)    ((Cg14Ptr)((p)->driverPrivate))
92
93/*
94 * This should match corresponding definition in Solaris's
95 * '/usr/include/sys/cg14io.h'.
96 */
97#ifdef __NetBSD__
98#include <dev/sun/fbio.h>
99#include <sys/ioccom.h>
100#define CG14_SET_PIXELMODE	_IOW('M', 3, int)
101#else
102#define CG14_SET_PIXELMODE	(('M' << 8) | 3)
103#endif
104
105#endif /* CG14_H */
106