*** xc/programs/Xserver/hw/sun/Imakefile.orig	Tue Sep 22 17:23:11 1998
--- xc/programs/Xserver/hw/sun/Imakefile	Wed Sep 23 13:20:13 1998
***************
*** 3,8 ****
--- 3,9 ----
  
  SRCS1 =	sunInit.c \
  	sunCfb.c \
+ 	sunPciMach64.c \
  	sunCfb24.c \
  	sunCursor.c \
  	sunFbs.c \
***************
*** 27,32 ****
--- 28,34 ----
  #endif
  
  OBJS1 = sunCfb.o \
+ 	sunPciMach64.o \
  	sunCfb24.o \
  	sunCursor.o \
  	sunFbs.o \
*** xc/programs/Xserver/hw/sun/constype.c.orig	Tue Sep 22 17:28:17 1998
--- xc/programs/Xserver/hw/sun/constype.c	Tue Sep 22 17:32:29 1998
***************
*** 87,93 ****
   * of the TCX 
   */
  #define XFBTYPE_TCX		21
! #define XFBTYPE_LASTPLUSONE	22
  
  /* decoding as of Release 3.4 : fbio.h 1.3 87/01/09 SMI */
  	/* the convention for entries in this table is to translate the
--- 87,94 ----
   * of the TCX 
   */
  #define XFBTYPE_TCX		21
! #define XFBTYPE_PCICARD		22
! #define XFBTYPE_LASTPLUSONE	23
  
  /* decoding as of Release 3.4 : fbio.h 1.3 87/01/09 SMI */
  	/* the convention for entries in this table is to translate the
***************
*** 98,104 ****
  	 *	FBTYPE_SUNxGP		becomes gpx
  	 *	FBTYPE_NOTSUN[1-9]	becomes ns[A-J]
  	 */
