Subject: Re: X + vga
To: None <port-alpha@netbsd.org>
From: Simon Burge <simonb@netbsd.org>
List: port-alpha
Date: 02/24/2000 11:09:36
Frank van der Linden wrote:

> On Fri, Feb 18, 2000 at 08:05:13AM +1100, Simon Burge wrote:
> > I got to the stage where I thought I had most of the FreeBSD goo to
> > support access to the PCI registers and running SuperProbe managed
> > to panic the box everytime.  I haven't looked at this recently though.
> > I can make the diffs available to anyone who's interested...
> 
> Perhaps you can either send them to this list and/or post an URL
> where they are available. And a pointer to the original FreeBSD patches.

The diffs aren't that big, so I've included them here.  I don't have a
pointer to the original FreeBSD patches - I just browsed the FreeBSD
cvsweb pages for the relevent files.  The alpha_pa_access() hack should
be done a bit better, but I was just trying to get something to work.

Here's the output of sysctl machdep on a PC164:

	alpha:~ 1> sysctl machdep
	machdep.console_device = ttyE0
	machdep.root_device = wd0
	machdep.unaligned_print = 1
	machdep.unaligned_fix = 1
	machdep.unaligned_sigbus = 0
	machdep.booted_kernel = netbsd
	machdep.chipset_type = cia
	machdep.chipset_bwx = 0
	machdep.chipset_ports = 573378134016
	machdep.chipset_memory = 549755813888
	machdep.chipset_dense = 575525617664
	machdep.chipset_haemask = 3758096384

Oh, and why-o-why do we have the sysctl's in alpha.h *AND* cpu.h???

I'm still ... ahem ... looking for my patches for the XFree86
SuperProbe program...

Simon.
--
? compile/GENERIC
Index: alpha/machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/alpha/machdep.c,v
retrieving revision 1.196
diff -p -u -r1.196 machdep.c
--- machdep.c	2000/02/22 15:43:54	1.196
+++ machdep.c	2000/02/22 22:48:45
@@ -1779,6 +1779,26 @@ cpu_sysctl(name, namelen, oldp, oldlenp,
 		return (sysctl_rdstring(oldp, oldlenp, newp,
 		    bootinfo.booted_kernel));
 
+	/* XXX XFREE86 STUFF */
+	case CPU_CHIPSET_TYPE:
+		return (sysctl_rdstring(oldp, oldlenp, newp,
+		    chipset_type));
+	case CPU_CHIPSET_BWX:
+		return (sysctl_rdint(oldp, oldlenp, newp,
+		    chipset_bwx));
+	case CPU_CHIPSET_PORTS:
+		return (sysctl_rdquad(oldp, oldlenp, newp,
+		    chipset_ports));
+	case CPU_CHIPSET_MEMORY:
+		return (sysctl_rdquad(oldp, oldlenp, newp,
+		    chipset_memory));
+	case CPU_CHIPSET_DENSE:
+		return (sysctl_rdquad(oldp, oldlenp, newp,
+		    chipset_dense));
+	case CPU_CHIPSET_HAEMASK:
+		return (sysctl_rdquad(oldp, oldlenp, newp,
+		    chipset_hae_mask));
+
 	default:
 		return (EOPNOTSUPP);
 	}
@@ -2062,6 +2082,7 @@ int
 alpha_pa_access(pa)
 	u_long pa;
 {
+#if 0	/* XXX XFREE86 STUFF */
 	int i;
 
 	for (i = 0; i < mem_cluster_cnt; i++) {
@@ -2073,6 +2094,9 @@ alpha_pa_access(pa)
 		return (mem_clusters[i].size & PAGE_MASK);	/* prot */
 	}
 	return (PROT_NONE);
+#else
+	return VM_PROT_READ|VM_PROT_WRITE;
+#endif
 }
 
 /* XXX XXX BEGIN XXX XXX */
Index: include/alpha.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/include/alpha.h,v
retrieving revision 1.6
diff -p -u -r1.6 alpha.h
--- alpha.h	1999/09/17 19:59:37	1.6
+++ alpha.h	2000/02/22 22:48:45
@@ -54,8 +54,16 @@
 #define	CPU_UNALIGNED_FIX	4	/* int: fix unaligned accesses */
 #define	CPU_UNALIGNED_SIGBUS	5	/* int: SIGBUS unaligned accesses */
 #define	CPU_BOOTED_KERNEL	6	/* string: booted kernel name */
