cgem: Support building as a loadable kernel module

For development, building a driver as kernel module is both convenient
and a time saver (no need for reboot on some change, testing it requires
just kldunload and kldload, a matter of seconds). For some special
cases, it may be even desirable to postpone initializing the network
interface after some action is done (loading a FPGA bitstream may be
required for Zynq/ZynqMP based hardware as an example).

Building is limited to ARM, ARM64 and RISC-V architectures (for Zynq,
ZynqMP, PolarFire Soc based boards, and HiFive based boards are known to
use CGEM at the moment).

Reviewed by:	mhorne
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34687
This commit is contained in:
Milan Obuch 2022-04-02 13:53:37 -03:00 committed by Mitchell Horne
parent f052fda5c5
commit 242cd60a0a
2 changed files with 13 additions and 0 deletions

View file

@ -147,6 +147,7 @@ SUBDIR= \
${_ice_ddp} \
${_ida} \
if_bridge \
${_if_cgem} \
if_disc \
if_edsc \
${_if_enc} \
@ -575,6 +576,11 @@ _ice_ddp= ice_ddp
.endif
.endif
.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \
${MACHINE_CPUARCH} == "riscv"
_if_cgem= if_cgem
.endif
# These rely on 64bit atomics
.if ${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe"
_mps= mps

View file

@ -0,0 +1,7 @@
.PATH: ${SRCTOP}/sys/dev/cadence
KMOD= if_cgem
SRCS= if_cgem.c
SRCS+= bus_if.h device_if.h miibus_if.h ofw_bus_if.h
.include <bsd.kmod.mk>