aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1998-05-30 18:28:12 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1998-05-30 18:28:12 +0000
commit5db3b83128b19589eadee0068812d4a650f66749 (patch)
tree920f49e46934cec957b7b988ebb8f338f9b8345e
parent5b32180784b641ac33add5398c936520c93c670e (diff)
downloadsrc-5db3b83128b19589eadee0068812d4a650f66749.tar.gz
src-5db3b83128b19589eadee0068812d4a650f66749.zip
Add minimum driver for XC6200 based cards. Currently it knows about
the HOT1 from www.vcc.com.
Notes
Notes: svn path=/head/; revision=36475
-rw-r--r--sys/conf/NOTES5
-rw-r--r--sys/conf/files1
-rw-r--r--sys/i386/conf/LINT5
-rw-r--r--sys/i386/conf/NOTES5
-rw-r--r--sys/pci/xrpu.c110
5 files changed, 123 insertions, 3 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 6c4d1a85db33..7642cc65841a 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.433 1998/05/19 23:23:09 julian Exp $
+# $Id: LINT,v 1.434 1998/05/21 03:22:20 wpaul Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -1252,7 +1252,10 @@ device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr
device bqu0 at isa? port 0x150
device stl0 at isa? port 0x2a0 tty irq 10 vector stlintr
device stli0 at isa? port 0x2a0 tty iomem 0xcc000 flags 23 iosiz 0x1000
+# You are unlikely to have the hardware for loran0 <phk@FreeBSD.org>
device loran0 at isa? port ? tty irq 5 vector loranintr
+# HOT1 Xilinx 6200 card (www.vcc.com)
+device xrpu0
#
# EISA devices:
diff --git a/sys/conf/files b/sys/conf/files
index cf55d1e64978..74e85534e8e7 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -403,6 +403,7 @@ pci/pci_compat.c optional pci
pci/pcisupport.c optional pci
pci/tek390.c optional amd device-driver
pci/wdc_p.c optional wdc device-driver
+pci/xrpu.c optional xrpu device-driver
posix4/posix4_mib.c standard
posix4/p1003_1b.c standard
posix4/ksched.c optional _kposix_priority_scheduling
diff --git a/sys/i386/conf/LINT b/sys/i386/conf/LINT
index 6c4d1a85db33..7642cc65841a 100644
--- a/sys/i386/conf/LINT
+++ b/sys/i386/conf/LINT
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.433 1998/05/19 23:23:09 julian Exp $
+# $Id: LINT,v 1.434 1998/05/21 03:22:20 wpaul Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -1252,7 +1252,10 @@ device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr
device bqu0 at isa? port 0x150
device stl0 at isa? port 0x2a0 tty irq 10 vector stlintr
device stli0 at isa? port 0x2a0 tty iomem 0xcc000 flags 23 iosiz 0x1000
+# You are unlikely to have the hardware for loran0 <phk@FreeBSD.org>
device loran0 at isa? port ? tty irq 5 vector loranintr
+# HOT1 Xilinx 6200 card (www.vcc.com)
+device xrpu0
#
# EISA devices:
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 6c4d1a85db33..7642cc65841a 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can.
#
-# $Id: LINT,v 1.433 1998/05/19 23:23:09 julian Exp $
+# $Id: LINT,v 1.434 1998/05/21 03:22:20 wpaul Exp $
#
# NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from
@@ -1252,7 +1252,10 @@ device asc0 at isa? port IO_ASC1 tty drq 3 irq 10 vector ascintr
device bqu0 at isa? port 0x150
device stl0 at isa? port 0x2a0 tty irq 10 vector stlintr
device stli0 at isa? port 0x2a0 tty iomem 0xcc000 flags 23 iosiz 0x1000
+# You are unlikely to have the hardware for loran0 <phk@FreeBSD.org>
device loran0 at isa? port ? tty irq 5 vector loranintr
+# HOT1 Xilinx 6200 card (www.vcc.com)
+device xrpu0
#
# EISA devices:
diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c
new file mode 100644
index 000000000000..4a78d602f6d0
--- /dev/null
+++ b/sys/pci/xrpu.c
@@ -0,0 +1,110 @@
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ * $Id$
+ *
+ * A very simple device driver for PCI cards based on Xilinx 6200 series
+ * FPGA/RPU devices. Current Functionality is to allow you to open and
+ * mmap the entire thing into your program.
+ *
+ * Hardware currently supported:
+ * www.vcc.com HotWorks 1 6216 based card.
+ *
+ */
+
+#ifndef DEVFS
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/devfsext.h>
+#include <pci/pcireg.h>
+#include <pci/pcivar.h>
+
+static char* xrpu_probe (pcici_t tag, pcidi_t type);
+static void xrpu_attach (pcici_t tag, int unit);
+static u_long xrpu_count;
+
+static vm_offset_t virbase, physbase;
+
+static int
+xrpuopen(dev_t dev, int flag, int mode, struct proc *p)
+{
+ return (0);
+}
+
+static int
+xrpuclose(dev_t dev, int flag, int mode, struct proc *p)
+{
+ return (0);
+}
+
+static int
+xrpummap(dev_t dev, int offset, int nprot)
+{
+ if (offset >= 0x1000000)
+ return (-1);
+ return (i386_btop(physbase + offset));
+}
+
+/*
+ * Device driver initialization stuff
+ */
+
+#define CDEV_MAJOR 100
+static struct cdevsw xrpudevsw = {
+ xrpuopen, xrpuclose, noread, nowrite,
+ noioctl, nullstop, noreset, nodevtotty,
+ seltrue, xrpummap, nostrategy, "xrpu",
+ NULL, -1
+};
+
+/*
+ * PCI initialization stuff
+ */
+
+static struct pci_device xrpu_device = {
+ "xrpu",
+ xrpu_probe,
+ xrpu_attach,
+ &xrpu_count,
+ NULL
+};
+
+DATA_SET (pcidevice_set, xrpu_device);
+
+static char*
+xrpu_probe (pcici_t tag, pcidi_t typea)
+{
+ int data = pci_conf_read(tag, PCI_CLASS_REG);
+ u_int id = pci_conf_read(tag, PCI_ID_REG);
+ const char *vendor, *chip, *type;
+
+ vendor = chip = type = 0;
+
+ if (id == 0x6216133e) {
+ return "VCC Hotworks-I xc6216";
+ }
+ return 0;
+}
+
+static void
+xrpu_attach (pcici_t tag, int unit)
+{
+ dev_t cdev = makedev(CDEV_MAJOR, 0);
+
+ pci_map_mem(tag, PCI_MAP_REG_START, &virbase, &physbase);
+
+ printf("Mapped physbase %p to virbase %p\n", physbase, virbase);
+
+ cdevsw_add(&cdev, &xrpudevsw, NULL);
+
+ devfs_add_devswf(&xrpudevsw, 0, DV_CHR, UID_ROOT, GID_WHEEL, 0600,
+ "xrpu0", 0);
+}
+#endif /* DEVFS */