git: 49f55cdfd80a - stable/13 - cgem: Support building as a loadable kernel module
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Apr 2022 14:05:06 UTC
The branch stable/13 has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=49f55cdfd80adbfd4ced4d28d58163ea8920e834
commit 49f55cdfd80adbfd4ced4d28d58163ea8920e834
Author: Milan Obuch <bsd@dino.sk>
AuthorDate: 2022-04-02 16:53:37 +0000
Commit: Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-04-11 14:04:08 +0000
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
(cherry picked from commit 242cd60a0a670ff7cc446436bedd129fbdce062c)
---
sys/modules/Makefile | 6 ++++++
sys/modules/if_cgem/Makefile | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 46d36631dea8..232728df7f63 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -151,6 +151,7 @@ SUBDIR= \
${_ice_ddp} \
${_ida} \
if_bridge \
+ ${_if_cgem} \
if_disc \
if_edsc \
${_if_enc} \
@@ -585,6 +586,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" && \
${MACHINE_CPUARCH} != "mips"
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>