! static char *decode_fb[] = {
  	"bw1", "cg1",
  	"bw2", "cg2",
  	"gp2",
--- 99,105 ----
  	 *	FBTYPE_SUNxGP		becomes gpx
  	 *	FBTYPE_NOTSUN[1-9]	becomes ns[A-J]
  	 */
! static char *decode_fb[FBTYPE_LASTPLUSONE] = {
  	"bw1", "cg1",
  	"bw2", "cg2",
  	"gp2",
***************
*** 162,167 ****
--- 163,171 ----
  	    if (fbattr.fbtype.fb_type == XFBTYPE_TCX) {
  		*fbname = "tcx";
  		return 0;
+ 	    } else if (fbattr.fbtype.fb_type == XFBTYPE_PCICARD) {
+ 		*fbname = "pcicard (Mach64, p9000, p9100, S3, etc.)";
+ 		return 0;
  	    } else {
  		*fbname = "unk";
  		return 1;
*** xc/programs/Xserver/hw/sun/sun.h.orig	Tue Sep 22 15:51:54 1998
--- xc/programs/Xserver/hw/sun/sun.h	Tue Sep 22 17:48:34 1998
***************
*** 81,86 ****
--- 81,87 ----
  # include <sys/kbd.h>
  # include <sys/kbio.h>
  # include <sys/msio.h>
+ # include <sys/visual_io.h> /* for PCI card support */
  # include <sys/vuid_event.h>
  # include <sys/memreg.h>
  # include <stropts.h>
***************
*** 122,128 ****
  #define XFBTYPE_LASTPLUSONE	FBTYPE_LASTPLUSONE	
  #else
  #define XFBTYPE_TCX		21
! #define XFBTYPE_LASTPLUSONE	22
  #endif
  
  extern int gettimeofday();
--- 123,130 ----
  #define XFBTYPE_LASTPLUSONE	FBTYPE_LASTPLUSONE	
  #else
  #define XFBTYPE_TCX		21
! #define XFBTYPE_PCICARD		22 
! #define XFBTYPE_LASTPLUSONE	23
  #endif
  
  extern int gettimeofday();
*** xc/programs/Xserver/hw/sun/sunCfb.c.orig	Tue Sep 22 17:46:36 1998
--- xc/programs/Xserver/hw/sun/sunCfb.c	Thu Oct  1 17:27:52 1998
***************
*** 298,303 ****
--- 298,343 ----
  	cfbCreateDefColormap, sunSaveScreen, 0);
  }
  
+ Bool sunPCIInit (screen, pScreen, argc, argv)
+     int	    	  screen;    	/* what screen am I going to be */
+     ScreenPtr	  pScreen;  	/* The Screen to initialize */
+     int	    	  argc;	    	/* The number of the Server's arguments. */
+     char    	  **argv;   	/* The arguments themselves. Don't change! */
+ {
+     extern Bool sunPCIMach64Init(int, ScreenPtr, int*);
+     char buf[VIS_MAXNAMELEN];
+     struct pcidata {
+ 	char* cardname;
+ 	Bool (*init_fn)(int, ScreenPtr, int*);
+     } pci_data[] = {
+ 	{ "SUNWm64", sunPCIMach64Init }
+     };
+     int i;
+     int fb_start;
+ 
+     if (ioctl(sunFbs[pScreen->myNum].fd, VIS_GETIDENTIFIER, buf) < 0) {
+ 	Error("sunPCIInit");
+ 	FatalError( "sunPCIInit: VIS_GETIDENTIFIER failed\n" );
+     }
+ 
+     for (i = 0; i < sizeof pci_data / sizeof pci_data[0]; i++) {
+ 	if (strcmp (buf, pci_data[i].cardname) == 0) {
+ 	    if ((*pci_data[i].init_fn) (screen, pScreen,&fb_start) == FALSE) {
+ 		Error("sunPCIInit: PCI frame buffer init failed");
+ 		return FALSE;
+ 	    }
+ 	} else {
+ 	    Error("sunPCIInit: unsupported PCI frame buffer");
+ 	    return FALSE;
+ 	}
+     }
+ 
+     sunFbs[screen].EnterLeave = (void (*)())NoopDDA;
+     return sunInitCommon (screen, pScreen, (off_t) 0,
+ 	sunCfbScreenInit, CGScreenInit,
+ 	cfbCreateDefColormap, sunSaveScreen, fb_start);
+ }
+ 
  #if !defined(i386) && !defined(__bsdi__) /* { */
  
  #ifdef SVR4
*** xc/programs/Xserver/hw/sun/sunInit.c.orig	Tue Sep 22 15:54:43 1998
--- xc/programs/Xserver/hw/sun/sunInit.c	Tue Sep 22 16:21:31 1998
***************
*** 81,86 ****
--- 81,87 ----
  #define CG6I NULL
  #define CG8I NULL
  #define TCXI NULL
+ #define PCII NULL
  #else /* }{ */
  extern Bool sunCG3Init(
  #if NeedFunctionPrototypes
***************
*** 140,145 ****
--- 141,159 ----
  #else /* }{ */
  #define TCXI NULL
  #endif /* } */
+ #ifdef XFBTYPE_PCICARD  /* { */
+ extern Bool sunPCIInit(
+ #if NeedFunctionPrototypes
+     int /* screen */,
+     ScreenPtr /* pScreen */,
+     int /* argc */,
+     char** /* argv */
+ #endif
+ );
+ #define PCII sunPCIInit
+ #else /* }{ */
+ #define PCII NULL
+ #endif /* } */
  #if SUNMAXDEPTH > 8 /* { */
  #ifdef FBTYPE_MEMCOLOR /* { */
  extern Bool sunCG8Init(
***************
*** 226,231 ****
--- 240,248 ----
  #ifdef XFBTYPE_TCX
    { TCXI, "TCX           (tcx)" },
  #endif
+ #ifdef XFBTYPE_PCICARD
+   { PCII, "PCI           (Mach64, p9000, p9100, S3, etc.)" },
+ #endif
  #endif /* } */
  };
  
*** xc/programs/Xserver/hw/sun/sunPciMach64.c.orig	Tue Sep 22 17:55:04 1998
--- xc/programs/Xserver/hw/sun/sunPciMach64.c	Thu Oct  1 17:26:36 1998
***************
*** 0 ****
--- 1,47 ----
+ 
+ /* 
+  * Copyright © 1998 Kaleb S. KEITHLEY
+  *
+  * Permission to use, copy, modify, and distribute this
+  * software and its documentation for any purpose and without
+  * fee is hereby granted, provided that the above copyright
+  * notice appear in all copies.  Kaleb S. KEITHLEY makes no 
+  * representations about the suitability of this software for 
+  * any purpose.  It is provided "as is" without express or 
+  * implied warranty.
+  */
+ 
+ #include "sun.h"
+ 
+ static int fd;
+ 
+ static void sunPciVideoOff ()
+ {
+     int video_on = FBVIDEO_OFF;
+ 
+     if (ioctl(fd, FBIOSVIDEO, &video_on) < 0) {
+ 	Error("sunPCIVideoOff");
+ 	FatalError( "sunPciVideoOff: FBIOSVIDEO failed\n" );
+     }
+ }
+ 
+ Bool sunPCIMach64Init (screen, pScreen, fb_start)
+     int	    	  screen;    	/* what screen am I going to be */
+     ScreenPtr	  pScreen;  	/* The Screen to initialize */
+     int*	  fb_start;
+ {
+     struct fbgattr* fbattr;
+     int video_on = FBVIDEO_ON;
+ 
+     fd = sunFbs[pScreen->myNum].fd;
+     (void) atexit (sunPciVideoOff);
+ 
+     fbattr = (struct fbgattr*) sunFbs[pScreen->myNum].fbPriv;
+     *fb_start = fbattr->sattr.dev_specific[5];
+ 
+     if (ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &video_on) < 0) {
+ 	Error("sunPCIMach64Init");
+ 	FatalError( "sunPCIMach64Init: FBIOSVIDEO failed\n" );
+     }
+     return TRUE;
+ }
