xref: /netbsd/sys/dev/ic/i128reg.h (revision a4cb521a)
1*a4cb521aSrin /*	$NetBSD: i128reg.h,v 1.5 2020/04/16 23:29:53 rin Exp $ */
2740e56f3Smacallan 
3740e56f3Smacallan /*-
4740e56f3Smacallan  * Copyright (c) 2007 Michael Lorenz
5740e56f3Smacallan  * All rights reserved.
6740e56f3Smacallan  *
7740e56f3Smacallan  * Redistribution and use in source and binary forms, with or without
8740e56f3Smacallan  * modification, are permitted provided that the following conditions
9740e56f3Smacallan  * are met:
10740e56f3Smacallan  * 1. Redistributions of source code must retain the above copyright
11740e56f3Smacallan  *    notice, this list of conditions and the following disclaimer.
12740e56f3Smacallan  * 2. Redistributions in binary form must reproduce the above copyright
13740e56f3Smacallan  *    notice, this list of conditions and the following disclaimer in the
14740e56f3Smacallan  *    documentation and/or other materials provided with the distribution.
15740e56f3Smacallan  *
16740e56f3Smacallan  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17740e56f3Smacallan  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18740e56f3Smacallan  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19740e56f3Smacallan  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20740e56f3Smacallan  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21740e56f3Smacallan  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22740e56f3Smacallan  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23740e56f3Smacallan  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24740e56f3Smacallan  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25740e56f3Smacallan  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26740e56f3Smacallan  * POSSIBILITY OF SUCH DAMAGE.
27740e56f3Smacallan  */
28740e56f3Smacallan 
29*a4cb521aSrin #include <sys/cdefs.h>
30*a4cb521aSrin __KERNEL_RCSID(0, "$NetBSD: i128reg.h,v 1.5 2020/04/16 23:29:53 rin Exp $");
31*a4cb521aSrin 
32740e56f3Smacallan /*
33740e56f3Smacallan  * register definition for Number Nine Imagine 128 graphics controllers
34740e56f3Smacallan  *
35740e56f3Smacallan  * adapted from XFree86's i128 driver source
36740e56f3Smacallan  */
37740e56f3Smacallan 
38740e56f3Smacallan #ifndef I128REG_H
39740e56f3Smacallan #define I128REG_H
40740e56f3Smacallan 
41740e56f3Smacallan #define INTP     0x4000
42740e56f3Smacallan #define  INTP_DD_INT 0x01	/* drawing op completed  */
43740e56f3Smacallan #define  INTP_CL_INT 0x02
44740e56f3Smacallan #define INTM     0x4004
45740e56f3Smacallan #define  INTM_DD_MSK 0x01
46740e56f3Smacallan #define  INTM_CL_MSK 0x02
47740e56f3Smacallan #define FLOW     0x4008
48740e56f3Smacallan #define  FLOW_DEB    0x01	/* drawing engine busy   */
49740e56f3Smacallan #define  FLOW_MCB    0x02	/* mem controller busy   */
50740e56f3Smacallan #define  FLOW_CLP    0x04
51740e56f3Smacallan #define  FLOW_PRV    0x08	/* prev cmd still running or cache ready */
52740e56f3Smacallan #define BUSY     0x400C
53740e56f3Smacallan #define  BUSY_BUSY   0x01	/* command pipeline busy */
54740e56f3Smacallan #define XYW_AD   0x4010
55740e56f3Smacallan #define Z_CTRL   0x4018
56740e56f3Smacallan #define BUF_CTRL 0x4020
57740e56f3Smacallan #define  BC_AMV      0x02
58740e56f3Smacallan #define  BC_MP       0x04
59740e56f3Smacallan #define  BC_AMD      0x08
60740e56f3Smacallan #define  BC_SEN_MSK  0x0300
61740e56f3Smacallan #define  BC_SEN_DB   0x0000
62740e56f3Smacallan #define  BC_SEN_VB   0x0100
63740e56f3Smacallan #define  BC_SEN_MB   0x0200
64740e56f3Smacallan #define  BC_SEN_CB   0x0300
65740e56f3Smacallan #define  BC_DEN_MSK  0x0C00
66740e56f3Smacallan #define  BC_DEN_DB   0x0000
67740e56f3Smacallan #define  BC_DEN_VB   0x0400
68740e56f3Smacallan #define  BC_DEN_MB   0x0800
69740e56f3Smacallan #define  BC_DEN_CB   0x0C00
70740e56f3Smacallan #define  BC_DSE      0x1000
71740e56f3Smacallan #define  BC_VSE      0x2000
72740e56f3Smacallan #define  BC_MSE      0x4000
73740e56f3Smacallan #define  BC_PS_MSK   0x001F0000
74740e56f3Smacallan #define  BC_MDM_MSK  0x00600000
75740e56f3Smacallan #define  BC_MDM_KEY  0x00200000
76740e56f3Smacallan #define  BC_MDM_PLN  0x00400000
77740e56f3Smacallan #define  BC_BLK_ENA  0x00800000
78740e56f3Smacallan #define  BC_PSIZ_MSK 0x03000000
79740e56f3Smacallan #define  BC_PSIZ_8B  0x00000000
80740e56f3Smacallan #define  BC_PSIZ_16B 0x01000000
81740e56f3Smacallan #define  BC_PSIZ_32B 0x02000000
82740e56f3Smacallan #define  BC_PSIZ_NOB 0x03000000
83740e56f3Smacallan #define  BC_CO       0x40000000
84740e56f3Smacallan #define  BC_CR       0x80000000
85740e56f3Smacallan #define DE_PGE   0x4024
86740e56f3Smacallan #define  DP_DVP_MSK  0x0000001F
87740e56f3Smacallan #define  DP_MP_MSK   0x000F0000
88740e56f3Smacallan #define DE_SORG   0x4028
89740e56f3Smacallan #define DE_DORG   0x402C
90740e56f3Smacallan #define DE_MSRC   0x4030
91740e56f3Smacallan #define DE_WKEY   0x4038
92740e56f3Smacallan #define DE_KYDAT  0x403C
93740e56f3Smacallan #define DE_ZPTCH  0x403C
94740e56f3Smacallan #define DE_SPTCH  0x4040
95740e56f3Smacallan #define DE_DPTCH  0x4044
96740e56f3Smacallan #define CMD       0x4048
97740e56f3Smacallan #define  CMD_OPC_MSK 0x000000FF
98740e56f3Smacallan #define  CMD_ROP_MSK 0x0000FF00
99740e56f3Smacallan #define  CMD_STL_MSK 0x001F0000
100740e56f3Smacallan #define  CMD_CLP_MSK 0x00E00000
101740e56f3Smacallan #define  CMD_PAT_MSK 0x0F000000
102740e56f3Smacallan #define  CMD_HDF_MSK 0x70000000
103740e56f3Smacallan #define CMD_OPC   0x4050
104740e56f3Smacallan #define  CO_NOOP     0x00
105740e56f3Smacallan #define  CO_BITBLT   0x01
106740e56f3Smacallan #define  CO_LINE     0x02
107740e56f3Smacallan #define  CO_ELINE    0x03
108740e56f3Smacallan #define  CO_TRIAN    0x04
109740e56f3Smacallan #define  CO_RXFER    0x06
110740e56f3Smacallan #define  CO_WXFER    0x07
111740e56f3Smacallan #define CMD_ROP   0x4054
112740e56f3Smacallan #define  CR_CLEAR    0x00
113740e56f3Smacallan #define  CR_NOR      0x01
114740e56f3Smacallan #define  CR_AND_INV  0x02
115740e56f3Smacallan #define  CR_COPY_INV 0x03
116740e56f3Smacallan #define  CR_AND_REV  0x04
117740e56f3Smacallan #define  CR_INVERT   0x05
118740e56f3Smacallan #define  CR_XOR      0x06
119740e56f3Smacallan #define  CR_NAND     0x07
120740e56f3Smacallan #define  CR_AND      0x08
121740e56f3Smacallan #define  CR_EQUIV    0x09
122740e56f3Smacallan #define  CR_NOOP     0x0A
123740e56f3Smacallan #define  CR_OR_INV   0x0B
124740e56f3Smacallan #define  CR_COPY     0x0C
125740e56f3Smacallan #define  CR_OR_REV   0x0D
126740e56f3Smacallan #define  CR_OR       0x0E
127740e56f3Smacallan #define  CR_SET      0x0F
128740e56f3Smacallan #define CMD_STYLE 0x4058
129740e56f3Smacallan #define  CS_SOLID    0x01
130740e56f3Smacallan #define  CS_TRNSP    0x02
131740e56f3Smacallan #define  CS_STP_NO   0x00
132740e56f3Smacallan #define  CS_STP_PL   0x04
133740e56f3Smacallan #define  CS_STP_PA32 0x08
134740e56f3Smacallan #define  CS_STP_PA8  0x0C
135740e56f3Smacallan #define  CS_EDI      0x10
136740e56f3Smacallan #define CMD_PATRN 0x405C
137740e56f3Smacallan #define  CP_APAT_NO  0x00
138740e56f3Smacallan #define  CP_APAT_8X  0x01
139740e56f3Smacallan #define  CP_APAT_32X 0x02
140740e56f3Smacallan #define  CP_NLST     0x04
141740e56f3Smacallan #define  CP_PRST     0x08
142740e56f3Smacallan #define CMD_CLP   0x4060
143740e56f3Smacallan #define  CC_NOCLP    0x00
144740e56f3Smacallan #define  CC_CLPRECI  0x02
145740e56f3Smacallan #define  CC_CLPRECO  0x03
146740e56f3Smacallan #define  CC_CLPSTOP  0x04
147740e56f3Smacallan #define CMD_HDF   0x4064
148740e56f3Smacallan #define  CH_BIT_SWP  0x01
149740e56f3Smacallan #define  CH_BYT_SWP  0x02
150740e56f3Smacallan #define  CH_WRD_SWP  0x04
151740e56f3Smacallan #define FORE      0x4068
152740e56f3Smacallan #define BACK      0x406C
153740e56f3Smacallan #define MASK      0x4070
154740e56f3Smacallan #define RMSK      0x4074
155740e56f3Smacallan #define LPAT      0x4078
156740e56f3Smacallan #define PCTRL     0x407C
157740e56f3Smacallan #define  PC_PLEN_MSK  0x0000001F
158740e56f3Smacallan #define  PC_PSCL_MSK  0x000000E0
159740e56f3Smacallan #define  PC_SPTR_MSK  0x00001F00
160740e56f3Smacallan #define  PC_SSCL_MSK  0x0000E000
161740e56f3Smacallan #define  PC_STATE_MSK 0xFFFF0000
162e44cd7acSmacallan #define CLPTL     0x4080		/* clipping top/left */
163740e56f3Smacallan #define  CLPTLY_MSK   0x0000FFFF
164740e56f3Smacallan #define  CLPTLX_MSK   0xFFFF0000
165e44cd7acSmacallan #define CLPBR     0x4084		/* clipping bottom/right */
166740e56f3Smacallan #define  CLPBRY_MSK   0x0000FFFF
167740e56f3Smacallan #define  CLPBRX_MSK   0xFFFF0000
168740e56f3Smacallan #define XY0_SRC   0x4088
169740e56f3Smacallan #define XY1_DST   0x408C      /* trigger */
170740e56f3Smacallan #define XY2_WH    0x4090
171740e56f3Smacallan #define XY3_DIR   0x4094
172740e56f3Smacallan #define  DIR_LR_TB    0x00000000
173740e56f3Smacallan #define  DIR_LR_BT    0x00000001
174740e56f3Smacallan #define  DIR_RL_TB    0x00000002
175740e56f3Smacallan #define  DIR_RL_BT    0x00000003
176740e56f3Smacallan #define  DIR_BT		0x00000001
177740e56f3Smacallan #define  DIR_RL		0x00000002
178740e56f3Smacallan #define XY4_ZM    0x4098
179740e56f3Smacallan #define  ZOOM_NONE    0x00000000
180740e56f3Smacallan #define  XY_Y_DATA    0x0000FFFF
181740e56f3Smacallan #define  XY_X_DATA    0xFFFF0000
182740e56f3Smacallan #define  XY_I_DATA1   0x0000FFFF
183740e56f3Smacallan #define  XY_I_DATA2   0xFFFF0000
184740e56f3Smacallan #define DL_ADR    0x40F8
185740e56f3Smacallan #define DL_CNTRL  0x40FC
186740e56f3Smacallan #define ACNTRL    0x416C
187740e56f3Smacallan 
188740e56f3Smacallan /* wait until the blitter can accept another command */
189740e56f3Smacallan #define I128_READY(tag, regh) \
190740e56f3Smacallan 	do {} while ((bus_space_read_4(tag, regh, BUSY) & BUSY_BUSY) != 0);
191740e56f3Smacallan 
192740e56f3Smacallan /* wait until it's safe to access video memory */
193740e56f3Smacallan #define I128_DONE(tag, regh) \
194740e56f3Smacallan 	do {} while ((bus_space_read_4(tag, regh, FLOW) & 0x0f) != 0);
195740e56f3Smacallan 
196740e56f3Smacallan #endif /* I128REG_H */
197