Home | History | Annotate | Line # | Download | only in dev
sxreg.h revision 1.2
      1  1.2  macallan /*	$NetBSD: sxreg.h,v 1.2 2013/02/06 04:06:29 macallan Exp $	*/
      2  1.1  macallan 
      3  1.1  macallan /*-
      4  1.1  macallan  * Copyright (c) 2013 The NetBSD Foundation, Inc.
      5  1.1  macallan  * All rights reserved.
      6  1.1  macallan  *
      7  1.1  macallan  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1  macallan  * by Michael Lorenz.
      9  1.1  macallan  *
     10  1.1  macallan  * Redistribution and use in source and binary forms, with or without
     11  1.1  macallan  * modification, are permitted provided that the following conditions
     12  1.1  macallan  * are met:
     13  1.1  macallan  * 1. Redistributions of source code must retain the above copyright
     14  1.1  macallan  *    notice, this list of conditions and the following disclaimer.
     15  1.1  macallan  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  macallan  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  macallan  *    documentation and/or other materials provided with the distribution.
     18  1.1  macallan  *
     19  1.1  macallan  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  1.1  macallan  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  1.1  macallan  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  1.1  macallan  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  1.1  macallan  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  1.1  macallan  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  1.1  macallan  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  1.1  macallan  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  1.1  macallan  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  1.1  macallan  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  1.1  macallan  * POSSIBILITY OF SUCH DAMAGE.
     30  1.1  macallan  */
     31  1.1  macallan 
     32  1.1  macallan /* register definitions for Sun's SX / SPAM rendering engine */
     33  1.1  macallan 
     34  1.1  macallan #ifndef SXREG_H
     35  1.1  macallan #define SXREG_H
     36  1.1  macallan 
     37  1.1  macallan /* SX control registers */
     38  1.1  macallan #define SX_CONTROL_STATUS	0x00000000
     39  1.1  macallan #define SX_ERROR		0x00000004
     40  1.1  macallan #define SX_PAGE_BOUND_LOWER	0x00000008
     41  1.1  macallan #define SX_PAGE_BOUND_UPPER	0x0000000c
     42  1.1  macallan #define SX_PLANEMASK		0x00000010
     43  1.1  macallan #define SX_ROP_CONTROL		0x00000014	/* 8 bit ROP */
     44  1.1  macallan #define SX_IQ_OVERFLOW_COUNTER	0x00000018
     45  1.1  macallan #define SX_DIAGNOSTICS		0x0000001c
     46  1.1  macallan #define SX_INSTRUCTIONS		0x00000020
     47  1.1  macallan #define SX_ID			0x00000028
     48  1.1  macallan #define SX_R0_INIT		0x0000002c
     49  1.1  macallan #define SX_SOFTRESET		0x00000030
     50  1.1  macallan /* write registers directly, only when processor is stopped */
     51  1.1  macallan #define SX_DIRECT_R0		0x00000100
     52  1.1  macallan #define SX_DIRECT_R1		0x00000104	/* and so on until R127 */
     53  1.1  macallan /* write registers via pseudo instructions */
     54  1.1  macallan #define SX_QUEUED_R0		0x00000300
     55  1.1  macallan #define SX_QUEUED_R1		0x00000304	/* and so on until R127 */
     56  1.2  macallan #define SX_QUEUED(r)		(0x300 + (r << 2))
     57  1.2  macallan 
     58  1.2  macallan /* special purpose registers */
     59  1.2  macallan #define R_ZERO	0
     60  1.2  macallan #define R_SCAM	1
     61  1.2  macallan #define R_MASK	2	/* bitmask for SX_STORE_SELECT */
     62  1.1  macallan 
     63  1.1  macallan /*
     64  1.1  macallan  * registers are repeated at 0x1000 with certain parts read only
     65  1.1  macallan  * ( like the PAGE_BOUND registers ) which userlanf has no business writing to
     66  1.1  macallan  */
     67  1.1  macallan 
     68  1.1  macallan /* SX_CONTROL_STATUS */
     69  1.1  macallan #define SX_EE1		0x00000001	/* illegal instruction */
     70  1.1  macallan #define SX_EE2		0x00000002	/* page bound error */
     71  1.1  macallan #define SX_EE3		0x00000004	/* illegal memory access */
     72  1.1  macallan #define SX_EE4		0x00000008	/* illegal register access */
     73  1.1  macallan #define SX_EE5		0x00000010	/* alignment violation */
     74  1.1  macallan #define SX_EE6		0x00000020	/* illegal instruction queue write */
     75  1.1  macallan #define SX_EI		0x00000080	/* interrupt on error */
     76  1.1  macallan #define SX_PB		0x00001000	/* enable page bound checking */
     77  1.1  macallan #define SX_WO		0x00002000	/* write occured ( by SX ) */
     78  1.1  macallan #define SX_GO		0x00004000	/* start/stop the processor */
     79  1.1  macallan #define SX_MT		0x00008000	/* instruction queue is empty */
     80  1.1  macallan 
     81  1.1  macallan /* SX_ERROR */
     82  1.1  macallan #define SX_SE1		0x00000001	/* illegal instruction */
     83  1.1  macallan #define SX_SE2		0x00000002	/* page bound error */
     84  1.1  macallan #define SX_SE3		0x00000004	/* illegal memory access */
     85  1.1  macallan #define SX_SE4		0x00000008	/* illegal register access */
     86  1.1  macallan #define SX_SE5		0x00000010	/* alignment violation */
     87  1.1  macallan #define SX_SE6		0x00000020	/* illegal instruction queue write */
     88  1.1  macallan #define SX_SI		0x00000080	/* interrupt on error */
     89  1.1  macallan 
     90  1.1  macallan /* SX_ID */
     91  1.1  macallan #define SX_ARCHITECTURE_MASK	0x000000ff
     92  1.1  macallan #define SX_CHIP_REVISION	0x0000ff00
     93  1.1  macallan 
     94  1.1  macallan /* SX_DIAGNOSTICS */
     95  1.1  macallan #define SX_IQ_FIFO_ACCESS	0x00000001	/* allow memory instructions
     96  1.1  macallan 						 * in SX_INSTRUCTIONS */
     97  1.1  macallan 
     98  1.1  macallan /*
     99  1.1  macallan  * memory referencing instructions are written to 0x800000000 + PA
    100  1.1  macallan  * so we have to go through ASI 0x28 ( ASI_BYPASS + 8 )
    101  1.1  macallan  */
    102  1.1  macallan #define ASI_SX	0x28
    103  1.1  macallan 
    104  1.1  macallan /* load / store instructions */
    105  1.1  macallan #define SX_STORE_COND	(0x4 << 19)	/* conditional write with mask */
    106  1.1  macallan #define SX_STORE_CLAMP	(0x2 << 19)
    107  1.1  macallan #define SX_STORE_MASK	(0x1 << 19)	/* apply plane mask */
    108  1.2  macallan #define SX_STORE_SELECT	(0x8 << 19)	/* expand with plane reg dest[0]/dest[1] */
    109  1.1  macallan #define SX_LOAD		(0xa << 19)
    110  1.1  macallan #define SX_STORE	(0x0 << 19)
    111  1.1  macallan 
    112  1.1  macallan /* data type */
    113  1.1  macallan #define SX_UBYTE_0	(0x00 << 14)
    114  1.1  macallan #define SX_UBYTE_8	(0x01 << 14)
    115  1.1  macallan #define SX_UBYTE_16	(0x02 << 14)
    116  1.1  macallan #define SX_UBYTE_24	(0x03 << 14)
    117  1.1  macallan #define SX_SBYTE_0	(0x04 << 14)
    118  1.1  macallan #define SX_SBYTE_8	(0x05 << 14)
    119  1.1  macallan #define SX_SBYTE_16	(0x06 << 14)
    120  1.1  macallan #define SX_SBYTE_24	(0x07 << 14)
    121  1.1  macallan #define SX_UQUAD_0	(0x08 << 14)
    122  1.1  macallan #define SX_UQUAD_8	(0x09 << 14)
    123  1.1  macallan #define SX_UQUAD_16	(0x0a << 14)
    124  1.1  macallan #define SX_UQUAD_24	(0x0b << 14)
    125  1.1  macallan #define SX_SQUAD_0	(0x0c << 14)
    126  1.1  macallan #define SX_SQUAD_8	(0x0d << 14)
    127  1.1  macallan #define SX_SQUAD_16	(0x0e << 14)
    128  1.1  macallan #define SX_SQUAD_24	(0x0f << 14)
    129  1.1  macallan #define SX_UCHAN_0	(0x10 << 14)
    130  1.1  macallan #define SX_UCHAN_8	(0x11 << 14)
    131  1.1  macallan #define SX_UCHAN_16	(0x12 << 14)
    132  1.1  macallan #define SX_UCHAN_24	(0x13 << 14)
    133  1.1  macallan #define SX_SCHAN_0	(0x14 << 14)
    134  1.1  macallan #define SX_SCHAN_8	(0x15 << 14)
    135  1.1  macallan #define SX_SCHAN_16	(0x16 << 14)
    136  1.1  macallan #define SX_SCHAN_24	(0x17 << 14)
    137  1.1  macallan #define SX_USHORT_0	(0x18 << 14)
    138  1.1  macallan #define SX_USHORT_8	(0x19 << 14)
    139  1.1  macallan #define SX_USHORT_16	(0x1a << 14)
    140  1.1  macallan #define SX_SSHORT_0	(0x1c << 14)
    141  1.1  macallan #define SX_SSHORT_8	(0x1d << 14)
    142  1.1  macallan #define SX_SSHORT_16	(0x1e << 14)
    143  1.1  macallan #define SX_LONG		(0x1b << 14)
    144  1.1  macallan #define SX_PACKED	(0x1f << 14)
    145  1.1  macallan 
    146  1.1  macallan 
    147  1.2  macallan #define SX_LD(dreg, cnt, o)  (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    148  1.2  macallan 				SX_LONG | (dreg << 7) | (o))
    149  1.2  macallan #define SX_LDB(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    150  1.2  macallan 				SX_UBYTE_0 | (dreg << 7) | (o))
    151  1.2  macallan #define SX_LDP(dreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_LOAD | \
    152  1.2  macallan 				SX_PACKED | (dreg << 7) | (o))
    153  1.2  macallan #define SX_ST(sreg, cnt, o)  (0x80000000 | ((cnt) << 23) | SX_STORE | \
    154  1.2  macallan 				SX_LONG | (sreg << 7) | (o))
    155  1.2  macallan #define SX_STB(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    156  1.2  macallan 				SX_UBYTE_0 | (sreg << 7) | (o))
    157  1.2  macallan #define SX_STP(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE | \
    158  1.2  macallan 				SX_PACKED | (sreg << 7) | (o))
    159  1.2  macallan #define SX_STS(sreg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT \
    160  1.2  macallan 				| SX_LONG | (sreg << 7) | (o))
    161  1.2  macallan #define SX_STBS(reg, cnt, o) (0x80000000 | ((cnt) << 23) | SX_STORE_SELECT \
    162  1.2  macallan 				| SX_UBYTE_0 | (reg << 7) | (o))
    163  1.1  macallan 
    164  1.1  macallan #endif /* SXREG_H */
    165