1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds /* $Id: newport.h,v 1.5 1999/08/04 06:01:51 ulfc Exp $
31da177e4SLinus Torvalds *
41da177e4SLinus Torvalds * newport.h: Defines and register layout for NEWPORT graphics
51da177e4SLinus Torvalds * hardware.
61da177e4SLinus Torvalds *
779add627SJustin P. Mattock * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
81da177e4SLinus Torvalds *
925985edcSLucas De Marchi * Ulf Carlsson - Compatibility with the IRIX structures added
101da177e4SLinus Torvalds */
111da177e4SLinus Torvalds
121da177e4SLinus Torvalds #ifndef _SGI_NEWPORT_H
131da177e4SLinus Torvalds #define _SGI_NEWPORT_H
141da177e4SLinus Torvalds
151da177e4SLinus Torvalds
161da177e4SLinus Torvalds typedef volatile unsigned int npireg_t;
171da177e4SLinus Torvalds
181da177e4SLinus Torvalds union npfloat {
191da177e4SLinus Torvalds volatile float flt;
201da177e4SLinus Torvalds npireg_t word;
211da177e4SLinus Torvalds };
221da177e4SLinus Torvalds
231da177e4SLinus Torvalds typedef union npfloat npfreg_t;
241da177e4SLinus Torvalds
251da177e4SLinus Torvalds union np_dcb {
261da177e4SLinus Torvalds npireg_t byword;
271da177e4SLinus Torvalds struct { volatile unsigned short s0, s1; } byshort;
281da177e4SLinus Torvalds struct { volatile unsigned char b0, b1, b2, b3; } bybytes;
291da177e4SLinus Torvalds };
301da177e4SLinus Torvalds
311da177e4SLinus Torvalds struct newport_rexregs {
321da177e4SLinus Torvalds npireg_t drawmode1; /* GL extra mode bits */
331da177e4SLinus Torvalds
341da177e4SLinus Torvalds #define DM1_PLANES 0x00000007
351da177e4SLinus Torvalds #define DM1_NOPLANES 0x00000000
361da177e4SLinus Torvalds #define DM1_RGBPLANES 0x00000001
371da177e4SLinus Torvalds #define DM1_RGBAPLANES 0x00000002
381da177e4SLinus Torvalds #define DM1_OLAYPLANES 0x00000004
391da177e4SLinus Torvalds #define DM1_PUPPLANES 0x00000005
401da177e4SLinus Torvalds #define DM1_CIDPLANES 0x00000006
411da177e4SLinus Torvalds
421da177e4SLinus Torvalds #define NPORT_DMODE1_DDMASK 0x00000018
431da177e4SLinus Torvalds #define NPORT_DMODE1_DD4 0x00000000
441da177e4SLinus Torvalds #define NPORT_DMODE1_DD8 0x00000008
451da177e4SLinus Torvalds #define NPORT_DMODE1_DD12 0x00000010
461da177e4SLinus Torvalds #define NPORT_DMODE1_DD24 0x00000018
471da177e4SLinus Torvalds #define NPORT_DMODE1_DSRC 0x00000020
481da177e4SLinus Torvalds #define NPORT_DMODE1_YFLIP 0x00000040
491da177e4SLinus Torvalds #define NPORT_DMODE1_RWPCKD 0x00000080
501da177e4SLinus Torvalds #define NPORT_DMODE1_HDMASK 0x00000300
511da177e4SLinus Torvalds #define NPORT_DMODE1_HD4 0x00000000
521da177e4SLinus Torvalds #define NPORT_DMODE1_HD8 0x00000100
531da177e4SLinus Torvalds #define NPORT_DMODE1_HD12 0x00000200
541da177e4SLinus Torvalds #define NPORT_DMODE1_HD32 0x00000300
551da177e4SLinus Torvalds #define NPORT_DMODE1_RWDBL 0x00000400
561da177e4SLinus Torvalds #define NPORT_DMODE1_ESWAP 0x00000800 /* Endian swap */
571da177e4SLinus Torvalds #define NPORT_DMODE1_CCMASK 0x00007000
581da177e4SLinus Torvalds #define NPORT_DMODE1_CCLT 0x00001000
591da177e4SLinus Torvalds #define NPORT_DMODE1_CCEQ 0x00002000
601da177e4SLinus Torvalds #define NPORT_DMODE1_CCGT 0x00004000
611da177e4SLinus Torvalds #define NPORT_DMODE1_RGBMD 0x00008000
621da177e4SLinus Torvalds #define NPORT_DMODE1_DENAB 0x00010000 /* Dither enable */
631da177e4SLinus Torvalds #define NPORT_DMODE1_FCLR 0x00020000 /* Fast clear */
641da177e4SLinus Torvalds #define NPORT_DMODE1_BENAB 0x00040000 /* Blend enable */
651da177e4SLinus Torvalds #define NPORT_DMODE1_SFMASK 0x00380000
661da177e4SLinus Torvalds #define NPORT_DMODE1_SF0 0x00000000
671da177e4SLinus Torvalds #define NPORT_DMODE1_SF1 0x00080000
681da177e4SLinus Torvalds #define NPORT_DMODE1_SFDC 0x00100000
691da177e4SLinus Torvalds #define NPORT_DMODE1_SFMDC 0x00180000
701da177e4SLinus Torvalds #define NPORT_DMODE1_SFSA 0x00200000
711da177e4SLinus Torvalds #define NPORT_DMODE1_SFMSA 0x00280000
721da177e4SLinus Torvalds #define NPORT_DMODE1_DFMASK 0x01c00000
731da177e4SLinus Torvalds #define NPORT_DMODE1_DF0 0x00000000
741da177e4SLinus Torvalds #define NPORT_DMODE1_DF1 0x00400000
751da177e4SLinus Torvalds #define NPORT_DMODE1_DFSC 0x00800000
761da177e4SLinus Torvalds #define NPORT_DMODE1_DFMSC 0x00c00000
771da177e4SLinus Torvalds #define NPORT_DMODE1_DFSA 0x01000000
781da177e4SLinus Torvalds #define NPORT_DMODE1_DFMSA 0x01400000
791da177e4SLinus Torvalds #define NPORT_DMODE1_BBENAB 0x02000000 /* Back blend enable */
801da177e4SLinus Torvalds #define NPORT_DMODE1_PFENAB 0x04000000 /* Pre-fetch enable */
811da177e4SLinus Torvalds #define NPORT_DMODE1_ABLEND 0x08000000 /* Alpha blend */
821da177e4SLinus Torvalds #define NPORT_DMODE1_LOMASK 0xf0000000
831da177e4SLinus Torvalds #define NPORT_DMODE1_LOZERO 0x00000000
841da177e4SLinus Torvalds #define NPORT_DMODE1_LOAND 0x10000000
851da177e4SLinus Torvalds #define NPORT_DMODE1_LOANDR 0x20000000
861da177e4SLinus Torvalds #define NPORT_DMODE1_LOSRC 0x30000000
871da177e4SLinus Torvalds #define NPORT_DMODE1_LOANDI 0x40000000
881da177e4SLinus Torvalds #define NPORT_DMODE1_LODST 0x50000000
891da177e4SLinus Torvalds #define NPORT_DMODE1_LOXOR 0x60000000
901da177e4SLinus Torvalds #define NPORT_DMODE1_LOOR 0x70000000
911da177e4SLinus Torvalds #define NPORT_DMODE1_LONOR 0x80000000
921da177e4SLinus Torvalds #define NPORT_DMODE1_LOXNOR 0x90000000
931da177e4SLinus Torvalds #define NPORT_DMODE1_LONDST 0xa0000000
941da177e4SLinus Torvalds #define NPORT_DMODE1_LOORR 0xb0000000
951da177e4SLinus Torvalds #define NPORT_DMODE1_LONSRC 0xc0000000
961da177e4SLinus Torvalds #define NPORT_DMODE1_LOORI 0xd0000000
971da177e4SLinus Torvalds #define NPORT_DMODE1_LONAND 0xe0000000
981da177e4SLinus Torvalds #define NPORT_DMODE1_LOONE 0xf0000000
991da177e4SLinus Torvalds
1001da177e4SLinus Torvalds npireg_t drawmode0; /* REX command register */
1011da177e4SLinus Torvalds
1021da177e4SLinus Torvalds /* These bits define the graphics opcode being performed. */
1031da177e4SLinus Torvalds #define NPORT_DMODE0_OPMASK 0x00000003 /* Opcode mask */
1041da177e4SLinus Torvalds #define NPORT_DMODE0_NOP 0x00000000 /* No operation */
1051da177e4SLinus Torvalds #define NPORT_DMODE0_RD 0x00000001 /* Read operation */
1061da177e4SLinus Torvalds #define NPORT_DMODE0_DRAW 0x00000002 /* Draw operation */
1071da177e4SLinus Torvalds #define NPORT_DMODE0_S2S 0x00000003 /* Screen to screen operation */
1081da177e4SLinus Torvalds
1091da177e4SLinus Torvalds /* The following decide what addressing mode(s) are to be used */
1101da177e4SLinus Torvalds #define NPORT_DMODE0_AMMASK 0x0000001c /* Address mode mask */
1111da177e4SLinus Torvalds #define NPORT_DMODE0_SPAN 0x00000000 /* Spanning address mode */
1121da177e4SLinus Torvalds #define NPORT_DMODE0_BLOCK 0x00000004 /* Block address mode */
1131da177e4SLinus Torvalds #define NPORT_DMODE0_ILINE 0x00000008 /* Iline address mode */
1141da177e4SLinus Torvalds #define NPORT_DMODE0_FLINE 0x0000000c /* Fline address mode */
1151da177e4SLinus Torvalds #define NPORT_DMODE0_ALINE 0x00000010 /* Aline address mode */
1161da177e4SLinus Torvalds #define NPORT_DMODE0_TLINE 0x00000014 /* Tline address mode */
1171da177e4SLinus Torvalds #define NPORT_DMODE0_BLINE 0x00000018 /* Bline address mode */
1181da177e4SLinus Torvalds
1191da177e4SLinus Torvalds /* And now some misc. operation control bits. */
1201da177e4SLinus Torvalds #define NPORT_DMODE0_DOSETUP 0x00000020
1211da177e4SLinus Torvalds #define NPORT_DMODE0_CHOST 0x00000040
1221da177e4SLinus Torvalds #define NPORT_DMODE0_AHOST 0x00000080
1231da177e4SLinus Torvalds #define NPORT_DMODE0_STOPX 0x00000100
1241da177e4SLinus Torvalds #define NPORT_DMODE0_STOPY 0x00000200
1251da177e4SLinus Torvalds #define NPORT_DMODE0_SK1ST 0x00000400
1261da177e4SLinus Torvalds #define NPORT_DMODE0_SKLST 0x00000800
1271da177e4SLinus Torvalds #define NPORT_DMODE0_ZPENAB 0x00001000
1281da177e4SLinus Torvalds #define NPORT_DMODE0_LISPENAB 0x00002000
1291da177e4SLinus Torvalds #define NPORT_DMODE0_LISLST 0x00004000
1301da177e4SLinus Torvalds #define NPORT_DMODE0_L32 0x00008000
1311da177e4SLinus Torvalds #define NPORT_DMODE0_ZOPQ 0x00010000
1321da177e4SLinus Torvalds #define NPORT_DMODE0_LISOPQ 0x00020000
1331da177e4SLinus Torvalds #define NPORT_DMODE0_SHADE 0x00040000
1341da177e4SLinus Torvalds #define NPORT_DMODE0_LRONLY 0x00080000
1351da177e4SLinus Torvalds #define NPORT_DMODE0_XYOFF 0x00100000
1361da177e4SLinus Torvalds #define NPORT_DMODE0_CLAMP 0x00200000
1371da177e4SLinus Torvalds #define NPORT_DMODE0_ENDPF 0x00400000
1381da177e4SLinus Torvalds #define NPORT_DMODE0_YSTR 0x00800000
1391da177e4SLinus Torvalds
1401da177e4SLinus Torvalds npireg_t lsmode; /* Mode for line stipple ops */
1411da177e4SLinus Torvalds npireg_t lspattern; /* Pattern for line stipple ops */
1421da177e4SLinus Torvalds npireg_t lspatsave; /* Backup save pattern */
1431da177e4SLinus Torvalds npireg_t zpattern; /* Pixel zpattern */
1441da177e4SLinus Torvalds npireg_t colorback; /* Background color */
1451da177e4SLinus Torvalds npireg_t colorvram; /* Clear color for fast vram */
1461da177e4SLinus Torvalds npireg_t alpharef; /* Reference value for afunctions */
1471da177e4SLinus Torvalds unsigned int pad0;
1481da177e4SLinus Torvalds npireg_t smask0x; /* Window GL relative screen mask 0 */
1491da177e4SLinus Torvalds npireg_t smask0y; /* Window GL relative screen mask 0 */
1501da177e4SLinus Torvalds npireg_t _setup;
1511da177e4SLinus Torvalds npireg_t _stepz;
1521da177e4SLinus Torvalds npireg_t _lsrestore;
1531da177e4SLinus Torvalds npireg_t _lssave;
1541da177e4SLinus Torvalds
1551da177e4SLinus Torvalds unsigned int _pad1[0x30];
1561da177e4SLinus Torvalds
1571da177e4SLinus Torvalds /* Iterators, full state for context switch */
1581da177e4SLinus Torvalds npfreg_t _xstart; /* X-start point (current) */
1591da177e4SLinus Torvalds npfreg_t _ystart; /* Y-start point (current) */
1601da177e4SLinus Torvalds npfreg_t _xend; /* x-end point */
1611da177e4SLinus Torvalds npfreg_t _yend; /* y-end point */
1621da177e4SLinus Torvalds npireg_t xsave; /* copy of xstart integer value for BLOCk addressing MODE */
1631da177e4SLinus Torvalds npireg_t xymove; /* x.y offset from xstart, ystart for relative operations */
1641da177e4SLinus Torvalds npfreg_t bresd;
1651da177e4SLinus Torvalds npfreg_t bress1;
1661da177e4SLinus Torvalds npireg_t bresoctinc1;
1671da177e4SLinus Torvalds volatile int bresrndinc2;
1681da177e4SLinus Torvalds npireg_t brese1;
1691da177e4SLinus Torvalds npireg_t bress2;
1701da177e4SLinus Torvalds npireg_t aweight0;
1711da177e4SLinus Torvalds npireg_t aweight1;
1721da177e4SLinus Torvalds npfreg_t xstartf;
1731da177e4SLinus Torvalds npfreg_t ystartf;
1741da177e4SLinus Torvalds npfreg_t xendf;
1751da177e4SLinus Torvalds npfreg_t yendf;
1761da177e4SLinus Torvalds npireg_t xstarti;
1771da177e4SLinus Torvalds npfreg_t xendf1;
1781da177e4SLinus Torvalds npireg_t xystarti;
1791da177e4SLinus Torvalds npireg_t xyendi;
1801da177e4SLinus Torvalds npireg_t xstartendi;
1811da177e4SLinus Torvalds
1821da177e4SLinus Torvalds unsigned int _unused2[0x29];
1831da177e4SLinus Torvalds
1841da177e4SLinus Torvalds npfreg_t colorred;
1851da177e4SLinus Torvalds npfreg_t coloralpha;
1861da177e4SLinus Torvalds npfreg_t colorgrn;
1871da177e4SLinus Torvalds npfreg_t colorblue;
1881da177e4SLinus Torvalds npfreg_t slopered;
1891da177e4SLinus Torvalds npfreg_t slopealpha;
1901da177e4SLinus Torvalds npfreg_t slopegrn;
1911da177e4SLinus Torvalds npfreg_t slopeblue;
1921da177e4SLinus Torvalds npireg_t wrmask;
1931da177e4SLinus Torvalds npireg_t colori;
1941da177e4SLinus Torvalds npfreg_t colorx;
1951da177e4SLinus Torvalds npfreg_t slopered1;
1961da177e4SLinus Torvalds npireg_t hostrw0;
1971da177e4SLinus Torvalds npireg_t hostrw1;
1981da177e4SLinus Torvalds npireg_t dcbmode;
1991da177e4SLinus Torvalds #define NPORT_DMODE_WMASK 0x00000003
2001da177e4SLinus Torvalds #define NPORT_DMODE_W4 0x00000000
2011da177e4SLinus Torvalds #define NPORT_DMODE_W1 0x00000001
2021da177e4SLinus Torvalds #define NPORT_DMODE_W2 0x00000002
2031da177e4SLinus Torvalds #define NPORT_DMODE_W3 0x00000003
2041da177e4SLinus Torvalds #define NPORT_DMODE_EDPACK 0x00000004
2051da177e4SLinus Torvalds #define NPORT_DMODE_ECINC 0x00000008
2061da177e4SLinus Torvalds #define NPORT_DMODE_CMASK 0x00000070
2071da177e4SLinus Torvalds #define NPORT_DMODE_AMASK 0x00000780
2081da177e4SLinus Torvalds #define NPORT_DMODE_AVC2 0x00000000
2091da177e4SLinus Torvalds #define NPORT_DMODE_ACMALL 0x00000080
2101da177e4SLinus Torvalds #define NPORT_DMODE_ACM0 0x00000100
2111da177e4SLinus Torvalds #define NPORT_DMODE_ACM1 0x00000180
2121da177e4SLinus Torvalds #define NPORT_DMODE_AXMALL 0x00000200
2131da177e4SLinus Torvalds #define NPORT_DMODE_AXM0 0x00000280
2141da177e4SLinus Torvalds #define NPORT_DMODE_AXM1 0x00000300
2151da177e4SLinus Torvalds #define NPORT_DMODE_ABT 0x00000380
2161da177e4SLinus Torvalds #define NPORT_DMODE_AVCC1 0x00000400
2171da177e4SLinus Torvalds #define NPORT_DMODE_AVAB1 0x00000480
2181da177e4SLinus Torvalds #define NPORT_DMODE_ALG3V0 0x00000500
2191da177e4SLinus Torvalds #define NPORT_DMODE_A1562 0x00000580
2201da177e4SLinus Torvalds #define NPORT_DMODE_ESACK 0x00000800
2211da177e4SLinus Torvalds #define NPORT_DMODE_EASACK 0x00001000
2221da177e4SLinus Torvalds #define NPORT_DMODE_CWMASK 0x0003e000
2231da177e4SLinus Torvalds #define NPORT_DMODE_CHMASK 0x007c0000
2241da177e4SLinus Torvalds #define NPORT_DMODE_CSMASK 0x0f800000
2251da177e4SLinus Torvalds #define NPORT_DMODE_SENDIAN 0x10000000
2261da177e4SLinus Torvalds
2271da177e4SLinus Torvalds unsigned int _unused3;
2281da177e4SLinus Torvalds
2291da177e4SLinus Torvalds union np_dcb dcbdata0;
2301da177e4SLinus Torvalds npireg_t dcbdata1;
2311da177e4SLinus Torvalds };
2321da177e4SLinus Torvalds
2331da177e4SLinus Torvalds struct newport_cregs {
2341da177e4SLinus Torvalds npireg_t smask1x;
2351da177e4SLinus Torvalds npireg_t smask1y;
2361da177e4SLinus Torvalds npireg_t smask2x;
2371da177e4SLinus Torvalds npireg_t smask2y;
2381da177e4SLinus Torvalds npireg_t smask3x;
2391da177e4SLinus Torvalds npireg_t smask3y;
2401da177e4SLinus Torvalds npireg_t smask4x;
2411da177e4SLinus Torvalds npireg_t smask4y;
2421da177e4SLinus Torvalds npireg_t topscan;
2431da177e4SLinus Torvalds npireg_t xywin;
2441da177e4SLinus Torvalds npireg_t clipmode;
2451da177e4SLinus Torvalds #define NPORT_CMODE_SM0 0x00000001
2461da177e4SLinus Torvalds #define NPORT_CMODE_SM1 0x00000002
2471da177e4SLinus Torvalds #define NPORT_CMODE_SM2 0x00000004
2481da177e4SLinus Torvalds #define NPORT_CMODE_SM3 0x00000008
2491da177e4SLinus Torvalds #define NPORT_CMODE_SM4 0x00000010
2501da177e4SLinus Torvalds #define NPORT_CMODE_CMSK 0x00001e00
2511da177e4SLinus Torvalds
2521da177e4SLinus Torvalds unsigned int _unused0;
2531da177e4SLinus Torvalds unsigned int config;
2541da177e4SLinus Torvalds #define NPORT_CFG_G32MD 0x00000001
2551da177e4SLinus Torvalds #define NPORT_CFG_BWIDTH 0x00000002
2561da177e4SLinus Torvalds #define NPORT_CFG_ERCVR 0x00000004
2571da177e4SLinus Torvalds #define NPORT_CFG_BDMSK 0x00000078
2581da177e4SLinus Torvalds #define NPORT_CFG_BFAINT 0x00000080
2591da177e4SLinus Torvalds #define NPORT_CFG_GDMSK 0x00001f80
2601da177e4SLinus Torvalds #define NPORT_CFG_GD0 0x00000100
2611da177e4SLinus Torvalds #define NPORT_CFG_GD1 0x00000200
2621da177e4SLinus Torvalds #define NPORT_CFG_GD2 0x00000400
2631da177e4SLinus Torvalds #define NPORT_CFG_GD3 0x00000800
2641da177e4SLinus Torvalds #define NPORT_CFG_GD4 0x00001000
2651da177e4SLinus Torvalds #define NPORT_CFG_GFAINT 0x00002000
2661da177e4SLinus Torvalds #define NPORT_CFG_TOMSK 0x0001c000
2671da177e4SLinus Torvalds #define NPORT_CFG_VRMSK 0x000e0000
2681da177e4SLinus Torvalds #define NPORT_CFG_FBTYP 0x00100000
2691da177e4SLinus Torvalds
2701da177e4SLinus Torvalds npireg_t _unused1;
2711da177e4SLinus Torvalds npireg_t status;
2721da177e4SLinus Torvalds #define NPORT_STAT_VERS 0x00000007
2731da177e4SLinus Torvalds #define NPORT_STAT_GBUSY 0x00000008
2741da177e4SLinus Torvalds #define NPORT_STAT_BBUSY 0x00000010
2751da177e4SLinus Torvalds #define NPORT_STAT_VRINT 0x00000020
2761da177e4SLinus Torvalds #define NPORT_STAT_VIDINT 0x00000040
2771da177e4SLinus Torvalds #define NPORT_STAT_GLMSK 0x00001f80
2781da177e4SLinus Torvalds #define NPORT_STAT_BLMSK 0x0007e000
2791da177e4SLinus Torvalds #define NPORT_STAT_BFIRQ 0x00080000
2801da177e4SLinus Torvalds #define NPORT_STAT_GFIRQ 0x00100000
2811da177e4SLinus Torvalds
2821da177e4SLinus Torvalds npireg_t ustatus;
2831da177e4SLinus Torvalds npireg_t dcbreset;
2841da177e4SLinus Torvalds };
2851da177e4SLinus Torvalds
2861da177e4SLinus Torvalds struct newport_regs {
2871da177e4SLinus Torvalds struct newport_rexregs set;
2881da177e4SLinus Torvalds unsigned int _unused0[0x16e];
2891da177e4SLinus Torvalds struct newport_rexregs go;
2901da177e4SLinus Torvalds unsigned int _unused1[0x22e];
2911da177e4SLinus Torvalds struct newport_cregs cset;
2921da177e4SLinus Torvalds unsigned int _unused2[0x1ef];
2931da177e4SLinus Torvalds struct newport_cregs cgo;
2941da177e4SLinus Torvalds };
2951da177e4SLinus Torvalds
2961da177e4SLinus Torvalds typedef struct {
2971da177e4SLinus Torvalds unsigned int drawmode1;
2981da177e4SLinus Torvalds unsigned int drawmode0;
2991da177e4SLinus Torvalds unsigned int lsmode;
3001da177e4SLinus Torvalds unsigned int lspattern;
3011da177e4SLinus Torvalds unsigned int lspatsave;
3021da177e4SLinus Torvalds unsigned int zpattern;
3031da177e4SLinus Torvalds unsigned int colorback;
3041da177e4SLinus Torvalds unsigned int colorvram;
3051da177e4SLinus Torvalds unsigned int alpharef;
3061da177e4SLinus Torvalds unsigned int smask0x;
3071da177e4SLinus Torvalds unsigned int smask0y;
3081da177e4SLinus Torvalds unsigned int _xstart;
3091da177e4SLinus Torvalds unsigned int _ystart;
3101da177e4SLinus Torvalds unsigned int _xend;
3111da177e4SLinus Torvalds unsigned int _yend;
3121da177e4SLinus Torvalds unsigned int xsave;
3131da177e4SLinus Torvalds unsigned int xymove;
3141da177e4SLinus Torvalds unsigned int bresd;
3151da177e4SLinus Torvalds unsigned int bress1;
3161da177e4SLinus Torvalds unsigned int bresoctinc1;
3171da177e4SLinus Torvalds unsigned int bresrndinc2;
3181da177e4SLinus Torvalds unsigned int brese1;
3191da177e4SLinus Torvalds unsigned int bress2;
3201da177e4SLinus Torvalds
3211da177e4SLinus Torvalds unsigned int aweight0;
3221da177e4SLinus Torvalds unsigned int aweight1;
3231da177e4SLinus Torvalds unsigned int colorred;
3241da177e4SLinus Torvalds unsigned int coloralpha;
3251da177e4SLinus Torvalds unsigned int colorgrn;
3261da177e4SLinus Torvalds unsigned int colorblue;
3271da177e4SLinus Torvalds unsigned int slopered;
3281da177e4SLinus Torvalds unsigned int slopealpha;
3291da177e4SLinus Torvalds unsigned int slopegrn;
3301da177e4SLinus Torvalds unsigned int slopeblue;
3311da177e4SLinus Torvalds unsigned int wrmask;
3321da177e4SLinus Torvalds unsigned int hostrw0;
3331da177e4SLinus Torvalds unsigned int hostrw1;
3341da177e4SLinus Torvalds
3351da177e4SLinus Torvalds /* configregs */
3361da177e4SLinus Torvalds
3371da177e4SLinus Torvalds unsigned int smask1x;
3381da177e4SLinus Torvalds unsigned int smask1y;
3391da177e4SLinus Torvalds unsigned int smask2x;
3401da177e4SLinus Torvalds unsigned int smask2y;
3411da177e4SLinus Torvalds unsigned int smask3x;
3421da177e4SLinus Torvalds unsigned int smask3y;
3431da177e4SLinus Torvalds unsigned int smask4x;
3441da177e4SLinus Torvalds unsigned int smask4y;
3451da177e4SLinus Torvalds unsigned int topscan;
3461da177e4SLinus Torvalds unsigned int xywin;
3471da177e4SLinus Torvalds unsigned int clipmode;
3481da177e4SLinus Torvalds unsigned int config;
3491da177e4SLinus Torvalds
3501da177e4SLinus Torvalds /* dcb registers */
3511da177e4SLinus Torvalds unsigned int dcbmode;
3521da177e4SLinus Torvalds unsigned int dcbdata0;
3531da177e4SLinus Torvalds unsigned int dcbdata1;
3541da177e4SLinus Torvalds } newport_ctx;
3551da177e4SLinus Torvalds
3561da177e4SLinus Torvalds /* Reading/writing VC2 registers. */
3571da177e4SLinus Torvalds #define VC2_REGADDR_INDEX 0x00000000
3581da177e4SLinus Torvalds #define VC2_REGADDR_IREG 0x00000010
3591da177e4SLinus Torvalds #define VC2_REGADDR_RAM 0x00000030
3601da177e4SLinus Torvalds #define VC2_PROTOCOL (NPORT_DMODE_EASACK | 0x00800000 | 0x00040000)
3611da177e4SLinus Torvalds
3621da177e4SLinus Torvalds #define VC2_VLINET_ADDR 0x000
3631da177e4SLinus Torvalds #define VC2_VFRAMET_ADDR 0x400
3641da177e4SLinus Torvalds #define VC2_CGLYPH_ADDR 0x500
3651da177e4SLinus Torvalds
3661da177e4SLinus Torvalds /* Now the Indexed registers of the VC2. */
3671da177e4SLinus Torvalds #define VC2_IREG_VENTRY 0x00
3681da177e4SLinus Torvalds #define VC2_IREG_CENTRY 0x01
3691da177e4SLinus Torvalds #define VC2_IREG_CURSX 0x02
3701da177e4SLinus Torvalds #define VC2_IREG_CURSY 0x03
3711da177e4SLinus Torvalds #define VC2_IREG_CCURSX 0x04
3721da177e4SLinus Torvalds #define VC2_IREG_DENTRY 0x05
3731da177e4SLinus Torvalds #define VC2_IREG_SLEN 0x06
3741da177e4SLinus Torvalds #define VC2_IREG_RADDR 0x07
3751da177e4SLinus Torvalds #define VC2_IREG_VFPTR 0x08
3761da177e4SLinus Torvalds #define VC2_IREG_VLSPTR 0x09
3771da177e4SLinus Torvalds #define VC2_IREG_VLIR 0x0a
3781da177e4SLinus Torvalds #define VC2_IREG_VLCTR 0x0b
3791da177e4SLinus Torvalds #define VC2_IREG_CTPTR 0x0c
3801da177e4SLinus Torvalds #define VC2_IREG_WCURSY 0x0d
3811da177e4SLinus Torvalds #define VC2_IREG_DFPTR 0x0e
3821da177e4SLinus Torvalds #define VC2_IREG_DLTPTR 0x0f
3831da177e4SLinus Torvalds #define VC2_IREG_CONTROL 0x10
3841da177e4SLinus Torvalds #define VC2_IREG_CONFIG 0x20
3851da177e4SLinus Torvalds
newport_vc2_set(struct newport_regs * regs,unsigned char vc2ireg,unsigned short val)3863f08ff4aSAdrian Bunk static inline void newport_vc2_set(struct newport_regs *regs,
3873f08ff4aSAdrian Bunk unsigned char vc2ireg,
3881da177e4SLinus Torvalds unsigned short val)
3891da177e4SLinus Torvalds {
3901da177e4SLinus Torvalds regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 |
3911da177e4SLinus Torvalds NPORT_DMODE_ECINC | VC2_PROTOCOL);
3921da177e4SLinus Torvalds regs->set.dcbdata0.byword = (vc2ireg << 24) | (val << 8);
3931da177e4SLinus Torvalds }
3941da177e4SLinus Torvalds
newport_vc2_get(struct newport_regs * regs,unsigned char vc2ireg)3953f08ff4aSAdrian Bunk static inline unsigned short newport_vc2_get(struct newport_regs *regs,
3961da177e4SLinus Torvalds unsigned char vc2ireg)
3971da177e4SLinus Torvalds {
3981da177e4SLinus Torvalds regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 |
3991da177e4SLinus Torvalds NPORT_DMODE_ECINC | VC2_PROTOCOL);
4001da177e4SLinus Torvalds regs->set.dcbdata0.bybytes.b3 = vc2ireg;
4011da177e4SLinus Torvalds regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 |
4021da177e4SLinus Torvalds NPORT_DMODE_ECINC | VC2_PROTOCOL);
4031da177e4SLinus Torvalds return regs->set.dcbdata0.byshort.s1;
4041da177e4SLinus Torvalds }
4051da177e4SLinus Torvalds
4061da177e4SLinus Torvalds /* VC2 Control register bits */
4071da177e4SLinus Torvalds #define VC2_CTRL_EVIRQ 0x0001
4081da177e4SLinus Torvalds #define VC2_CTRL_EDISP 0x0002
4091da177e4SLinus Torvalds #define VC2_CTRL_EVIDEO 0x0004
4101da177e4SLinus Torvalds #define VC2_CTRL_EDIDS 0x0008
4111da177e4SLinus Torvalds #define VC2_CTRL_ECURS 0x0010
4121da177e4SLinus Torvalds #define VC2_CTRL_EGSYNC 0x0020
4131da177e4SLinus Torvalds #define VC2_CTRL_EILACE 0x0040
4141da177e4SLinus Torvalds #define VC2_CTRL_ECDISP 0x0080
4151da177e4SLinus Torvalds #define VC2_CTRL_ECCURS 0x0100
4161da177e4SLinus Torvalds #define VC2_CTRL_ECG64 0x0200
4171da177e4SLinus Torvalds #define VC2_CTRL_GLSEL 0x0400
4181da177e4SLinus Torvalds
4191da177e4SLinus Torvalds /* Controlling the color map on NEWPORT. */
4201da177e4SLinus Torvalds #define NCMAP_REGADDR_AREG 0x00000000
4211da177e4SLinus Torvalds #define NCMAP_REGADDR_ALO 0x00000000
4221da177e4SLinus Torvalds #define NCMAP_REGADDR_AHI 0x00000010
4231da177e4SLinus Torvalds #define NCMAP_REGADDR_PBUF 0x00000020
4241da177e4SLinus Torvalds #define NCMAP_REGADDR_CREG 0x00000030
4251da177e4SLinus Torvalds #define NCMAP_REGADDR_SREG 0x00000040
4261da177e4SLinus Torvalds #define NCMAP_REGADDR_RREG 0x00000060
4271da177e4SLinus Torvalds #define NCMAP_PROTOCOL (0x00008000 | 0x00040000 | 0x00800000)
4281da177e4SLinus Torvalds
newport_cmap_setaddr(struct newport_regs * regs,unsigned short addr)4291da177e4SLinus Torvalds static __inline__ void newport_cmap_setaddr(struct newport_regs *regs,
4301da177e4SLinus Torvalds unsigned short addr)
4311da177e4SLinus Torvalds {
4321da177e4SLinus Torvalds regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
4331da177e4SLinus Torvalds NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC |
4341da177e4SLinus Torvalds NCMAP_REGADDR_AREG | NPORT_DMODE_W2);
4351da177e4SLinus Torvalds regs->set.dcbdata0.byshort.s1 = addr;
4361da177e4SLinus Torvalds regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
4371da177e4SLinus Torvalds NCMAP_REGADDR_PBUF | NPORT_DMODE_W3);
4381da177e4SLinus Torvalds }
4391da177e4SLinus Torvalds
newport_cmap_setrgb(struct newport_regs * regs,unsigned char red,unsigned char green,unsigned char blue)4401da177e4SLinus Torvalds static __inline__ void newport_cmap_setrgb(struct newport_regs *regs,
4411da177e4SLinus Torvalds unsigned char red,
4421da177e4SLinus Torvalds unsigned char green,
4431da177e4SLinus Torvalds unsigned char blue)
4441da177e4SLinus Torvalds {
4451da177e4SLinus Torvalds regs->set.dcbdata0.byword =
4461da177e4SLinus Torvalds (red << 24) |
4471da177e4SLinus Torvalds (green << 16) |
4481da177e4SLinus Torvalds (blue << 8);
4491da177e4SLinus Torvalds }
4501da177e4SLinus Torvalds
4511da177e4SLinus Torvalds /* Miscellaneous NEWPORT routines. */
4521da177e4SLinus Torvalds #define BUSY_TIMEOUT 100000
newport_wait(struct newport_regs * regs)4531da177e4SLinus Torvalds static __inline__ int newport_wait(struct newport_regs *regs)
4541da177e4SLinus Torvalds {
4551da177e4SLinus Torvalds int t = BUSY_TIMEOUT;
4561da177e4SLinus Torvalds
45791ad1203SRoel Kluin while (--t)
4581da177e4SLinus Torvalds if (!(regs->cset.status & NPORT_STAT_GBUSY))
4591da177e4SLinus Torvalds break;
4601da177e4SLinus Torvalds return !t;
4611da177e4SLinus Torvalds }
4621da177e4SLinus Torvalds
newport_bfwait(struct newport_regs * regs)4631da177e4SLinus Torvalds static __inline__ int newport_bfwait(struct newport_regs *regs)
4641da177e4SLinus Torvalds {
4651da177e4SLinus Torvalds int t = BUSY_TIMEOUT;
4661da177e4SLinus Torvalds
46791ad1203SRoel Kluin while (--t)
4681da177e4SLinus Torvalds if(!(regs->cset.status & NPORT_STAT_BBUSY))
4691da177e4SLinus Torvalds break;
4701da177e4SLinus Torvalds return !t;
4711da177e4SLinus Torvalds }
4721da177e4SLinus Torvalds
4731da177e4SLinus Torvalds /*
4741da177e4SLinus Torvalds * DCBMODE register defines:
4751da177e4SLinus Torvalds */
4761da177e4SLinus Torvalds
4771da177e4SLinus Torvalds /* Width of the data being transferred for each DCBDATA[01] word */
4781da177e4SLinus Torvalds #define DCB_DATAWIDTH_4 0x0
4791da177e4SLinus Torvalds #define DCB_DATAWIDTH_1 0x1
4801da177e4SLinus Torvalds #define DCB_DATAWIDTH_2 0x2
4811da177e4SLinus Torvalds #define DCB_DATAWIDTH_3 0x3
4821da177e4SLinus Torvalds
4831da177e4SLinus Torvalds /* If set, all of DCBDATA will be moved, otherwise only DATAWIDTH bytes */
4841da177e4SLinus Torvalds #define DCB_ENDATAPACK (1 << 2)
4851da177e4SLinus Torvalds
4861da177e4SLinus Torvalds /* Enables DCBCRS auto increment after each DCB transfer */
4871da177e4SLinus Torvalds #define DCB_ENCRSINC (1 << 3)
4881da177e4SLinus Torvalds
4891da177e4SLinus Torvalds /* shift for accessing the control register select address (DBCCRS, 3 bits) */
4901da177e4SLinus Torvalds #define DCB_CRS_SHIFT 4
4911da177e4SLinus Torvalds
4921da177e4SLinus Torvalds /* DCBADDR (4 bits): display bus slave address */
4931da177e4SLinus Torvalds #define DCB_ADDR_SHIFT 7
4941da177e4SLinus Torvalds #define DCB_VC2 (0 << DCB_ADDR_SHIFT)
4951da177e4SLinus Torvalds #define DCB_CMAP_ALL (1 << DCB_ADDR_SHIFT)
4961da177e4SLinus Torvalds #define DCB_CMAP0 (2 << DCB_ADDR_SHIFT)
4971da177e4SLinus Torvalds #define DCB_CMAP1 (3 << DCB_ADDR_SHIFT)
4981da177e4SLinus Torvalds #define DCB_XMAP_ALL (4 << DCB_ADDR_SHIFT)
4991da177e4SLinus Torvalds #define DCB_XMAP0 (5 << DCB_ADDR_SHIFT)
5001da177e4SLinus Torvalds #define DCB_XMAP1 (6 << DCB_ADDR_SHIFT)
5011da177e4SLinus Torvalds #define DCB_BT445 (7 << DCB_ADDR_SHIFT)
5021da177e4SLinus Torvalds #define DCB_VCC1 (8 << DCB_ADDR_SHIFT)
5031da177e4SLinus Torvalds #define DCB_VAB1 (9 << DCB_ADDR_SHIFT)
5041da177e4SLinus Torvalds #define DCB_LG3_BDVERS0 (10 << DCB_ADDR_SHIFT)
5051da177e4SLinus Torvalds #define DCB_LG3_ICS1562 (11 << DCB_ADDR_SHIFT)
5061da177e4SLinus Torvalds #define DCB_RESERVED (15 << DCB_ADDR_SHIFT)
5071da177e4SLinus Torvalds
5081da177e4SLinus Torvalds /* DCB protocol ack types */
5091da177e4SLinus Torvalds #define DCB_ENSYNCACK (1 << 11)
5101da177e4SLinus Torvalds #define DCB_ENASYNCACK (1 << 12)
5111da177e4SLinus Torvalds
5121da177e4SLinus Torvalds #define DCB_CSWIDTH_SHIFT 13
5131da177e4SLinus Torvalds #define DCB_CSHOLD_SHIFT 18
5141da177e4SLinus Torvalds #define DCB_CSSETUP_SHIFT 23
5151da177e4SLinus Torvalds
5161da177e4SLinus Torvalds /* XMAP9 specific defines */
5171da177e4SLinus Torvalds /* XMAP9 -- registers as seen on the DCBMODE register*/
5181da177e4SLinus Torvalds # define XM9_CRS_CONFIG (0 << DCB_CRS_SHIFT)
5191da177e4SLinus Torvalds # define XM9_PUPMODE (1 << 0)
5201da177e4SLinus Torvalds # define XM9_ODD_PIXEL (1 << 1)
5211da177e4SLinus Torvalds # define XM9_8_BITPLANES (1 << 2)
5221da177e4SLinus Torvalds # define XM9_SLOW_DCB (1 << 3)
5231da177e4SLinus Torvalds # define XM9_VIDEO_RGBMAP_MASK (3 << 4)
5241da177e4SLinus Torvalds # define XM9_EXPRESS_VIDEO (1 << 6)
5251da177e4SLinus Torvalds # define XM9_VIDEO_OPTION (1 << 7)
5261da177e4SLinus Torvalds # define XM9_CRS_REVISION (1 << DCB_CRS_SHIFT)
5271da177e4SLinus Torvalds # define XM9_CRS_FIFO_AVAIL (2 << DCB_CRS_SHIFT)
5281da177e4SLinus Torvalds # define XM9_FIFO_0_AVAIL 0
5291da177e4SLinus Torvalds # define XM9_FIFO_1_AVAIL 1
5301da177e4SLinus Torvalds # define XM9_FIFO_2_AVAIL 3
5311da177e4SLinus Torvalds # define XM9_FIFO_3_AVAIL 2
5321da177e4SLinus Torvalds # define XM9_FIFO_FULL XM9_FIFO_0_AVAIL
5331da177e4SLinus Torvalds # define XM9_FIFO_EMPTY XM9_FIFO_3_AVAIL
5341da177e4SLinus Torvalds # define XM9_CRS_CURS_CMAP_MSB (3 << DCB_CRS_SHIFT)
5351da177e4SLinus Torvalds # define XM9_CRS_PUP_CMAP_MSB (4 << DCB_CRS_SHIFT)
5361da177e4SLinus Torvalds # define XM9_CRS_MODE_REG_DATA (5 << DCB_CRS_SHIFT)
5371da177e4SLinus Torvalds # define XM9_CRS_MODE_REG_INDEX (7 << DCB_CRS_SHIFT)
5381da177e4SLinus Torvalds
5391da177e4SLinus Torvalds
5401da177e4SLinus Torvalds #define DCB_CYCLES(setup,hold,width) \
5411da177e4SLinus Torvalds ((hold << DCB_CSHOLD_SHIFT) | \
5421da177e4SLinus Torvalds (setup << DCB_CSSETUP_SHIFT)| \
5431da177e4SLinus Torvalds (width << DCB_CSWIDTH_SHIFT))
5441da177e4SLinus Torvalds
5451da177e4SLinus Torvalds #define W_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 0)
5461da177e4SLinus Torvalds #define WSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (5, 5, 0)
5471da177e4SLinus Torvalds #define WAYSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (12, 12, 0)
5481da177e4SLinus Torvalds #define R_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 3)
5491da177e4SLinus Torvalds
5501da177e4SLinus Torvalds static __inline__ void
xmap9FIFOWait(struct newport_regs * rex)5511da177e4SLinus Torvalds xmap9FIFOWait (struct newport_regs *rex)
5521da177e4SLinus Torvalds {
5531da177e4SLinus Torvalds rex->set.dcbmode = DCB_XMAP0 | XM9_CRS_FIFO_AVAIL |
5541da177e4SLinus Torvalds DCB_DATAWIDTH_1 | R_DCB_XMAP9_PROTOCOL;
5551da177e4SLinus Torvalds newport_bfwait (rex);
5561da177e4SLinus Torvalds
5571da177e4SLinus Torvalds while ((rex->set.dcbdata0.bybytes.b3 & 3) != XM9_FIFO_EMPTY)
5581da177e4SLinus Torvalds ;
5591da177e4SLinus Torvalds }
5601da177e4SLinus Torvalds
5611da177e4SLinus Torvalds static __inline__ void
xmap9SetModeReg(struct newport_regs * rex,unsigned int modereg,unsigned int data24,int cfreq)5621da177e4SLinus Torvalds xmap9SetModeReg (struct newport_regs *rex, unsigned int modereg, unsigned int data24, int cfreq)
5631da177e4SLinus Torvalds {
5641da177e4SLinus Torvalds if (cfreq > 119)
5651da177e4SLinus Torvalds rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
5661da177e4SLinus Torvalds DCB_DATAWIDTH_4 | W_DCB_XMAP9_PROTOCOL;
5671da177e4SLinus Torvalds else if (cfreq > 59)
5681da177e4SLinus Torvalds rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
5691da177e4SLinus Torvalds DCB_DATAWIDTH_4 | WSLOW_DCB_XMAP9_PROTOCOL;
5701da177e4SLinus Torvalds else
5711da177e4SLinus Torvalds rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
5721da177e4SLinus Torvalds DCB_DATAWIDTH_4 | WAYSLOW_DCB_XMAP9_PROTOCOL;
5731da177e4SLinus Torvalds rex->set.dcbdata0.byword = ((modereg) << 24) | (data24 & 0xffffff);
5741da177e4SLinus Torvalds }
5751da177e4SLinus Torvalds
5761da177e4SLinus Torvalds #define BT445_PROTOCOL DCB_CYCLES(1,1,3)
5771da177e4SLinus Torvalds
5781da177e4SLinus Torvalds #define BT445_CSR_ADDR_REG (0 << DCB_CRS_SHIFT)
5791da177e4SLinus Torvalds #define BT445_CSR_REVISION (2 << DCB_CRS_SHIFT)
5801da177e4SLinus Torvalds
5811da177e4SLinus Torvalds #define BT445_REVISION_REG 0x01
5821da177e4SLinus Torvalds
5831da177e4SLinus Torvalds #endif /* !(_SGI_NEWPORT_H) */
5841da177e4SLinus Torvalds
585