From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 13436 invoked from network); 17 Mar 2000 14:54:52 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 17 Mar 2000 14:54:52 -0000 Received: from pc12.civ.hw.ac.uk (root@pc12.civ.hw.ac.uk [137.195.49.67]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id JAA11106 for ; Fri, 17 Mar 2000 09:54:51 -0500 Received: from civ.hw.ac.uk (IDENT:civhr@localhost.localdomain [127.0.0.1]) by pc12.civ.hw.ac.uk (8.9.3/8.9.3) with ESMTP id OAA01316 for ; Fri, 17 Mar 2000 14:54:49 GMT Sender: civhr@pc12.civ.hw.ac.uk Message-ID: <38D24738.A2D3D586@civ.hw.ac.uk> Date: Fri, 17 Mar 2000 14:54:48 +0000 From: Hannes Reinecke Organization: Heriot Watt University, Edinburgh X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.3.51 i586) X-Accept-Language: en MIME-Version: 1.0 To: AXP Developers list Subject: Re: FIX #2: XF-4.0 doesn't like my Permedia 2 References: <38D24644.B5B3747F@civ.hw.ac.uk> Content-Type: multipart/mixed; boundary="------------6FC1C588CBE52F5777DD7FCE" This is a multi-part message in MIME format. --------------6FC1C588CBE52F5777DD7FCE Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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 --------------6FC1C588CBE52F5777DD7FCE Content-Type: text/plain; charset=us-ascii; name="xfree.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xfree.diff" 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) --------------6FC1C588CBE52F5777DD7FCE--