/[gxemul]/trunk/src/include/pxreg.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/src/include/pxreg.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations)
Mon Oct 8 16:18:00 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 12563 byte(s)
++ trunk/HISTORY	(local)
$Id: HISTORY,v 1.707 2005/04/27 16:37:33 debug Exp $
20050408	Some minor updates to the wdc. Linux now doesn't complain
		anymore if a disk is non-present.
20050409	Various minor fixes (a bintrans bug, and some other things).
		The wdc seems to work with Playstation2 emulation, but there
		is a _long_ annoying delay when disks are detected.
		Fixing a really important bintrans bug (when devices and RAM
		are mixed within 4KB pages), which was triggered with
		NetBSD/playstation2 kernels.
20050410	Adding a dummy dev_ps2_ether (just so that NetBSD doesn't
		complain as much during bootup).
		Symbols starting with '$' are now ignored.
		Renaming dev_ps2_ohci.c to dev_ohci.c, etc.
20050411	Moving the bintrans-cache-isolation check from cpu_mips.c to
		cpu_mips_coproc.c. (I thought this would give a speedup, but
		it's not noticable.)
		Better playstation2 sbus interrupt code.
		Skip ahead many ticks if the count register is read manually.
		(This increases the speed of delay-loops that simply read
		the count register.)
20050412	Updates to the playstation2 timer/interrupt code.
		Some other minor updates.
20050413	NetBSD/cobalt runs from a disk image :-) including userland;
		updating the documentation on how to install NetBSD/cobalt
		using NetBSD/pmax (!).
		Some minor bintrans updates (no real speed improvement) and
		other minor updates (playstation2 now uses the -o options).
20050414	Adding a dummy x86 (and AMD64) mode.
20050415	Adding some (32-bit and 16-bit) x86 instructions.
		Adding some initial support for non-SCSI, non-IDE floppy
		images. (The x86 mode can boot from these, more or less.)
		Moving the devices/ and include/ directories to src/devices/
		and src/include/, respectively.
20050416	Continuing on the x86 stuff. (Adding pc_bios.c and some simple
		support for software interrupts in 16-bit mode.)
20050417	Ripping out most of the x86 instruction decoding stuff, trying
		to rewrite it in a cleaner way.
		Disabling some of the least working CPU families in the
		configure script (sparc, x86, alpha, hppa), so that they are
		not enabled by default.
20050418	Trying to fix the bug which caused problems when turning on
		and off bintrans interactively, by flushing the bintrans cache
		whenever bintrans is manually (re)enabled.
20050419	Adding the 'lswi' ppc instruction.
		Minor updates to the x86 instruction decoding.
20050420	Renaming x86 register name indices from R_xx to X86_R_xx (this
		makes building on Tru64 nicer).
20050422	Adding a check for duplicate MIPS TLB entries on tlbwr/tlbwi.
20050427	Adding screenshots to guestoses.html.
		Some minor fixes and testing for the next release.

==============  RELEASE 0.3.2  ==============


