Commit d74c2749 authored by Franco Fichtner's avatar Franco Fichtner

system: do the previous for thermal modules plus some naming unification

parent efb83c51
...@@ -375,10 +375,7 @@ function is_fqdn($fqdn) { ...@@ -375,10 +375,7 @@ function is_fqdn($fqdn) {
return($hostname); return($hostname);
} }
/* function load_crypto_module()
* load_crypto() - Load crypto modules if enabled in config.
*/
function load_crypto()
{ {
global $config; global $config;
...@@ -388,22 +385,13 @@ function load_crypto() ...@@ -388,22 +385,13 @@ function load_crypto()
} }
} }
/* function load_thermal_module()
* load_thermal_hardware() - Load temperature monitor kernel module
*/
function load_thermal_hardware()
{ {
global $config; global $config;
$thermal_hardware_modules = array('coretemp', 'amdtemp');
if (!isset($config['system']['thermal_hardware']) || !in_array($config['system']['thermal_hardware'], $thermal_hardware_modules)) {
return false;
}
if (!empty($config['system']['thermal_hardware']) && !is_module_loaded($config['system']['thermal_hardware'])) { if (!empty($config['system']['thermal_hardware']) && !is_module_loaded($config['system']['thermal_hardware'])) {
log_error("Loading {$config['system']['thermal_hardware']} thermal monitor module."); log_error(sprintf(gettext('Loading %s thermal monitor module.'), $config['system']['thermal_hardware']));
mwexec("/sbin/kldload {$config['system']['thermal_hardware']}"); mwexecf('/sbin/kldload %s', $config['system']['thermal_hardware']);
} }
} }
......
...@@ -201,10 +201,10 @@ system_setup_sysctl(); ...@@ -201,10 +201,10 @@ system_setup_sysctl();
echo "done.\n"; echo "done.\n";
/* enable optional crypto modules */ /* enable optional crypto modules */
load_crypto(); load_crypto_module();
/* enable optional thermal sensor modules */ /* enable optional thermal sensor modules */
load_thermal_hardware(); load_thermal_module();
/* set up our timezone */ /* set up our timezone */
system_timezone_configure(); system_timezone_configure();
......
...@@ -40,7 +40,7 @@ require_once("interfaces.inc"); ...@@ -40,7 +40,7 @@ require_once("interfaces.inc");
function crypto_modules() function crypto_modules()
{ {
$crypto_modules = array( $modules = array(
'aesni' => gettext('AES-NI CPU-based Acceleration'), 'aesni' => gettext('AES-NI CPU-based Acceleration'),
'glxsb' => gettext('AMD Geode LX Security Block'), 'glxsb' => gettext('AMD Geode LX Security Block'),
'hifn' => gettext('Hifn 7751/7951/7811/7955/7956 Crypto Accelerator'), 'hifn' => gettext('Hifn 7751/7951/7811/7955/7956 Crypto Accelerator'),
...@@ -50,7 +50,7 @@ function crypto_modules() ...@@ -50,7 +50,7 @@ function crypto_modules()
); );
$available = array(); $available = array();
foreach ($crypto_modules as $name => $desc) { foreach ($modules as $name => $desc) {
if (file_exists("/boot/kernel/{$name}.ko")) { if (file_exists("/boot/kernel/{$name}.ko")) {
$available[$name] = $desc; $available[$name] = $desc;
} }
...@@ -59,10 +59,22 @@ function crypto_modules() ...@@ -59,10 +59,22 @@ function crypto_modules()
return $available; return $available;
} }
$thermal_hardware_modules = array( function thermal_modules()
'coretemp' => gettext('Intel Core* CPU on-die thermal sensor'), {
$modules = array(
'amdtemp' => gettext('AMD K8, K10 and K11 CPU on-die thermal sensor'), 'amdtemp' => gettext('AMD K8, K10 and K11 CPU on-die thermal sensor'),
); 'coretemp' => gettext('Intel Core* CPU on-die thermal sensor'),
);
$available = array();
foreach ($modules as $name => $desc) {
if (file_exists("/boot/kernel/{$name}.ko")) {
$available[$name] = $desc;
}
}
return $available;
}
if ($_SERVER['REQUEST_METHOD'] === 'GET') { if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array(); $pconfig = array();
...@@ -95,10 +107,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -95,10 +107,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors = array(); $input_errors = array();
$pconfig = $_POST; $pconfig = $_POST;
if (!empty($pconfig['thermal_hardware']) && !array_key_exists($pconfig['thermal_hardware'], $thermal_hardware_modules)) {
$input_errors[] = gettext("Please select a valid Thermal Hardware Sensor.");
}
if (count($input_errors) == 0) { if (count($input_errors) == 0) {
if (!empty($pconfig['proxyurl'])) { if (!empty($pconfig['proxyurl'])) {
$config['system']['proxyurl'] = $_POST['proxyurl']; $config['system']['proxyurl'] = $_POST['proxyurl'];
...@@ -213,8 +221,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -213,8 +221,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_resolvconf_generate(true); system_resolvconf_generate(true);
filter_configure(); filter_configure();
activate_powerd(); activate_powerd();
load_crypto(); load_crypto_module();
load_thermal_hardware(); load_thermal_module();
if ($need_relayd_restart) { if ($need_relayd_restart) {
relayd_configure(); relayd_configure();
} }
...@@ -459,7 +467,7 @@ include("head.inc"); ...@@ -459,7 +467,7 @@ include("head.inc");
<select name="thermal_hardware" class="selectpicker" data-style="btn-default"> <select name="thermal_hardware" class="selectpicker" data-style="btn-default">
<option value=""><?=gettext("None/ACPI"); ?></option> <option value=""><?=gettext("None/ACPI"); ?></option>
<?php <?php
foreach ($thermal_hardware_modules as $themalmod_name => $themalmod_descr) :?> foreach (thermal_modules() as $themalmod_name => $themalmod_descr) :?>
<option value="<?=$themalmod_name; ?>" <?=$pconfig['thermal_hardware'] == $themalmod_name ? " selected=\"selected\"" :"";?>> <option value="<?=$themalmod_name; ?>" <?=$pconfig['thermal_hardware'] == $themalmod_name ? " selected=\"selected\"" :"";?>>
<?="{$themalmod_descr} ({$themalmod_name})"; ?> <?="{$themalmod_descr} ({$themalmod_name})"; ?>
</option> </option>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment