From ca6a48c886feeb26fde786c6d6782703bf42e93f Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 28 Aug 1997 01:45:16 +0000 Subject: Newport context switching implemented (la de da, la de da). Linux newport structure is now compatible with the IRIX version. GNOME compliant display properties implemented. Oops. Wrong mailing list. --- drivers/sgi/char/cons_newport.c | 98 ++++++++-------- drivers/sgi/char/graphics.h | 4 +- drivers/sgi/char/newport.c | 156 +++++++++++++++++++++++++ drivers/sgi/char/newport.h | 245 +++++++++++++++++++++++++--------------- drivers/sgi/char/sgicons.c | 21 +++- 5 files changed, 382 insertions(+), 142 deletions(-) (limited to 'drivers/sgi/char') diff --git a/drivers/sgi/char/cons_newport.c b/drivers/sgi/char/cons_newport.c index d9bd0158a..1fb02c0b5 100644 --- a/drivers/sgi/char/cons_newport.c +++ b/drivers/sgi/char/cons_newport.c @@ -1,4 +1,4 @@ -/* $Id: cons_newport.c,v 1.2 1997/07/16 02:50:38 miguel Exp $ +/* $Id: cons_newport.c,v 1.3 1997/08/26 04:35:53 miguel Exp $ * cons_newport.c: Newport graphics console code for the SGI. * * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) @@ -45,25 +45,25 @@ #define BMASK(c) (c << 24) #define RENDER(regs, cp) do { \ -(regs)->go.zpat = BMASK((cp)[0x0]); (regs)->go.zpat = BMASK((cp)[0x1]); \ -(regs)->go.zpat = BMASK((cp)[0x2]); (regs)->go.zpat = BMASK((cp)[0x3]); \ -(regs)->go.zpat = BMASK((cp)[0x4]); (regs)->go.zpat = BMASK((cp)[0x5]); \ -(regs)->go.zpat = BMASK((cp)[0x6]); (regs)->go.zpat = BMASK((cp)[0x7]); \ -(regs)->go.zpat = BMASK((cp)[0x8]); (regs)->go.zpat = BMASK((cp)[0x9]); \ -(regs)->go.zpat = BMASK((cp)[0xa]); (regs)->go.zpat = BMASK((cp)[0xb]); \ -(regs)->go.zpat = BMASK((cp)[0xc]); (regs)->go.zpat = BMASK((cp)[0xd]); \ -(regs)->go.zpat = BMASK((cp)[0xe]); (regs)->go.zpat = BMASK((cp)[0xf]); \ +(regs)->go.zpattern = BMASK((cp)[0x0]); (regs)->go.zpattern = BMASK((cp)[0x1]); \ +(regs)->go.zpattern = BMASK((cp)[0x2]); (regs)->go.zpattern = BMASK((cp)[0x3]); \ +(regs)->go.zpattern = BMASK((cp)[0x4]); (regs)->go.zpattern = BMASK((cp)[0x5]); \ +(regs)->go.zpattern = BMASK((cp)[0x6]); (regs)->go.zpattern = BMASK((cp)[0x7]); \ +(regs)->go.zpattern = BMASK((cp)[0x8]); (regs)->go.zpattern = BMASK((cp)[0x9]); \ +(regs)->go.zpattern = BMASK((cp)[0xa]); (regs)->go.zpattern = BMASK((cp)[0xb]); \ +(regs)->go.zpattern = BMASK((cp)[0xc]); (regs)->go.zpattern = BMASK((cp)[0xd]); \ +(regs)->go.zpattern = BMASK((cp)[0xe]); (regs)->go.zpattern = BMASK((cp)[0xf]); \ } while(0) #define REVERSE_RENDER(regs, cp) do { \ -(regs)->go.zpat = BMASK((~(cp)[0x0])); (regs)->go.zpat = BMASK((~(cp)[0x1])); \ -(regs)->go.zpat = BMASK((~(cp)[0x2])); (regs)->go.zpat = BMASK((~(cp)[0x3])); \ -(regs)->go.zpat = BMASK((~(cp)[0x4])); (regs)->go.zpat = BMASK((~(cp)[0x5])); \ -(regs)->go.zpat = BMASK((~(cp)[0x6])); (regs)->go.zpat = BMASK((~(cp)[0x7])); \ -(regs)->go.zpat = BMASK((~(cp)[0x8])); (regs)->go.zpat = BMASK((~(cp)[0x9])); \ -(regs)->go.zpat = BMASK((~(cp)[0xa])); (regs)->go.zpat = BMASK((~(cp)[0xb])); \ -(regs)->go.zpat = BMASK((~(cp)[0xc])); (regs)->go.zpat = BMASK((~(cp)[0xd])); \ -(regs)->go.zpat = BMASK((~(cp)[0xe])); (regs)->go.zpat = BMASK((~(cp)[0xf])); \ +(regs)->go.zpattern = BMASK((~(cp)[0x0])); (regs)->go.zpattern = BMASK((~(cp)[0x1])); \ +(regs)->go.zpattern = BMASK((~(cp)[0x2])); (regs)->go.zpattern = BMASK((~(cp)[0x3])); \ +(regs)->go.zpattern = BMASK((~(cp)[0x4])); (regs)->go.zpattern = BMASK((~(cp)[0x5])); \ +(regs)->go.zpattern = BMASK((~(cp)[0x6])); (regs)->go.zpattern = BMASK((~(cp)[0x7])); \ +(regs)->go.zpattern = BMASK((~(cp)[0x8])); (regs)->go.zpattern = BMASK((~(cp)[0x9])); \ +(regs)->go.zpattern = BMASK((~(cp)[0xa])); (regs)->go.zpattern = BMASK((~(cp)[0xb])); \ +(regs)->go.zpattern = BMASK((~(cp)[0xc])); (regs)->go.zpattern = BMASK((~(cp)[0xd])); \ +(regs)->go.zpattern = BMASK((~(cp)[0xe])); (regs)->go.zpattern = BMASK((~(cp)[0xf])); \ } while(0) extern int default_red[16], default_grn[16], default_blu[16]; @@ -149,11 +149,11 @@ newport_init_cursor(void) /* Load the SRAM on the VC2 for this new GLYPH. */ cookie = (unsigned short *) cursor; newport_vc2_set(npregs, VC2_IREG_RADDR, VC2_CGLYPH_ADDR); - npregs->set.dmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM | - NPORT_DMODE_W2 | VC2_PROTOCOL); + npregs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM | + NPORT_DMODE_W2 | VC2_PROTOCOL); for(i = 0; i < 128; i++) { newport_bfwait(); - npregs->set.ddata0.hwords.s1 = *cookie++; + npregs->set.dcbdata0.hwords.s1 = *cookie++; } /* Place the cursor at origin. */ @@ -167,13 +167,13 @@ static inline void newport_clear_screen(void) { newport_wait(); - npregs->set.wmask = 0xffffffff; - npregs->set.dmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + npregs->set.wrmask = 0xffffffff; + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX | NPORT_DMODE0_STOPY); - npregs->set.ci = 0; - npregs->set.xysti = 0; - npregs->go.xyei = (((1280 + 63) << 16)|(1024)); + npregs->set.colori = 0; + npregs->set.xystarti = 0; + npregs->go.xyendi = (((1280 + 63) << 16)|(1024)); newport_bfwait(); } @@ -204,15 +204,15 @@ newport_render_logo(void) ypos = 18; newport_wait(); - npregs->set.ci = 9; - npregs->set.dmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + npregs->set.colori = 9; + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB | NPORT_DMODE0_L32); for(i = 0; i < 80; i+=8) { /* Set coordinates for bitmap operation. */ - npregs->set.xysti = ((xpos + i) << 16) | ypos; - npregs->set.xyei = (((xpos + i) + 7) << 16); + npregs->set.xystarti = ((xpos + i) << 16) | ypos; + npregs->set.xyendi = (((xpos + i) + 7) << 16); newport_wait(); bmap = linux_logo + (i * 80); @@ -231,13 +231,13 @@ static inline void newport_render_background(int xpos, int ypos, int ci) { newport_wait(); - npregs->set.wmask = 0xffffffff; - npregs->set.dmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + npregs->set.wrmask = 0xffffffff; + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX | NPORT_DMODE0_STOPY); - npregs->set.ci = ci; - npregs->set.xysti = (xpos << 16) | ypos; - npregs->go.xyei = ((xpos + 7) << 16) | (ypos + 15); + npregs->set.colori = ci; + npregs->set.xystarti = (xpos << 16) | ypos; + npregs->go.xyendi = ((xpos + 7) << 16) | (ypos + 15); } void @@ -306,12 +306,12 @@ newport_set_cursor(int currcons) newport_render_background(oxpos, oypos, (cattr & 0xf000) >> 12); p = &vga_font[(cattr & 0xff) << 4]; newport_wait(); - npregs->set.ci = (cattr & 0x0f00) >> 8; - npregs->set.dmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + npregs->set.colori = (cattr & 0x0f00) >> 8; + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB | NPORT_DMODE0_L32); - npregs->set.xysti = (oxpos << 16) | oypos; - npregs->set.xyei = ((oxpos + 7) << 16); + npregs->set.xystarti = (oxpos << 16) | oypos; + npregs->set.xyendi = ((oxpos + 7) << 16); newport_wait(); RENDER(npregs, p); } @@ -319,12 +319,12 @@ newport_set_cursor(int currcons) newport_render_background(xpos, ypos, (cattr & 0xf000) >> 12); p = &vga_font[(cattr & 0xff) << 4]; newport_wait(); - npregs->set.ci = (cattr & 0x0f00) >> 8; - npregs->set.dmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + npregs->set.colori = (cattr & 0x0f00) >> 8; + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB | NPORT_DMODE0_L32); - npregs->set.xysti = (xpos << 16) | ypos; - npregs->set.xyei = ((xpos + 7) << 16); + npregs->set.xystarti = (xpos << 16) | ypos; + npregs->set.xyendi = ((xpos + 7) << 16); newport_wait(); REVERSE_RENDER(npregs, p); restore_flags (flags); @@ -423,14 +423,14 @@ newport_blitc(unsigned short charattr, unsigned long addr) /* Set the color and drawing mode. */ newport_wait(); - npregs->set.ci = charattr & 0xf; - npregs->set.dmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | + npregs->set.colori = charattr & 0xf; + npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK | NPORT_DMODE0_STOPX | NPORT_DMODE0_ZPENAB | NPORT_DMODE0_L32); /* Set coordinates for bitmap operation. */ - npregs->set.xysti = (xpos << 16) | ypos; - npregs->set.xyei = ((xpos + 7) << 16); + npregs->set.xystarti = (xpos << 16) | ypos; + npregs->set.xyendi = ((xpos + 7) << 16); newport_wait(); /* Go, baby, go... */ @@ -547,7 +547,7 @@ struct graphics_ops newport_graphic_ops = { (void *) &newport_board_info, /* board info */ sizeof (struct ng1_info), /* size of our data structure */ 0, 0, /* g_regs, g_regs_size */ - 0, 0 /* save_context, restore_context */ + newport_save, newport_restore /* save_context, restore_context */ }; struct graphics_ops * @@ -558,14 +558,14 @@ newport_probe (int slot, const char **name) npregs = (struct newport_regs *) (KSEG1 + 0x1f0f0000); p = npregs; - p->cset.cfg = NPORT_CFG_GD0; + p->cset.config = NPORT_CFG_GD0; if(newport_wait()) { prom_printf("whoops, timeout, no NEWPORT there?"); return 0; } - p->set.xsti = TESTVAL; if(p->set.fxstart.i != XSTI_TO_FXSTART(TESTVAL)) { + p->set.xstarti = TESTVAL; if(p->set._xstart.i != XSTI_TO_FXSTART(TESTVAL)) { prom_printf("newport_probe: read back wrong value ;-(\n"); return 0; } diff --git a/drivers/sgi/char/graphics.h b/drivers/sgi/char/graphics.h index df844386a..016bc03bf 100644 --- a/drivers/sgi/char/graphics.h +++ b/drivers/sgi/char/graphics.h @@ -17,8 +17,8 @@ struct graphics_ops { unsigned long g_regs; int g_regs_size; - void (*g_save_context)(void); - void (*g_restore_context)(void); + void (*g_save_context)(void *); + void (*g_restore_context)(void *); }; void shmiq_init (void); diff --git a/drivers/sgi/char/newport.c b/drivers/sgi/char/newport.c index 05e7ce709..e0c7a2d83 100644 --- a/drivers/sgi/char/newport.c +++ b/drivers/sgi/char/newport.c @@ -1 +1,157 @@ +/* + * newport.c: context switching the newport graphics card + * + * Author: Miguel de Icaza + */ + +#include "newport.h" + /* Kernel routines for supporting graphics context switching */ + +void newport_save (void *y) +{ + newport_ctx *x = y; + newport_wait (); + +#define LOAD(val) x->val = npregs->set.val; +#define LOADI(val) x->val = npregs->set.val.i; +#define LOADC(val) x->val = npregs->cset.val; + + LOAD(drawmode1); + LOAD(drawmode0); + LOAD(lsmode); + LOAD(lspattern); + LOAD(lspatsave); + LOAD(zpattern); + LOAD(colorback); + LOAD(colorvram); + LOAD(alpharef); + LOAD(smask0x); + LOAD(smask0y); + LOADI(_xstart); + LOADI(_ystart); + LOADI(_xend); + LOADI(_yend); + LOAD(xsave); + LOAD(xymove); + LOADI(bresd); + LOADI(bress1); + LOAD(bresoctinc1); + LOAD(bresrndinc2); + LOAD(brese1); + LOAD(bress2); + LOAD(aweight0); + LOAD(aweight1); + LOADI(colorred); + LOADI(coloralpha); + LOADI(colorgrn); + LOADI(colorblue); + LOADI(slopered); + LOADI(slopealpha); + LOADI(slopegrn); + LOADI(slopeblue); + LOAD(wrmask); + LOAD(hostrw0); + LOAD(hostrw1); + + /* configregs */ + + LOADC(smask1x); + LOADC(smask1y); + LOADC(smask2x); + LOADC(smask2y); + LOADC(smask3x); + LOADC(smask3y); + LOADC(smask4x); + LOADC(smask4y); + LOADC(topscan); + LOADC(xywin); + LOADC(clipmode); + LOADC(config); + + /* Mhm, maybe I am missing something, but it seems that + * saving/restoring the DCB is only a matter of saving these + * registers + */ + + newport_bfwait (); + LOAD (dcbmode); + newport_bfwait (); + x->dcbdata0 = npregs->set.dcbdata0.all; + newport_bfwait (); + LOAD(dcbdata1); +} + +/* + * Importat things to keep in mind when restoring the newport context: + * + * 1. slopered register is stored as a 2's complete (s12.11); + * needs to be converted to a signed magnitude (s(8)12.11). + * + * 2. xsave should be stored after xstart. + * + * 3. None of the registers should be written with the GO address. + * (read the docs for more details on this). + */ +void newport_restore (void *y) +{ + newport_ctx *x = y; +#define STORE(val) npregs->set.val = x->val +#define STOREI(val) npregs->set.val.i = x->val +#define STOREC(val) npregs->cset.val = x->val + newport_wait (); + + STORE(drawmode1); + STORE(drawmode0); + STORE(lsmode); + STORE(lspattern); + STORE(lspatsave); + STORE(zpattern); + STORE(colorback); + STORE(colorvram); + STORE(alpharef); + STORE(smask0x); + STORE(smask0y); + STOREI(_xstart); + STOREI(_ystart); + STOREI(_xend); + STOREI(_yend); + STORE(xsave); + STORE(xymove); + STOREI(bresd); + STOREI(bress1); + STORE(bresoctinc1); + STORE(bresrndinc2); + STORE(brese1); + STORE(bress2); + STORE(aweight0); + STORE(aweight1); + STOREI(colorred); + STOREI(coloralpha); + STOREI(colorgrn); + STOREI(colorblue); + STOREI(slopered); + STOREI(slopealpha); + STOREI(slopegrn); + STOREI(slopeblue); + STORE(wrmask); + STORE(hostrw0); + STORE(hostrw1); + + /* configregs */ + + STOREC(smask1x); + STOREC(smask1y); + STOREC(smask2x); + STOREC(smask2y); + STOREC(smask3x); + STOREC(smask3y); + STOREC(smask4x); + STOREC(smask4y); + STOREC(topscan); + STOREC(xywin); + STOREC(clipmode); + STOREC(config); + + /* FIXME: restore dcb thingies */ +} diff --git a/drivers/sgi/char/newport.h b/drivers/sgi/char/newport.h index 582305bd8..21a624d28 100644 --- a/drivers/sgi/char/newport.h +++ b/drivers/sgi/char/newport.h @@ -1,4 +1,4 @@ -/* $Id: newport.h,v 1.2 1997/07/02 06:20:19 miguel Exp $ +/* $Id: newport.h,v 1.3 1997/07/16 02:50:39 miguel Exp $ * newport.h: Defines and register layout for NEWPORT graphics * hardware. * @@ -25,14 +25,16 @@ union np_dcb { }; struct newport_rexregs { - npireg_t dmode1; /* GL extra mode bits */ -#define NPORT_DMODE1_PMASK 0x00000007 -#define NPORT_DMODE1_NOPLANES 0x00000000 -#define NPORT_DMODE1_RGBPLANES 0x00000001 -#define NPORT_DMODE1_RGBAPLANES 0x00000002 -#define NPORT_DMODE1_OLPLANES 0x00000004 -#define NPORT_DMODE1_PUPPLANES 0x00000005 -#define NPORT_DMODE1_CIDPLANES 0x00000006 + npireg_t drawmode1; /* GL extra mode bits */ + +#define DM1_PLANES 0x00000007 +#define DM1_NOPLANES 0x00000000 +#define DM1_RGBPLANES 0x00000001 +#define DM1_RGBAPLANES 0x00000002 +#define DM1_OLAYPLANES 0x00000004 +#define DM1_PUPPLANES 0x00000005 +#define DM1_CIDPLANES 0x00000006 + #define NPORT_DMODE1_DDMASK 0x00000018 #define NPORT_DMODE1_DD4 0x00000000 #define NPORT_DMODE1_DD8 0x00000008 @@ -91,7 +93,7 @@ struct newport_rexregs { #define NPORT_DMODE1_LONAND 0xe0000000 #define NPORT_DMODE1_LOONE 0xf0000000 - npireg_t dmode0; /* REX command register */ + npireg_t drawmode0; /* REX command register */ /* These bits define the graphics opcode being performed. */ #define NPORT_DMODE0_OPMASK 0x00000003 /* Opcode mask */ @@ -131,64 +133,65 @@ struct newport_rexregs { #define NPORT_DMODE0_ENDPF 0x00400000 #define NPORT_DMODE0_YSTR 0x00800000 - npireg_t lismode; /* Mode for line stipple ops */ - npireg_t lispat; /* Pattern for line stipple ops */ - npireg_t lispsave; /* Backup save pattern */ - npireg_t zpat; /* Pixel zpattern */ - npireg_t colbk; /* Background color */ - npireg_t colvram; /* Clear color for fast vram */ - npireg_t aref; /* Reference value for afunctions */ - unsigned long _unused0; - npireg_t scmskx0; /* Window GL relative screen mask 0 */ - npireg_t scmsky0; /* Window GL relative screen mask 0 */ - npireg_t xsetup; - npireg_t xzpenab; - npireg_t xlisrestore; - npireg_t xlissave; - - unsigned long _unused1[0x30]; - - npfreg_t fxstart; - npfreg_t fystart; - npfreg_t fxend; - npfreg_t fyend; - npireg_t xsv; - npireg_t xymv; - npfreg_t brd; - npfreg_t brs1; - npireg_t broinc1; - volatile int brinc2; - npireg_t bre1; - npireg_t bre2; - npireg_t aw0; - npireg_t aw1; - npfreg_t xstf; - npfreg_t ystf; - npfreg_t xef; - npfreg_t yef; - npireg_t xsti; - npfreg_t xef1; - npireg_t xysti; - npireg_t xyei; - npireg_t xstei; + npireg_t lsmode; /* Mode for line stipple ops */ + npireg_t lspattern; /* Pattern for line stipple ops */ + npireg_t lspatsave; /* Backup save pattern */ + npireg_t zpattern; /* Pixel zpattern */ + npireg_t colorback; /* Background color */ + npireg_t colorvram; /* Clear color for fast vram */ + npireg_t alpharef; /* Reference value for afunctions */ + unsigned long pad0; + npireg_t smask0x; /* Window GL relative screen mask 0 */ + npireg_t smask0y; /* Window GL relative screen mask 0 */ + npireg_t _setup; + npireg_t _stepz; + npireg_t _lsrestore; + npireg_t _lssave; + + unsigned long _pad1[0x30]; + + /* Iterators, full state for context switch */ + npfreg_t _xstart; /* X-start point (current) */ + npfreg_t _ystart; /* Y-start point (current) */ + npfreg_t _xend; /* x-end point */ + npfreg_t _yend; /* y-end point */ + npireg_t xsave; /* copy of xstart integer value for BLOCk addressing MODE */ + npireg_t xymove; /* x.y offset from xstart, ystart for relative operations */ + npfreg_t bresd; + npfreg_t bress1;; + npireg_t bresoctinc1; + volatile int bresrndinc2; + npireg_t brese1; + npireg_t bress2; + npireg_t aweight0; + npireg_t aweight1; + npfreg_t xstartf; + npfreg_t ystartf; + npfreg_t xendf; + npfreg_t yendf; + npireg_t xstarti; + npfreg_t xendf1; + npireg_t xystarti; + npireg_t xyendi; + npireg_t xstartendi; unsigned long _unused2[0x29]; - npfreg_t cred; - npfreg_t calpha; - npfreg_t cgreen; - npfreg_t cblue; - npfreg_t slred; - npfreg_t slalpha; - npfreg_t slgreen; - npfreg_t slblue; - npireg_t wmask; - npireg_t ci; - npfreg_t cx; - npfreg_t sl1; - npireg_t hrw0; - npireg_t hrw1; - npireg_t dmode; + npfreg_t colorred; + npfreg_t coloralpha; + npfreg_t colorgrn; + npfreg_t colorblue; + npfreg_t slopered; + npfreg_t slopealpha; + npfreg_t slopegrn; + npfreg_t slopeblue; + npireg_t wrmask; + npireg_t colori; + npfreg_t colorx; + npfreg_t slopered1; + npireg_t hostrw0; + npireg_t hostrw1; + npireg_t dcbmode; #define NPORT_DMODE_WMASK 0x00000003 #define NPORT_DMODE_W4 0x00000000 #define NPORT_DMODE_W1 0x00000001 @@ -219,22 +222,22 @@ struct newport_rexregs { unsigned long _unused3; - union np_dcb ddata0; - npireg_t ddata1; + union np_dcb dcbdata0; + npireg_t dcbdata1; }; struct newport_cregs { - npireg_t smskx1; - npireg_t smsky1; - npireg_t smskx2; - npireg_t smsky2; - npireg_t smskx3; - npireg_t smsky3; - npireg_t smskx4; - npireg_t smsky4; - npireg_t tscan; - npireg_t win; - npireg_t cmode; + npireg_t smask1x; + npireg_t smask1y; + npireg_t smask2x; + npireg_t smask2y; + npireg_t smask3x; + npireg_t smask3y; + npireg_t smask4x; + npireg_t smask4y; + npireg_t topscan; + npireg_t xywin; + npireg_t clipmode; #define NPORT_CMODE_SM0 0x00000001 #define NPORT_CMODE_SM1 0x00000002 #define NPORT_CMODE_SM2 0x00000004 @@ -243,7 +246,7 @@ struct newport_cregs { #define NPORT_CMODE_CMSK 0x00001e00 unsigned long _unused0; - unsigned long cfg; + unsigned long config; #define NPORT_CFG_G32MD 0x00000001 #define NPORT_CFG_BWIDTH 0x00000002 #define NPORT_CFG_ERCVR 0x00000004 @@ -286,6 +289,67 @@ struct newport_regs { }; extern struct newport_regs *npregs; + +typedef struct { + unsigned int drawmode1; + unsigned int drawmode0; + unsigned int lsmode; + unsigned int lspattern; + unsigned int lspatsave; + unsigned int zpattern; + unsigned int colorback; + unsigned int colorvram; + unsigned int alpharef; + unsigned int smask0x; + unsigned int smask0y; + unsigned int _xstart; + unsigned int _ystart; + unsigned int _xend; + unsigned int _yend; + unsigned int xsave; + unsigned int xymove; + unsigned int bresd; + unsigned int bress1; + unsigned int bresoctinc1; + unsigned int bresrndinc2; + unsigned int brese1; + unsigned int bress2; + + unsigned int aweight0; + unsigned int aweight1; + unsigned int colorred; + unsigned int coloralpha; + unsigned int colorgrn; + unsigned int colorblue; + unsigned int slopered; + unsigned int slopealpha; + unsigned int slopegrn; + unsigned int slopeblue; + unsigned int wrmask; + unsigned int hostrw0; + unsigned int hostrw1; + + /* configregs */ + + unsigned int smask1x; + unsigned int smask1y; + unsigned int smask2x; + unsigned int smask2y; + unsigned int smask3x; + unsigned int smask3y; + unsigned int smask4x; + unsigned int smask4y; + unsigned int topscan; + unsigned int xywin; + unsigned int clipmode; + unsigned int config; + + /* dcb registers */ + unsigned int dcbmode; + unsigned int dcbdata0; + unsigned int dcbdata1; +} newport_ctx; + /* Reading/writing VC2 registers. */ #define VC2_REGADDR_INDEX 0x00000000 #define VC2_REGADDR_IREG 0x00000010 @@ -319,20 +383,20 @@ extern struct newport_regs *npregs; extern inline void newport_vc2_set(struct newport_regs *regs, unsigned char vc2ireg, unsigned short val) { - regs->set.dmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | + regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 | NPORT_DMODE_ECINC | VC2_PROTOCOL); - regs->set.ddata0.all = (vc2ireg << 24) | (val << 8); + regs->set.dcbdata0.all = (vc2ireg << 24) | (val << 8); } extern inline unsigned short newport_vc2_get(struct newport_regs *regs, unsigned char vc2ireg) { - regs->set.dmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | + regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 | NPORT_DMODE_ECINC | VC2_PROTOCOL); - regs->set.ddata0.bytes.b3 = vc2ireg; - regs->set.dmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 | + regs->set.dcbdata0.bytes.b3 = vc2ireg; + regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_IREG | NPORT_DMODE_W2 | NPORT_DMODE_ECINC | VC2_PROTOCOL); - return regs->set.ddata0.hwords.s1; + return regs->set.dcbdata0.hwords.s1; } /* VC2 Control register bits */ @@ -361,11 +425,11 @@ extern inline unsigned short newport_vc2_get(struct newport_regs *regs, static inline void newport_cmap_setaddr(struct newport_regs *regs, unsigned short addr) { - regs->set.dmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC | NCMAP_REGADDR_AREG | NPORT_DMODE_W2); - regs->set.ddata0.hwords.s1 = addr; - regs->set.dmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | + regs->set.dcbdata0.hwords.s1 = addr; + regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL | NCMAP_REGADDR_PBUF | NPORT_DMODE_W3); } @@ -374,7 +438,7 @@ static inline void newport_cmap_setrgb(struct newport_regs *regs, unsigned char green, unsigned char blue) { - regs->set.ddata0.all = + regs->set.dcbdata0.all = (red << 24) | (green << 16) | (blue << 8); @@ -408,4 +472,7 @@ static inline int newport_bfwait(void) extern struct graphics_ops *newport_probe (int, const char **); +void newport_save (void *); +void newport_restore (void *); + #endif /* !(_SGI_NEWPORT_H) */ diff --git a/drivers/sgi/char/sgicons.c b/drivers/sgi/char/sgicons.c index 210bffec3..fb937679b 100644 --- a/drivers/sgi/char/sgicons.c +++ b/drivers/sgi/char/sgicons.c @@ -16,11 +16,28 @@ #include #include "gconsole.h" +/* To make psaux code cleaner */ +int aux_device_present = 0xaa; + /* This is the system graphics console (the first adapter found) */ struct console_ops *gconsole = 0; +struct console_ops *real_gconsole = 0; -/* To make psaux code cleaner */ -int aux_device_present = 0xaa; +void +enable_gconsole (void) +{ + if (!gconsole) + gconsole = real_gconsole; +} + +void +disable_gconsole (void) +{ + if (gconsole){ + real_gconsole = gconsole; + gconsole = 0; + } +} void register_gconsole (struct console_ops *gc) -- cgit v1.2.3