aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Obuch <bsd@dino.sk>2022-04-02 16:53:37 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2022-04-03 15:28:37 +0000
commit242cd60a0a670ff7cc446436bedd129fbdce062c (patch)
tree4d33d02f5c49d0fe3ea17860aafbc8320693ec46
parentf052fda5c503877c012103412feec735316bed96 (diff)
downloadsrc-242cd60a0a670ff7cc446436bedd129fbdce062c.tar.gz
src-242cd60a0a670ff7cc446436bedd129fbdce062c.zip
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
-rw-r--r--sys/modules/Makefile6
-rw-r--r--sys/modules/if_cgem/Makefile7
2 files changed, 13 insertions, 0 deletions
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 3731e9c1e453..944a76163748 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -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
diff --git a/sys/modules/if_cgem/Makefile b/sys/modules/if_cgem/Makefile
new file mode 100644
index 000000000000..5d552994449a
--- /dev/null
+++ b/sys/modules/if_cgem/Makefile
@@ -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>