-#define	CPU_MAXID		7	/* 6 valid machdep IDs */
+/* XXX XFREE86 CTLS */
+#define CPU_CHIPSET_TYPE	 7	/* string: PCI chipset type */
+#define CPU_CHIPSET_BWX		 8	/* int: CPU supports BWX access */
+#define CPU_CHIPSET_PORTS	 9	/* quad: PCI chipset port address */
+#define CPU_CHIPSET_MEMORY	10	/* quad: PCI chipset memory address */
+#define CPU_CHIPSET_DENSE	11	/* quad: PCI chipset dense memory address */
+#define CPU_CHIPSET_HAEMASK	12	/* quad: PCI chipset mask for HAE register */
 
+#define	CPU_MAXID		13	/* 12 valid machdep IDs */
+
 #define	CTL_MACHDEP_NAMES { \
 	{ 0, 0 }, \
 	{ "console_device", CTLTYPE_STRUCT }, \
@@ -64,11 +72,25 @@
 	{ "unaligned_fix", CTLTYPE_INT }, \
 	{ "unaligned_sigbus", CTLTYPE_INT }, \
 	{ "booted_kernel", CTLTYPE_STRING }, \
+	{ "chipset_type", CTLTYPE_STRING }, \
+	{ "chipset_bwx", CTLTYPE_INT }, \
+	{ "chipset_ports", CTLTYPE_QUAD }, \
+	{ "chipset_memory", CTLTYPE_QUAD }, \
+	{ "chipset_dense", CTLTYPE_QUAD }, \
+	{ "chipset_haemask", CTLTYPE_QUAD }, \
 }
 
 #ifdef _KERNEL
 
 #include <machine/bus.h>
+
+/* XXX XFREE86 CTLS */
+extern	char chipset_type[10];
+extern	int chipset_bwx;
+extern	u_int64_t chipset_ports;
+extern	u_int64_t chipset_memory;
+extern	u_int64_t chipset_dense;
+extern	u_int64_t chipset_hae_mask;
 
 struct pcb;
 struct proc;
Index: include/cpu.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/include/cpu.h,v
retrieving revision 1.36
diff -p -u -r1.36 cpu.h
--- cpu.h	1999/12/16 20:17:23	1.36
+++ cpu.h	2000/02/22 22:48:45
@@ -201,8 +201,16 @@ u_int64_t want_resched;		/* resched() wa
 #define	CPU_UNALIGNED_FIX	4	/* int: fix unaligned accesses */
 #define	CPU_UNALIGNED_SIGBUS	5	/* int: SIGBUS unaligned accesses */
 #define	CPU_BOOTED_KERNEL	6	/* string: booted kernel name */
-#define	CPU_MAXID		7	/* 6 valid machdep IDs */
+/* XXX XFREE86 CTLS */
+#define CPU_CHIPSET_TYPE	 7	/* string: PCI chipset type */
+#define CPU_CHIPSET_BWX		 8	/* int: CPU supports BWX access */
+#define CPU_CHIPSET_PORTS	 9	/* quad: PCI chipset port address */
+#define CPU_CHIPSET_MEMORY	10	/* quad: PCI chipset memory address */
+#define CPU_CHIPSET_DENSE	11	/* quad: PCI chipset dense memory address */
+#define CPU_CHIPSET_HAEMASK	12	/* quad: PCI chipset mask for HAE register */
 
+#define	CPU_MAXID		13	/* 12 valid machdep IDs */
+
 #define	CTL_MACHDEP_NAMES { \
 	{ 0, 0 }, \
 	{ "console_device", CTLTYPE_STRUCT }, \
@@ -211,6 +219,12 @@ u_int64_t want_resched;		/* resched() wa
 	{ "unaligned_fix", CTLTYPE_INT }, \
 	{ "unaligned_sigbus", CTLTYPE_INT }, \
 	{ "booted_kernel", CTLTYPE_STRING }, \
+	{ "chipset_type", CTLTYPE_STRING }, \
+	{ "chipset_bwx", CTLTYPE_INT }, \
+	{ "chipset_ports", CTLTYPE_QUAD }, \
+	{ "chipset_memory", CTLTYPE_QUAD }, \
+	{ "chipset_dense", CTLTYPE_QUAD }, \
+	{ "chipset_haemask", CTLTYPE_QUAD }, \
 }
 
 #ifdef _KERNEL
Index: pci/apecs.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/pci/apecs.c,v
retrieving revision 1.36
diff -p -u -r1.36 apecs.c
--- apecs.c	1999/11/04 19:15:22	1.36
+++ apecs.c	2000/02/22 22:48:46
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.
 #include <sys/device.h>
 #include <vm/vm.h>
 
+#include <machine/alpha.h>		/* XXX XFREE86 STUFF */
 #include <machine/autoconf.h>
 #include <machine/rpb.h>
 
