summaryrefslogtreecommitdiffstats
path: root/drivers/sgi
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-08-25 09:12:35 +0000
commitc7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch)
tree3682407a599b8f9f03fc096298134cafba1c9b2f /drivers/sgi
parent1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff)
o Merge with Linux 2.1.116.
o New Newport console code. o New G364 console code.
Diffstat (limited to 'drivers/sgi')
-rw-r--r--drivers/sgi/char/Makefile2
-rw-r--r--drivers/sgi/char/cons_newport.c610
-rw-r--r--drivers/sgi/char/graphics.c157
-rw-r--r--drivers/sgi/char/linux_logo.h1
-rw-r--r--drivers/sgi/char/newport.c2
-rw-r--r--drivers/sgi/char/newport.h584
-rw-r--r--drivers/sgi/char/sgicons.c147
-rw-r--r--drivers/sgi/char/sgiserial.c12
-rw-r--r--drivers/sgi/char/shmiq.c4
-rw-r--r--drivers/sgi/char/streamable.c13
-rw-r--r--drivers/sgi/char/usema.c10
11 files changed, 70 insertions, 1472 deletions
diff --git a/drivers/sgi/char/Makefile b/drivers/sgi/char/Makefile
index 5616d03a5..e23a4e88b 100644
--- a/drivers/sgi/char/Makefile
+++ b/drivers/sgi/char/Makefile
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
O_TARGET := sgichar.o
-O_OBJS := graphics.o streamable.o newport.o cons_newport.o sgicons.o \
+O_OBJS := graphics.o streamable.o newport.o sgicons.o \
vga_font.o rrm.o shmiq.o usema.o
ifeq ($(CONFIG_SGI_SERIAL),y)
diff --git a/drivers/sgi/char/cons_newport.c b/drivers/sgi/char/cons_newport.c
deleted file mode 100644
index b49ba172b..000000000
--- a/drivers/sgi/char/cons_newport.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
- * cons_newport.c: Newport graphics console code for the SGI.
- *
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- *
- * $Id: cons_newport.c,v 1.8 1998/03/03 16:57:28 ralf Exp $
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/interrupt.h>
-#include <linux/errno.h>
-#include <linux/kd.h>
-#include <linux/tty.h>
-#include <linux/malloc.h>
-#include <linux/major.h>
-#include <linux/mm.h>
-#include <linux/version.h>
-
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-#include <asm/bitops.h>
-#include <asm/sgialib.h>
-#include <asm/ptrace.h>
-
-#include <linux/kbd_kern.h>
-#include <linux/vt_kern.h>
-#include <linux/consolemap.h>
-#include <linux/selection.h>
-#include <linux/console_struct.h>
-
-#include "gconsole.h"
-#include "newport.h"
-#include "graphics.h" /* Just for now */
-#include <asm/gfx.h>
-#include <asm/ng1.h>
-
-#if 0
-#include "linux_logo.h"
-#endif
-
-#define BMASK(c) (c << 24)
-
-#define RENDER(regs, cp) do { \
-(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.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];
-extern unsigned char video_type;
-
-static int cursor_pos = -1;
-struct newport_regs *npregs;
-
-#define TESTVAL 0xdeadbeef
-#define XSTI_TO_FXSTART(val) (((val) & 0xffff) << 11)
-
-static inline void
-newport_disable_video(void)
-{
- unsigned short treg;
-
- treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
- newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg & ~(VC2_CTRL_EVIDEO)));
-}
-
-static inline void
-newport_enable_video(void)
-{
- unsigned short treg;
-
- treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
- newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg | VC2_CTRL_EVIDEO));
-}
-
-static inline void
-newport_disable_cursor(void)
-{
- unsigned short treg;
-
- treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
- newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg & ~(VC2_CTRL_ECDISP)));
-}
-
-#if 0
-static inline void
-newport_enable_cursor(void)
-{
- unsigned short treg;
-
- treg = newport_vc2_get(npregs, VC2_IREG_CONTROL);
- newport_vc2_set(npregs, VC2_IREG_CONTROL, (treg | VC2_CTRL_ECDISP));
-}
-#endif
-
-static inline void
-newport_init_cmap(void)
-{
- unsigned short i;
-
- for(i = 0; i < 16; i++) {
- newport_bfwait();
- newport_cmap_setaddr(npregs, color_table[i]);
- newport_cmap_setrgb(npregs,
- default_red[i],
- default_grn[i],
- default_blu[i]);
- }
-}
-
-#if 0
-static inline void
-newport_init_cursor(void)
-{
- unsigned char cursor[256];
- unsigned short *cookie;
- int i;
-
- for(i = 0; i < 256; i++)
- cursor[i] = 0x0;
- for(i = 211; i < 256; i+=4) {
- cursor[i] = 0xff;
-#if 0
- cursor[(i + 128) << 2] = 0xff;
- cursor[((i + 128) << 2) + 1] = 0xff;
-#endif
- }
-
- /* 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.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_RAM |
- NPORT_DMODE_W2 | VC2_PROTOCOL);
- for(i = 0; i < 128; i++) {
- newport_bfwait();
- npregs->set.dcbdata0.hwords.s1 = *cookie++;
- }
-
- /* Place the cursor at origin. */
- newport_vc2_set(npregs, VC2_IREG_CURSX, 0);
- newport_vc2_set(npregs, VC2_IREG_CURSY, 0);
- newport_enable_cursor();
-}
-#endif
-
-static inline void
-newport_clear_screen(void)
-{
- newport_wait();
- npregs->set.wrmask = 0xffffffff;
- npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
- NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX |
- NPORT_DMODE0_STOPY);
- npregs->set.colori = 0;
- npregs->set.xystarti = 0;
- npregs->go.xyendi = (((1280 + 63) << 16)|(1024));
- newport_bfwait();
-}
-
-static inline void
-newport_render_version(void)
-{
-#if 0
- unsigned short *ush;
- int currcons = 0;
- char *p;
-
- ush = (unsigned short *) video_mem_base + video_num_columns * 2 + 20;
- for (p = "SGI/Linux version " UTS_RELEASE; *p; p++, ush++) {
- *ush = (attr << 8) + *p;
- newport_blitc (*ush, (unsigned long) ush);
- }
-#endif
-}
-
-#if 0
-static inline void
-newport_render_logo(void)
-{
- int i, xpos, ypos;
- unsigned char *bmap;
-
- xpos = 8;
- ypos = 18;
-
- newport_wait();
- 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.xystarti = ((xpos + i) << 16) | ypos;
- npregs->set.xyendi = (((xpos + i) + 7) << 16);
- newport_wait();
-
- bmap = linux_logo + (i * 80);
- RENDER(npregs, bmap); bmap += 0x10;
- RENDER(npregs, bmap); bmap += 0x10;
- RENDER(npregs, bmap); bmap += 0x10;
- RENDER(npregs, bmap); bmap += 0x10;
- RENDER(npregs, bmap);
- }
- prom_getchar();
- prom_imode();
-}
-#endif
-
-static inline void
-newport_render_background(int xpos, int ypos, int ci)
-{
- newport_wait();
- npregs->set.wrmask = 0xffffffff;
- npregs->set.drawmode0 = (NPORT_DMODE0_DRAW | NPORT_DMODE0_BLOCK |
- NPORT_DMODE0_DOSETUP | NPORT_DMODE0_STOPX |
- NPORT_DMODE0_STOPY);
- npregs->set.colori = ci;
- npregs->set.xystarti = (xpos << 16) | ypos;
- npregs->go.xyendi = ((xpos + 7) << 16) | (ypos + 15);
-}
-
-void
-newport_set_origin(unsigned short offset)
-{
- /* maybe this works... */
- __origin = offset;
-}
-
-void
-newport_hide_cursor(void)
-{
- int xpos, ypos, idx;
- unsigned long flags;
-
- if(vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
- return;
- save_and_cli(flags);
-
- idx = cursor_pos;
- if(idx == -1) {
- restore_flags(flags);
- return;
- }
- xpos = 8 + ((idx % video_num_columns) << 3);
- ypos = 18 + ((idx / video_num_columns) << 4);
- newport_render_background(xpos, ypos, 0);
- restore_flags(flags);
-}
-
-void
-newport_set_cursor(int currcons)
-{
- int xpos, ypos, idx, oldpos;
- unsigned short *sp, *osp, cattr;
- unsigned long flags;
- unsigned char *p;
-
- if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS)
- return;
-
- if (__real_origin != __origin)
- __set_origin(__real_origin);
-
- save_and_cli(flags);
-
- idx = (pos - video_mem_base) >> 1;
- sp = (unsigned short *) pos;
- oldpos = cursor_pos;
- cursor_pos = idx;
- if(!deccm) {
- hide_cursor();
- restore_flags(flags);
- return;
- }
- xpos = 8 + ((idx % video_num_columns) << 3);
- ypos = 18 + ((idx / video_num_columns) << 4);
- if(oldpos != -1) {
- int oxpos, oypos;
-
- /* Restore old location. */
- osp = (unsigned short *) ((oldpos << 1) + video_mem_base);
- oxpos = 8 + ((oldpos % video_num_columns) << 3);
- oypos = 18 + ((oldpos / video_num_columns) << 4);
- cattr = *osp;
- newport_render_background(oxpos, oypos, (cattr & 0xf000) >> 12);
- p = &vga_font[(cattr & 0xff) << 4];
- newport_wait();
- 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.xystarti = (oxpos << 16) | oypos;
- npregs->set.xyendi = ((oxpos + 7) << 16);
- newport_wait();
- RENDER(npregs, p);
- }
- cattr = *sp;
- newport_render_background(xpos, ypos, (cattr & 0xf000) >> 12);
- p = &vga_font[(cattr & 0xff) << 4];
- newport_wait();
- 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.xystarti = (xpos << 16) | ypos;
- npregs->set.xyendi = ((xpos + 7) << 16);
- newport_wait();
- REVERSE_RENDER(npregs, p);
- restore_flags (flags);
- return;
-}
-
-void
-newport_get_scrmem(int currcons)
-{
- memcpyw((unsigned short *)vc_scrbuf[currcons],
- (unsigned short *)origin, video_screen_size);
- origin = video_mem_start = (unsigned long)vc_scrbuf[currcons];
- scr_end = video_mem_end = video_mem_start + video_screen_size;
- pos = origin + y*video_size_row + (x<<1);
-}
-
-void
-newport_set_scrmem(int currcons, long offset)
-{
- if (video_mem_term - video_mem_base < offset + video_screen_size)
- offset = 0;
- memcpyw((unsigned short *)(video_mem_base + offset),
- (unsigned short *) origin, video_screen_size);
- video_mem_start = video_mem_base;
- video_mem_end = video_mem_term;
- origin = video_mem_base + offset;
- scr_end = origin + video_screen_size;
- pos = origin + y*video_size_row + (x<<1);
- has_wrapped = 0;
-}
-
-int
-newport_set_get_cmap(unsigned char * arg, int set)
-{
- unsigned short ent;
- int i;
-
- i = verify_area(set ? VERIFY_READ : VERIFY_WRITE, (void *)arg, 16*3);
- if (i)
- return i;
-
- for (i=0; i<16; i++) {
- if (set) {
- __get_user(default_red[i], arg++);
- __get_user(default_grn[i], arg++);
- __get_user(default_blu[i], arg++);
- } else {
- __put_user (default_red[i], arg++);
- __put_user (default_grn[i], arg++);
- __put_user (default_blu[i], arg++);
- }
- }
- if (set) {
- for (i=0; i<MAX_NR_CONSOLES; i++) {
- if (vc_cons_allocated(i)) {
- int j, k;
- for (j = k = 0; j<16; j++) {
- vc_cons[i].d->vc_palette[k++] =
- default_red[j];
- vc_cons[i].d->vc_palette[k++] =
- default_grn[j];
- vc_cons[i].d->vc_palette[k++] =
- default_blu[j];
- }
- }
- }
- if(console_blanked || vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
- return 0;
- for(ent = 0; ent < 16; ent++) {
- newport_bfwait();
- newport_cmap_setaddr(npregs, ent);
- newport_cmap_setrgb(npregs,
- default_red[ent],
- default_grn[ent],
- default_blu[ent]);
- }
- }
-
- return 0;
-}
-
-void
-newport_blitc(unsigned short charattr, unsigned long addr)
-{
- int idx, xpos, ypos;
- unsigned char *p;
-
- idx = (addr - (video_mem_base + (__origin<<1))) >> 1;
- xpos = 8 + ((idx % video_num_columns) << 3);
- ypos = 18 + ((idx / video_num_columns) << 4);
-
- p = &vga_font[(charattr & 0xff) << 4];
- charattr = (charattr >> 8) & 0xff;
-
- newport_render_background(xpos, ypos, (charattr & 0xf0) >> 4);
-
- /* Set the color and drawing mode. */
- newport_wait();
- 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.xystarti = (xpos << 16) | ypos;
- npregs->set.xyendi = ((xpos + 7) << 16);
- newport_wait();
-
- /* Go, baby, go... */
- RENDER(npregs, p);
-}
-
-void
-newport_memsetw(void * s, unsigned short c, unsigned int count)
-{
- unsigned short * addr = (unsigned short *) s;
-
- count /= 2;
- if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) {
- while (count) {
- count--;
- *addr++ = c;
- }
- return;
- }
- if ((unsigned long) addr + count > video_mem_term ||
- (unsigned long) addr < video_mem_base) {
- if ((unsigned long) addr + count <= video_mem_term ||
- (unsigned long) addr > video_mem_base) {
- while (count) {
- count--;
- *addr++ = c;
- }
- return;
- } else {
- while (count) {
- count--;
- scr_writew(c, addr++);
- }
- }
- } else {
- while (count) {
- count--;
- if (*addr != c) {
- newport_blitc(c, (unsigned long)addr);
- *addr++ = c;
- } else
- addr++;
- }
- }
-}
-
-void
-newport_memcpyw(unsigned short *to, unsigned short *from, unsigned int count)
-{
- if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS) {
- memcpy(to, from, count);
- return;
- }
- if ((unsigned long) to + count > video_mem_term ||
- (unsigned long) to < video_mem_base) {
- if ((unsigned long) to + count <= video_mem_term ||
- (unsigned long) to > video_mem_base)
- memcpy(to, from, count);
- else {
- count /= 2;
- while (count) {
- count--;
- scr_writew(scr_readw(from++), to++);
- }
- }
- } else {
- count /= 2;
- while (count) {
- count--;
- if (*to != *from) {
- newport_blitc(*from, (unsigned long)to);
- *to++ = *from++;
- } else {
- from++;
- to++;
- }
- }
- }
-}
-
-struct console_ops newport_console = {
- newport_set_origin,
- newport_hide_cursor,
- newport_set_cursor,
- newport_get_scrmem,
- newport_set_scrmem,
- newport_set_get_cmap,
- newport_blitc,
- newport_memsetw,
- newport_memcpyw
-};
-
-/* Currently hard-coded values that are the same as those found on my system */
-struct ng1_info newport_board_info = {
- { "NG1", "" /* what is the label? */, 1280, 1024, sizeof (struct ng1_info) },
- 6, /* boardrev */
- 1, /* rex3rev */
- 0, /* vc2rev */
- 2, /* monitor type */
- 0, /* videoinstalled */
- 3, /* mcrev */
- 24, /* bitplanes */
- 0, /* xmap9rev */
- 2, /* cmaprev */
- { 256, 1280, 1024, 76}, /* ng1_vof_info */
- 13, /* paneltype */
- 0
-};
-
-void
-newport_reset (void)
-{
- newport_wait();
- newport_enable_video();
-
- /* Init the cursor disappear. */
- newport_wait();
-#if 0
- newport_init_cursor();
-#else
- newport_disable_cursor();
-#endif
-
- newport_init_cmap();
-
- /* Clear the screen. */
- newport_clear_screen();
-}
-
-/* right now the newport does not do anything at all */
-struct graphics_ops newport_graphic_ops = {
- 0, /* owner */
- 0, /* current user */
- (void *) &newport_board_info, /* board info */
- sizeof (struct ng1_info), /* size of our data structure */
- 0, 0, /* g_regs, g_regs_size */
- newport_save, newport_restore, /* g_save_context, g_restore_context */
- newport_reset, newport_ioctl /* g_reset_console, g_ioctl */
-};
-
-__initfunc(struct graphics_ops * newport_probe (int slot, const char **name))
-{
- struct newport_regs *p;
-
- npregs = (struct newport_regs *) (KSEG1 + 0x1f0f0000);
-
- p = npregs;
- p->cset.config = NPORT_CFG_GD0;
-
- if(newport_wait()) {
- prom_printf("whoops, timeout, no NEWPORT there?");
- return 0;
- }
-
- p->set.xstarti = TESTVAL; if(p->set._xstart.i != XSTI_TO_FXSTART(TESTVAL)) {
- prom_printf("newport_probe: read back wrong value ;-(\n");
- return 0;
- }
-
- if (slot == 0){
- register_gconsole (&newport_console);
- video_type = VIDEO_TYPE_SGI;
- can_do_color = 1;
- *name = "NEWPORT";
- }
-
- newport_reset ();
- newport_render_version();
-#if 0
- newport_render_logo();
-#endif
- newport_graphic_ops.g_regs = 0x1f0f0000;
- newport_graphic_ops.g_regs_size = sizeof (struct newport_regs);
- return &newport_graphic_ops;
-}
diff --git a/drivers/sgi/char/graphics.c b/drivers/sgi/char/graphics.c
index ae6afa74e..18ffab8a3 100644
--- a/drivers/sgi/char/graphics.c
+++ b/drivers/sgi/char/graphics.c
@@ -1,7 +1,9 @@
-/*
+/* $Id: graphics.c,v 1.5 1998/08/19 21:55:29 ralf Exp $
+ *
* gfx.c: support for SGI's /dev/graphics, /dev/opengl
*
* Author: Miguel de Icaza (miguel@nuclecu.unam.mx)
+ Ralf Baechle (ralf@gnu.org)
*
* On IRIX, /dev/graphics is [10, 146]
* /dev/opengl is [10, 147]
@@ -21,6 +23,7 @@
* We implement those misterious things, and tried not to think about
* the reasons behind them.
*/
+#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/miscdevice.h>
@@ -36,8 +39,7 @@
#include <asm/pgtable.h>
/* The boards */
-#include "newport.h"
-#include <asm/ng1.h>
+extern struct graphics_ops *newport_probe (int, const char **);
#ifdef PRODUCTION_DRIVER
#define enable_gconsole()
@@ -61,17 +63,16 @@ sgi_graphics_ioctl (struct inode *inode, struct file *file, unsigned int cmd, un
unsigned int board;
unsigned int devnum = GRAPHICS_CARD (inode->i_rdev);
int i;
-
+
if ((cmd >= RRM_BASE) && (cmd <= RRM_CMD_LIMIT))
return rrm_command (cmd-RRM_BASE, (void *) arg);
-
+
switch (cmd){
case GFX_GETNUM_BOARDS:
return boards;
case GFX_GETBOARD_INFO: {
struct gfx_getboardinfo_args *bia = (void *) arg;
- struct ng1_info *bi;
void *dest_buf;
int max_len;
@@ -84,28 +85,13 @@ sgi_graphics_ioctl (struct inode *inode, struct file *file, unsigned int cmd, un
if (board >= boards)
return -EINVAL;
-
- if (max_len < sizeof (struct ng1_info))
+ if (max_len < sizeof (struct gfx_getboardinfo_args))
return -EINVAL;
-#if 0
- /* So, g_board_info_len is being set to zero somewhere,
- and it's screwing stuff up.
- XXX security!
- */
- if (cards[board].g_board_info_len &&
- max_len > cards [board].g_board_info_len)
+ if (max_len > cards [board].g_board_info_len)
max_len = cards [boards].g_board_info_len;
-#endif
i = verify_area (VERIFY_WRITE, dest_buf, max_len);
if (i) return i;
- bi = cards[board].g_board_info;
-#ifdef DEBUG_GRAPHICS
- printk(KERN_DEBUG "GFX_GETBOARD_INFO: "
- "copying data for board %d to %x: \"%s\" (%d/%d)\n",
- board, dest_buf,
- bi->gfx_info.name, bi->gfx_info.length, max_len);
-#endif
- if (copy_to_user (dest_buf, bi, max_len))
+ if (copy_to_user (dest_buf, cards [board].g_board_info, max_len))
return -EFAULT;
return max_len;
}
@@ -116,12 +102,7 @@ sgi_graphics_ioctl (struct inode *inode, struct file *file, unsigned int cmd, un
int r;
i = verify_area (VERIFY_READ, (void *)arg, sizeof (struct gfx_attach_board_args));
- if (i) {
- printk(KERN_WARNING
- "GFX_ATTACH_BOARD: error %d, args %p\n", i,
- (void *)arg);
- return i;
- }
+ if (i) return i;
__get_user_ret (board, &att->board, -EFAULT);
__get_user_ret (vaddr, &att->vaddr, -EFAULT);
@@ -133,60 +114,26 @@ sgi_graphics_ioctl (struct inode *inode, struct file *file, unsigned int cmd, un
* below to find our board information.
*/
if (board != devnum){
- printk ("Parameter board does not match the current board\n");
- return -EINVAL;
- }
-
- if (board >= boards) {
- printk(KERN_WARNING
- "GFX_ATTACH_BOARD: board %d >= max (%d)\n",
- board, boards);
- return -EINVAL;
+ printk ("Parameter board does not match the current board\n");
+ return -EINVAL;
}
+ if (board >= boards)
+ return -EINVAL;
+
/* If it is the first opening it, then make it the board owner */
if (!cards [board].g_owner)
- cards [board].g_owner = current;
+ cards [board].g_owner = current;
/*
* Ok, we now call mmap on this file, which will end up calling
* sgi_graphics_mmap
*/
-#ifdef DEBUG_GRAPHICS
- if ((unsigned long)vaddr & ~PAGE_MASK) {
- printk(KERN_WARNING "GFX_ATTACH_BOARD: "
- "vaddr %0#lx isn't a PAGE_SIZE (%0#lx) multiple\n",
- vaddr, PAGE_SIZE);
-
- return -EINVAL;
- }
- if (!file->f_op || !file->f_op->mmap) {
- printk(KERN_WARNING "GFX_ATTACH_BOARD: "
- "mmap is going to suck: f_op = %x, mmap = %x\n",
- file->f_op, (file->f_op ? file->f_op->mmap : 0));
- }
-#endif
- /* do we really need to disable before we know that
- * everything worked OK?
- */
disable_gconsole ();
- r = do_mmap (file, (unsigned long)vaddr,
- cards [board].g_regs_size,
- PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE, 0);
- if (r) {
- if (r < 0) {
-#ifdef DEBUG_GRAPHICS
- printk(KERN_WARNING "GFX_ATTACH_BOARD: "
- "mmap(/dev/graphics, %x, %lx) failed (%d)\n",
- vaddr, cards[board].g_regs_size,
- r);
-#endif
- enable_gconsole();
- }
- return r;
- }
-
- return 0;
+ r = do_mmap (file, (unsigned long)vaddr, cards [board].g_regs_size,
+ PROT_READ|PROT_WRITE, MAP_FIXED|MAP_PRIVATE, 0);
+ if (r)
+ return r;
}
/* Strange, the real mapping seems to be done at GFX_ATTACH_BOARD,
@@ -197,13 +144,13 @@ sgi_graphics_ioctl (struct inode *inode, struct file *file, unsigned int cmd, un
case GFX_LABEL:
return 0;
-
+
/* Version check
* for my IRIX 6.2 X server, this is what the kernel returns
*/
case 1:
return 3;
-
+
/* Xsgi does not use this one, I assume minor is the board being queried */
case GFX_IS_MANAGED:
if (devnum > boards)
@@ -222,20 +169,15 @@ int
sgi_graphics_close (struct inode *inode, struct file *file)
{
int board = GRAPHICS_CARD (inode->i_rdev);
-
+
/* Tell the rendering manager that one client is going away */
rrm_close (inode, file);
/* Was this file handle from the board owner?, clear it */
if (current == cards [board].g_owner){
-#ifdef DEBUG_GRAPHICS
- printk(KERN_WARNING "sgi_graphics_close: "
- "owner \"%s\" of board %d closed, resetting\n",
- current->comm, board);
-#endif
- cards [board].g_owner = 0;
- (*cards [board].g_reset_console)();
- enable_gconsole ();
+ cards [board].g_owner = 0;
+ (*cards [board].g_reset_console)();
+ enable_gconsole ();
}
return 0;
}
@@ -259,13 +201,8 @@ sgi_graphics_nopage (struct vm_area_struct *vma, unsigned long address, int writ
* and revoke the mapping in that case.
*/
if (cards [board].g_user && cards [board].g_user != current){
- /* FIXME: save graphics context here, dump it to rendering node? */
-#ifdef DEBUG_GRAPHICS
- printk(KERN_WARNING "sgi_graphics_nopage: "
- "need to remove mapping from process \"%s\"\n",
- cards[board].g_user->comm);
-#endif
- remove_mapping (cards [board].g_user, vma->vm_start, vma->vm_end);
+ /* FIXME: save graphics context here, dump it to rendering node? */
+ remove_mapping (cards [board].g_user, vma->vm_start, vma->vm_end);
}
cards [board].g_user = current;
#if DEBUG_GRAPHICS
@@ -277,7 +214,7 @@ sgi_graphics_nopage (struct vm_area_struct *vma, unsigned long address, int writ
printk ("page/pfn: 0x%lx\n", page);
printk ("TLB entry: %lx\n", pte_val (mk_pte (page + PAGE_OFFSET, PAGE_USERIO)));
#endif
-
+
/* 2. Map this into the current process address space */
page = ((cards [board].g_regs) + (address - vma->vm_start));
return page + PAGE_OFFSET;
@@ -308,26 +245,21 @@ sgi_graphics_mmap (struct file *file, struct vm_area_struct *vma)
uint size;
size = vma->vm_end - vma->vm_start;
- if (vma->vm_offset & ~PAGE_MASK) {
-#ifdef DEBUG_GRAPHICS
- printk(KERN_WARNING "sgi_graphics_mmap: "
- "vm_offset %0#lx doesn't fit with PAGE_SIZE %0#lx\n",
- vma->vm_offset, PAGE_SIZE);
-#endif
+ if (vma->vm_offset & ~PAGE_MASK)
return -ENXIO;
- }
/* 1. Set our special graphic virtualizer */
vma->vm_ops = &graphics_mmap;
/* 2. Set the special tlb permission bits */
vma->vm_page_prot = PAGE_USERIO;
-
+
/* final setup */
vma->vm_file = file;
return 0;
}
-
+
+#if 0
/* Do any post card-detection setup on graphics_ops */
static void
graphics_ops_post_init (int slot)
@@ -336,6 +268,7 @@ graphics_ops_post_init (int slot)
cards [slot].g_owner = (struct task_struct *) 0;
cards [slot].g_user = (struct task_struct *) 0;
}
+#endif
struct file_operations sgi_graphics_fops = {
NULL, /* llseek */
@@ -355,12 +288,12 @@ struct file_operations sgi_graphics_fops = {
/* /dev/graphics */
static struct miscdevice dev_graphics = {
- SGI_GRAPHICS_MINOR, "sgi-graphics", &sgi_graphics_fops
+ SGI_GRAPHICS_MINOR, "sgi-graphics", &sgi_graphics_fops
};
/* /dev/opengl */
static struct miscdevice dev_opengl = {
- SGI_OPENGL_MINOR, "sgi-opengl", &sgi_graphics_fops
+ SGI_OPENGL_MINOR, "sgi-opengl", &sgi_graphics_fops
};
/* This is called later from the misc-init routine */
@@ -372,14 +305,17 @@ __initfunc(void gfx_register (void))
__initfunc(void gfx_init (const char **name))
{
+#if 0
struct console_ops *console;
struct graphics_ops *g;
+#endif
printk ("GFX INIT: ");
shmiq_init ();
usema_init ();
-
- if ((g = newport_probe (boards, name)) != 0){
+
+#if 0
+ if ((g = newport_probe (boards, name)) != 0) {
cards [boards] = *g;
graphics_ops_post_init (boards);
boards++;
@@ -387,9 +323,8 @@ __initfunc(void gfx_init (const char **name))
}
/* Add more graphic drivers here */
/* Keep passing console around */
-
- if (boards > MAXCARDS){
- printk ("Too many cards found on the system\n");
- prom_halt ();
- }
+#endif
+
+ if (boards > MAXCARDS)
+ printk (KERN_WARNING "Too many cards found on the system\n");
}
diff --git a/drivers/sgi/char/linux_logo.h b/drivers/sgi/char/linux_logo.h
index eaeae3841..ca041ddde 100644
--- a/drivers/sgi/char/linux_logo.h
+++ b/drivers/sgi/char/linux_logo.h
@@ -906,3 +906,4 @@ unsigned char linux_logo[] = {
0xD0, 0x5E, 0xD0, 0xD1, 0xCB, 0x58, 0x4C, 0xCF,
0xCF, 0xCE, 0xCE, 0x57, 0x63, 0xCC, 0xCD, 0x57,
};
+
diff --git a/drivers/sgi/char/newport.c b/drivers/sgi/char/newport.c
index 32b555480..b63aab2d3 100644
--- a/drivers/sgi/char/newport.c
+++ b/drivers/sgi/char/newport.c
@@ -10,7 +10,7 @@
#include <asm/gfx.h>
#include <asm/ng1.h>
#include <asm/uaccess.h>
-#include "newport.h"
+#include <asm/newport.h>
/* Kernel routines for supporting graphics context switching */
diff --git a/drivers/sgi/char/newport.h b/drivers/sgi/char/newport.h
deleted file mode 100644
index 8b78bafb0..000000000
--- a/drivers/sgi/char/newport.h
+++ /dev/null
@@ -1,584 +0,0 @@
-/* $Id: newport.h,v 1.6 1998/03/03 01:23:07 ralf Exp $
- * newport.h: Defines and register layout for NEWPORT graphics
- * hardware.
- *
- * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- */
-
-#ifndef _SGI_NEWPORT_H
-#define _SGI_NEWPORT_H
-
-
-typedef volatile unsigned long npireg_t;
-
-union npfloat {
- volatile float f;
- npireg_t i;
-};
-
-typedef union npfloat npfreg_t;
-
-union np_dcb {
- npireg_t all;
- struct { volatile unsigned short s0, s1; } hwords;
- struct { volatile unsigned char b0, b1, b2, b3; } bytes;
-};
-
-struct newport_rexregs {
- 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
-#define NPORT_DMODE1_DD12 0x00000010
-#define NPORT_DMODE1_DD24 0x00000018
-#define NPORT_DMODE1_DSRC 0x00000020
-#define NPORT_DMODE1_YFLIP 0x00000040
-#define NPORT_DMODE1_RWPCKD 0x00000080
-#define NPORT_DMODE1_HDMASK 0x00000300
-#define NPORT_DMODE1_HD4 0x00000000
-#define NPORT_DMODE1_HD8 0x00000100
-#define NPORT_DMODE1_HD12 0x00000200
-#define NPORT_DMODE1_HD32 0x00000300
-#define NPORT_DMODE1_RWDBL 0x00000400
-#define NPORT_DMODE1_ESWAP 0x00000800 /* Endian swap */
-#define NPORT_DMODE1_CCMASK 0x00007000
-#define NPORT_DMODE1_CCLT 0x00001000
-#define NPORT_DMODE1_CCEQ 0x00002000
-#define NPORT_DMODE1_CCGT 0x00004000
-#define NPORT_DMODE1_RGBMD 0x00008000
-#define NPORT_DMODE1_DENAB 0x00010000 /* Dither enable */
-#define NPORT_DMODE1_FCLR 0x00020000 /* Fast clear */
-#define NPORT_DMODE1_BENAB 0x00040000 /* Blend enable */
-#define NPORT_DMODE1_SFMASK 0x00380000
-#define NPORT_DMODE1_SF0 0x00000000
-#define NPORT_DMODE1_SF1 0x00080000
-#define NPORT_DMODE1_SFDC 0x00100000
-#define NPORT_DMODE1_SFMDC 0x00180000
-#define NPORT_DMODE1_SFSA 0x00200000
-#define NPORT_DMODE1_SFMSA 0x00280000
-#define NPORT_DMODE1_DFMASK 0x01c00000
-#define NPORT_DMODE1_DF0 0x00000000
-#define NPORT_DMODE1_DF1 0x00400000
-#define NPORT_DMODE1_DFSC 0x00800000
-#define NPORT_DMODE1_DFMSC 0x00c00000
-#define NPORT_DMODE1_DFSA 0x01000000
-#define NPORT_DMODE1_DFMSA 0x01400000
-#define NPORT_DMODE1_BBENAB 0x02000000 /* Back blend enable */
-#define NPORT_DMODE1_PFENAB 0x04000000 /* Pre-fetch enable */
-#define NPORT_DMODE1_ABLEND 0x08000000 /* Alpha blend */
-#define NPORT_DMODE1_LOMASK 0xf0000000
-#define NPORT_DMODE1_LOZERO 0x00000000
-#define NPORT_DMODE1_LOAND 0x10000000
-#define NPORT_DMODE1_LOANDR 0x20000000
-#define NPORT_DMODE1_LOSRC 0x30000000
-#define NPORT_DMODE1_LOANDI 0x40000000
-#define NPORT_DMODE1_LODST 0x50000000
-#define NPORT_DMODE1_LOXOR 0x60000000
-#define NPORT_DMODE1_LOOR 0x70000000
-#define NPORT_DMODE1_LONOR 0x80000000
-#define NPORT_DMODE1_LOXNOR 0x90000000
-#define NPORT_DMODE1_LONDST 0xa0000000
-#define NPORT_DMODE1_LOORR 0xb0000000
-#define NPORT_DMODE1_LONSRC 0xc0000000
-#define NPORT_DMODE1_LOORI 0xd0000000
-#define NPORT_DMODE1_LONAND 0xe0000000
-#define NPORT_DMODE1_LOONE 0xf0000000
-
- npireg_t drawmode0; /* REX command register */
-
- /* These bits define the graphics opcode being performed. */
-#define NPORT_DMODE0_OPMASK 0x00000003 /* Opcode mask */
-#define NPORT_DMODE0_NOP 0x00000000 /* No operation */
-#define NPORT_DMODE0_RD 0x00000001 /* Read operation */
-#define NPORT_DMODE0_DRAW 0x00000002 /* Draw operation */
-#define NPORT_DMODE0_S2S 0x00000003 /* Screen to screen operation */
-
- /* The following decide what addressing mode(s) are to be used */
-#define NPORT_DMODE0_AMMASK 0x0000001c /* Address mode mask */
-#define NPORT_DMODE0_SPAN 0x00000000 /* Spanning address mode */
-#define NPORT_DMODE0_BLOCK 0x00000004 /* Block address mode */
-#define NPORT_DMODE0_ILINE 0x00000008 /* Iline address mode */
-#define NPORT_DMODE0_FLINE 0x0000000c /* Fline address mode */
-#define NPORT_DMODE0_ALINE 0x00000010 /* Aline address mode */
-#define NPORT_DMODE0_TLINE 0x00000014 /* Tline address mode */
-#define NPORT_DMODE0_BLINE 0x00000018 /* Bline address mode */
-
- /* And now some misc. operation control bits. */
-#define NPORT_DMODE0_DOSETUP 0x00000020
-#define NPORT_DMODE0_CHOST 0x00000040
-#define NPORT_DMODE0_AHOST 0x00000080
-#define NPORT_DMODE0_STOPX 0x00000100
-#define NPORT_DMODE0_STOPY 0x00000200
-#define NPORT_DMODE0_SK1ST 0x00000400
-#define NPORT_DMODE0_SKLST 0x00000800
-#define NPORT_DMODE0_ZPENAB 0x00001000
-#define NPORT_DMODE0_LISPENAB 0x00002000
-#define NPORT_DMODE0_LISLST 0x00004000
-#define NPORT_DMODE0_L32 0x00008000
-#define NPORT_DMODE0_ZOPQ 0x00010000
-#define NPORT_DMODE0_LISOPQ 0x00020000
-#define NPORT_DMODE0_SHADE 0x00040000
-#define NPORT_DMODE0_LRONLY 0x00080000
-#define NPORT_DMODE0_XYOFF 0x00100000
-#define NPORT_DMODE0_CLAMP 0x00200000
-#define NPORT_DMODE0_ENDPF 0x00400000
-#define NPORT_DMODE0_YSTR 0x00800000
-
- 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 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
-#define NPORT_DMODE_W2 0x00000002
-#define NPORT_DMODE_W3 0x00000003
-#define NPORT_DMODE_EDPACK 0x00000004
-#define NPORT_DMODE_ECINC 0x00000008
-#define NPORT_DMODE_CMASK 0x00000070
-#define NPORT_DMODE_AMASK 0x00000780
-#define NPORT_DMODE_AVC2 0x00000000
-#define NPORT_DMODE_ACMALL 0x00000080
-#define NPORT_DMODE_ACM0 0x00000100
-#define NPORT_DMODE_ACM1 0x00000180
-#define NPORT_DMODE_AXMALL 0x00000200
-#define NPORT_DMODE_AXM0 0x00000280
-#define NPORT_DMODE_AXM1 0x00000300
-#define NPORT_DMODE_ABT 0x00000380
-#define NPORT_DMODE_AVCC1 0x00000400
-#define NPORT_DMODE_AVAB1 0x00000480
-#define NPORT_DMODE_ALG3V0 0x00000500
-#define NPORT_DMODE_A1562 0x00000580
-#define NPORT_DMODE_ESACK 0x00000800
-#define NPORT_DMODE_EASACK 0x00001000
-#define NPORT_DMODE_CWMASK 0x0003e000
-#define NPORT_DMODE_CHMASK 0x007c0000
-#define NPORT_DMODE_CSMASK 0x0f800000
-#define NPORT_DMODE_SENDIAN 0x10000000
-
- unsigned long _unused3;
-
- union np_dcb dcbdata0;
- npireg_t dcbdata1;
-};
-
-struct newport_cregs {
- 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
-#define NPORT_CMODE_SM3 0x00000008
-#define NPORT_CMODE_SM4 0x00000010
-#define NPORT_CMODE_CMSK 0x00001e00
-
- unsigned long _unused0;
- unsigned long config;
-#define NPORT_CFG_G32MD 0x00000001
-#define NPORT_CFG_BWIDTH 0x00000002
-#define NPORT_CFG_ERCVR 0x00000004
-#define NPORT_CFG_BDMSK 0x00000078
-#define NPORT_CFG_GDMSK 0x00000f80
-#define NPORT_CFG_GD0 0x00000080
-#define NPORT_CFG_GD1 0x00000100
-#define NPORT_CFG_GD2 0x00000200
-#define NPORT_CFG_GD3 0x00000400
-#define NPORT_CFG_GD4 0x00000800
-#define NPORT_CFG_GFAINT 0x00001000
-#define NPORT_CFG_TOMSK 0x0000e000
-#define NPORT_CFG_VRMSK 0x00070000
-#define NPORT_CFG_FBTYP 0x00080000
-
- npireg_t _unused1;
- npireg_t stat;
-#define NPORT_STAT_VERS 0x00000007
-#define NPORT_STAT_GBUSY 0x00000008
-#define NPORT_STAT_BBUSY 0x00000010
-#define NPORT_STAT_VRINT 0x00000020
-#define NPORT_STAT_VIDINT 0x00000040
-#define NPORT_STAT_GLMSK 0x00001f80
-#define NPORT_STAT_BLMSK 0x0007e000
-#define NPORT_STAT_BFIRQ 0x00080000
-#define NPORT_STAT_GFIRQ 0x00100000
-
- npireg_t ustat;
- npireg_t dreset;
-};
-
-struct newport_regs {
- struct newport_rexregs set;
- unsigned long _unused0[0x16e];
- struct newport_rexregs go;
- unsigned long _unused1[0x22e];
- struct newport_cregs cset;
- unsigned long _unused2[0x1ef];
- struct newport_cregs cgo;
-};
-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
-#define VC2_REGADDR_RAM 0x00000030
-#define VC2_PROTOCOL (NPORT_DMODE_EASACK | 0x00800000 | 0x00040000)
-
-#define VC2_VLINET_ADDR 0x000
-#define VC2_VFRAMET_ADDR 0x400
-#define VC2_CGLYPH_ADDR 0x500
-
-/* Now the Indexed registers of the VC2. */
-#define VC2_IREG_VENTRY 0x00
-#define VC2_IREG_CENTRY 0x01
-#define VC2_IREG_CURSX 0x02
-#define VC2_IREG_CURSY 0x03
-#define VC2_IREG_CCURSX 0x04
-#define VC2_IREG_DENTRY 0x05
-#define VC2_IREG_SLEN 0x06
-#define VC2_IREG_RADDR 0x07
-#define VC2_IREG_VFPTR 0x08
-#define VC2_IREG_VLSPTR 0x09
-#define VC2_IREG_VLIR 0x0a
-#define VC2_IREG_VLCTR 0x0b
-#define VC2_IREG_CTPTR 0x0c
-#define VC2_IREG_WCURSY 0x0d
-#define VC2_IREG_DFPTR 0x0e
-#define VC2_IREG_DLTPTR 0x0f
-#define VC2_IREG_CONTROL 0x10
-#define VC2_IREG_CONFIG 0x20
-
-extern inline void newport_vc2_set(struct newport_regs *regs, unsigned char vc2ireg,
- unsigned short val)
-{
- regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W3 |
- NPORT_DMODE_ECINC | VC2_PROTOCOL);
- regs->set.dcbdata0.all = (vc2ireg << 24) | (val << 8);
-}
-
-extern inline unsigned short newport_vc2_get(struct newport_regs *regs,
- unsigned char vc2ireg)
-{
- regs->set.dcbmode = (NPORT_DMODE_AVC2 | VC2_REGADDR_INDEX | NPORT_DMODE_W1 |
- NPORT_DMODE_ECINC | VC2_PROTOCOL);
- 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.dcbdata0.hwords.s1;
-}
-
-/* VC2 Control register bits */
-#define VC2_CTRL_EVIRQ 0x0001
-#define VC2_CTRL_EDISP 0x0002
-#define VC2_CTRL_EVIDEO 0x0004
-#define VC2_CTRL_EDIDS 0x0008
-#define VC2_CTRL_ECURS 0x0010
-#define VC2_CTRL_EGSYNC 0x0020
-#define VC2_CTRL_EILACE 0x0040
-#define VC2_CTRL_ECDISP 0x0080
-#define VC2_CTRL_ECCURS 0x0100
-#define VC2_CTRL_ECG64 0x0200
-#define VC2_CTRL_GLSEL 0x0400
-
-/* Controlling the color map on NEWPORT. */
-#define NCMAP_REGADDR_AREG 0x00000000
-#define NCMAP_REGADDR_ALO 0x00000000
-#define NCMAP_REGADDR_AHI 0x00000010
-#define NCMAP_REGADDR_PBUF 0x00000020
-#define NCMAP_REGADDR_CREG 0x00000030
-#define NCMAP_REGADDR_SREG 0x00000040
-#define NCMAP_REGADDR_RREG 0x00000060
-#define NCMAP_PROTOCOL (0x00008000 | 0x00040000 | 0x00800000)
-
-static inline void newport_cmap_setaddr(struct newport_regs *regs,
- unsigned short addr)
-{
- regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
- NPORT_DMODE_SENDIAN | NPORT_DMODE_ECINC |
- NCMAP_REGADDR_AREG | NPORT_DMODE_W2);
- regs->set.dcbdata0.hwords.s1 = addr;
- regs->set.dcbmode = (NPORT_DMODE_ACMALL | NCMAP_PROTOCOL |
- NCMAP_REGADDR_PBUF | NPORT_DMODE_W3);
-}
-
-static inline void newport_cmap_setrgb(struct newport_regs *regs,
- unsigned char red,
- unsigned char green,
- unsigned char blue)
-{
- regs->set.dcbdata0.all =
- (red << 24) |
- (green << 16) |
- (blue << 8);
-}
-
-/* Miscellaneous NEWPORT routines. */
-#define BUSY_TIMEOUT 100000
-static inline int newport_wait(void)
-{
- int i = 0;
-
- while(i < BUSY_TIMEOUT)
- if(!(npregs->cset.stat & NPORT_STAT_GBUSY))
- break;
- if(i == BUSY_TIMEOUT)
- return 1;
- return 0;
-}
-
-static inline int newport_bfwait(void)
-{
- int i = 0;
-
- while(i < BUSY_TIMEOUT)
- if(!(npregs->cset.stat & NPORT_STAT_BBUSY))
- break;
- if(i == BUSY_TIMEOUT)
- return 1;
- return 0;
-}
-
-/* newport.c and cons_newport.c routines */
-extern struct graphics_ops *newport_probe (int, const char **);
-
-void newport_save (void *);
-void newport_restore (void *);
-void newport_reset (void);
-int newport_ioctl (int card, int cmd, unsigned long arg);
-
-/*
- * DCBMODE register defines:
- */
-
-/* Widht of the data being transfered for each DCBDATA[01] word */
-#define DCB_DATAWIDTH_4 0x0
-#define DCB_DATAWIDTH_1 0x1
-#define DCB_DATAWIDTH_2 0x2
-#define DCB_DATAWIDTH_3 0x3
-
-/* If set, all of DCBDATA will be moved, otherwise only DATAWIDTH bytes */
-#define DCB_ENDATAPACK (1 << 2)
-
-/* Enables DCBCRS auto increment after each DCB transfer */
-#define DCB_ENCRSINC (1 << 3)
-
-/* shift for accessing the control register select address (DBCCRS, 3 bits) */
-#define DCB_CRS_SHIFT 4
-
-/* DCBADDR (4 bits): display bus slave address */
-#define DCB_ADDR_SHIFT 7
-#define DCB_VC2 (0 << DCB_ADDR_SHIFT)
-#define DCB_CMAP_ALL (1 << DCB_ADDR_SHIFT)
-#define DCB_CMAP0 (2 << DCB_ADDR_SHIFT)
-#define DCB_CMAP1 (3 << DCB_ADDR_SHIFT)
-#define DCB_XMAP_ALL (4 << DCB_ADDR_SHIFT)
-#define DCB_XMAP0 (5 << DCB_ADDR_SHIFT)
-#define DCB_XMAP1 (6 << DCB_ADDR_SHIFT)
-#define DCB_BT445 (7 << DCB_ADDR_SHIFT)
-#define DCB_VCC1 (8 << DCB_ADDR_SHIFT)
-#define DCB_VAB1 (9 << DCB_ADDR_SHIFT)
-#define DCB_LG3_BDVERS0 (10 << DCB_ADDR_SHIFT)
-#define DCB_LG3_ICS1562 (11 << DCB_ADDR_SHIFT)
-#define DCB_RESERVED (15 << DCB_ADDR_SHIFT)
-
-/* DCB protocol ack types */
-#define DCB_ENSYNCACK (1 << 11)
-#define DCB_ENASYNCACK (1 << 12)
-
-#define DCB_CSWIDTH_SHIFT 13
-#define DCB_CSHOLD_SHIFT 18
-#define DCB_CSSETUP_SHIFT 23
-
-/* XMAP9 specific defines */
-/* XMAP9 -- registers as seen on the DCBMODE register*/
-# define XM9_CRS_CONFIG (0 << DCB_CRS_SHIFT)
-# define XM9_PUPMODE (1 << 0)
-# define XM9_ODD_PIXEL (1 << 1)
-# define XM9_8_BITPLANES (1 << 2)
-# define XM9_SLOW_DCB (1 << 3)
-# define XM9_VIDEO_RGBMAP_MASK (3 << 4)
-# define XM9_EXPRESS_VIDEO (1 << 6)
-# define XM9_VIDEO_OPTION (1 << 7)
-# define XM9_CRS_REVISION (1 << DCB_CRS_SHIFT)
-# define XM9_CRS_FIFO_AVAIL (2 << DCB_CRS_SHIFT)
-# define XM9_FIFO_0_AVAIL 0
-# define XM9_FIFO_1_AVAIL 1
-# define XM9_FIFO_2_AVAIL 3
-# define XM9_FIFO_3_AVAIL 2
-# define XM9_FIFO_FULL XM9_FIFO_0_AVAIL
-# define XM9_FIFO_EMPTY XM9_FIFO_3_AVAIL
-# define XM9_CRS_CURS_CMAP_MSB (3 << DCB_CRS_SHIFT)
-# define XM9_CRS_PUP_CMAP_MSB (4 << DCB_CRS_SHIFT)
-# define XM9_CRS_MODE_REG_DATA (5 << DCB_CRS_SHIFT)
-# define XM9_CRS_MODE_REG_INDEX (7 << DCB_CRS_SHIFT)
-
-
-#define DCB_CYCLES(setup,hold,width) \
- ((hold << DCB_CSHOLD_SHIFT) | \
- (setup << DCB_CSSETUP_SHIFT)| \
- (width << DCB_CSWIDTH_SHIFT))
-
-#define W_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 0)
-#define WSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (5, 5, 0)
-#define WAYSLOW_DCB_XMAP9_PROTOCOL DCB_CYCLES (12, 12, 0)
-#define R_DCB_XMAP9_PROTOCOL DCB_CYCLES (2, 1, 3)
-
-static inline void
-xmap9FIFOWait (struct newport_regs *rex)
-{
- rex->set.dcbmode = DCB_XMAP0 | XM9_CRS_FIFO_AVAIL |
- DCB_DATAWIDTH_1 | R_DCB_XMAP9_PROTOCOL;
- newport_bfwait ();
-
- while ((rex->set.dcbdata0.bytes.b3 & 3) != XM9_FIFO_EMPTY)
- ;
-}
-
-static inline void
-xmap9SetModeReg (struct newport_regs *rex, unsigned int modereg, unsigned int data24, int cfreq)
-{
- if (cfreq > 119)
- rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
- DCB_DATAWIDTH_4 | W_DCB_XMAP9_PROTOCOL;
- else if (cfreq > 59)
- rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
- DCB_DATAWIDTH_4 | WSLOW_DCB_XMAP9_PROTOCOL;
- else
- rex->set.dcbmode = DCB_XMAP_ALL | XM9_CRS_MODE_REG_DATA |
- DCB_DATAWIDTH_4 | WAYSLOW_DCB_XMAP9_PROTOCOL;
- rex->set.dcbdata0.all = ((modereg) << 24) | (data24 & 0xffffff);
-}
-
-#endif /* !(_SGI_NEWPORT_H) */
diff --git a/drivers/sgi/char/sgicons.c b/drivers/sgi/char/sgicons.c
index 746ac93b4..1b3c95a5e 100644
--- a/drivers/sgi/char/sgicons.c
+++ b/drivers/sgi/char/sgicons.c
@@ -1,14 +1,11 @@
-/*
+/* $Id$
+ *
* sgicons.c: Setting up and registering console I/O on the SGI.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
* Copyright (C) 1997 Miguel de Icaza (miguel@nuclecu.unam.mx)
*
* This implement a virtual console interface.
- *
- * This should be replaced with Gert's all-singing all-dancing
- * graphics console code in the future
- *
*/
#include <linux/init.h>
#include <linux/kernel.h>
@@ -46,143 +43,3 @@ register_gconsole (struct console_ops *gc)
return;
gconsole = gc;
}
-
-void
-__set_origin (unsigned short offset)
-{
- if (gconsole)
- (*gconsole->set_origin)(offset);
-}
-
-void
-hide_cursor (void)
-{
-
- if (gconsole)
- (*gconsole->hide_cursor)();
-}
-
-void
-set_cursor (int currcons)
-{
- if (gconsole)
- (*gconsole->set_cursor)(currcons);
-}
-
-void
-get_scrmem (int currcons)
-{
- if (gconsole)
- (*gconsole->get_scrmem)(currcons);
-}
-
-void
-set_scrmem (int currcons, long offset)
-{
- if (gconsole)
- (*gconsole->set_scrmem)(currcons, offset);
-}
-
-int
-set_get_cmap (unsigned char *arg, int set)
-{
- if (gconsole)
- return (*gconsole->set_get_cmap)(arg, set);
- return 0;
-}
-
-void
-blitc (unsigned short charattr, unsigned long addr)
-{
- if (gconsole)
- (*gconsole->blitc)(charattr, addr);
-}
-
-void
-memsetw (void *s, unsigned short c, unsigned int count)
-{
- if (gconsole)
- (*gconsole->memsetw)(s, c, count);
-}
-
-void
-memcpyw (unsigned short *to, unsigned short *from, unsigned int count)
-{
- if (gconsole)
- (*gconsole->memcpyw)(to, from, count);
-}
-
-int
-con_adjust_height (unsigned long fontheight)
-{
- return -EINVAL;
-}
-
-int
-set_get_font (char *arg, int set, int ch512)
-{
- int error, i, line;
-
- if (!arg)
- return -EINVAL;
- error = verify_area (set ? VERIFY_READ : VERIFY_WRITE, (void *) arg,
- ch512 ? 2* cmapsz : cmapsz);
- if (error)
- return error;
-
- /* download the current font */
- if (!set) {
- memset (arg, 0, cmapsz);
- for (i = 0; i < 256; i++) {
- for (line = 0; line < CHAR_HEIGHT; line++)
- __put_user (vga_font [i], arg+(i*32+line));
- }
- return 0;
- }
-
- /* set the font */
- for (i = 0; i < 256; i++) {
- for (line = 0; line < CHAR_HEIGHT; line++) {
- __get_user(vga_font [i*CHAR_HEIGHT + line],
- arg + (i * 32 + line));
- }
- }
- return 0;
-}
-
-/*
- * dummy routines for the VESA blanking code, which is VGA only,
- * so we don't have to carry that stuff around for the Sparc... */
-void vesa_blank(void) { }
-void vesa_unblank(void) { }
-void set_vesa_blanking(const unsigned long arg) { }
-void vesa_powerdown(void) { }
-void set_palette (void) { }
-
-__initfunc(int con_is_present())
-{
- return 1;
-}
-
-extern unsigned long video_mem_base, video_screen_size, video_mem_term;
-
-__initfunc(unsigned long con_type_init(unsigned long start_mem, const char **name))
-{
- extern int serial_console;
-
- if (serial_console)
- *name = "NONE";
- else {
- gfx_init (name);
- printk("Video screen size is %08lx at %08lx\n",
- video_screen_size, start_mem);
- video_mem_base = start_mem;
- start_mem += (video_screen_size * 2);
- video_mem_term = start_mem;
- }
- return start_mem;
-}
-
-__initfunc(void con_type_init_finish(void))
-{
-}
diff --git a/drivers/sgi/char/sgiserial.c b/drivers/sgi/char/sgiserial.c
index e5aacc366..4e7b4e56a 100644
--- a/drivers/sgi/char/sgiserial.c
+++ b/drivers/sgi/char/sgiserial.c
@@ -1,9 +1,6 @@
-/*
- * sgiserial.c: Serial port driver for SGI machines.
+/* sgiserial.c: Serial port driver for SGI machines.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
- *
- * $Id: sgiserial.c,v 1.9 1998/05/04 09:12:59 ralf Exp $
*/
#include <linux/config.h> /* for CONFIG_REMOTE_DEBUG */
@@ -33,6 +30,8 @@
#include "sgiserial.h"
+int serial_console;
+
#define NUM_SERIAL 1 /* One chip on board. */
#define NUM_CHANNELS (NUM_SERIAL * 2)
@@ -1730,13 +1729,12 @@ static inline struct sgi_zslayout *get_zs(int chip)
}
-
static inline void
rs_cons_check(struct sgi_serial *ss, int channel)
{
int i, o, io;
- static consout_registered = 0;
- static msg_printed = 0;
+ static int consout_registered = 0;
+ static int msg_printed = 0;
i = o = io = 0;
diff --git a/drivers/sgi/char/shmiq.c b/drivers/sgi/char/shmiq.c
index 9c8bfc4dd..b79308c58 100644
--- a/drivers/sgi/char/shmiq.c
+++ b/drivers/sgi/char/shmiq.c
@@ -51,8 +51,8 @@
#include <linux/vmalloc.h>
#include <linux/wait.h>
#include <linux/major.h>
+#include <linux/smp_lock.h>
-#include <asm/smp_lock.h>
#include <asm/shmiq.h>
#include <asm/mman.h>
#include <asm/uaccess.h>
@@ -238,7 +238,7 @@ bad_file:
return -EBADF;
}
-extern sys_munmap(unsigned long addr, size_t len);
+extern int sys_munmap(unsigned long addr, size_t len);
static int
qcntl_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg, int minor)
diff --git a/drivers/sgi/char/streamable.c b/drivers/sgi/char/streamable.c
index 02129fde4..30603fade 100644
--- a/drivers/sgi/char/streamable.c
+++ b/drivers/sgi/char/streamable.c
@@ -1,14 +1,14 @@
-/*
+/* $Id: streamable.c,v 1.2 1998/08/19 21:55:31 ralf Exp $
+ *
* streamable.c: streamable devices. /dev/gfx
* (C) 1997 Miguel de Icaza (miguel@nuclecu.unam.mx)
*
* Major 10 is the streams clone device. The IRIX Xsgi server just
* opens /dev/gfx and closes it inmediately.
*
- * $Id$
*/
+
#include <linux/fs.h>
-#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/sched.h>
#include <linux/kbd_kern.h>
@@ -52,14 +52,14 @@ get_sioc (struct strioctl *sioc, unsigned long arg)
static int
sgi_gfx_open (struct inode *inode, struct file *file)
{
- printk ("GFX: Opened by %d\n", current->pid);
+ printk ("GFX: Opened by %ld\n", current->pid);
return 0;
}
static int
sgi_gfx_close (struct inode *inode, struct file *file)
{
- printk ("GFX: Closed by %d\n", current->pid);
+ printk ("GFX: Closed by %ld\n", current->pid);
return 0;
}
@@ -352,7 +352,8 @@ static struct miscdevice dev_input_mouse = {
SGI_STREAMS_KEYBOARD, "streams-mouse", &sgi_mouse_fops
};
-__initfunc(void streamable_init (void))
+void
+streamable_init (void)
{
printk ("streamable misc devices registered (keyb:%d, gfx:%d)\n",
SGI_STREAMS_KEYBOARD, SGI_GFX_MINOR);
diff --git a/drivers/sgi/char/usema.c b/drivers/sgi/char/usema.c
index 83a26a717..880c93c31 100644
--- a/drivers/sgi/char/usema.c
+++ b/drivers/sgi/char/usema.c
@@ -20,10 +20,9 @@
* usema(7m), usinit(3p), usnewsema(3p)
* /usr/include/sys/usioctl.h
*
- * $Id$
- */
+*/
+
#include <linux/fs.h>
-#include <linux/init.h>
#include <linux/miscdevice.h>
#include <linux/sched.h>
#include <linux/file.h>
@@ -33,8 +32,8 @@
#include <linux/dcache.h>
#include <linux/mm.h>
#include <linux/slab.h>
+#include <linux/smp_lock.h>
-#include <asm/smp_lock.h>
#include <asm/usioctl.h>
#include <asm/mman.h>
#include <asm/uaccess.h>
@@ -187,7 +186,8 @@ static struct miscdevice dev_usemaclone = {
SGI_USEMACLONE, "usemaclone", &sgi_usemaclone_fops
};
-__initfunc(void usema_init(void))
+void
+usema_init(void)
{
printk("usemaclone misc device registered (minor: %d)\n",
SGI_USEMACLONE);