summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-05-15 01:00:16 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-05-15 01:00:16 +0000
commit3f8f1d45987c523777fb5dca594107abacbc4063 (patch)
treea2ce1ccb41dc81d8237117aabb3bf456ebaddc19 /sys
parent72d92b7ca2034f10cc1cb9a24475aa76b1f1c586 (diff)
start work on a driver for emulex fibre channel controllers.
it is split up into a bus independant chunk (dev/ic/sli*) and the attach glue (dev/pci/sli_pci.c) cos there are sbus varaints of this chip which i hope to get my hands on one day. this does nothing except attach to the LP8000 controllers.
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files6
-rw-r--r--sys/dev/ic/sli.c51
-rw-r--r--sys/dev/ic/slireg.h17
-rw-r--r--sys/dev/ic/slivar.h26
-rw-r--r--sys/dev/pci/files.pci6
-rw-r--r--sys/dev/pci/sli_pci.c89
6 files changed, 193 insertions, 2 deletions
diff --git a/sys/conf/files b/sys/conf/files
index eb7b0976040..65bc2ec63c7 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.397 2007/04/05 16:25:25 mglocker Exp $
+# $OpenBSD: files,v 1.398 2007/05/15 01:00:15 dlg Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -185,6 +185,10 @@ file dev/ic/isp_openbsd.c isp
device mpi: scsi
file dev/ic/mpi.c mpi
+# Emulex Light Pulse Fibre Channel (Service Level Interface)
+device sli: scsi
+file dev/ic/sli.c sli
+
# Silicon Image 3124/3132/3531 SATALink
device sili: scsi, atascsi
file dev/ic/sili.c sili
diff --git a/sys/dev/ic/sli.c b/sys/dev/ic/sli.c
new file mode 100644
index 00000000000..8d621ae5a7a
--- /dev/null
+++ b/sys/dev/ic/sli.c
@@ -0,0 +1,51 @@
+/* $OpenBSD: sli.c,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+
+/*
+ * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>
+
+#include <machine/bus.h>
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
+#include <dev/ic/slireg.h>
+#include <dev/ic/slivar.h>
+
+struct cfdriver sli_cd = {
+ NULL, "sli", DV_DULL
+};
+
+int
+sli_attach(struct sli_softc *sc)
+{
+ printf("\n");
+
+ return (0);
+}
+
+int
+sli_detach(struct sli_softc *sc, int flags)
+{
+ return (0);
+}
diff --git a/sys/dev/ic/slireg.h b/sys/dev/ic/slireg.h
new file mode 100644
index 00000000000..b253f6d9488
--- /dev/null
+++ b/sys/dev/ic/slireg.h
@@ -0,0 +1,17 @@
+/* $OpenBSD: slireg.h,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+
+/*
+ * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
diff --git a/sys/dev/ic/slivar.h b/sys/dev/ic/slivar.h
new file mode 100644
index 00000000000..fd06163e627
--- /dev/null
+++ b/sys/dev/ic/slivar.h
@@ -0,0 +1,26 @@
+/* $OpenBSD: slivar.h,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+
+/*
+ * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+struct sli_softc {
+ struct device sc_dev;
+ struct scsi_link sc_link;
+};
+#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)
+
+int sli_attach(struct sli_softc *);
+int sli_detach(struct sli_softc *, int);
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci
index 97b75f148dd..1876ec0897a 100644
--- a/sys/dev/pci/files.pci
+++ b/sys/dev/pci/files.pci
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pci,v 1.233 2007/05/04 14:37:40 jsg Exp $
+# $OpenBSD: files.pci,v 1.234 2007/05/15 01:00:15 dlg Exp $
# $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $
#
# Config file and device description for machine-independent PCI code.
@@ -207,6 +207,10 @@ file dev/pci/isp_pci.c isp_pci
attach mpi at pci with mpi_pci
file dev/pci/mpi_pci.c mpi_pci
+# Emulex Light Pulse Fibre Channel (Service Level Interface)
+attach sli at pci with sli_pci
+file dev/pci/sli_pci.c sli_pci
+
# Silicon Image 3124/3132/3531 SATALink
attach sili at pci with sili_pci
file dev/pci/sili_pci.c sili_pci
diff --git a/sys/dev/pci/sli_pci.c b/sys/dev/pci/sli_pci.c
new file mode 100644
index 00000000000..8eee51f229c
--- /dev/null
+++ b/sys/dev/pci/sli_pci.c
@@ -0,0 +1,89 @@
+/* $OpenBSD: sli_pci.c,v 1.1 2007/05/15 01:00:15 dlg Exp $ */
+
+/*
+ * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
+#include <dev/ic/slireg.h>
+#include <dev/ic/slivar.h>
+
+int sli_pci_match(struct device *, void *, void *);
+void sli_pci_attach(struct device *, struct device *, void *);
+int sli_pci_detach(struct device *, int);
+
+struct sli_pci_softc {
+ struct sli_softc psc_sli;
+
+ pci_chipset_tag_t psc_pc;
+ pcitag_t psc_tag;
+
+ void *psc_ih;
+};
+
+struct cfattach sli_pci_ca = {
+ sizeof(struct sli_pci_softc),
+ sli_pci_match,
+ sli_pci_attach,
+ sli_pci_detach
+};
+
+static const struct pci_matchid sli_pci_devices[] = {
+ { PCI_VENDOR_EMULEX, PCI_PRODUCT_EMULEX_LP8000 }
+};
+
+int
+sli_pci_match(struct device *parent, void *match, void *aux)
+{
+ return (pci_matchbyid((struct pci_attach_args *)aux, sli_pci_devices,
+ sizeof(sli_pci_devices) / sizeof(sli_pci_devices[0])));
+}
+
+void
+sli_pci_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct sli_pci_softc *psc = (struct sli_pci_softc *)self;
+ struct sli_softc *sc = &psc->psc_sli;
+
+ sli_attach(sc);
+}
+
+int
+sli_pci_detach(struct device *self, int flags)
+{
+ struct sli_pci_softc *psc = (struct sli_pci_softc *)self;
+ struct sli_softc *sc = &psc->psc_sli;
+ int rv;
+
+ rv = sli_detach(sc, flags);
+ if (rv != 0)
+ return (rv);
+
+ return (0);
+}