Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Hannes Reinecke <civhr@civ.hw.ac.uk>
To: AXP Developers list <axp-list@redhat.com>
Subject: Re: FIX #2: XF-4.0 doesn't like my Permedia 2
Date: Fri, 17 Mar 2000 14:54:48 +0000	[thread overview]
Message-ID: <38D24738.A2D3D586@civ.hw.ac.uk> (raw)
In-Reply-To: 38D24644.B5B3747F@civ.hw.ac.uk

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

Hiya,

this is the cleaner version of that one presented by Michel.
(And next time quote me correctly, Michel, 'cause the previous thing
wasn't meant to be a proper fix).
It does work for 164SX-machines, should for 164LX. Miata is possible,
but someone should send me an output of /proc/cpuinfo to incorporate it.

It would also be quite helpful if I could have some feedback from people
with older machines on whether XFree86-4.0 works for them.

Cheers,

Hannes
-- 
Hannes Reinecke                                 <civhr@civ.hw.ac.uk>
Fluid Loading and Instrumentation Center  Tel: (+44) 131 449 5111 x4430
Dept. of Civil & Offshore Engineering           Fax: (+44) 131 451 3154
Heriot Watt University, Edinburgh EH14 4AS

[-- Attachment #2: xfree.diff --]
[-- Type: text/plain, Size: 3772 bytes --]

diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c.orig xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c
--- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c.orig	Sat Feb 26 05:43:53 2000
+++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c	Thu Mar 16 23:28:15 2000
@@ -66,9 +66,8 @@
 #  define isJensen (!_bus_base())
 # endif
 
-# define needSparse (_bus_base_sparse() != 0)
-
-# define BUS_BASE _bus_base()
+static unsigned long xf86_axp_IOBase;
+# define BUS_BASE xf86_axp_IOBase
 
 #else 
 
@@ -83,6 +82,7 @@
 static pointer mapVidMem(int, unsigned long, unsigned long);
 static void unmapVidMem(int, pointer, unsigned long);
 #if defined (__alpha__) 
+static int checkSparseVidMemBase( void );
 static pointer mapVidMemSparse(int, unsigned long, unsigned long);
 static void unmapVidMemSparse(int, pointer, unsigned long);
 # if defined(JENSEN_SUPPORT)
@@ -298,15 +298,15 @@
 	if (isJensen) {
 # ifndef JENSEN_SUPPORT
 	  FatalError("Jensen is not supported any more\n"
-		     "If you are interesetd in fixing Jensen support\n"
+		     "If you are interested in fixing Jensen support\n"
 		     "please contact xfree86@xfree86.org\n");
 # else
 	  xf86Msg(X_INFO,"Machine type is Jensen\n");
 	  pVidMem->mapMem = mapVidMemJensen;
 	  pVidMem->unmapMem = unmapVidMemJensen;
 # endif /* JENSEN_SUPPORT */
-	} else if (needSparse) {
-	  xf86Msg(X_INFO,"Machine needs sparse mapping\n");
+	} else if (checkSparseVidMemBase()) {
+	    xf86Msg(X_INFO,"Machine needs sparse mapping\n");
 	  pVidMem->mapMem = mapVidMemSparse;
 	  pVidMem->unmapMem = unmapVidMemSparse;
 	} else {
@@ -508,6 +508,82 @@
 writeSparse16(int Value, pointer Base, register unsigned long Offset);
 static void
 writeSparse32(int Value, pointer Base, register unsigned long Offset);
+
+static int checkSparseVidMemBase( void )
+{
+    char buf[256];
+    char cpu_model[64];
+    char sys_type[64];
+    char sys_var[64];
+    FILE *info_fptr;
+    int has_bwx = 1;
+    int can_bwa = 1;
+
+    if (_bus_base_sparse()) {
+	/* Open /proc/cpuinfo to find out about where we are running on */
+	info_fptr = fopen("/proc/cpuinfo","r");
+	if (!info_fptr) {
+	    xf86Msg(X_WARNING,
+		    "Could not open /proc/cpuinfo, falling back to default\n");
+	    xf86_axp_IOBase = _bus_base_sparse();
+	    return 1;
+	}
+
+	*cpu_model = '\0';
+	*sys_type = '\0';
+	*sys_var = '\0';
+
+	while (!feof(info_fptr)) {
+	    fgets(buf,255,info_fptr);
+	    if (sscanf(buf,"cpu model : %s ",cpu_model) == 1) {
+		if (!strcmp(cpu_model,"EV3") ||
+		    !strcmp(cpu_model,"EV4") ||
+		    !strcmp(cpu_model,"Simulate") ||
+		    !strcmp(cpu_model,"LCA4") ||
+		    !strcmp(cpu_model,"EV5") ||
+		    !strcmp(cpu_model,"EV45") ) {
+		    has_bwx = 0;
+		}
+	    }
+	    if (sscanf(buf,"system type : %s ",sys_type) == 1) {
+		if (strcmp(sys_type, "EB164")) {
+		    can_bwa = 0;
+		} else {
+		    can_bwa = 1;
+		}
+	    }
+	    if (sscanf(buf,"system variation : %s ",sys_var) == 1) {
+		if (!strcmp(sys_var,"EB164") || 
+		    !strcmp(sys_var,"PC164") ) {
+		    can_bwa = 0;
+		}
+	    }
+	}
+	fclose(info_fptr);
+
+	xf86Msg(X_INFO,"Alpha %s cpu on a %s (variation %s)\n",
+		cpu_model, sys_type,
+		*sys_var?sys_var:"default");
+
+	if (!has_bwx) {
+	    xf86Msg(X_INFO,"CPU does not support BWX extension\n");
+	    xf86_axp_IOBase = _bus_base_sparse();
+	    return 1;
+	}
+	
+	if (!can_bwa) {
+	    xf86Msg(X_INFO,
+		    "System does not support 21164 Byte/Word addressing\n");
+	    xf86_axp_IOBase = _bus_base_sparse();
+	    return 1;
+	}
+	xf86_axp_IOBase = _bus_base() + 0x200000000;
+	return 0;
+    } else {
+	xf86_axp_IOBase = _bus_base();
+	return 0;
+    }
+}
 
 static pointer
 mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size)

       reply	other threads:[~2000-03-17 14:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <38D24644.B5B3747F@civ.hw.ac.uk>
2000-03-17 14:54 ` Hannes Reinecke [this message]
2000-03-17 18:43   ` FIX #2: XF-4.0 doesn't like my Permedia 2 Richard Henderson
2000-03-18  2:34     ` Richard Henderson
2000-04-18  9:42 ` XFree86 4.0 Hannes Reinecke
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox