summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-08-14 23:16:44 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-08-14 23:16:44 +0000
commite19aca6a2afa7ad5264383b327e28ea04226bb3f (patch)
tree4d2d7dbe91502ac791fa85fa93f4c88ba79cff0f /sys
parent52078722a3742d1ee15ea4378cd87911738a4e53 (diff)
enter nxe, a driver for the netxen 10Gb cards.
i have most of this already written but this is just the attach glue. i'll be adding code in smallish chunks so i can decruft it as i go.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/files.pci7
-rw-r--r--sys/dev/pci/if_nxe.c95
2 files changed, 101 insertions, 1 deletions
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci
index 5861aa98398..189c11f58bc 100644
--- a/sys/dev/pci/files.pci
+++ b/sys/dev/pci/files.pci
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pci,v 1.241 2007/08/14 18:54:39 reyk Exp $
+# $OpenBSD: files.pci,v 1.242 2007/08/14 23:16:43 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.
@@ -351,6 +351,11 @@ device xge: ether, ifnet, ifmedia
attach xge at pci
file dev/pci/if_xge.c xge
+# NetXen NX2031/NX2035 10Gb Ethernet
+device nxe: ether, ifnet, ifmedia
+attach nxe at pci
+file dev/pci/if_nxe.c nxe
+
# Tehuti Networks 10Gb Ethernet
device thtc {}
attach thtc at pci
diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c
new file mode 100644
index 00000000000..3294594b9bf
--- /dev/null
+++ b/sys/dev/pci/if_nxe.c
@@ -0,0 +1,95 @@
+/* $OpenBSD: if_nxe.c,v 1.1 2007/08/14 23:16:43 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 "bpfilter.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/sockio.h>
+#include <sys/mbuf.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+
+#include <machine/bus.h>
+
+#include <dev/pci/pcireg.h>
+#include <dev/pci/pcivar.h>
+#include <dev/pci/pcidevs.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_types.h>
+
+#if NBPFILTER > 0
+#include <net/bpf.h>
+#endif
+
+#ifdef INET
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#endif
+
+int nxe_match(struct device *, void *, void *);
+void nxe_attach(struct device *, struct device *, void *);
+
+struct nxe_softc {
+ struct device sc_dev;
+};
+
+struct cfattach nxe_ca = {
+ sizeof(struct nxe_softc),
+ nxe_match,
+ nxe_attach
+};
+
+struct cfdriver nxe_cd = {
+ NULL,
+ "nxe",
+ DV_IFNET
+};
+
+#define DEVNAME(_sc) ((_sc)->sc_dev.dv_xname)
+#define sizeofa(_a) (sizeof(_a) / sizeof((_a)[0]))
+
+const struct pci_matchid nxe_devices[] = {
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_10GXxR },
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_10GCX4 },
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_4GCU },
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_IMEZ },
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_HMEZ },
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_IMEZ_2 },
+ { PCI_VENDOR_NETXEN, PCI_PRODUCT_NETXEN_NXB_HMEZ_2 }
+};
+
+int
+nxe_match(struct device *parent, void *match, void *aux)
+{
+ struct pci_attach_args *pa = aux;
+
+ return (pci_matchbyid(pa, nxe_devices, sizeofa(nxe_devices)));
+}
+
+void
+nxe_attach(struct device *parent, struct device *self, void *aux)
+{
+ printf("\n");
+}