Author: wma
Date: Fri May 20 11:00:06 2016
New Revision: 300294
URL: https://svnweb.freebsd.org/changeset/base/300294

Log:
  Allow building VNIC as a module
  
  Add directory structure and fix dependencies to be able to
  build and use Cavium VNIC driver as a module.
  
  Reviewed by:  zbb
  Obtained from:        Semihalf
  Sponsored by: Cavium
  Differential Revision:        https://reviews.freebsd.org/D6345

Added:
  head/sys/modules/vnic/
  head/sys/modules/vnic/Makefile   (contents, props changed)
  head/sys/modules/vnic/mrmlbus/
  head/sys/modules/vnic/mrmlbus/Makefile   (contents, props changed)
  head/sys/modules/vnic/thunder_bgx/
  head/sys/modules/vnic/thunder_bgx/Makefile   (contents, props changed)
  head/sys/modules/vnic/thunder_mdio/
  head/sys/modules/vnic/thunder_mdio/Makefile   (contents, props changed)
  head/sys/modules/vnic/vnicpf/
  head/sys/modules/vnic/vnicpf/Makefile   (contents, props changed)
  head/sys/modules/vnic/vnicvf/
  head/sys/modules/vnic/vnicvf/Makefile   (contents, props changed)
Modified:
  head/sys/conf/files.arm64
  head/sys/dev/vnic/mrml_bridge.c
  head/sys/dev/vnic/nic_main.c
  head/sys/dev/vnic/nicvf_main.c
  head/sys/dev/vnic/thunder_bgx.c
  head/sys/dev/vnic/thunder_mdio.c

Modified: head/sys/conf/files.arm64
==============================================================================
--- head/sys/conf/files.arm64   Fri May 20 10:26:12 2016        (r300293)
+++ head/sys/conf/files.arm64   Fri May 20 11:00:06 2016        (r300294)
@@ -82,7 +82,7 @@ dev/vnic/thunder_bgx_fdt.c    optional        vnic
 dev/vnic/thunder_bgx.c         optional        vnic pci
 dev/vnic/thunder_mdio_fdt.c    optional        vnic fdt
 dev/vnic/thunder_mdio.c                optional        vnic
-dev/vnic/lmac_if.m             optional        vnic
+dev/vnic/lmac_if.m             optional        inet | inet6 | vnic
 kern/kern_clocksource.c                standard
 kern/msi_if.m                  optional        intrng
 kern/pic_if.m                  optional        intrng

Modified: head/sys/dev/vnic/mrml_bridge.c
==============================================================================
--- head/sys/dev/vnic/mrml_bridge.c     Fri May 20 10:26:12 2016        
(r300293)
+++ head/sys/dev/vnic/mrml_bridge.c     Fri May 20 11:00:06 2016        
(r300294)
@@ -85,6 +85,7 @@ static devclass_t mrmlbus_fdt_devclass;
 
 EARLY_DRIVER_MODULE(mrmlbus, pcib, mrmlbus_fdt_driver, mrmlbus_fdt_devclass, 
0, 0,
     BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
+MODULE_VERSION(mrmlbus, 1);
 
 static int mrmlb_ofw_fill_ranges(phandle_t, struct simplebus_softc *);
 static int mrmlb_ofw_bus_attach(device_t);

Modified: head/sys/dev/vnic/nic_main.c
==============================================================================
--- head/sys/dev/vnic/nic_main.c        Fri May 20 10:26:12 2016        
(r300293)
+++ head/sys/dev/vnic/nic_main.c        Fri May 20 11:00:06 2016        
(r300294)
@@ -137,18 +137,19 @@ static device_method_t nicpf_methods[] =
        DEVMETHOD_END,
 };
 
-static driver_t nicpf_driver = {
+static driver_t vnicpf_driver = {
        "vnicpf",
        nicpf_methods,
        sizeof(struct nicpf),
 };
 
-static devclass_t nicpf_devclass;
+static devclass_t vnicpf_devclass;
 
-DRIVER_MODULE(nicpf, pci, nicpf_driver, nicpf_devclass, 0, 0);
-MODULE_DEPEND(nicpf, pci, 1, 1, 1);
-MODULE_DEPEND(nicpf, ether, 1, 1, 1);
-MODULE_DEPEND(nicpf, thunder_bgx, 1, 1, 1);
+DRIVER_MODULE(vnicpf, pci, vnicpf_driver, vnicpf_devclass, 0, 0);
+MODULE_VERSION(vnicpf, 1);
+MODULE_DEPEND(vnicpf, pci, 1, 1, 1);
+MODULE_DEPEND(vnicpf, ether, 1, 1, 1);
+MODULE_DEPEND(vnicpf, thunder_bgx, 1, 1, 1);
 
 static int nicpf_alloc_res(struct nicpf *);
 static void nicpf_free_res(struct nicpf *);

Modified: head/sys/dev/vnic/nicvf_main.c
==============================================================================
--- head/sys/dev/vnic/nicvf_main.c      Fri May 20 10:26:12 2016        
(r300293)
+++ head/sys/dev/vnic/nicvf_main.c      Fri May 20 11:00:06 2016        
(r300294)
@@ -129,10 +129,11 @@ static driver_t nicvf_driver = {
 
 static devclass_t nicvf_devclass;
 
-DRIVER_MODULE(nicvf, pci, nicvf_driver, nicvf_devclass, 0, 0);
-MODULE_DEPEND(nicvf, pci, 1, 1, 1);
-MODULE_DEPEND(nicvf, ether, 1, 1, 1);
-MODULE_DEPEND(nicvf, vnic_pf, 1, 1, 1);
+DRIVER_MODULE(vnicvf, pci, nicvf_driver, nicvf_devclass, 0, 0);
+MODULE_VERSION(vnicvf, 1);
+MODULE_DEPEND(vnicvf, pci, 1, 1, 1);
+MODULE_DEPEND(vnicvf, ether, 1, 1, 1);
+MODULE_DEPEND(vnicvf, vnicpf, 1, 1, 1);
 
 static int nicvf_allocate_misc_interrupt(struct nicvf *);
 static int nicvf_enable_misc_interrupt(struct nicvf *);

Modified: head/sys/dev/vnic/thunder_bgx.c
==============================================================================
--- head/sys/dev/vnic/thunder_bgx.c     Fri May 20 10:26:12 2016        
(r300293)
+++ head/sys/dev/vnic/thunder_bgx.c     Fri May 20 11:00:06 2016        
(r300294)
@@ -109,9 +109,10 @@ static driver_t thunder_bgx_driver = {
 static devclass_t thunder_bgx_devclass;
 
 DRIVER_MODULE(thunder_bgx, pci, thunder_bgx_driver, thunder_bgx_devclass, 0, 
0);
+MODULE_VERSION(thunder_bgx, 1);
 MODULE_DEPEND(thunder_bgx, pci, 1, 1, 1);
 MODULE_DEPEND(thunder_bgx, ether, 1, 1, 1);
-MODULE_DEPEND(thunder_bgx, octeon_mdio, 1, 1, 1);
+MODULE_DEPEND(thunder_bgx, thunder_mdio, 1, 1, 1);
 
 static int
 thunder_bgx_probe(device_t dev)

Modified: head/sys/dev/vnic/thunder_mdio.c
==============================================================================
--- head/sys/dev/vnic/thunder_mdio.c    Fri May 20 10:26:12 2016        
(r300293)
+++ head/sys/dev/vnic/thunder_mdio.c    Fri May 20 11:00:06 2016        
(r300294)
@@ -122,8 +122,10 @@ DEFINE_CLASS_0(thunder_mdio, thunder_mdi
     sizeof(struct thunder_mdio_softc));
 
 DRIVER_MODULE(miibus, thunder_mdio, miibus_driver, miibus_devclass, 0, 0);
+MODULE_VERSION(thunder_mdio, 1);
 MODULE_DEPEND(thunder_mdio, ether, 1, 1, 1);
 MODULE_DEPEND(thunder_mdio, miibus, 1, 1, 1);
+MODULE_DEPEND(thunder_mdio, mrmlbus, 1, 1, 1);
 
 MALLOC_DEFINE(M_THUNDER_MDIO, "ThunderX MDIO",
     "Cavium ThunderX MDIO dynamic memory");

Added: head/sys/modules/vnic/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/vnic/Makefile      Fri May 20 11:00:06 2016        
(r300294)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+SYSDIR?=${.CURDIR}/../..
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+CFLAGS+=       -DFDT
+
+SUBDIR = mrmlbus thunder_mdio thunder_bgx vnicpf vnicvf
+
+.include <bsd.subdir.mk>

Added: head/sys/modules/vnic/mrmlbus/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/vnic/mrmlbus/Makefile      Fri May 20 11:00:06 2016        
(r300294)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+SYSDIR?=${.CURDIR}/../../..
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+S=     ${.CURDIR}/../../..
+
+.PATH: $S/dev/vnic
+
+KMOD=  mrmlbus
+SRCS=  device_if.h bus_if.h opt_platform.h pci_if.h ofw_bus_if.h miibus_if.h 
lmac_if.h
+SRCS+= mrml_bridge.c
+
+CFLAGS+=       -DFDT
+
+.include <bsd.kmod.mk>

Added: head/sys/modules/vnic/thunder_bgx/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/vnic/thunder_bgx/Makefile  Fri May 20 11:00:06 2016        
(r300294)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+SYSDIR?=${.CURDIR}/../../..
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+S=     ${.CURDIR}/../../..
+
+.PATH: $S/dev/vnic
+
+KMOD=  thunder_bgx
+SRCS=  thunder_bgx.c thunder_bgx_fdt.c
+SRCS+= opt_platform.h device_if.h bus_if.h pci_if.h lmac_if.h ofw_bus_if.h
+
+CFLAGS+=       -DFDT
+
+.include <bsd.kmod.mk>

Added: head/sys/modules/vnic/thunder_mdio/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/vnic/thunder_mdio/Makefile Fri May 20 11:00:06 2016        
(r300294)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+SYSDIR?=${.CURDIR}/../../..
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+S=     ${.CURDIR}/../../..
+
+.PATH: $S/dev/vnic
+
+KMOD=  thunder_mdio
+SRCS=  opt_platform.h device_if.h bus_if.h pci_if.h ofw_bus_if.h miibus_if.h 
lmac_if.h
+SRCS+= thunder_mdio.c thunder_mdio_fdt.c
+
+CFLAGS+=       -DFDT
+
+.include <bsd.kmod.mk>

Added: head/sys/modules/vnic/vnicpf/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/vnic/vnicpf/Makefile       Fri May 20 11:00:06 2016        
(r300294)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+SYSDIR?=${.CURDIR}/../../..
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+S=     ${.CURDIR}/../../..
+
+.PATH: $S/dev/vnic
+
+KMOD=  vnicpf
+SRCS=  pci_iov_if.h opt_platform.h device_if.h bus_if.h pci_if.h ofw_bus_if.h 
miibus_if.h lmac_if.h
+SRCS+= nic_main.c
+
+CFLAGS+=       -DFDT -DPCI_IOV
+
+.include <bsd.kmod.mk>

Added: head/sys/modules/vnic/vnicvf/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/vnic/vnicvf/Makefile       Fri May 20 11:00:06 2016        
(r300294)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+SYSDIR?=${.CURDIR}/../../..
+.include "${SYSDIR}/conf/kern.opts.mk"
+
+S=     ${.CURDIR}/../../..
+
+.PATH: $S/dev/vnic
+
+KMOD=  vnicvf
+SRCS=  nicvf_main.c nicvf_queues.c
+SRCS+= opt_platform.h ofw_bus_if.h lmac_if.h miibus_if.h pci_if.h bus_if.h 
device_if.h opt_inet.h opt_inet6.h
+
+CFLAGS+=       -DFDT -DPCI_IOV
+
+.include <bsd.kmod.mk>
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to