From 242cd60a0a670ff7cc446436bedd129fbdce062c Mon Sep 17 00:00:00 2001 From: Milan Obuch Date: Sat, 2 Apr 2022 13:53:37 -0300 Subject: [PATCH] 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 --- sys/modules/Makefile | 6 ++++++ sys/modules/if_cgem/Makefile | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 sys/modules/if_cgem/Makefile diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 3731e9c1e45..944a7616374 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 00000000000..5d552994449 --- /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