1 /* gxemul: $Id: pxreg.h,v 1.2 2005/03/05 12:34:03 debug Exp $ */
2 /* $NetBSD: pxreg.h,v 1.8 2000/06/13 13:39:12 ad Exp $ */
3
4 #ifndef _PMAX_DEV_PXREG_H_
5 #define _PMAX_DEV_PXREG_H_
6
7 /*-
8 * Copyright (c) 1999 The NetBSD Foundation, Inc.
9 * All rights reserved.
10 *
11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Andrew Doran.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 * must display the following acknowledgement:
24 * This product includes software developed by the NetBSD
25 * Foundation, Inc. and its contributors.
26 * 4. Neither the name of The NetBSD Foundation nor the names of its
27 * contributors may be used to endorse or promote products derived
28 * from this software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
31 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
32 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
34 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 * POSSIBILITY OF SUCH DAMAGE.
41 */
42
43 /*
44 * Definitions for the PixelStamp on Digital's 2D and 3D TurboChannel
45 * graphics accelerators. Stamp command packets take this general format:
46 *
47 * command word
48 *
49 * per-packet context (optional):
50 * line width
51 * xy mask
52 * cliping rectangle min & max
53 * rgb constant
54 * z constant
55 *
56 * per-primitive context (optional):
57 * xy mask
58 * xy mask address
59 * primitive data (vertices, spans info, video)
60 * line width
61 * halfspace equals conditions
62 * rgb flat, or rgb{1,2,3} smooth
63 * z flat, or z{1,2,3} smooth
64 */
65
66 /*
67 * These definitions are for the stamp command word, the first in
68 * each packet. This is a 32-bit word on all architectures.
69 */
70
71 /* opcode type */
72 #define STAMP_CMD_POINTS (0x0000)
73 #define STAMP_CMD_LINES (0x0001)
74 #define STAMP_CMD_TRIANGLES (0x0002)
75 #define STAMP_CMD_COPYSPANS (0x0005)
76 #define STAMP_CMD_READSPANS (0x0006)
77 #define STAMP_CMD_WRITESPANS (0x0007)
78 #define STAMP_CMD_VIDEO (0x0008)
79
80 /* RGB format */
81 #define STAMP_RGB_NONE (0x0000)
82 #define STAMP_RGB_CONST (0x0010)
83 #define STAMP_RGB_FLAT (0x0020)
84 #define STAMP_RGB_SMOOTH (0x0030)
85
86 /* Z format */
87 #define STAMP_Z_NONE (0x0000)
88 #define STAMP_Z_CONST (0x0040)
89 #define STAMP_Z_FLAT (0x0080)
90 #define STAMP_Z_SMOOTH (0x00c0)
91
92 /* XY mask format */
93 #define STAMP_XY_NONE (0x0000)
94 #define STAMP_XY_PERPACKET (0x0100)
95 #define STAMP_XY_PERPRIMATIVE (0x0200)
96
97 /* line width format */
98 #define STAMP_LW_NONE (0x0000)
99 #define STAMP_LW_PERPACKET (0x0400)
100 #define STAMP_LW_PERPRIMATIVE (0x0800)
101
102 /* misc. */
103 #define STAMP_CLIPRECT (0x00080000)
104 #define STAMP_MESH (0x00200000)
105 #define STAMP_AALINE (0x00800000)
106 #define STAMP_HS_EQUALS (0x80000000)
107
108 /*
109 * These definitions are for the stamp update word, also part of
110 * each packet.
111 */
112
113 /* plane */
114 #define STAMP_PLANE_8X3 (0 << 5)
115 #define STAMP_PLANE_24 (1 << 5)
116
117 /* when to write enable the stamp */
118 #define STAMP_WE_SIGN (0x04 << 8)
119 #define STAMP_WE_XYMASK (0x02 << 8)
120 #define STAMP_WE_CLIPRECT (0x01 << 8)
121 #define STAMP_WE_NONE (0x00 << 8)
122
123 /* update method */
124 #define STAMP_METHOD_CLEAR (0x60 << 12)
125 #define STAMP_METHOD_AND (0x14 << 12)
126 #define STAMP_METHOD_ANDREV (0x15 << 12)
127 #define STAMP_METHOD_COPY (0x20 << 12)
128 #define STAMP_METHOD_ANDINV (0x16 << 12)
129 #define STAMP_METHOD_NOOP (0x40 << 12)
130 #define STAMP_METHOD_XOR (0x11 << 12)
131 #define STAMP_METHOD_OR (0x0f << 12)
132 #define STAMP_METHOD_NOR (0x17 << 12)
133 #define STAMP_METHOD_EQUIV (0x10 << 12)
134 #define STAMP_METHOD_INV (0x4e << 12)
135 #define STAMP_METHOD_ORREV (0x0e << 12)
136 #define STAMP_METHOD_COPYINV (0x2d << 12)
137 #define STAMP_METHOD_ORINV (0x0d << 12)
138 #define STAMP_METHOD_NAND (0x0c << 12)
139 #define STAMP_METHOD_SET (0x6c << 12)
140 #define STAMP_METHOD_SUM (0x00 << 12)
141 #define STAMP_METHOD_DIFF (0x02 << 12)
142 #define STAMP_METHOD_REVDIFF (0x01 << 12)
143
144 /* double buffering */
145 #define STAMP_DB_NONE (0x00 << 28)
146 #define STAMP_DB_01 (0x01 << 28)
147 #define STAMP_DB_12 (0x02 << 28)
148 #define STAMP_DB_02 (0x04 << 28)
149
150 /* misc */
151 #define STAMP_UPDATE_ENABLE (1)
152 #define STAMP_SAVE_SIGN (1<<6)
153 #define STAMP_SAVE_ALPHA (1<<7)
154 #define STAMP_SUPERSAMPLE (1<<11)
155 #define STAMP_SPAN (1<<19)
156 #define STAMP_COPYSPAN_ALIGNED (1<<20)
157 #define STAMP_MINMAX (1<<21)
158 #define STAMP_MULT (1<<22)
159 #define STAMP_MULTACC (1<<23)
160 #define STAMP_HALF_BUFF (1<27)
161 #define STAMP_INITIALIZE (1<<31)
162
163 #ifdef _KERNEL
164 #define STAMP_WIDTH (pxi->pxi_stampw)
165 #define STAMP_HEIGHT (pxi->pxi_stamph)
166 #endif
167
168 #define XMASKADDR(__sx, __a) (((__a)-((__sx) % STAMP_WIDTH)) & 0xF)
169 #define YMASKADDR(__sy, __b) (((__b)-((__sy) % STAMP_HEIGHT)) & 0xF)
170 #define XYMASKADDR(_x,_y,_a,_b) (XMASKADDR(_x,_a) << 16 | YMASKADDR(_y,_b))
171
172 /*
173 * For the poll register. Don't mess with the # of retries or the delay
174 * unless you know what you're doing. According to OSF header files,
175 * the delay on Alpha is 20us, and the # of retries should be 4000. This is
176 * inadequate, particularly on the PXG which seems to run at a higher
177 * frequency. The STIC gets wedged while scrolling quite a lot.
178 */
179 #define STAMP_OK (0)
180 #define STAMP_BUSY (1)
181 #define STAMP_RETRIES (7000)
182 #define STAMP_DELAY (20)
183
184 #if 0 /* was: #ifdef alpha in NetBSD */
185 #define __PXS(n) ((n) << 1)
186 #else
187 #define __PXS(n) (n)
188 #endif
189
190 /*
191 * Hardware offsets within PX board's TC slot.
192 */
193 #define PX_STIC_POLL_OFFSET __PXS(0x000000) /* STIC DMA poll space */
194 #define PX_STAMP_OFFSET __PXS(0x0c0000) /* pixelstamp space on STIC */
195 #define PX_STIC_OFFSET __PXS(0x180000) /* STIC registers */
196 #define PX_VDAC_OFFSET __PXS(0x200000) /* VDAC registers (bt459) */
197 #define PX_VDAC_RESET_OFFSET __PXS(0x300000) /* VDAC reset register */
198 #define PX_ROM_OFFSET __PXS(0x300000) /* ROM code */
199
200 /*
201 * Hardware offsets within PXG board's TC slot.
202 */
203 #define PXG_STIC_POLL_OFFSET __PXS(0x000000) /* STIC DMA poll space */
204 #define PXG_STAMP_OFFSET __PXS(0x0c0000) /* pixelstamp space on STIC */
205 #define PXG_STIC_OFFSET __PXS(0x180000) /* STIC registers */
206 #define PXG_SRAM_OFFSET __PXS(0x200000) /* N10 SRAM */
207 #define PXG_HOST_INTR_OFFSET __PXS(0x280000) /* N10 host interrupt */
208 #define PXG_COPROC_INTR_OFFSET __PXS(0x2c0000) /* N10 coprocessor interrupt */
209 #define PXG_VDAC_OFFSET __PXS(0x300000) /* VDAC registers (bt459) */
210 #define PXG_VDAC_RESET_OFFSET __PXS(0x340000) /* VDAC reset register */
211 #define PXG_ROM_OFFSET __PXS(0x380000) /* ROM code */
212 #define PXG_N10_START_OFFSET __PXS(0x380000) /* N10 start register */
213 #define PXG_N10_RESET_OFFSET __PXS(0x3c0000) /* N10 reset (stop?) register */
214
215 /*
216 * STIC registers
217 */
218 struct stic_regs {
219 #if 0 /* was: ifdef __alpha in NetBSD */
220 volatile int32_t __pad0;
221 volatile int32_t __pad1;
222 volatile int32_t __pad2;
223 volatile int32_t __pad3;
224 volatile int32_t hsync;
225 volatile int32_t __pad4;
226 volatile int32_t hsync2;
227 volatile int32_t __pad5;
228 volatile int32_t hblank;
229 volatile int32_t __pad6;
230 volatile int32_t vsync;
231 volatile int32_t __pad7;
232 volatile int32_t vblank;
233 volatile int32_t __pad8;
234 volatile int32_t vtest;
235 volatile int32_t __pad9;
236 volatile int32_t ipdvint;
237 volatile int32_t __pad10;
238 volatile int32_t __pad11;
239 volatile int32_t __pad12;
240 volatile int32_t sticsr;
241 volatile int32_t __pad13;
242 volatile int32_t busdat;
243 volatile int32_t __pad14;
244 volatile int32_t busadr;
245 volatile int32_t __pad15;
246 volatile int32_t __pad16;
247 volatile int32_t __pad17;
248 volatile int32_t buscsr;
249 volatile int32_t __pad18;
250 volatile int32_t modcl;
251 volatile int32_t __pad19;
252 #else /* __alpha */
253 volatile int32_t __pad0;
254 volatile int32_t __pad1;
255 volatile int32_t hsync;
256 volatile int32_t hsync2;
257 volatile int32_t hblank;
258 volatile int32_t vsync;
259 volatile int32_t vblank;
260 volatile int32_t vtest;
261 volatile int32_t ipdvint;
262 volatile int32_t __pad2;
263 volatile int32_t sticsr;
264 volatile int32_t busdat;
265 volatile int32_t busadr;
266 volatile int32_t __pad3;
267 volatile int32_t buscsr;
268 volatile int32_t modcl;
269 #endif /* __alpha */
270 };
271
272 /*
273 * Bit definitions for px_stic_regs.stic_csr.
274 * these appear to exactly what the PROM tests use.
275 */
276 #define STIC_CSR_TSTFNC 0x00000003
277 # define STIC_CSR_TSTFNC_NORMAL 0
278 # define STIC_CSR_TSTFNC_PARITY 1
279 # define STIC_CSR_TSTFNC_CNTPIX 2
280 # define STIC_CSR_TSTFNC_TSTDAC 3
281 #define STIC_CSR_CHECKPAR 0x00000004
282 #define STIC_CSR_STARTVT 0x00000010
283 #define STIC_CSR_START 0x00000020
284 #define STIC_CSR_RESET 0x00000040
285 #define STIC_CSR_STARTST 0x00000080
286
287 /*
288 * Bit definitions for stic_regs.int.
289 * Three four-bit wide fields, for error (E), vertical-blank (V), and
290 * packetbuf-done (P) intererupts, respectively.
291 * The low-order three bits of each field are enable, requested,
292 * and acknowledge bits. The top bit of each field is unused.
293 */
294 #define STIC_INT_E_EN 0x00000001
295 #define STIC_INT_E 0x00000002
296 #define STIC_INT_E_WE 0x00000004
297
298 #define STIC_INT_V_EN 0x00000100
299 #define STIC_INT_V 0x00000200
300 #define STIC_INT_V_WE 0x00000400
301
302 #define STIC_INT_P_EN 0x00010000
303 #define STIC_INT_P 0x00020000
304 #define STIC_INT_P_WE 0x00040000
305
306 #define STIC_INT_E_MASK (STIC_INT_E_EN | STIC_INT_E | STIC_INT_E_WE)
307 #define STIC_INT_V_MASK (STIC_INT_V_EN | STIC_INT_V | STIC_INT_V_WE)
308 #define STIC_INT_P_MASK (STIC_INT_P_EN | STIC_INT_P | STIC_INT_P_WE)
309 #define STIC_INT_MASK (STIC_INT_E_MASK | STIC_INT_P_MASK | STIC_INT_V_MASK)
310
311 #define STIC_INT_WE (STIC_INT_E_WE | STIC_INT_V_WE | STIC_INT_P_WE)
312 #define STIC_INT_CLR (STIC_INT_E_EN | STIC_INT_V_EN | STIC_INT_P_EN)
313
314 /*
315 * Convert a system physical address to STIC poll offset. Polling the offset
316 * returned will initiate DMA at the provided address. For the PX, the STIC
317 * only sees 23-bits (8MB) of address space. Also, bits 21-22 in physical
318 * address space map to bits 27-28 in the STIC's warped view of the world.
319 * This is also true for bits 15-20, which map to bits 18-23. Bits 0 and 1
320 * are meaningless, because everything is word aligned.
321 *
322 * The final shift-right-by-9 is to map the address to poll register offset.
323 * These begin at px_softc.poll (which should obviously be added to the
324 * return value of this function to get a vaild poll address).
325 *
326 * This shift right gives us a granularity of 512 bytes when DMAing. The
327 * holes in STIC address space mean that DMAs can never cross a 32kB
328 * boundary. The maximum size for a DMA AFAIK is about 4kB.
329 *
330 * For the PXG, the PA is relative to SRAM (i.e. i860) address space, not
331 * system address space. The poll address will either return STAMP_OK, or
332 * STAMP_BUSY.
333 */
334
335 #if 0
336 static __inline__ u_long px_sys2stic __P((void *));
337 static __inline__ u_long px_sys2dma __P((void *));
338 static __inline__ volatile int32_t *px_poll_addr __P((caddr_t, void *));
339
340 static __inline__ u_long
341 px_sys2stic(addr)
342 void *addr;
343 {
344 u_long v;
345
346 v = (u_long)addr;
347 v = ((v & ~0x7fff) << 3) | (v & 0x7fff);
348 return (v & 0x1ffff800);
349 }
350
351 static __inline__ u_long
352 px_sys2dma(addr)
353 void *addr;
354 {
355
356 return px_sys2stic(addr) >> 9;
357 }
358
359 /*
360 * This is simply a wrapper for the above that returns a proper VA to
361 * poll when given a px_softc.
362 */
363 static __inline__ volatile int32_t *
364 px_poll_addr(slotbase, addr)
365 caddr_t slotbase;
366 void *addr;
367 {
368
369 return (volatile int32_t *)(slotbase + px_sys2dma(addr));
370 }
371 #endif
372
373 #endif /* !_PMAX_DEV_PXREG_H_ */

  ViewVC Help
Powered by ViewVC 1.1.26