From f60156f68f615dc137391f3a909a0ee7a0c3c003 Mon Sep 17 00:00:00 2001 From: jim-p Date: Fri, 6 Jul 2012 14:38:21 -0400 Subject: Add an option to System > Advanced, misc tab to enable loading thermal modules (amdtemp, coretemp) --- etc/inc/pfsense-utils.inc | 17 ++++++++++++++++ etc/rc.bootup | 3 +++ usr/local/www/system_advanced_misc.php | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 3e5fa24..f809371 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -1567,6 +1567,23 @@ function load_crypto() { } } +/* + * load_thermal_hardware() - Load temperature monitor kernel module + */ +function load_thermal_hardware() { + global $config, $g; + $thermal_hardware_modules = array('coretemp', 'amdtemp'); + + if (!in_array($config['system']['thermal_hardware'], $thermal_hardware_modules)) + return false; + + $is_loaded = `/sbin/kldstat | /usr/bin/grep -c {$config['system']['thermal_hardware']}`; + if (!empty($config['system']['thermal_hardware']) && ($is_loaded == 0)) { + log_error("Loading {$config['system']['thermal_hardware']} thermal monitor module."); + mwexec("/sbin/kldload {$config['system']['thermal_hardware']}"); + } +} + /****f* pfsense-utils/isvm * NAME * isvm diff --git a/etc/rc.bootup b/etc/rc.bootup index c21a4d5..b6dad33 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -223,6 +223,9 @@ echo "done.\n"; /* enable optional crypto modules */ load_crypto(); +/* enable optional thermal sensor modules */ +load_thermal_hardware(); + /* run any early shell commands specified in config.xml */ system_do_shell_commands(1); diff --git a/usr/local/www/system_advanced_misc.php b/usr/local/www/system_advanced_misc.php index d1d07aa..2309a4b 100644 --- a/usr/local/www/system_advanced_misc.php +++ b/usr/local/www/system_advanced_misc.php @@ -65,6 +65,7 @@ $pconfig['maxmss_enable'] = isset($config['system']['maxmss_enable']); $pconfig['maxmss'] = $config['system']['maxmss']; $pconfig['powerd_enable'] = isset($config['system']['powerd_enable']); $pconfig['crypto_hardware'] = $config['system']['crypto_hardware']; +$pconfig['thermal_hardware'] = $config['system']['thermal_hardware']; $pconfig['schedule_states'] = isset($config['system']['schedule_states']); $pconfig['kill_states'] = isset($config['system']['kill_states']); @@ -76,6 +77,9 @@ else $crypto_modules = array('glxsb' => gettext("AMD Geode LX Security Block"), 'aesni' => gettext("AES-NI CPU-based Acceleration")); +$thermal_hardware_modules = array( 'coretemp' => gettext("Intel Core* CPU on-die thermal sensor"), + 'amdtemp' => gettext("AMD K8, K10 and K11 CPU on-die thermal sensor")); + if ($_POST) { unset($input_errors); @@ -87,6 +91,9 @@ if ($_POST) { if (!empty($_POST['crypto_hardware']) && !array_key_exists($_POST['crypto_hardware'], $crypto_modules)) $input_errors[] = gettext("Please select a valid Cryptographic Accelerator."); + if (!empty($_POST['thermal_hardware']) && !array_key_exists($_POST['thermal_hardware'], $thermal_hardware_modules)) + $input_errors[] = gettext("Please select a valid Thermal Hardware Sensor."); + if (!$input_errors) { if($_POST['harddiskstandby'] <> "") { @@ -172,6 +179,11 @@ if ($_POST) { else unset($config['system']['crypto_hardware']); + if($_POST['thermal_hardware']) + $config['system']['thermal_hardware'] = $_POST['thermal_hardware']; + else + unset($config['system']['thermal_hardware']); + if($_POST['schedule_states'] == "yes") $config['system']['schedule_states'] = true; else @@ -194,6 +206,7 @@ if ($_POST) { activate_powerd(); load_crypto(); + load_thermal_hardware(); vpn_ipsec_configure_preferoldsa(); if ($need_racoon_restart) vpn_ipsec_force_reload(); @@ -392,6 +405,30 @@ function maxmss_checked(obj) {   + + + + + + +
+ +

+ + + + +   + + -- cgit v1.1