From: jsg Date: Sat, 18 Apr 2015 11:05:32 +0000 (+0000) Subject: add and use module param macros X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=21aed1a77f78d4e8e2a00a7495284b681c672075;p=openbsd add and use module param macros --- diff --git a/sys/dev/pci/drm/drm_crtc_helper.c b/sys/dev/pci/drm/drm_crtc_helper.c index 02c75c0c3c2..20fb6f2cb87 100644 --- a/sys/dev/pci/drm/drm_crtc_helper.c +++ b/sys/dev/pci/drm/drm_crtc_helper.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_crtc_helper.c,v 1.11 2015/04/06 09:23:19 jsg Exp $ */ +/* $OpenBSD: drm_crtc_helper.c,v 1.12 2015/04/18 11:05:32 jsg Exp $ */ /* * Copyright (c) 2006-2008 Intel Corporation * Copyright (c) 2007 Dave Airlie @@ -67,6 +67,7 @@ void drm_helper_move_panel_connectors_to_head(struct drm_device *dev) EXPORT_SYMBOL(drm_helper_move_panel_connectors_to_head); static bool drm_kms_helper_poll = true; +module_param_named(poll, drm_kms_helper_poll, bool, 0600); static void drm_mode_validate_flag(struct drm_connector *connector, int flags) diff --git a/sys/dev/pci/drm/drm_edid.c b/sys/dev/pci/drm/drm_edid.c index ca9a407e3fa..9d4e415c09e 100644 --- a/sys/dev/pci/drm/drm_edid.c +++ b/sys/dev/pci/drm/drm_edid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_edid.c,v 1.12 2015/04/05 12:53:41 kettenis Exp $ */ +/* $OpenBSD: drm_edid.c,v 1.13 2015/04/18 11:05:32 jsg Exp $ */ /* * Copyright (c) 2006 Luc Verhaegen (quirks list) * Copyright (c) 2007-2008 Intel Corporation @@ -156,8 +156,10 @@ int drm_edid_header_is_valid(const u8 *raw_edid) } EXPORT_SYMBOL(drm_edid_header_is_valid); -/* Minimum number of valid EDID header bytes (0-8, default 6) */ -static int edid_fixup = 6; +static int edid_fixup __read_mostly = 6; +module_param_named(edid_fixup, edid_fixup, int, 0400); +MODULE_PARM_DESC(edid_fixup, + "Minimum number of valid EDID header bytes (0-8, default 6)"); /* * Sanity check the EDID block (base or extension). Return 0 if the block diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h index a859b1ec20f..b2f20c055ca 100644 --- a/sys/dev/pci/drm/drm_linux.h +++ b/sys/dev/pci/drm/drm_linux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.h,v 1.24 2015/04/12 17:10:07 kettenis Exp $ */ +/* $OpenBSD: drm_linux.h,v 1.25 2015/04/18 11:05:32 jsg Exp $ */ /* * Copyright (c) 2013, 2014 Mark Kettenis * @@ -60,7 +60,11 @@ typedef bus_addr_t phys_addr_t; #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (1ULL<<(n)) -1) #define EXPORT_SYMBOL(x) + #define MODULE_FIRMWARE(x) +#define MODULE_PARM_DESC(parm, desc) +#define module_param_named(name, value, type, perm) + #define ARRAY_SIZE nitems #define ERESTARTSYS EINTR diff --git a/sys/dev/pci/drm/i915/i915_drv.c b/sys/dev/pci/drm/i915/i915_drv.c index b00d7f4842e..7336be104a9 100644 --- a/sys/dev/pci/drm/i915/i915_drv.c +++ b/sys/dev/pci/drm/i915/i915_drv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i915_drv.c,v 1.79 2015/04/17 00:54:42 jsg Exp $ */ +/* $OpenBSD: i915_drv.c,v 1.80 2015/04/18 11:05:32 jsg Exp $ */ /* * Copyright (c) 2008-2009 Owain G. Ainsworth * @@ -74,60 +74,94 @@ struct inteldrm_file { } mm; }; -/* - * Override lid status (0=autodetect, 1=autodetect disabled [default], - * -1=force lid closed, -2=force lid open) - */ -int i915_panel_ignore_lid = 1; - -/* Enable powersavings, fbc, downclocking, etc. (default: true) */ -unsigned int i915_powersave = 1; - -/* Use semaphores for inter-ring sync (default: -1 (use per-chip defaults)) */ -int i915_semaphores = -1; - -/* - * Enable frame buffer compression for power savings - * (default: -1 (use per-chip default)) - */ -int i915_enable_fbc = -1; - -/* - * Enable power-saving render C-state 6. - * Different stages can be selected via bitmask values - * (0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). - * For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. - * default: -1 (use per-chip default) - */ -int i915_enable_rc6 = -1; - -/* Use panel (LVDS/eDP) downclocking for power savings (default: false) */ -unsigned int i915_lvds_downclock = 0; - -/* - * Specify LVDS channel mode - * (0=probe BIOS [default], 1=single-channel, 2=dual-channel) - */ -int i915_lvds_channel_mode = 0; - -/* - * Use Spread Spectrum Clock with panels [LVDS/eDP] - * (default: auto from VBT) - */ -int i915_panel_use_ssc = -1; - -/* - * Override/Ignore selection of SDVO panel mode in the VBT - * (-2=ignore, -1=auto [default], index in VBT BIOS table) - */ -int i915_vbt_sdvo_panel_type = -1; +#ifdef __linux__ +static int i915_modeset __read_mostly = -1; +module_param_named(modeset, i915_modeset, int, 0400); +MODULE_PARM_DESC(modeset, + "Use kernel modesetting [KMS] (0=DRM_I915_KMS from .config, " + "1=on, -1=force vga console preference [default])"); +#endif -/* - * Periodically check GPU activity for detecting hangs. - * WARNING: Disabling this can cause system wide hangs. - * (default: true) - */ -bool i915_enable_hangcheck = true; +unsigned int i915_fbpercrtc __always_unused = 0; +module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400); + +int i915_panel_ignore_lid __read_mostly = 1; +module_param_named(panel_ignore_lid, i915_panel_ignore_lid, int, 0600); +MODULE_PARM_DESC(panel_ignore_lid, + "Override lid status (0=autodetect, 1=autodetect disabled [default], " + "-1=force lid closed, -2=force lid open)"); + +unsigned int i915_powersave __read_mostly = 1; +module_param_named(powersave, i915_powersave, int, 0600); +MODULE_PARM_DESC(powersave, + "Enable powersavings, fbc, downclocking, etc. (default: true)"); + +int i915_semaphores __read_mostly = -1; +module_param_named(semaphores, i915_semaphores, int, 0600); +MODULE_PARM_DESC(semaphores, + "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); + +int i915_enable_rc6 __read_mostly = -1; +module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400); +MODULE_PARM_DESC(i915_enable_rc6, + "Enable power-saving render C-state 6. " + "Different stages can be selected via bitmask values " + "(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). " + "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. " + "default: -1 (use per-chip default)"); + +int i915_enable_fbc __read_mostly = -1; +module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); +MODULE_PARM_DESC(i915_enable_fbc, + "Enable frame buffer compression for power savings " + "(default: -1 (use per-chip default))"); + +unsigned int i915_lvds_downclock __read_mostly = 0; +module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400); +MODULE_PARM_DESC(lvds_downclock, + "Use panel (LVDS/eDP) downclocking for power savings " + "(default: false)"); + +int i915_lvds_channel_mode __read_mostly; +module_param_named(lvds_channel_mode, i915_lvds_channel_mode, int, 0600); +MODULE_PARM_DESC(lvds_channel_mode, + "Specify LVDS channel mode " + "(0=probe BIOS [default], 1=single-channel, 2=dual-channel)"); + +int i915_panel_use_ssc __read_mostly = -1; +module_param_named(lvds_use_ssc, i915_panel_use_ssc, int, 0600); +MODULE_PARM_DESC(lvds_use_ssc, + "Use Spread Spectrum Clock with panels [LVDS/eDP] " + "(default: auto from VBT)"); + +int i915_vbt_sdvo_panel_type __read_mostly = -1; +module_param_named(vbt_sdvo_panel_type, i915_vbt_sdvo_panel_type, int, 0600); +MODULE_PARM_DESC(vbt_sdvo_panel_type, + "Override/Ignore selection of SDVO panel mode in the VBT " + "(-2=ignore, -1=auto [default], index in VBT BIOS table)"); + +static bool i915_try_reset __read_mostly = true; +module_param_named(reset, i915_try_reset, bool, 0600); +MODULE_PARM_DESC(reset, "Attempt GPU resets (default: true)"); + +bool i915_enable_hangcheck __read_mostly = true; +module_param_named(enable_hangcheck, i915_enable_hangcheck, bool, 0644); +MODULE_PARM_DESC(enable_hangcheck, + "Periodically check GPU activity for detecting hangs. " + "WARNING: Disabling this can cause system wide hangs. " + "(default: true)"); + +int i915_enable_ppgtt __read_mostly = -1; +module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); +MODULE_PARM_DESC(i915_enable_ppgtt, + "Enable PPGTT (default: true)"); + +unsigned int i915_preliminary_hw_support __read_mostly = 0; +module_param_named(preliminary_hw_support, i915_preliminary_hw_support, int, 0600); +MODULE_PARM_DESC(preliminary_hw_support, + "Enable preliminary hardware support. " + "Enable Haswell and ValleyView Support. " + "(default: false)"); const struct intel_device_info * i915_get_device_id(int); @@ -1451,10 +1485,8 @@ int i915_reset(struct drm_device *dev) drm_i915_private_t *dev_priv = dev->dev_private; int ret; -#ifdef notyet if (!i915_try_reset) return 0; -#endif mutex_lock(&dev->struct_mutex); diff --git a/sys/dev/pci/drm/i915/intel_panel.c b/sys/dev/pci/drm/i915/intel_panel.c index 10521276b3d..9e316d4aaf6 100644 --- a/sys/dev/pci/drm/i915/intel_panel.c +++ b/sys/dev/pci/drm/i915/intel_panel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intel_panel.c,v 1.8 2015/02/12 04:56:03 kettenis Exp $ */ +/* $OpenBSD: intel_panel.c,v 1.9 2015/04/18 11:05:32 jsg Exp $ */ /* * Copyright © 2006-2010 Intel Corporation * Copyright (c) 2006 Dave Airlie @@ -208,12 +208,12 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev) } static int i915_panel_invert_brightness; -/* +MODULE_PARM_DESC(invert_brightness, "Invert backlight brightness " "(-1 force normal, 0 machine defaults, 1 force inversion), please " "report PCI device ID, subsystem vendor and subsystem device ID " "to dri-devel@lists.freedesktop.org, if your machine needs it. " "It will then be included in an upcoming module version."); -*/ +module_param_named(invert_brightness, i915_panel_invert_brightness, int, 0600); static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val) { struct drm_i915_private *dev_priv = dev->dev_private; diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c index 35f930078a3..d6a7477c789 100644 --- a/sys/dev/pci/drm/radeon/radeon_kms.c +++ b/sys/dev/pci/drm/radeon/radeon_kms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radeon_kms.c,v 1.38 2015/04/17 00:54:42 jsg Exp $ */ +/* $OpenBSD: radeon_kms.c,v 1.39 2015/04/18 11:05:32 jsg Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. @@ -122,57 +122,75 @@ struct cfdriver radeondrm_cd = { NULL, "radeondrm", DV_DULL }; -/* Disable AGP writeback for scratch registers */ int radeon_no_wb; - -/* Disable/Enable modesetting */ int radeon_modeset = 1; - -/* Disable/Enable dynamic clocks */ int radeon_dynclks = -1; - -/* Enable ATOMBIOS modesetting for R4xx */ int radeon_r4xx_atom = 0; - -/* AGP Mode (-1 == PCI) */ int radeon_agpmode = 0; - -/* Restrict VRAM for testing */ int radeon_vram_limit = 0; - -/* Size of PCIE/IGP gart to setup in megabytes (32, 64, etc) */ int radeon_gart_size = 512; /* default gart size */ - -/* Run benchmark */ int radeon_benchmarking = 0; - -/* Run tests */ int radeon_testing = 0; - -/* Force connector table */ int radeon_connector_table = 0; - -/* TV enable (0 = disable) */ int radeon_tv = 1; - -/* Audio enable (1 = enable) */ int radeon_audio = 0; - -/* Display Priority (0 = auto, 1 = normal, 2 = high) */ int radeon_disp_priority = 0; - -/* hw i2c engine enable (0 = disable) */ int radeon_hw_i2c = 0; - -/* PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable) */ int radeon_pcie_gen2 = -1; - -/* MSI support (1 = enable, 0 = disable, -1 = auto) */ int radeon_msi = -1; - -/* GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable) */ int radeon_lockup_timeout = 10000; +MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); +module_param_named(no_wb, radeon_no_wb, int, 0444); + +MODULE_PARM_DESC(modeset, "Disable/Enable modesetting"); +module_param_named(modeset, radeon_modeset, int, 0400); + +MODULE_PARM_DESC(dynclks, "Disable/Enable dynamic clocks"); +module_param_named(dynclks, radeon_dynclks, int, 0444); + +MODULE_PARM_DESC(r4xx_atom, "Enable ATOMBIOS modesetting for R4xx"); +module_param_named(r4xx_atom, radeon_r4xx_atom, int, 0444); + +MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing"); +module_param_named(vramlimit, radeon_vram_limit, int, 0600); + +MODULE_PARM_DESC(agpmode, "AGP Mode (-1 == PCI)"); +module_param_named(agpmode, radeon_agpmode, int, 0444); + +MODULE_PARM_DESC(gartsize, "Size of PCIE/IGP gart to setup in megabytes (32, 64, etc)"); +module_param_named(gartsize, radeon_gart_size, int, 0600); + +MODULE_PARM_DESC(benchmark, "Run benchmark"); +module_param_named(benchmark, radeon_benchmarking, int, 0444); + +MODULE_PARM_DESC(test, "Run tests"); +module_param_named(test, radeon_testing, int, 0444); + +MODULE_PARM_DESC(connector_table, "Force connector table"); +module_param_named(connector_table, radeon_connector_table, int, 0444); + +MODULE_PARM_DESC(tv, "TV enable (0 = disable)"); +module_param_named(tv, radeon_tv, int, 0444); + +MODULE_PARM_DESC(audio, "Audio enable (1 = enable)"); +module_param_named(audio, radeon_audio, int, 0444); + +MODULE_PARM_DESC(disp_priority, "Display Priority (0 = auto, 1 = normal, 2 = high)"); +module_param_named(disp_priority, radeon_disp_priority, int, 0444); + +MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)"); +module_param_named(hw_i2c, radeon_hw_i2c, int, 0444); + +MODULE_PARM_DESC(pcie_gen2, "PCIE Gen2 mode (-1 = auto, 0 = disable, 1 = enable)"); +module_param_named(pcie_gen2, radeon_pcie_gen2, int, 0444); + +MODULE_PARM_DESC(msi, "MSI support (1 = enable, 0 = disable, -1 = auto)"); +module_param_named(msi, radeon_msi, int, 0444); + +MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable)"); +module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444); + /* * set if the mountroot hook has a fatal error * such as not being able to find the firmware on newer cards