162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* $Id: newport.h,v 1.5 1999/08/04 06:01:51 ulfc Exp $ 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * newport.h: Defines and register layout for NEWPORT graphics 562306a36Sopenharmony_ci * hardware. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Ulf Carlsson - Compatibility with the IRIX structures added 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#ifndef _SGI_NEWPORT_H 1362306a36Sopenharmony_ci#define _SGI_NEWPORT_H 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_citypedef volatile unsigned int npireg_t; 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciunion npfloat { 1962306a36Sopenharmony_ci volatile float flt; 2062306a36Sopenharmony_ci npireg_t word; 2162306a36Sopenharmony_ci}; 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_citypedef union npfloat npfreg_t; 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciunion np_dcb { 2662306a36Sopenharmony_ci npireg_t byword; 2762306a36Sopenharmony_ci struct { volatile unsigned short s0, s1; } byshort; 2862306a36Sopenharmony_ci struct { volatile unsigned char b0, b1, b2, b3; } bybytes; 2962306a36Sopenharmony_ci}; 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_cistruct newport_rexregs { 3262306a36Sopenharmony_ci npireg_t drawmode1; /* GL extra mode bits */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define DM1_PLANES 0x00000007 3562306a36Sopenharmony_ci#define DM1_NOPLANES 0x00000000 3662306a36Sopenharmony_ci#define DM1_RGBPLANES 0x00000001 3762306a36Sopenharmony_ci#define DM1_RGBAPLANES 0x00000002 3862306a36Sopenharmony_ci#define DM1_OLAYPLANES 0x00000004 3962306a36Sopenharmony_ci#define DM1_PUPPLANES 0x00000005 4062306a36Sopenharmony_ci#define DM1_CIDPLANES 0x00000006 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define NPORT_DMODE1_DDMASK 0x00000018 4362306a36Sopenharmony_ci#define NPORT_DMODE1_DD4 0x00000000 4462306a36Sopenharmony_ci#define NPORT_DMODE1_DD8 0x00000008 4562306a36Sopenharmony_ci#define NPORT_DMODE1_DD12 0x00000010 4662306a36Sopenharmony_ci#define NPORT_DMODE1_DD24 0x00000018 4762306a36Sopenharmony_ci#define NPORT_DMODE1_DSRC 0x00000020 4862306a36Sopenharmony_ci#define NPORT_DMODE1_YFLIP 0x00000040 4962306a36Sopenharmony_ci#define NPORT_DMODE1_RWPCKD 0x00000080 5062306a36Sopenharmony_ci#define NPORT_DMODE1_HDMASK 0x00000300 5162306a36Sopenharmony_ci#define NPORT_DMODE1_HD4 0x00000000 5262306a36Sopenharmony_ci#define NPORT_DMODE1_HD8 0x00000100 5362306a36Sopenharmony_ci#define NPORT_DMODE1_HD12 0x00000200 5462306a36Sopenharmony_ci#define NPORT_DMODE1_HD32 0x00000300 5562306a36Sopenharmony_ci#define NPORT_DMODE1_RWDBL 0x00000400 5662306a36Sopenharmony_ci#define NPORT_DMODE1_ESWAP 0x00000800 /* Endian swap */ 5762306a36Sopenharmony_ci#define NPORT_DMODE1_CCMASK 0x00007000 5862306a36Sopenharmony_ci#define NPORT_DMODE1_CCLT 0x00001000 5962306a36Sopenharmony_ci#define NPORT_DMODE1_CCEQ 0x00002000 6062306a36Sopenharmony_ci#define NPORT_DMODE1_CCGT 0x00004000 6162306a36Sopenharmony_ci#define NPORT_DMODE1_RGBMD 0x00008000 6262306a36Sopenharmony_ci#define NPORT_DMODE1_DENAB 0x00010000 /* Dither enable */ 6362306a36Sopenharmony_ci#define NPORT_DMODE1_FCLR 0x00020000 /* Fast clear */ 6462306a36Sopenharmony_ci#define NPORT_DMODE1_BENAB 0x00040000 /* Blend enable */ 6562306a36Sopenharmony_ci#define NPORT_DMODE1_SFMASK 0x00380000 6662306a36Sopenharmony_ci#define NPORT_DMODE1_SF0 0x00000000 6762306a36Sopenharmony_ci#define NPORT_DMODE1_SF1 0x00080000 6862306a36Sopenharmony_ci#define NPORT_DMODE1_SFDC 0x00100000 6962306a36Sopenharmony_ci#define NPORT_DMODE1_SFMDC 0x00180000 7062306a36Sopenharmony_ci#define NPORT_DMODE1_SFSA 0x00200000 7162306a36Sopenharmony_ci#define NPORT_DMODE1_SFMSA 0x00280000 7262306a36Sopenharmony_ci#define NPORT_DMODE1_DFMASK 0x01c00000 7362306a36Sopenharmony_ci#define NPORT_DMODE1_DF0 0x00000000 7462306a36Sopenharmony_ci#define NPORT_DMODE1_DF1 0x00400000 7562306a36Sopenharmony_ci#define NPORT_DMODE1_DFSC 0x00800000 7662306a36Sopenharmony_ci#define NPORT_DMODE1_DFMSC 0x00c00000 7762306a36Sopenharmony_ci#define NPORT_DMODE1_DFSA 0x01000000 7862306a36Sopenharmony_ci#define NPORT_DMODE1_DFMSA 0x01400000 7962306a36Sopenharmony_ci#define NPORT_DMODE1_BBENAB 0x02000000 /* Back blend enable */ 8062306a36Sopenharmony_ci#define NPORT_DMODE1_PFENAB 0x04000000 /* Pre-fetch enable */ 8162306a36Sopenharmony_ci#define NPORT_DMODE1_ABLEND 0x08000000 /* Alpha blend */ 8262306a36Sopenharmony_ci#define NPORT_DMODE1_LOMASK 0xf0000000 8362306a36Sopenharmony_ci#define NPORT_DMODE1_LOZERO 0x00000000 8462306a36Sopenharmony_ci#define NPORT_DMODE1_LOAND 0x10000000 8562306a36Sopenharmony_ci#define NPORT_DMODE1_LOANDR 0x20000000 8662306a36Sopenharmony_ci#define NPORT_DMODE1_LOSRC 0x30000000 8762306a36Sopenharmony_ci#define NPORT_DMODE1_LOANDI 0x40000000 8862306a36Sopenharmony_ci#define NPORT_DMODE1_LODST 0x50000000 8962306a36Sopenharmony_ci#define NPORT_DMODE1_LOXOR 0x60000000 9062306a36Sopenharmony_ci#define NPORT_DMODE1_LOOR 0x70000000 9162306a36Sopenharmony_ci#define NPORT_DMODE1_LONOR 0x80000000 9262306a36Sopenharmony_ci#define NPORT_DMODE1_LOXNOR 0x90000000 9362306a36Sopenharmony_ci#define NPORT_DMODE1_LONDST 0xa0000000 9462306a36Sopenharmony_ci#define NPORT_DMODE1_LOORR 0xb0000000 9562306a36Sopenharmony_ci#define NPORT_DMODE1_LONSRC 0xc0000000 9662306a36Sopenharmony_ci#define NPORT_DMODE1_LOORI 0xd0000000 9762306a36Sopenharmony_ci#define NPORT_DMODE1_LONAND 0xe0000000 9862306a36Sopenharmony_ci#define NPORT_DMODE1_LOONE 0xf0000000 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci npireg_t drawmode0; /* REX command register */ 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci /* These bits define the graphics opcode being performed. */ 10362306a36Sopenharmony_ci#define NPORT_DMODE0_OPMASK 0x00000003 /* Opcode mask */ 10462306a36Sopenharmony_ci#define NPORT_DMODE0_NOP 0x00000000 /* No operation */ 10562306a36Sopenharmony_ci#define NPORT_DMODE0_RD 0x00000001 /* Read operation */ 10662306a36Sopenharmony_ci#define NPORT_DMODE0_DRAW 0x00000002 /* Draw operation */ 10762306a36Sopenharmony_ci#define NPORT_DMODE0_S2S 0x00000003 /* Screen to screen operation */ 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci /* The following decide what addressing mode(s) are to be used */ 11062306a36Sopenharmony_ci#define NPORT_DMODE0_AMMASK 0x0000001c /* Address mode mask */ 11162306a36Sopenharmony_ci#define NPORT_DMODE0_SPAN 0x00000000 /* Spanning address mode */ 11262306a36Sopenharmony_ci#define NPORT_DMODE0_BLOCK 0x00000004 /* Block address mode */ 11362306a36Sopenharmony_ci#define NPORT_DMODE0_ILINE 0x00000008 /* Iline address mode */ 11462306a36Sopenharmony_ci#define NPORT_DMODE0_FLINE 0x0000000c /* Fline address mode */ 11562306a36Sopenharmony_ci#define NPORT_DMODE0_ALINE 0x00000010 /* Aline address mode */ 11662306a36Sopenharmony_ci#define NPORT_DMODE0_TLINE 0x00000014 /* Tline address mode */ 11762306a36Sopenharmony_ci#define NPORT_DMODE0_BLINE 0x00000018 /* Bline address mode */ 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci /* And now some misc. operation control bits. */ 12062306a36Sopenharmony_ci#define NPORT_DMODE0_DOSETUP 0x00000020 12162306a36Sopenharmony_ci#define NPORT_DMODE0_CHOST 0x00000040 12262306a36Sopenharmony_ci#define NPORT_DMODE0_AHOST 0x00000080 12362306a36Sopenharmony_ci#define NPORT_DMODE0_STOPX 0x00000100 12462306a36Sopenharmony_ci#define NPORT_DMODE0_STOPY 0x00000200 12562306a36Sopenharmony_ci#define NPORT_DMODE0_SK1ST 0x00000400 12662306a36Sopenharmony_ci#define NPORT_DMODE0_SKLST 0x00000800 12762306a36Sopenharmony_ci#define NPORT_DMODE0_ZPENAB 0x00001000 12862306a36Sopenharmony_ci#define NPORT_DMODE0_LISPENAB 0x00002000 12962306a36Sopenharmony_ci#define NPORT_DMODE0_LISLST 0x00004000 13062306a36Sopenharmony_ci#define NPORT_DMODE0_L32 0x00008000 13162306a36Sopenharmony_ci#define NPORT_DMODE0_ZOPQ 0x00010000 13262306a36Sopenharmony_ci#define NPORT_DMODE0_LISOPQ 0x00020000 13362306a36Sopenharmony_ci#define NPORT_DMODE0_SHADE 0x00040000 13462306a36Sopenharmony_ci#define NPORT_DMODE0_LRONLY 0x00080000 13562306a36Sopenharmony_ci#define NPORT_DMODE0_XYOFF 0x00100000 13662306a36Sopenharmony_ci#define NPORT_DMODE0_CLAMP 0x00200000 13762306a36Sopenharmony_ci#define NPORT_DMODE0_ENDPF 0x00400000 13862306a36Sopenharmony_ci#define NPORT_DMODE0_YSTR 0x00800000 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci npireg_t lsmode; /* Mode for line stipple ops */ 14162306a36Sopenharmony_ci npireg_t lspattern; /* Pattern for line stipple ops */ 14262306a36Sopenharmony_ci npireg_t lspatsave; /* Backup save pattern */ 14362306a36Sopenharmony_ci npireg_t zpattern; /* Pixel zpattern */ 14462306a36Sopenharmony_ci npireg_t colorback; /* Background color */ 14562306a36Sopenharmony_ci npireg_t colorvram; /* Clear color for fast vram */ 14662306a36Sopenharmony_ci npireg_t alpharef; /* Reference value for afunctions */ 14762306a36Sopenharmony_ci unsigned int pad0; 14862306a36Sopenharmony_ci npireg_t smask0x; /* Window GL relative screen mask 0 */ 14962306a36Sopenharmony_ci npireg_t smask0y; /* Window GL relative screen mask 0 */ 15062306a36Sopenharmony_ci npireg_t _setup; 15162306a36Sopenharmony_ci npireg_t _stepz; 15262306a36Sopenharmony_ci npireg_t _lsrestore; 15362306a36Sopenharmony_ci npireg_t _lssave; 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci unsigned int _pad1[0x30]; 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci /* Iterators, full state for context switch */ 15862306a36Sopenharmony_ci npfreg_t _xstart; /* X-start point (current) */ 15962306a36Sopenharmony_ci npfreg_t _ystart; /* Y-start point (current) */ 16062306a36Sopenharmony_ci npfreg_t _xend; /* x-end point */ 16162306a36Sopenharmony_ci npfreg_t _yend; /* y-end point */ 16262306a36Sopenharmony_ci npireg_t xsave; /* copy of xstart integer value for BLOCk addressing MODE */ 16362306a36Sopenharmony_ci npireg_t xymove; /* x.y offset from xstart, ystart for relative operations */ 16462306a36Sopenharmony_ci npfreg_t bresd; 16562306a36Sopenharmony_ci npfreg_t bress1; 16662306a36Sopenharmony_ci npireg_t bresoctinc1; 16762306a36Sopenharmony_ci volatile int bresrndinc2; 16862306a36Sopenharmony_ci npireg_t brese1; 16962306a36Sopenharmony_ci npireg_t bress2; 17062306a36Sopenharmony_ci npireg_t aweight0; 17162306a36Sopenharmony_ci npireg_t aweight1; 17262306a36Sopenharmony_ci npfreg_t xstartf; 17362306a36Sopenharmony_ci npfreg_t ystartf; 17462306a36Sopenharmony_ci npfreg_t xendf; 17562306a36Sopenharmony_ci npfreg_t yendf; 17662306a36Sopenharmony_ci npireg_t xstarti; 17762306a36Sopenharmony_ci npfreg_t xendf1; 17862306a36Sopenharmony_ci npireg_t xystarti; 17962306a36Sopenharmony_ci npireg_t xyendi; 18062306a36Sopenharmony_ci npireg_t xstartendi; 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci unsigned int _unused2[0x29]; 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ci npfreg_t colorred; 18562306a36Sopenharmony_ci npfreg_t coloralpha; 18662306a36Sopenharmony_ci npfreg_t colorgrn; 18762306a36Sopenharmony_ci npfreg_t colorblue; 18862306a36Sopenharmony_ci npfreg_t slopered; 18962306a36Sopenharmony_ci npfreg_t slopealpha; 19062306a36Sopenharmony_ci npfreg_t slopegrn; 19162306a36Sopenharmony_ci npfreg_t slopeblue; 19262306a36Sopenharmony_ci npireg_t wrmask; 19362306a36Sopenharmony_ci npireg_t colori; 19462306a36Sopenharmony_ci npfreg_t colorx; 19562306a36Sopenharmony_ci npfreg_t slopered1; 19662306a36Sopenharmony_ci npireg_t hostrw0; 19762306a36Sopenharmony_ci npireg_t hostrw1; 19862306a36Sopenharmony_ci npireg_t dcbmode; 19962306a36Sopenharmony_ci#define NPORT_DMODE_WMASK 0x00000003 20062306a36Sopenharmony_ci#define NPORT_DMODE_W4 0x00000000 20162306a36Sopenharmony_ci#define NPORT_DMODE_W1 0x00000001 20262306a36Sopenharmony_ci#define NPORT_DMODE_W2 0x00000002 20362306a36Sopenharmony_ci#define NPORT_DMODE_W3 0x00000003 20462306a36Sopenharmony_ci#define NPORT_DMODE_EDPACK 0x00000004 20562306a36Sopenharmony_ci#define NPORT_DMODE_ECINC 0x00000008 20662306a36Sopenharmony_ci#define NPORT_DMODE_CMASK 0x00000070 20762306a36Sopenharmony_ci#define NPORT_DMODE_AMASK 0x00000780 20862306a36Sopenharmony_ci#define NPORT_DMODE_AVC2 0x00000000 20962306a36Sopenharmony_ci#define NPORT_DMODE_ACMALL 0x00000080 21062306a36Sopenharmony_ci#define NPORT_DMODE_ACM0 0x00000100 21162306a36Sopenharmony_ci#define NPORT_DMODE_ACM1 0x00000180 21262306a36Sopenharmony_ci#define NPORT_DMODE_AXMALL 0x00000200 21362306a36Sopenharmony_ci#define NPORT_DMODE_AXM0 0x00000280 21462306a36Sopenharmony_ci#define NPORT_DMODE_AXM1 0x00000300 21562306a36Sopenharmony_ci#define NPORT_DMODE_ABT 0x00000380 21662306a36Sopenharmony_ci#define NPORT_DMODE_AVCC1 0x00000400 21762306a36Sopenharmony_ci#define NPORT_DMODE_AVAB1 0x00000480 21862306a36Sopenharmony_ci#define NPORT_DMODE_ALG3V0 0x00000500 21962306a36Sopenharmony_ci#define NPORT_DMODE_A1562 0x00000580 22062306a36Sopenharmony_ci#define NPORT_DMODE_ESACK 0x00000800 22162306a36Sopenharmony_ci#define NPORT_DMODE_EASACK 0x00001000 22262306a36Sopenharmony_ci#define NPORT_DMODE_CWMASK 0x0003e000 22362306a36Sopenharmony_ci#define NPORT_DMODE_CHMASK 0x007c0000 22462306a36Sopenharmony_ci#define NPORT_DMODE_CSMASK 0x0f800000 22562306a36Sopenharmony_ci#define NPORT_DMODE_SENDIAN 0x10000000 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci unsigned int _unused3; 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci union np_dcb dcbdata0; 23062306a36Sopenharmony_ci npireg_t dcbdata1; 23162306a36Sopenharmony_ci}; 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_cistruct newport_cregs { 23462306a36Sopenharmony_ci npireg_t smask1x; 23562306a36Sopenharmony_ci npireg_t smask1y; 23662306a36Sopenharmony_ci npireg_t smask2x; 23762306a36Sopenharmony_ci npireg_t smask2y; 23862306a36Sopenharmony_ci npireg_t smask3x; 23962306a36Sopenharmony_ci npireg_t smask3y; 24062306a36Sopenharmony_ci npireg_t smask4x; 24162306a36Sopenharmony_ci npireg_t smask4y; 24262306a36Sopenharmony_ci npireg_t topscan; 24362306a36Sopenharmony_ci npireg_t xywin; 24462306a36Sopenharmony_ci npireg_t clipmode; 24562306a36Sopenharmony_ci#define NPORT_CMODE_SM0 0x00000001 24662306a36Sopenharmony_ci#define NPORT_CMODE_SM1 0x00000002 24762306a36Sopenharmony_ci#define NPORT_CMODE_SM2 0x00000004 24862306a36Sopenharmony_ci#define NPORT_CMODE_SM3 0x00000008 24962306a36Sopenharmony_ci#define NPORT_CMODE_SM4 0x00000010 25062306a36Sopenharmony_ci#define NPORT_CMODE_CMSK 0x00001e00 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ci unsigned int _unused0; 25362306a36Sopenharmony_ci unsigned int config; 25462306a36Sopenharmony_ci#define NPORT_CFG_G32MD 0x00000001 25562306a36Sopenharmony_ci#define NPORT_CFG_BWIDTH 0x00000002 25662306a36Sopenharmony_ci#define NPORT_CFG_ERCVR 0x00000004 25762306a36Sopenharmony_ci#define NPORT_CFG_BDMSK 0x00000078 25862306a36Sopenharmony_ci#define NPORT_CFG_BFAINT 0x00000080 25962306a36Sopenharmony_ci#define NPORT_CFG_GDMSK 0x00001f80 26062306a36Sopenharmony_ci#define NPORT_CFG_GD0 0x00000100 26162306a36Sopenharmony_ci#define NPORT_CFG_GD1 0x00000200 26262306a36Sopenharmony_ci#define NPORT_CFG_GD2 0x00000400 26362306a36Sopenharmony_ci#define NPORT_CFG_GD3 0x00000800 26462306a36Sopenharmony_ci#define NPORT_CFG_GD4 0x00001000 26562306a36Sopenharmony_ci#define NPORT_CFG_GFAINT 0x00002000 26662306a36Sopenharmony_ci#define NPORT_CFG_TOMSK 0x0001c000 26762306a36Sopenharmony_ci#define NPORT_CFG_VRMSK 0x000e0000 26862306a36Sopenharmony_ci#define NPORT_CFG_FBTYP 0x00100000 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ci npireg_t _unused1; 27162306a36Sopenharmony_ci npireg_t status; 27262306a36Sopenharmony_ci#define NPORT_STAT_VERS 0x00000007 27362306a36Sopenharmony_ci#define NPORT_STAT_GBUSY 0x00000008 27462306a36Sopenharmony_ci#define NPORT_STAT_BBUSY 0x00000010 27562306a36Sopenharmony_ci#define NPORT_STAT_VRINT 0x00000020 27662306a36Sopenharmony_ci#define NPORT_STAT_VIDINT 0x00000040 27762306a36Sopenharmony_ci#define NPORT_STAT_GLMSK 0x00001f80 27862306a36Sopenharmony_ci#define NPORT_STAT_BLMSK 0x0007e000 27962306a36Sopenharmony_ci#define NPORT_STAT_BFIRQ 0x00080000 28062306a36Sopenharmony_ci#define NPORT_STAT_GFIRQ 0x00100000 28162306a36Sopenharmony_ci 28262306a36Sopenharmony_ci npireg_t ustatus; 28362306a36Sopenharmony_ci npireg_t dcbreset; 28462306a36Sopenharmony_ci}; 28562306a36Sopenharmony_ci 28662306a36Sopenharmony_cistruct newport_regs { 28762306a36Sopenharmony_ci struct newport_rexregs set; 28862306a36Sopenharmony_ci unsigned int _unused0[0x16e]; 28962306a36Sopenharmony_ci struct newport_rexregs go; 29062306a36Sopenharmony_ci unsigned int _unused1[0x22e]; 29162306a36Sopenharmony_ci struct newport_cregs cset; 29262306a36Sopenharmony_ci unsigned int _unused2[0x1ef]; 29362306a36Sopenharmony_ci struct newport_cregs cgo; 29462306a36Sopenharmony_ci}; 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_citypedef struct { 29762306a36Sopenharmony_ci unsigned int drawmode1; 29862306a36Sopenharmony_ci unsigned int drawmode0; 29962306a36Sopenharmony_ci unsigned int lsmode; 30062306a36Sopenharmony_ci unsigned int lspattern; 30162306a36Sopenharmony_ci unsigned int lspatsave; 30262306a36Sopenharmony_ci unsigned int zpattern; 30362306a36Sopenharmony_ci unsigned int colorback; 30462306a36Sopenharmony_ci unsigned int colorvram; 30562306a36Sopenharmony_ci unsigned int alpharef; 30662306a36Sopenharmony_ci unsigned int smask0x; 30762306a36Sopenharmony_ci unsigned int smask0y; 30862306a36Sopenharmony_ci unsigned int _xstart; 30962306a36Sopenharmony_ci unsigned int _ystart; 31062306a36Sopenharmony_ci unsigned int _xend; 31162306a36Sopenharmony_ci unsigned int _yend; 31262306a36Sopenharmony_ci unsigned int xsave; 31362306a36Sopenharmony_ci unsigned int xymove; 31462306a36Sopenharmony_ci unsigned int bresd; 31562306a36Sopenharmony_ci unsigned int bress1; 31662306a36Sopenharmony_ci unsigned int bresoctinc1; 31762306a36Sopenharmony_ci unsigned int bresrndinc2; 31862306a36Sopenharmony_ci unsigned int brese1; 31962306a36Sopenharmony_ci unsigned int bress2; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci unsigned int aweight0; 32262306a36Sopenharmony_ci unsigned int aweight1; 32362306a36Sopenharmony_ci unsigned int colorred; 32462306a36Sopenharmony_ci unsigned int coloralpha; 32562306a36Sopenharmony_ci unsigned int colorgrn; 32662306a36Sopenharmony_ci unsigned int colorblue; 32762306a36Sopenharmony_ci unsigned int slopered; 32862306a36Sopenharmony_ci unsigned int slopealpha; 32962306a36Sopenharmony_ci unsigned int slopegrn; 33062306a36Sopenharmony_ci unsigned int slopeblue; 33162306a36Sopenharmony_ci unsigned int wrmask; 33262306a36Sopenharmony_ci unsigned int hostrw0; 33362306a36Sopenharmony_ci unsigned int hostrw1; 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci /* configregs */ 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_ci unsigned int smask1x; 33862306a36Sopenharmony_ci unsigned int smask1y; 33962306a36Sopenharmony_ci unsigned int smask2x; 34062306a36Sopenharmony_ci unsigned int smask2y; 34162306a36Sopenharmony_ci unsigned int smask3x; 34262306a36Sopenharmony_ci unsigned int smask3y; 34362306a36Sopenharmony_ci unsigned int smask4x; 34462306a36Sopenharmony_ci unsigned int smask4y; 34562306a36Sopenharmony_ci unsigned int topscan; 34662306a36Sopenharmony_ci unsigned int xywin; 34762306a36Sopenharmony_ci unsigned int clipmode; 34862306a36Sopenharmony_ci unsigned int config; 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ci /* dcb registers */ 35162306a36Sopenharmony_ci unsigned int dcbmode; 35262306a36Sopenharmony_ci unsigned int dcbdata0; 35362306a36Sopenharmony_ci unsigned int dcbdata1; 35462306a36Sopenharmony_ci} newport_ctx; 35562306a36Sopenharmony_ci 35662306a36Sopenharmony_ci/* Reading/writing VC2 registers. */ 35762306a36Sopenharmony_ci#define VC2_REGADDR_INDEX 0x00000000 35862306a36Sopenharmony_ci#define VC2_REGADDR_IREG 0x00000010 35962306a36Sopenharmony_ci#define VC2_REGADDR_RAM 0x00000030 36062306a36Sopenharmony_ci#define VC2_PROTOCOL (NPORT_DMODE_EASACK | 0x00800000 | 0x00040000) 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci#define VC2_VLINET_ADDR 0x000 36362306a36Sopenharmony_ci#define VC2_VFRAMET_ADDR 0x400 36462306a36Sopenharmony_ci#define VC2_CGLYPH_ADDR 0x500 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_ci/* Now the Indexed registers of the VC2. */ 36762306a36Sopenharmony_ci#define VC2_IREG_VENTRY 0x00 36862306a36Sopenharmony_ci#define VC2_IREG_CENTRY 0x01 36962306a36Sopenharmony_ci#define VC2_IREG_CURSX 0x02 37062306a36Sopenharmony_ci#define VC2_IREG_CURSY 0x03 37162306a36Sopenharmony_ci#define VC2_IREG_CCURSX 0x04 37262306a36Sopenharmony_ci#define VC2_IREG_DENTRY 0x05 37362306a36Sopenharmony_ci#define VC2_IREG_SLEN 0x06 37462306a36Sopenharmony_ci#define VC2_IREG_RADDR 0x07 37562306a36Sopenharmony_ci#define VC2_IREG_VFPTR 0x08 37662306a36Sopenharmony_ci#define VC2_IREG_VLSPTR 0x09 37762306a36Sopenharmony_ci#define VC2_IREG_VLIR 0x0a 37862306a36Sopenharmony_ci#define VC2_IREG_VLCTR 0x0b 37962306a36Sopenharmony_ci#define VC2_IREG_CTPTR 0x0c 38062306a36Sopenharmony_ci#define VC2_IREG_WCURSY 0x0d 38162306a36Sopenharmony_ci#define VC2_IREG_DFPTR 0x0e 38262306a36Sopenharmony_ci#define VC2_IREG_DLTPTR 0x0f 38362306a36Sopenharmony_ci#define VC2_IREG_CONTROL 0x10 38462306a36Sopenharmony_ci#define VC2_IREG_CONFIG 0x20 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_cistatic inline void newport_vc2_set(struct newport_regs *regs, 38762306a36Sopenharmony_ci unsigned char vc2ireg, 38862306a36Sopenharmony_ci unsigned short val) 38962306a36Sopenharmony_ci{ 39062306a36Sopenharmony_ci regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | 39162306a36Sopenharmony_ci NPORT_DMODE_ECINC | VC2_PROTOCOL); 39262306a36Sopenharmony_ci regs->set.dcbdata0.byword = (vc2ireg << 24) | (val << 8); 39362306a36Sopenharmony_ci} 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_cistatic inline unsigned short newport_vc2_get(struct newport_regs *regs, 39662306a36Sopenharmony_ci unsigned char vc2ireg) 39762306a36Sopenharmony_ci{ 39862306a36Sopenharmony_ci regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | 39962306a36Sopenharmony_ci NPORT_DMODE_ECINC | VC2_PROTOCOL); 40062306a36Sopenharmony_ci regs->set.dcbdata0.bybytes.b3 = vc2ireg; 40162306a36Sopenharmony_ci regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 | 40262306a36Sopenharmony_ci NPORT_DMODE_ECINC | VC2_PROTOCOL); 40362306a36Sopenharmony_ci return regs->set.dcbdata0.byshort.s1; 40462306a36Sopenharmony_ci} 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_ci/* VC2 Control register bits */ 40762306a36Sopenharmony_ci#define VC2_CTRL_EVIRQ 0x0001 40862306a36Sopenharmony_ci#define VC2_CTRL_EDISP 0x0002 40962306a36Sopenharmony_ci#define VC2_CTRL_EVIDEO 0x0004 41062306a36Sopenharmony_ci#define VC2_CTRL_EDIDS 0x0008 41162306a36Sopenharmony_ci#define VC2_CTRL_ECURS 0x0010 41262306a36Sopenharmony_ci#define VC2_CTRL_EGSYNC 0x0020 41362306a36Sopenharmony_ci#define VC2_CTRL_EILACE 0x0040 41462306a36Sopenharmony_ci#define VC2_CTRL_ECDISP 0x0080 41562306a36Sopenharmony_ci#define VC2_CTRL_ECCURS 0x0100 41662306a36Sopenharmony_ci#define VC2_CTRL_ECG64 0x0200 41762306a36Sopenharmony_ci#define VC2_CTRL_GLSEL 0x0400 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci/* Controlling the color map on NEWPORT. */ 42062306a36Sopenharmony_ci#define NCMAP_REGADDR_AREG 0x00000000 42162306a36Sopenharmony_ci#define NCMAP_REGADDR_ALO 0x00000000 42262306a36Sopenharmony_ci#define NCMAP_REGADDR_AHI 0x00000010 42362306a36Sopenharmony_ci#define NCMAP_REGADDR_PBUF 0x00000020 42462306a36Sopenharmony_ci#define NCMAP_REGADDR_CREG 0x00000030 42562306a36Sopenharmony_ci#define NCMAP_REGADDR_SREG 0x00000040 42662306a36Sopenharmony_ci#define NCMAP_REGADDR_RREG 0x00000060 42762306a36Sopenharmony_ci#define NCMAP_PROTOCOL (0x00008000 | 0x00040000 | 0x00800000) 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_cistatic __inline__ void newport_cmap_setaddr(struct newport_regs *regs, 43062306a36Sopenharmony_ci unsigned short addr) 43162306a36Sopenharmony_ci{ 43262306a36Sopenharmony_ci regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | 43362306a36Sopenharmony_ci NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC | 43462306a36Sopenharmony_ci NCMAP_REGADDR_AREG | NPORT_DMODE_W2); 43562306a36Sopenharmony_ci regs->set.dcbdata0.byshort.s1 = addr; 43662306a36Sopenharmony_ci regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | 43762306a36Sopenharmony_ci NCMAP_REGADDR_PBUF | NPORT_DMODE_W3); 43862306a36Sopenharmony_ci} 43962306a36Sopenharmony_ci 44062306a36Sopenharmony_cistatic __inline__ void newport_cmap_setrgb(struct newport_regs *regs, 44162306a36Sopenharmony_ci unsigned char red, 44262306a36Sopenharmony_ci unsigned char green, 44362306a36Sopenharmony_ci unsigned char blue) 44462306a36Sopenharmony_ci{ 44562306a36Sopenharmony_ci regs->set.dcbdata0.byword = 44662306a36Sopenharmony_ci (red << 24) | 44762306a36Sopenharmony_ci (green << 16) | 44862306a36Sopenharmony_ci (blue << 8); 44962306a36Sopenharmony_ci} 45062306a36Sopenharmony_ci 45162306a36Sopenharmony_ci/* Miscellaneous NEWPORT routines. */ 45262306a36Sopenharmony_ci#define BUSY_TIMEOUT 100000 45362306a36Sopenharmony_cistatic __inline__ int newport_wait(struct newport_regs *regs) 45462306a36Sopenharmony_ci{ 45562306a36Sopenharmony_ci int t = BUSY_TIMEOUT; 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ci while (--t) 45862306a36Sopenharmony_ci if (!(regs->cset.status & NPORT_STAT_GBUSY)) 45962306a36Sopenharmony_ci break; 46062306a36Sopenharmony_ci return !t; 46162306a36Sopenharmony_ci} 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_cistatic __inline__ int newport_bfwait(struct newport_regs *regs) 46462306a36Sopenharmony_ci{ 46562306a36Sopenharmony_ci int t = BUSY_TIMEOUT; 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_ci while (--t) 46862306a36Sopenharmony_ci if(!(regs->cset.status & NPORT_STAT_BBUSY)) 46962306a36Sopenharmony_ci break; 47062306a36Sopenharmony_ci return !t; 47162306a36Sopenharmony_ci} 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* 47462306a36Sopenharmony_ci * DCBMODE register defines: 47562306a36Sopenharmony_ci */ 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ci/* Width of the data being transferred for each DCBDATA[01] word */ 47862306a36Sopenharmony_ci#define DCB_DATAWIDTH_4 0x0 47962306a36Sopenharmony_ci#define DCB_DATAWIDTH_1 0x1 48062306a36Sopenharmony_ci#define DCB_DATAWIDTH_2 0x2 48162306a36Sopenharmony_ci#define DCB_DATAWIDTH_3 0x3 48262306a36Sopenharmony_ci 48362306a36Sopenharmony_ci/* If set, all of DCBDATA will be moved, otherwise only DATAWIDTH bytes */ 48462306a36Sopenharmony_ci#define DCB_ENDATAPACK (1 << 2) 48562306a36Sopenharmony_ci 48662306a36Sopenharmony_ci/* Enables DCBCRS auto increment after each DCB transfer */ 48762306a36Sopenharmony_ci#define DCB_ENCRSINC (1 << 3) 48862306a36Sopenharmony_ci 48962306a36Sopenharmony_ci/* shift for accessing the control register select address (DBCCRS, 3 bits) */ 49062306a36Sopenharmony_ci#define DCB_CRS_SHIFT 4 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ci/* DCBADDR (4 bits): display bus slave address */ 49362306a36Sopenharmony_ci#define DCB_ADDR_SHIFT 7 49462306a36Sopenharmony_ci#define DCB_VC2 (0 << DCB_ADDR_SHIFT) 49562306a36Sopenharmony_ci#define DCB_CMAP_ALL (1 << DCB_ADDR_SHIFT) 49662306a36Sopenharmony_ci#define DCB_CMAP0 (2 << DCB_ADDR_SHIFT) 49762306a36Sopenharmony_ci#define DCB_CMAP1 (3 << DCB_ADDR_SHIFT) 49862306a36Sopenharmony_ci#define DCB_XMAP_ALL (4 << DCB_ADDR_SHIFT) 49962306a36Sopenharmony_ci#define DCB_XMAP0 (5 << DCB_ADDR_SHIFT) 50062306a36Sopenharmony_ci#define DCB_XMAP1 (6 << DCB_ADDR_SHIFT) 50162306a36Sopenharmony_ci#define DCB_BT445 (7 << DCB_ADDR_SHIFT) 50262306a36Sopenharmony_ci#define DCB_VCC1 (8 << DCB_ADDR_SHIFT) 50362306a36Sopenharmony_ci#define DCB_VAB1 (9 << DCB_ADDR_SHIFT) 50462306a36Sopenharmony_ci#define DCB_LG3_BDVERS0 (10 << DCB_ADDR_SHIFT) 50562306a36Sopenharmony_ci#define DCB_LG3_ICS1562 (11 << DCB_ADDR_SHIFT) 50662306a36Sopenharmony_ci#define DCB_RESERVED (15 << DCB_ADDR_SHIFT) 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_ci/* DCB protocol ack types */ 50962306a36Sopenharmony_ci#define DCB_ENSYNCACK (1 << 11) 51062306a36Sopenharmony_ci#define DCB_ENASYNCACK (1 << 12) 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci#define DCB_CSWIDTH_SHIFT 13 51362306a36Sopenharmony_ci#define DCB_CSHOLD_SHIFT 18 51462306a36Sopenharmony_ci#define DCB_CSSETUP_SHIFT 23 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ci/* XMAP9 specific defines */ 51762306a36Sopenharmony_ci/* XMAP9 -- registers as seen on the DCBMODE register*/ 51862306a36Sopenharmony_ci# define XM9_CRS_CONFIG (0 << DCB_CRS_SHIFT) 51962306a36Sopenharmony_ci# define XM9_PUPMODE (1 << 0) 52062306a36Sopenharmony_ci# define XM9_ODD_PIXEL (1 << 1) 52162306a36Sopenharmony_ci# define XM9_8_BITPLANES (1 << 2) 52262306a36Sopenharmony_ci# define XM9_SLOW_DCB (1 << 3) 52362306a36Sopenharmony_ci# define XM9_VIDEO_RGBMAP_MASK (3 << 4) 52462306a36Sopenharmony_ci# define XM9_EXPRESS_VIDEO (1 << 6) 52562306a36Sopenharmony_ci# define XM9_VIDEO_OPTION (1 << 7) 52662306a36Sopenharmony_ci# define XM9_CRS_REVISION (1 << DCB_CRS_SHIFT) 52762306a36Sopenharmony_ci# define XM9_CRS_FIFO_AVAIL (2 << DCB_CRS_SHIFT) 52862306a36Sopenharmony_ci# define XM9_FIFO_0_AVAIL 0 52962306a36Sopenharmony_ci# define XM9_FIFO_1_AVAIL 1 53062306a36Sopenharmony_ci# define XM9_FIFO_2_AVAIL 3 53162306a36Sopenharmony_ci# define XM9_FIFO_3_AVAIL 2 53262306a36Sopenharmony_ci# define XM9_FIFO_FULL XM9_FIFO_0_AVAIL 53362306a36Sopenharmony_ci# define XM9_FIFO_EMPTY XM9_FIFO_3_AVAIL 53462306a36Sopenharmony_ci# define XM9_CRS_CURS_CMAP_MSB (3 << DCB_CRS_SHIFT) 53562306a36Sopenharmony_ci# define XM9_CRS_PUP_CMAP_MSB (4 << DCB_CRS_SHIFT) 53662306a36Sopenharmony_ci# define XM9_CRS_MODE_REG_DATA (5 << DCB_CRS_SHIFT) 53762306a36Sopenharmony_ci# define XM9_CRS_MODE_REG_INDEX (7 << DCB_CRS_SHIFT) 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci#define DCB_CYCLES(setup,hold,width) \ 54162306a36Sopenharmony_ci ((hold << DCB_CSHOLD_SHIFT) | \ 54262306a36Sopenharmony_ci (setup << DCB_CSSETUP_SHIFT)| \ 54362306a36Sopenharmony_ci (width << DCB_CSWIDTH_SHIFT)) 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_ci#define W_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 0) 54662306a36Sopenharmony_ci#define WSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (5, 5, 0) 54762306a36Sopenharmony_ci#define WAYSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (12, 12, 0) 54862306a36Sopenharmony_ci#define R_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 3) 54962306a36Sopenharmony_ci 55062306a36Sopenharmony_cistatic __inline__ void 55162306a36Sopenharmony_cixmap9FIFOWait (struct newport_regs *rex) 55262306a36Sopenharmony_ci{ 55362306a36Sopenharmony_ci rex->set.dcbmode = DCB_XMAP0 | XM9_CRS_FIFO_AVAIL | 55462306a36Sopenharmony_ci DCB_DATAWIDTH_1 | R_DCB_XMAP9_PROTOCOL; 55562306a36Sopenharmony_ci newport_bfwait (rex); 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ci while ((rex->set.dcbdata0.bybytes.b3 & 3) != XM9_FIFO_EMPTY) 55862306a36Sopenharmony_ci ; 55962306a36Sopenharmony_ci} 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_cistatic __inline__ void 56262306a36Sopenharmony_cixmap9SetModeReg (struct newport_regs *rex, unsigned int modereg, unsigned int data24, int cfreq) 56362306a36Sopenharmony_ci{ 56462306a36Sopenharmony_ci if (cfreq > 119) 56562306a36Sopenharmony_ci rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA | 56662306a36Sopenharmony_ci DCB_DATAWIDTH_4 | W_DCB_XMAP9_PROTOCOL; 56762306a36Sopenharmony_ci else if (cfreq > 59) 56862306a36Sopenharmony_ci rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA | 56962306a36Sopenharmony_ci DCB_DATAWIDTH_4 | WSLOW_DCB_XMAP9_PROTOCOL; 57062306a36Sopenharmony_ci else 57162306a36Sopenharmony_ci rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA | 57262306a36Sopenharmony_ci DCB_DATAWIDTH_4 | WAYSLOW_DCB_XMAP9_PROTOCOL; 57362306a36Sopenharmony_ci rex->set.dcbdata0.byword = ((modereg) << 24) | (data24 & 0xffffff); 57462306a36Sopenharmony_ci} 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci#define BT445_PROTOCOL DCB_CYCLES(1,1,3) 57762306a36Sopenharmony_ci 57862306a36Sopenharmony_ci#define BT445_CSR_ADDR_REG (0 << DCB_CRS_SHIFT) 57962306a36Sopenharmony_ci#define BT445_CSR_REVISION (2 << DCB_CRS_SHIFT) 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci#define BT445_REVISION_REG 0x01 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_ci#endif /* !(_SGI_NEWPORT_H) */ 58462306a36Sopenharmony_ci 585