/* This is the hardware interface for newport graphics. It's taken from IRIX. Alex deVries */ #ifndef __SYS_NG1HW_H__ #define __SYS_NG1HW_H__ #ident "$Revision: 1.44 $" #define BIT(n) (0x1 << n) #ifndef REX_ASMCODE typedef union { volatile float flt; volatile unsigned int word; } float_long; typedef volatile unsigned int vol_ulong; typedef volatile unsigned int fixed16; typedef union { vol_ulong byword; struct { volatile unsigned short s0; volatile unsigned short s1; } byshort; struct { volatile unsigned char b0, b1, b2; volatile unsigned char b3; } bybyte; } DCB_reg; #ifndef REXSIM typedef struct rex3regs { /* THE CHIP */ vol_ulong drawmode1; /* extra mode bits for GL 0x0000 */ vol_ulong drawmode0; /* command register 0x0004 */ vol_ulong lsmode; /* line stipple mode 0x0008 */ vol_ulong lspattern; /* 32 bit pixel lspattern 0x000c */ vol_ulong lspatsave; /* save register for lspattern 0x0010 */ vol_ulong zpattern; /* 32 bit pixel zpattern 0x0014 */ vol_ulong colorback; /* background color 0x0018 */ vol_ulong colorvram; /* fast vram clear color 0x001c */ vol_ulong alpharef; /* afunction reference value 0x0020 */ vol_ulong pad0; /* padding 0x0024 */ vol_ulong smask0x; /* screen mask 0, window rel, 0x0028 */ vol_ulong smask0y; /* exclusively for the GL 0x002c */ vol_ulong _setup; /* do line/span setup, no iter 0x0030 */ vol_ulong _stepz; /* Enable ZPATTERN for this pix 0x0034 */ vol_ulong _lsrestore; /* Restore lspattern,count 0x0038 */ vol_ulong _lssave; /* Backup lspattern,count 0x003c */ char _pad1[0x100-0x40]; float_long _xstart; /* 16.4(7) current x 0x0100 */ float_long _ystart; /* 16.4(7) current y 0x0104 */ float_long _xend; /* 16.4(7) 0x0108 */ float_long _yend; /* 16.4(7) 0x010c */ vol_ulong xsave; /* 16 x save for blocks 0x0110 */ vol_ulong xymove; /* x,y copy dest offset 0x0114 */ float_long bresd; /* s19.8 bres d error term 0x0118 */ float_long bress1; /* s2.15 bres s coverage term 0x011c */ vol_ulong bresoctinc1; /* 3(4)17.3 octant+inc1 value 0x0120 */ volatile int bresrndinc2; /* 8(3)18.3 bres inc2 value 0x0124 */ vol_ulong brese1; /* 1.15 bres e1 (minor slope) 0x0128 */ vol_ulong bress2; /* s18.8 bres s2 coverage term 0x012c */ vol_ulong aweight0; /* antialiasing weights 0x0130 */ vol_ulong aweight1; /* antialiasing weights 0x0134 */ float_long xstartf; /* 12.4(7) GL version of _xstart0x0138 */ float_long ystartf; /* 12.4(7) 0x013c */ float_long xendf; /* 12.4(7) 0x0140 */ float_long yendf; /* 12.4(7) 0x0144 */ fixed16 xstarti; /* 16 integer format for xstart 0x0148 */ float_long xendf1; /* 12.4(7) same as xend 0x014c */ fixed16 xystarti; /* 16,16 0x0150 */ fixed16 xyendi; /* 16,16 0x0154 */ fixed16 xstartendi; /* 16,16 0x0158 */ char _pad2[0x200-0x15c]; float_long colorred; /* o12.11 red (also foreground) 0x0200 */ float_long coloralpha; /* o8.11 alpha 0x0204 */ float_long colorgrn; /* o8.11 green 0x0208 */ float_long colorblue; /* o8.11 blue 0x020c */ float_long slopered; /* s9.11 0x0210 */ float_long slopealpha; /* s9.11 0x0214 */ float_long slopegrn; /* s9.11 0x0218 */ float_long slopeblue; /* s9.11 0x021c */ vol_ulong wrmask; /* writemask 0x0220 */ vol_ulong colori; /* packed bgr/ci 0x0224 */ float_long colorx; /* 12.11 red (no overflow) 0x0228 */ float_long slopered1; /* same as slopered 0x022c */ vol_ulong hostrw0; /* host PIO/DMA port (msw) 0x0230 */ vol_ulong hostrw1; /* host PIO/DMA port (lsw) 0x0234 */ vol_ulong dcbmode; /* display ctrl bus mode reg 0x0238 */ volatile int pad3; /* 0x023c */ DCB_reg dcbdata0; /* display ctrl bus port (msw) 0x0240 */ vol_ulong dcbdata1; /* display ctrl bus port (lsw) 0x0244 */ } Rex3regs; typedef struct configregs { vol_ulong smask1x; /* screenmask1 right,left edges 0x1300 */ vol_ulong smask1y; /* screenmask1 bottom,top edges 0x1304 */ vol_ulong smask2x; /* screenmask2 right,left edges 0x1308 */ vol_ulong smask2y; /* screenmask2 bottom,top edges 0x130c */ vol_ulong smask3x; /* screenmask3 right,left edges 0x1310 */ vol_ulong smask3y; /* screenmask3 bottom,top edges 0x1314 */ vol_ulong smask4x; /* screenmask4 right,left edges 0x1318 */ vol_ulong smask4y; /* screenmask4 bottom,top edges 0x131c */ vol_ulong topscan; /* y coord of top screen line 0x1320 */ vol_ulong xywin; /* window offset 0x1324 */ vol_ulong clipmode; /* cid,smask settings 0x1328 */ vol_ulong pad0; /* 0x132c */ vol_ulong config; /* miscellaneous config bits 0x1330 */ vol_ulong pad1; /* 0x1334 */ vol_ulong status; /* chip busy, FIFO, int status 0x1338 */ /* read clears interrupt status bits */ vol_ulong ustatus; /* padding on rex rev a, 'read-only' 0x133c */ /* copy of status on rex rev b. */ vol_ulong dcbreset; /* resets DCB and flushes BFIFO 0x1340 */ } Configregs; typedef struct rex3chip { /* page 0 */ struct rex3regs set; /* 0x0000 */ char _pad0[0x7fc-sizeof(struct rex3regs)]; volatile unsigned int dummy; /* 0x7fc */ struct rex3regs go; /* 0x0800 */ char _pad1[0x1300-0x800-sizeof(struct rex3regs)]; /* page 1 */ struct { struct configregs set; /* 0x1300 */ char _pad0[0x800-sizeof(struct configregs)]; struct configregs go; /* 0x1b00 */ } p1; } rex3Chip, Rex3chip; #endif /* REX_ASMCODE */ #endif /* REXSIM */ /* Since alot of flags went away, define here as null bits and leave the code as it is for now, marking where we have to change stuff. NONE of these should be defined ! - billt */ #define LSCONTINUE 0 #define SHADECONTINUE 0 #define XYCONTINUE 0 #define XMAJOR 0 #define YMAJOR 0 #define QUADMODE 0 #define LRQPOLY 0 /* RGBMODE, DITHER now live in DM1 */ #define RGBMODECMD 0 #define DITHER 0 #define DITHERRANGE 0 /* BLOCK is a function of ADDRMODE */ #define BLOCK 0 #define STOPONX 0 #define STOPONY 0 /* COLORCOMPARE is a combo of 3 bits (<, = , >) */ #define COLORCOMP 0 /* FRACTIONS are gone... */ #define INITFRAC 0 #define FRACTION1 0 /* -- some old AUX1 junk -- */ #define DOUBLEBUF 0 #define DBLDST0 0 #define DBLDST1 0 #define DBLSRC 0 #define COLORAUX 0 /* --- a couple of old cmds also only for conversion --- */ #define REX_LDPIXEL 0x1 #define REX_ANTIAUX 0 #define REX_DRAW 0 #define LOGICSRC 0 /* --- Blech! locicops are in DM1 too! */ #define REX_LO_ZERO REX_LO_ZERO #define REX_LO_AND DM1_LO_AND #define REX_LO_ANDR DM1_LO_ANDR #define REX_LO_SRC DM1_LO_SRC #define REX_LO_ANDI DM1_LO_ANDI #define REX_LO_DST DM1_LO_DST #define REX_LO_XOR DM1_LO_XOR #define REX_LO_OR DM1_LO_OR #define REX_LO_NOR DM1_LO_NOR #define REX_LO_XNOR DM1_LO_XNOR #define REX_LO_NDST DM1_LO_NDST #define REX_LO_ORR DM1_LO_ORR #define REX_LO_NSRC DM1_LO_NSRC #define REX_LO_ORI DM1_LO_ORI #define REX_LO_NAND DM1_LO_NAND #define REX_LO_ONE DM1_LO_ONE /* * drawmode flags */ #define DM0_OPCODE 0x3 /* opcode(1:0) */ # define DM0_NOP 0x0 # define DM0_READ 0x1 # define DM0_DRAW 0x2 # define DM0_SCR2SCR 0x3 #define DM0_ADRMODE_SHIFT 2 /* adrmode(2:0) */ # define DM0_ADRMODE (0x7<set.dcbmode = DCB_LG3_BDVERS0 | \ LG3_BDVERS_PROTOCOL | DCB_DATAWIDTH_1 ; \ data = rex3->set.dcbdata0.bybyte.b3 #define lg3BdVersSet(rex3, data) \ rex3->set.dcbmode = DCB_LG3_BDVERS0 | \ LG3_BDVERS_PROTOCOL | DCB_DATAWIDTH_1 ; \ rex3->set.dcbdata0.bybyte.b3 = (data) #define Ics1562Set(rex3, data) \ rex3->set.dcbmode = DCB_LG3_ICS1562 | LG3_BDVERS_PROTOCOL | DCB_DATAWIDTH_1 ; \ rex3->set.dcbdata0.bybyte.b3 = (data) #define LG3_BD_001 0x7 #define LG3_BD_002 0x0 /* * Lsmode register bits */ #define LSRCOUNT_SHIFT 0 #define LSRCOUNT_MASK (0xff << LSRCOUNT_SHIFT) #define LSREPEAT_SHIFT 8 #define LSREPEAT_MASK (0xff << LSREPEAT_SHIFT) #define LSRCNTSAVE_SHIFT 16 #define LSRCNTSAVE_MASK (0xff << LSRCNTSAVE_SHIFT) #define LSLENGTH_SHIFT 24 #define LSLENGTH_MASK (0xf << LSLENGTH_SHIFT) #if defined ( _KERNEL ) && defined ( REX3_RUNTIME_REV_CHECK ) extern void _newport_poll_status (register struct rex3chip *, register int); #define REX3WAIT(rex3) _newport_poll_status (rex3, GFXBUSY) #define BFIFOWAIT(rex3) _newport_poll_status (rex3, BACKBUSY) #else /* XXX When we drop support for rex rev b, * change status to ustatus in the macros below. */ #define REX3WAIT(rex3) while ((rex3)->p1.set.status & GFXBUSY) #define BFIFOWAIT(rex3) while ((rex3)->p1.set.status & BACKBUSY) #endif /* * Legal GIO bus addresses for Newport graphics boards. */ #define REX3_GIO_ADDR_0 0x1f0f0000 #define REX3_GIO_ADDR_1 0x1f4f0000 #define REX3_GIO_ADDR_2 0x1f8f0000 #define REX3_GIO_ADDR_3 0x1fcf0000 #define NG1_XSIZE 1280 /* screen size in x */ #define NG1_YSIZE 1024 /* screen size in y */ /* * XXX Correct values TBD. Depends on video timing */ #define CURSOR_XOFF 29 #define CURSOR_YOFF 31 #ifdef _STANDALONE struct rex3chip; struct ng1_info; void Ng1RegisterInit(struct rex3chip *, struct ng1_info *); extern int ng1checkboard(void); extern void vc2LoadSRAM(struct rex3chip *, unsigned short *, unsigned int , unsigned int); #endif #endif /* __SYS_NG1HW_H__ */