From 125919f6552db4a63e630f583fca2d9383dff413 Mon Sep 17 00:00:00 2001 From: Greg V Date: Fri, 11 Feb 2022 20:03:18 +0300 Subject: [PATCH] FreeBSD: support charp module_params like hw.amdgpu.virtual_display, fixes #134 Depends on: https://reviews.freebsd.org/D34252 --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 -- linuxkpi/bsd/include/linux/moduleparam.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index c550ef2de4e..7ac4dee877e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -454,7 +454,6 @@ module_param_named(pg_mask, amdgpu_pg_mask, uint, 0444); MODULE_PARM_DESC(sdma_phase_quantum, "SDMA context switch phase quantum (x 1K GPU clock cycles, 0 = no change (default 32))"); module_param_named(sdma_phase_quantum, amdgpu_sdma_phase_quantum, uint, 0444); -#ifdef __linux__ /** * DOC: disable_cu (charp) * Set to disable CUs (It's set like se.sh.cu,...). The default is NULL. @@ -472,7 +471,6 @@ module_param_named(disable_cu, amdgpu_disable_cu, charp, 0444); MODULE_PARM_DESC(virtual_display, "Enable virtual display feature (the virtual_display will be set like xxxx:xx:xx.x,x;xxxx:xx:xx.x,x)"); module_param_named(virtual_display, amdgpu_virtual_display, charp, 0444); -#endif /** * DOC: job_hang_limit (int) diff --git a/linuxkpi/bsd/include/linux/moduleparam.h b/linuxkpi/bsd/include/linux/moduleparam.h index 4e4ddf0f04d..28e8b694356 100644 --- a/linuxkpi/bsd/include/linux/moduleparam.h +++ b/linuxkpi/bsd/include/linux/moduleparam.h @@ -37,6 +37,8 @@ #include +extern int lkpi_sysctl_handle_charp(SYSCTL_HANDLER_ARGS); + #ifndef LINUXKPI_PARAM_PARENT #define LINUXKPI_PARAM_PARENT _compat_linuxkpi #endif @@ -136,6 +138,15 @@ SYSCTL_DECL(_dev_drm); name, LINUXKPI_PARAM_PERM(perm), &(var), 0,\ LINUXKPI_PARAM_DESC(name))) +#define LINUXKPI_PARAM_charp(name, var, perm) \ + extern const char LINUXKPI_PARAM_DESC(name)[]; \ + LINUXKPI_PARAM_PASS(SYSCTL_PROC(LINUXKPI_PARAM_PARENT, OID_AUTO, \ + LINUXKPI_PARAM_NAME(name), LINUXKPI_PARAM_PERM(perm) | CTLTYPE_STRING | CTLFLAG_MPSAFE, \ + &(var), 0, lkpi_sysctl_handle_charp, "A", LINUXKPI_PARAM_DESC(name))); \ + LINUXKPI_PARAM_PASS(SYSCTL_PROC(DRM_PARAM_NAME, OID_AUTO, \ + name, LINUXKPI_PARAM_PERM(perm) | CTLTYPE_STRING | CTLFLAG_MPSAFE, \ + &(var), 0, lkpi_sysctl_handle_charp, "A", LINUXKPI_PARAM_DESC(name))) + #define module_param_string(name, str, len, perm) \ extern const char LINUXKPI_PARAM_DESC(name)[]; \ LINUXKPI_PARAM_PASS(SYSCTL_STRING(LINUXKPI_PARAM_PARENT, OID_AUTO,\