@@ -202,6 +203,14 @@ apecsattach(parent, self, aux)
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
 	config_found(self, &pba, apecsprint);
+
+	/* XXX XFREE86 STUFF */
+	snprintf(chipset_type, sizeof(chipset_type), "apecs");
+	chipset_bwx = 0;
+	chipset_ports = APECS_PCI_SIO;
+	chipset_memory = APECS_PCI_SPARSE;
+	chipset_dense = APECS_PCI_DENSE;
+	chipset_hae_mask = EPIC_HAXR1_EADDR;
 }
 
 static int
Index: pci/cia.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/pci/cia.c,v
retrieving revision 1.52
diff -p -u -r1.52 cia.c
--- cia.c	2000/02/09 01:39:20	1.52
+++ cia.c	2000/02/22 22:48:46
@@ -81,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.52
 #include <sys/device.h>
 #include <vm/vm.h>
 
+#include <machine/alpha.h>		/* XXX XFREE86 STUFF */
 #include <machine/autoconf.h>
 #include <machine/rpb.h>
 
@@ -403,6 +404,22 @@ ciaattach(parent, self, aux)
 		pba.pba_flags |= PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
 		    PCI_FLAGS_MWI_OKAY;
 	config_found(self, &pba, ciaprint);
+
+	/* XXX XFREE86 STUFF */
+	if (ccp->cc_flags & CCF_ISPYXIS) {
+		snprintf(chipset_type, sizeof(chipset_type), "pyxis");
+		chipset_bwx = 1;
+		chipset_ports = CIA_EV56_BWIO;
+		chipset_memory = CIA_EV56_BWMEM;
+		chipset_dense = CIA_PCI_DENSE;
+	} else {
+		snprintf(chipset_type, sizeof(chipset_type), "cia");
+		chipset_bwx = 0;
+		chipset_ports = CIA_PCI_SIO1;
+		chipset_memory = CIA_PCI_SMEM1;
+		chipset_dense = CIA_PCI_DENSE;
+		chipset_hae_mask = 7L << 29;
+	}
 }
 
 static int
Index: pci/lca.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/pci/lca.c,v
retrieving revision 1.34
diff -p -u -r1.34 lca.c
--- lca.c	1999/11/04 19:15:22	1.34
+++ lca.c	2000/02/22 22:48:46
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.34
 #include <sys/device.h>
 #include <vm/vm.h>
 
+#include <machine/alpha.h>		/* XXX XFREE86 STUFF */
 #include <machine/autoconf.h>
 #include <machine/rpb.h>
 
@@ -206,6 +207,14 @@ lcaattach(parent, self, aux)
 	pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED |
 	    PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | PCI_FLAGS_MWI_OKAY;
 	config_found(self, &pba, lcaprint);
+
+	/* XXX XFREE86 STUFF */
+	snprintf(chipset_type, sizeof(chipset_type), "lca");
+	chipset_bwx = 0;
+	chipset_ports = LCA_PCI_SIO;
+	chipset_memory = LCA_PCI_SPARSE;
+	chipset_dense = LCA_PCI_DENSE;
+	chipset_hae_mask = IOC_HAE_ADDREXT;
 }
 
 static int
Index: pci/pci_machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/alpha/pci/pci_machdep.c,v
retrieving revision 1.13
diff -p -u -r1.13 pci_machdep.c
--- pci_machdep.c	1998/05/28 16:59:32	1.13
+++ pci_machdep.c	2000/02/22 22:48:46
@@ -103,3 +103,12 @@ pci_display_console(iot, memt, pc, bus, 
 		panic("pci_display_console: unconfigured device at %d/%d/%d",
 		    bus, device, function);
 }
+
+
+/* XXX XFREE86 STUFF */
+char chipset_type[10];
+int chipset_bwx = 0;
+u_int64_t chipset_ports = 0;
+u_int64_t chipset_memory = 0;
+u_int64_t chipset_dense = 0;
+u_int64_t chipset_hae_mask = 0;