* Re: FIX #2: XF-4.0 doesn't like my Permedia 2
[not found] <38D24644.B5B3747F@civ.hw.ac.uk>
@ 2000-03-17 14:54 ` Hannes Reinecke
2000-03-17 18:43 ` Richard Henderson
2000-04-18 9:42 ` XFree86 4.0 Hannes Reinecke
1 sibling, 1 reply; 4+ messages in thread
From: Hannes Reinecke @ 2000-03-17 14:54 UTC (permalink / raw)
To: AXP Developers list
[-- 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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FIX #2: XF-4.0 doesn't like my Permedia 2
2000-03-17 14:54 ` FIX #2: XF-4.0 doesn't like my Permedia 2 Hannes Reinecke
@ 2000-03-17 18:43 ` Richard Henderson
2000-03-18 2:34 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2000-03-17 18:43 UTC (permalink / raw)
To: axp-list
On Fri, Mar 17, 2000 at 02:54:48PM +0000, Hannes Reinecke wrote:
> 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.
What if I go ahead and add the syscalls Jay and I talked about,
and you use those directly if they're available? New kernels
distribute faster than new libc's...
The new syscall would look like
enum pciconfig_iobase_which {
IOBASE_SPARSE_MEM = 1,
IOBASE_DENSE_MEM = 2,
IOBASE_SPARSE_IO = 3,
IOBASE_DENSE_IO = 4,
};
long pciconfig_iobase(enum pciconfig_iobase_which which,
unsigned long int __bus, unsigned long int __dfn);
I.e. you'd need pci information for the card you're interested in.
Which means we'll finally be able to support X on something other
than bus 0.
But supposing you get ENOSYS, you'll have to fall back on this:
> + 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;
> + }
> + }
> + }
Rather than try and figure out whether or not bwx is or is not
supported, I think you should try to exactly identify PYXIS.
That'd be LX, SX, Miata, and Ruffian. The later two are listed
in the "system type" field.
> + xf86_axp_IOBase = _bus_base() + 0x200000000;
Moreover, once you've identified PYXIS, don't rely on glibc
continuing to return the CIA_DENSE_MEM region. Go ahead and
hard-code CIA_BW_MEM = 0x8800000000UL.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FIX #2: XF-4.0 doesn't like my Permedia 2
2000-03-17 18:43 ` Richard Henderson
@ 2000-03-18 2:34 ` Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2000-03-18 2:34 UTC (permalink / raw)
To: axp-list
[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]
On Fri, Mar 17, 2000 at 10:43:09AM -0800, Richard Henderson wrote:
> On Fri, Mar 17, 2000 at 02:54:48PM +0000, Hannes Reinecke wrote:
> > 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.
>
> What if I go ahead and add the syscalls Jay and I talked about,
> and you use those directly if they're available? New kernels
> distribute faster than new libc's...
Here's a patch against 2.3.99-pre2-pre2 + stuff. It should
apply with fuzz to any kernel in the general area. I'll work
on a version for 2.2.15 this weekend.
Try it out like
unsigned long xbus_base(int bus, int dfn)
{
return syscall(376, 2, bus, dfn);
}
int main(int argc, char **argv)
{
unsigned long x = xbus_base(atoi(argv[1]), atoi(argv[2]));
if (x == -1UL)
perror("bus_base");
else
printf("bus_base %lx\n", x);
return 0;
}
00:08.0 Ethernet controller: Lite-On Communications Inc LNE100TX (rev 20)
01:08.0 SCSI storage controller: Adaptec AIC-7881U (rev 01)
[fidel:~] ./a.out 0 64
bus_base 80000000000
[fidel:~] ./a.out 1 64
bus_base 80200000000
[fidel:~] ./a.out 1 65
bus_base: No such device
r~
[-- Attachment #2: d-2399-2-iobase --]
[-- Type: text/plain, Size: 12538 bytes --]
diff -rup linux/arch/alpha/kernel/core_apecs.c 2.3.99-2-2/arch/alpha/kernel/core_apecs.c
--- linux/arch/alpha/kernel/core_apecs.c Thu Mar 16 19:30:37 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_apecs.c Fri Mar 17 16:13:22 2000
@@ -376,8 +376,12 @@ apecs_init_arch(void)
pci_isa_hose = hose = alloc_pci_controler();
hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource;
- hose->config_space = APECS_CONF;
hose->index = 0;
+
+ hose->sparse_mem_base = APECS_SPARSE_MEM - IDENT_ADDR;
+ hose->dense_mem_base = APECS_DENSE_MEM - IDENT_ADDR;
+ hose->sparse_io_base = APECS_IO - IDENT_ADDR;
+ hose->dense_io_base = 0;
/*
* Set up the PCI to main memory translation windows.
diff -rup linux/arch/alpha/kernel/core_cia.c 2.3.99-2-2/arch/alpha/kernel/core_cia.c
--- linux/arch/alpha/kernel/core_cia.c Thu Mar 16 19:31:34 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_cia.c Fri Mar 17 11:28:58 2000
@@ -640,7 +640,6 @@ do_init_arch(int is_pyxis)
pci_isa_hose = hose = alloc_pci_controler();
hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource;
- hose->config_space = CIA_CONF;
hose->index = 0;
if (! is_pyxis) {
@@ -654,6 +653,16 @@ do_init_arch(int is_pyxis)
if (request_resource(&iomem_resource, hae_mem) < 0)
printk(KERN_ERR "Failed to request HAE_MEM\n");
+
+ hose->sparse_mem_base = CIA_SPARSE_MEM - IDENT_ADDR;
+ hose->dense_mem_base = CIA_DENSE_MEM - IDENT_ADDR;
+ hose->sparse_io_base = CIA_IO - IDENT_ADDR;
+ hose->dense_io_base = 0;
+ } else {
+ hose->sparse_mem_base = 0;
+ hose->dense_mem_base = CIA_BW_MEM - IDENT_ADDR;
+ hose->sparse_io_base = 0;
+ hose->dense_io_base = CIA_BW_IO - IDENT_ADDR;
}
/*
diff -rup linux/arch/alpha/kernel/core_irongate.c 2.3.99-2-2/arch/alpha/kernel/core_irongate.c
--- linux/arch/alpha/kernel/core_irongate.c Mon Feb 21 02:49:21 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_irongate.c Fri Mar 17 11:51:00 2000
@@ -346,11 +346,15 @@ irongate_init_arch(void)
* Create our single hose.
*/
- hose = alloc_pci_controler();
+ pci_isa_hose = hose = alloc_pci_controler();
hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource;
- hose->config_space = IRONGATE_CONF;
hose->index = 0;
+
+ hose->sparse_mem_base = 0;
+ hose->dense_mem_base = IRONGATE_MEM - IDENT_ADDR;
+ hose->sparse_io_base = 0;
+ hose->dense_io_base = IRONGATE_IO - IDENT_ADDR;
hose->sg_isa = hose->sg_pci = NULL;
__direct_map_base = 0;
diff -rup linux/arch/alpha/kernel/core_lca.c 2.3.99-2-2/arch/alpha/kernel/core_lca.c
--- linux/arch/alpha/kernel/core_lca.c Thu Mar 16 19:30:37 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_lca.c Fri Mar 17 11:32:50 2000
@@ -298,8 +298,12 @@ lca_init_arch(void)
pci_isa_hose = hose = alloc_pci_controler();
hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource;
- hose->config_space = LCA_CONF;
hose->index = 0;
+
+ hose->sparse_mem_base = LCA_SPARSE_MEM - IDENT_ADDR;
+ hose->dense_mem_base = LCA_DENSE_MEM - IDENT_ADDR;
+ hose->sparse_io_base = LCA_IO - IDENT_ADDR;
+ hose->dense_io_base = 0;
/*
* Set up the PCI to main memory translation windows.
diff -rup linux/arch/alpha/kernel/core_mcpcia.c 2.3.99-2-2/arch/alpha/kernel/core_mcpcia.c
--- linux/arch/alpha/kernel/core_mcpcia.c Thu Mar 16 19:30:37 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_mcpcia.c Fri Mar 17 11:54:02 2000
@@ -189,7 +189,7 @@ mk_conf_addr(struct pci_dev *dev, int wh
bus = 0;
addr = (bus << 16) | (devfn << 8) | (where);
addr <<= 5; /* swizzle for SPARSE */
- addr |= hose->config_space;
+ addr |= hose->config_space_base;
*pci_addr = addr;
DBG_CFG(("mk_conf_addr: returning pci_addr 0x%lx\n", addr));
@@ -337,13 +337,19 @@ mcpcia_new_hose(int h)
int mid = MCPCIA_HOSE2MID(h);
hose = alloc_pci_controler();
+ if (h == 0)
+ pci_isa_hose = hose;
io = alloc_resource();
mem = alloc_resource();
hae_mem = alloc_resource();
hose->io_space = io;
hose->mem_space = hae_mem;
- hose->config_space = MCPCIA_CONF(mid);
+ hose->sparse_mem_base = MCPCIA_SPARSE(mid) - IDENT_ADDR;
+ hose->dense_mem_base = MCPCIA_DENSE(mid) - IDENT_ADDR;
+ hose->sparse_io_base = MCPCIA_IO(mid) - IDENT_ADDR;
+ hose->dense_io_base = 0;
+ hose->config_space_base = MCPCIA_CONF(mid);
hose->index = h;
io->start = MCPCIA_IO(mid) - MCPCIA_IO_BIAS;
diff -rup linux/arch/alpha/kernel/core_polaris.c 2.3.99-2-2/arch/alpha/kernel/core_polaris.c
--- linux/arch/alpha/kernel/core_polaris.c Mon Feb 21 02:49:42 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_polaris.c Fri Mar 17 11:54:10 2000
@@ -192,11 +192,15 @@ polaris_init_arch(void)
* Create our single hose.
*/
- hose = alloc_pci_controler();
+ pci_isa_hose = hose = alloc_pci_controler();
hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource;
- hose->config_space = POLARIS_DENSE_CONFIG_BASE;
hose->index = 0;
+
+ hose->sparse_mem_base = 0;
+ hose->dense_mem_base = POLARIS_DENSE_MEM_BASE - IDENT_ADDR;
+ hose->sparse_io_base = 0;
+ hose->dense_io_base = POLARIS_DENSE_IO_BASE - IDENT_ADDR;
hose->sg_isa = hose->sg_pci = NULL;
diff -rup linux/arch/alpha/kernel/core_t2.c 2.3.99-2-2/arch/alpha/kernel/core_t2.c
--- linux/arch/alpha/kernel/core_t2.c Mon Feb 21 02:49:21 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_t2.c Fri Mar 17 11:54:16 2000
@@ -384,11 +384,15 @@ t2_init_arch(void)
* Create our single hose.
*/
- hose = alloc_pci_controler();
+ pci_isa_hose = hose = alloc_pci_controler();
hose->io_space = &ioport_resource;
hose->mem_space = &iomem_resource;
- hose->config_space = T2_CONF;
hose->index = 0;
+
+ hose->sparse_mem_base = T2_SPARSE_MEM - IDENT_ADDR;
+ hose->dense_mem_base = T2_DENSE_MEM - IDENT_ADDR;
+ hose->sparse_io_base = T2_IO - IDENT_ADDR;
+ hose->dense_io_base = 0;
hose->sg_isa = hose->sg_pci = NULL;
__direct_map_base = 0x40000000;
diff -rup linux/arch/alpha/kernel/core_tsunami.c 2.3.99-2-2/arch/alpha/kernel/core_tsunami.c
--- linux/arch/alpha/kernel/core_tsunami.c Thu Mar 16 19:31:28 2000
+++ 2.3.99-2-2/arch/alpha/kernel/core_tsunami.c Fri Mar 17 16:49:47 2000
@@ -104,7 +104,7 @@ mk_conf_addr(struct pci_dev *dev, int wh
*type1 = (bus != 0);
addr = (bus << 16) | (device_fn << 8) | where;
- addr |= hose->config_space;
+ addr |= hose->config_space_base;
*pci_addr = addr;
DBG_CFG(("mk_conf_addr: returning pci_addr 0x%lx\n", addr));
@@ -291,7 +291,16 @@ tsunami_init_one_pchip(tsunami_pchip *pc
hose->io_space = alloc_resource();
hose->mem_space = alloc_resource();
- hose->config_space = TSUNAMI_CONF(index);
+ /* This is for userland consumption. For some reason, the 40-bit
+ PIO bias that we use in the kernel through KSEG didn't work for
+ the page table based user mappings. So make sure we get the
+ 43-bit PIO bias. */
+ hose->sparse_mem_base = 0;
+ hose->sparse_io_base = 0;
+ hose->dense_mem_base = TSUNAMI_MEM(index)-TSUNAMI_BASE+0x80000000000UL;
+ hose->dense_io_base = TSUNAMI_IO(index)-TSUNAMI_BASE+0x80000000000UL;
+
+ hose->config_space_base = TSUNAMI_CONF(index);
hose->index = index;
hose->io_space->start = TSUNAMI_IO(index) - TSUNAMI_IO_BIAS;
diff -rup linux/arch/alpha/kernel/entry.S 2.3.99-2-2/arch/alpha/kernel/entry.S
--- linux/arch/alpha/kernel/entry.S Thu Mar 16 19:31:28 2000
+++ 2.3.99-2-2/arch/alpha/kernel/entry.S Fri Mar 17 11:43:49 2000
@@ -8,7 +8,7 @@
#define SIGCHLD 20
-#define NR_SYSCALLS 376
+#define NR_SYSCALLS 377
/*
* These offsets must match with alpha_mv in <asm/machvec.h>.
@@ -1156,3 +1156,4 @@ sys_call_table:
.quad sys_ni_syscall /* sys_dipc */
.quad sys_pivot_root
.quad sys_mincore /* 375 */
+ .quad sys_pciconfig_iobase
diff -rup linux/arch/alpha/kernel/pci.c 2.3.99-2-2/arch/alpha/kernel/pci.c
--- linux/arch/alpha/kernel/pci.c Mon Feb 21 02:49:42 2000
+++ 2.3.99-2-2/arch/alpha/kernel/pci.c Fri Mar 17 14:20:20 2000
@@ -377,3 +377,39 @@ alloc_resource(void)
return res;
}
+
+
+/* Provide information on locations of various I/O regions in physical
+ memory. Do this on a per-card basis so that we choose the right hose. */
+
+asmlinkage long
+sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
+{
+ struct pci_controler *hose;
+ struct pci_dev *dev;
+
+ /* Special hook for ISA access. */
+ if (bus == 0 && dfn == 0) {
+ hose = pci_isa_hose;
+ } else {
+ dev = pci_find_slot(bus, dfn);
+ if (!dev)
+ return -ENODEV;
+ hose = dev->sysdata;
+ }
+
+ switch (which) {
+ case IOBASE_HOSE:
+ return hose->index;
+ case IOBASE_SPARSE_MEM:
+ return hose->sparse_mem_base;
+ case IOBASE_DENSE_MEM:
+ return hose->dense_mem_base;
+ case IOBASE_SPARSE_IO:
+ return hose->sparse_io_base;
+ case IOBASE_DENSE_IO:
+ return hose->dense_io_base;
+ }
+
+ return -EOPNOTSUPP;
+}
diff -rup linux/arch/alpha/kernel/sys_jensen.c 2.3.99-2-2/arch/alpha/kernel/sys_jensen.c
--- linux/arch/alpha/kernel/sys_jensen.c Thu Mar 16 19:30:37 2000
+++ 2.3.99-2-2/arch/alpha/kernel/sys_jensen.c Fri Mar 17 18:10:22 2000
@@ -29,6 +29,7 @@
#include "proto.h"
#include "irq_impl.h"
+#include "pci_impl.h"
#include "machvec_impl.h"
@@ -123,6 +124,22 @@ jensen_init_irq(void)
static void __init
jensen_init_arch(void)
{
+ struct pci_controler *hose;
+
+ /* Create a hose so that we can report i/o base addresses to
+ userland. */
+
+ pci_isa_hose = hose = alloc_pci_controler();
+ hose->io_space = &ioport_resource;
+ hose->mem_space = &iomem_resource;
+ hose->index = 0;
+
+ hose->sparse_mem_base = EISA_MEM - IDENT_ADDR;
+ hose->dense_mem_base = 0;
+ hose->sparse_io_base = EISA_IO - IDENT_ADDR;
+ hose->dense_io_base = 0;
+
+ hose->sg_isa = hose->sg_pci = NULL;
__direct_map_base = 0;
__direct_map_size = 0xffffffff;
}
diff -rup linux/include/asm-alpha/pci.h 2.3.99-2-2/include/asm-alpha/pci.h
--- linux/include/asm-alpha/pci.h Thu Mar 16 19:30:38 2000
+++ 2.3.99-2-2/include/asm-alpha/pci.h Fri Mar 17 18:06:58 2000
@@ -1,6 +1,8 @@
#ifndef __ALPHA_PCI_H
#define __ALPHA_PCI_H
+#ifdef __KERNEL__
+
#include <linux/spinlock.h>
#include <asm/scatterlist.h>
#include <asm/machvec.h>
@@ -22,7 +24,17 @@ struct pci_controler {
struct resource *io_space;
struct resource *mem_space;
- unsigned long config_space;
+ /* The following are for reporting to userland. The invariant is
+ that if we report a BWX-capable dense memory, we do not report
+ a sparse memory at all, even if it exists. */
+ unsigned long sparse_mem_base;
+ unsigned long dense_mem_base;
+ unsigned long sparse_io_base;
+ unsigned long dense_io_base;
+
+ /* This one's for the kernel only. It's in KSEG somewhere. */
+ unsigned long config_space_base;
+
unsigned int index;
unsigned int first_busno;
unsigned int last_busno;
@@ -126,5 +138,14 @@ pci_dma_sync_sg(struct pci_dev *dev, str
you would pass 0x00ffffff as the mask to this function. */
extern int pci_dma_supported(struct pci_dev *hwdev, dma_addr_t mask);
+
+#endif /* __KERNEL__ */
+
+/* Values for the `which' argument to sys_pciconfig_iobase. */
+#define IOBASE_HOSE 0
+#define IOBASE_SPARSE_MEM 1
+#define IOBASE_DENSE_MEM 2
+#define IOBASE_SPARSE_IO 3
+#define IOBASE_DENSE_IO 4
#endif /* __ALPHA_PCI_H */
diff -rup linux/include/asm-alpha/pgtable.h 2.3.99-2-2/include/asm-alpha/pgtable.h
--- linux/include/asm-alpha/pgtable.h Thu Mar 16 19:30:38 2000
+++ 2.3.99-2-2/include/asm-alpha/pgtable.h Fri Mar 17 18:06:58 2000
@@ -159,6 +159,16 @@ extern unsigned long __zero_page(void);
* On certain platforms whose physical address space can overlap KSEG,
* namely EV6 and above, we must re-twiddle the physaddr to restore the
* correct high-order bits.
+ *
+ * This is extremely confusing until you realize that this is actually
+ * just working around a userspace bug. The X server was intending to
+ * provide the physical address but instead provided the KSEG address.
+ * Or tried to, except it's not representable.
+ *
+ * On Tsunami there's nothing meaningful at 0x40000000000, so this is
+ * a safe thing to do. Come the first core logic that does put something
+ * in this area -- memory or whathaveyou -- then this hack will have
+ * to go away. So be prepared!
*/
#if defined(CONFIG_ALPHA_GENERIC) && defined(USE_48_BIT_KSEG)
diff -rup linux/include/asm-alpha/unistd.h 2.3.99-2-2/include/asm-alpha/unistd.h
--- linux/include/asm-alpha/unistd.h Thu Mar 16 19:31:28 2000
+++ 2.3.99-2-2/include/asm-alpha/unistd.h Fri Mar 17 17:18:36 2000
@@ -313,6 +313,7 @@
#define __NR_dipc 373
#define __NR_pivot_root 374
#define __NR_mincore 375
+#define __NR_pciconfig_iobase 376
#if defined(__LIBRARY__) && defined(__GNUC__)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: XFree86 4.0
[not found] <38D24644.B5B3747F@civ.hw.ac.uk>
2000-03-17 14:54 ` FIX #2: XF-4.0 doesn't like my Permedia 2 Hannes Reinecke
@ 2000-04-18 9:42 ` Hannes Reinecke
1 sibling, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2000-04-18 9:42 UTC (permalink / raw)
To: axp-list
[-- Attachment #1: Type: text/plain, Size: 915 bytes --]
Hiya,
> I have problem whith XFree86 4.0 on my PWS433a debian 2.2 kernel 2.2.14
> whith a Matrox Millenium II 4MB.
>
> When i start XFree86 the computer reboots :(
Oh well, we know that one. It most likely due to incorrect setting of
the MMIO-areas for pyxis chipsets. Try the attached patch.
Unfortunately it didn't make it into the distribution because a) its
quite ugly and b) Egbert couldn't agree with himself about the framework
for handling these cases.
(This is not to slight you, Egbert. I'll be happy to help in any way.)
(Once I got a new HD. 'scsi error: Medium Error; additional sense: Scan
head positioning error'. Grrr.)
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: 3773 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)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-04-18 9:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <38D24644.B5B3747F@civ.hw.ac.uk>
2000-03-17 14:54 ` FIX #2: XF-4.0 doesn't like my Permedia 2 Hannes Reinecke
2000-03-17 18:43 ` Richard Henderson
2000-03-18 2:34 ` Richard Henderson
2000-04-18 9:42 ` XFree86 4.0 Hannes Reinecke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox