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
This commit is contained in:
Wojciech Macek 2016-05-20 11:00:06 +00:00
parent 96b5475b7a
commit f4aafb9ea6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300294
12 changed files with 108 additions and 12 deletions

View File

@ -82,7 +82,7 @@ dev/vnic/thunder_bgx_fdt.c optional vnic fdt
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

View File

@ -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);

View File

@ -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 *);

View File

@ -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 *);

View File

@ -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)

View File

@ -122,8 +122,10 @@ DEFINE_CLASS_0(thunder_mdio, thunder_mdio_driver, thunder_mdio_methods,
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");

10
sys/modules/vnic/Makefile Normal file
View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>