pnozz.h revision f55eacde
1/*
2 * SBus Weitek P9100 driver - defines
3 *
4 * Copyright (C) 2005 Michael Lorenz
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 * MICHAEL LORENZ 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/* $NetBSD: pnozz.h,v 1.2 2021/05/27 04:48:10 jdc Exp $ */
24
25#ifndef PNOZZ_H
26#define PNOZZ_H
27
28#include "xf86.h"
29#include "xf86_OSproc.h"
30#include "xf86RamDac.h"
31#include <X11/Xmd.h>
32#include <dev/sun/fbio.h>
33#include "gcstruct.h"
34#include "pnozz_regs.h"
35#include "xf86sbusBus.h"
36#ifdef HAVE_XAA_H
37#include "xaa.h"
38#endif
39#include "exa.h"
40
41typedef struct {
42	unsigned int fg, bg;			/* FG/BG colors for stipple */
43	unsigned int patalign;                  /* X/Y alignment of bits */
44        unsigned int alu;			/* Transparent/Opaque + rop */
45        unsigned int bits[32];                  /* The stipple bits themselves */
46} PnozzStippleRec, *PnozzStipplePtr;
47
48typedef struct {
49	int type;
50	PnozzStipplePtr stipple;
51} PnozzPrivGCRec, *PnozzPrivGCPtr;
52
53typedef struct {
54	unsigned char	*fb;	/* 2MB framebuffer */
55	unsigned char	*fbc;	/* registers, so we can just add a byte offset */
56	int		vclipmax;
57	int		width;
58	int		height, scanlinesize, maxheight;
59	int		depthshift;
60	int		vidmem;
61
62	sbusDevicePtr	psdp;
63	struct fbcursor Cursor;
64	Bool		HWCursor;
65	Bool		NoAccel;
66	Bool		useXAA;
67	CloseScreenProcPtr CloseScreen;
68
69	xf86CursorInfoPtr CursorInfoRec;
70	unsigned int	CursorXY;
71	int		CursorBg, CursorFg;
72	Bool		CursorEnabled;
73	unsigned int	cursmask[32];	/* cursor mask bits */
74	unsigned int	cursbits[32];	/* what to show where mask enabled */
75	unsigned char pal[9];
76
77	OptionInfoPtr	Options;
78	ExaDriverPtr	pExa;
79	int		srcoff;
80#ifdef HAVE_XAA_H
81	unsigned char	*buffers[2];
82#endif
83	/*
84	 * XXX this is enough for everything a SPARCbook could do on it's
85	 * internal display but not necessarily for an external one
86	 */
87	CARD32		Buffer[6400];
88	int		words, last_word;
89	int		offset_mask;
90
91	int		DidSave;
92	unsigned int	SvSysConf;	/* System Configuration Register */
93	unsigned int	CRTC[4];	/* CRTC values for horizontal timing */
94	unsigned int	SvMemCtl;	/* memory control register */
95	unsigned char	SvDAC_MCCR;	/* DAC Misc Clock Ctrl (0x02) */
96	unsigned char	SvDAC_PF;	/* DAC Pixel Format (0x0a) */
97	unsigned char	SvDAC_MC3;	/* DAC Misc Control 3 */
98	unsigned char	SvVCO;		/* DAC System PLL VCO divider */
99	unsigned char	SvPLL;		/* clock multiplier / divider */
100
101} PnozzRec, *PnozzPtr;
102
103extern int  PnozzScreenPrivateIndex;
104extern int  PnozzGCPrivateIndex;
105extern int  PnozzWindowPrivateIndex;
106
107#define GET_PNOZZ_FROM_SCRN(p)    ((p->driverPrivate))
108
109#define PnozzGetScreenPrivate(s)						\
110((PnozzPtr) (s)->devPrivates[PnozzScreenPrivateIndex].ptr)
111
112#define PnozzGetGCPrivate(g)						\
113((PnozzPrivGCPtr) (g)->devPrivates [PnozzGCPrivateIndex].ptr)
114
115#define PnozzGetWindowPrivate(w)						\
116((PnozzStipplePtr) (w)->devPrivates[PnozzWindowPrivateIndex].ptr)
117
118#define PnozzSetWindowPrivate(w,p) 					\
119((w)->devPrivates[PnozzWindowPrivateIndex].ptr = (pointer) p)
120
121void pnozz_write_4(PnozzPtr, int, unsigned int);
122unsigned int pnozz_read_4(PnozzPtr, int);
123void pnozz_write_dac(PnozzPtr, int, unsigned char);
124unsigned char pnozz_read_dac(PnozzPtr, int);
125void pnozz_write_dac_ctl_reg(PnozzPtr, int, unsigned char);
126void pnozz_write_dac_ctl_reg_2(PnozzPtr, int, unsigned short);
127unsigned char pnozz_read_dac_ctl_reg(PnozzPtr, int);
128void pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int);
129
130int PnozzAccelInit(ScrnInfoPtr);
131Bool PnozzDGAInit(ScreenPtr);
132int PnozzEXAInit(ScreenPtr);
133void PnozzHideCursor(ScrnInfoPtr);
134void PnozzShowCursor(ScrnInfoPtr);
135
136#endif /* PNOZZ_H */
137