Skip site navigation (1)Skip section navigation (2)
Date:      Mon,  9 Aug 1999 14:40:25 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        freebsd-alpha@freebsd.org
Subject:   Seeking EB64PLUS owner running -current
Message-ID:  <14255.7930.281264.779454@grasshopper.cs.duke.edu>

next in thread | raw e-mail | index | archive | help

I'm looking for somebody with an EB64PLUS (EB64+, Aspen Alpine, etc)
who is running -current to test the below patch to apecs.c.  This
patch should enable scatter-gather DMA for ISA devices & allow you to
use the floppy driver.  (The other part of this patch enables the
floppy driver).

I've tested it locally on my AlphaStation 200 4/166 & want to be sure it
works on the other machines which use this chipset.

Thanks,

Drew
------------------------------------------------------------------------------
Andrew Gallatin, Sr Systems Programmer	http://www.cs.duke.edu/~gallatin
Duke University				Email: gallatin@cs.duke.edu
Department of Computer Science		Phone: (919) 660-6590


Index: pci/apecs.c
===================================================================
RCS file: /home/ncvs/src/sys/alpha/pci/apecs.c,v
retrieving revision 1.8
diff -u -b -B -r1.8 apecs.c
--- apecs.c	1999/05/20 15:33:18	1.8
+++ apecs.c	1999/07/10 23:19:46
@@ -59,6 +59,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/module.h>
+#include <sys/malloc.h>
 #include <sys/bus.h>
 #include <machine/bus.h>
 #include <sys/rman.h>
@@ -73,7 +74,12 @@
 #include <machine/cpuconf.h>
 #include <machine/swiz.h>
 #include <machine/rpb.h>
+#include <machine/sgmap.h>
 
+#include <vm/vm.h>
+#include <vm/vm_prot.h>
+#include <vm/vm_page.h>
+
 #define KV(pa)			ALPHA_PHYS_TO_K0SEG(pa)
 
 static devclass_t	apecs_devclass;
@@ -478,6 +484,63 @@
 	sizeof(struct apecs_softc),
 };
 
+#define APECS_SGMAP_BASE		(8*1024*1024)
+#define APECS_SGMAP_SIZE		(8*1024*1024)
+
+static void
+apecs_sgmap_invalidate(void)
+{
+	alpha_mb();
+	REGVAL(EPIC_TBIA) = 0;
+	alpha_mb();
+}
+
+static void
+apecs_sgmap_map(void *arg, vm_offset_t ba, vm_offset_t pa)
+{
+	u_int64_t *sgtable = arg;
+	int index = alpha_btop(ba - APECS_SGMAP_BASE);
+
+	if (pa) {
+		if (pa > (1L<<32))
+			panic("apecs_sgmap_map: can't map address 0x%lx", pa);
+		sgtable[index] = ((pa >> 13) << 1) | 1;
+	} else {
+		sgtable[index] = 0;
+	}
+	alpha_mb();
+	apecs_sgmap_invalidate();
+}
+
+static void
+apecs_init_sgmap(void)
+{
+	void *sgtable;
+
+	/*
+	 * First setup Window 0 to map 8Mb to 16Mb with an
+	 * sgmap. Allocate the map aligned to a 32 boundary.
+	 */
+	REGVAL(EPIC_PCI_BASE_1) = APECS_SGMAP_BASE |
+		EPIC_PCI_BASE_SGEN | EPIC_PCI_BASE_WENB;
+	alpha_mb();
+
+	REGVAL(EPIC_PCI_MASK_1) = EPIC_PCI_MASK_8M;
+	alpha_mb();
+
+	sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT,
+			       0, (1L<<34),
+			       32*1024, (1L<<34));
+	if (!sgtable)
+		panic("apecs_init_sgmap: can't allocate page table");
+	REGVAL(EPIC_TBASE_1) =
+		(pmap_kextract((vm_offset_t) sgtable) >> EPIC_TBASE_SHIFT);
+
+	chipset.sgmap = sgmap_map_create(APECS_SGMAP_BASE,
+					 APECS_SGMAP_BASE + APECS_SGMAP_SIZE,
+					 apecs_sgmap_map, sgtable);
+}
+
 void
 apecs_init()
 {
@@ -509,6 +572,7 @@
 
 	pci_init_resources();
 	isa_init_intr();
+	apecs_init_sgmap();
 
 	device_add_child(dev, "pcib", 0, 0);
 
Index: conf/GENERIC
===================================================================
RCS file: /home/ncvs/src/sys/alpha/conf/GENERIC,v
retrieving revision 1.33
diff -u -b -B -r1.33 GENERIC
--- GENERIC	1999/08/08 19:28:56	1.33
+++ GENERIC	1999/08/09 18:37:26
@@ -90,9 +90,8 @@
 # real time clock
 device		mcclock0 at isa0 port 0x70
 
-# Not enabled since it only works on CIA chipsets
-#controller	fdc0	at isa? port IO_FD1 irq 6 drq 2
-#disk		fd0	at fdc0 drive 0
+controller	fdc0	at isa? port IO_FD1 irq 6 drq 2
+disk		fd0	at fdc0 drive 0
 
 controller	atkbdc0	at isa? port IO_KBD
 device		atkbd0	at atkbdc? irq 1


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14255.7930.281264.779454>