asmc: rename wol sysctl to auto_poweron
Older SMC firmware exposed AUPO as a Wake-on-LAN control. On updated firmware, the key controls automatic power-on when AC power is restored after a power loss; WoL is handled by the GBE controller instead. Rename the sysctl to reflect the current semantics. No compatibility alias is provided as the sysctl has not appeared in any release. Reviewed by: ziaee, adrian Differential Revision: https://reviews.freebsd.org/D56747
This commit is contained in:
committed by
Adrian Chadd
parent
045a9ef829
commit
36b399f55e
@@ -1,4 +1,4 @@
|
||||
.\"-
|
||||
.\"
|
||||
.\" Copyright (c) 2007, 2008, 2009 Rui Paulo <rpaulo@FreeBSD.org>
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
@@ -112,6 +112,13 @@ minimum fan speed, the minimum speed and the maximum speed
|
||||
respectively.
|
||||
.Pp
|
||||
All values are in RPM.
|
||||
.Sh POWER MANAGEMENT
|
||||
The
|
||||
.Va dev.asmc.%d.auto_poweron
|
||||
sysctl controls whether the machine automatically powers on when AC power
|
||||
is restored after an unclean power loss
|
||||
.Pq SMC key Dq AUPO .
|
||||
A value of 1 enables automatic power-on; 0 disables it.
|
||||
.Sh RAW SMC KEY ACCESS
|
||||
When the kernel is compiled with the
|
||||
.Dv ASMC_DEBUG
|
||||
|
||||
+10
-14
@@ -123,7 +123,7 @@ static int asmc_mbp_sysctl_light_left(SYSCTL_HANDLER_ARGS);
|
||||
static int asmc_mbp_sysctl_light_right(SYSCTL_HANDLER_ARGS);
|
||||
static int asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS);
|
||||
static int asmc_mbp_sysctl_light_left_10byte(SYSCTL_HANDLER_ARGS);
|
||||
static int asmc_wol_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
static int asmc_aupo_sysctl(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
static int asmc_key_getinfo(device_t, const char *, uint8_t *, char *);
|
||||
|
||||
@@ -793,14 +793,14 @@ asmc_init(device_t dev)
|
||||
device_printf(dev, "SMC revision: %x.%x%x%x\n", buf[0], buf[1], buf[2],
|
||||
ntohs(*(uint16_t *)buf + 4));
|
||||
|
||||
/* Wake-on-LAN convenience sysctl */
|
||||
/* Auto power-on after AC power loss (AUPO). */
|
||||
if (asmc_key_read(dev, ASMC_KEY_AUPO, buf, 1) == 0) {
|
||||
SYSCTL_ADD_PROC(sysctlctx,
|
||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
|
||||
OID_AUTO, "wol",
|
||||
OID_AUTO, "auto_poweron",
|
||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
|
||||
dev, 0, asmc_wol_sysctl, "I",
|
||||
"Wake-on-LAN enable (0=off, 1=on)");
|
||||
dev, 0, asmc_aupo_sysctl, "I",
|
||||
"Auto power-on after AC power loss (0=off, 1=on)");
|
||||
}
|
||||
|
||||
sc->sc_nfan = asmc_fan_count(dev);
|
||||
@@ -1222,7 +1222,7 @@ asmc_key_getinfo(device_t dev, const char *key, uint8_t *len, char *type)
|
||||
/*
|
||||
* Raw SMC key access sysctls - enables reading/writing any SMC key by name
|
||||
* Usage:
|
||||
* sysctl dev.asmc.0.raw.key=AUPO # Set key, auto-detects length
|
||||
* sysctl dev.asmc.0.raw.key=TC0P # Set key, auto-detects length
|
||||
* sysctl dev.asmc.0.raw.value # Read current value (hex bytes)
|
||||
* sysctl dev.asmc.0.raw.value=01 # Write new value
|
||||
*/
|
||||
@@ -2338,18 +2338,17 @@ asmc_mbp_sysctl_light_left_10byte(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
|
||||
/*
|
||||
* Wake-on-LAN convenience sysctl.
|
||||
* Reading returns 1 if WoL is enabled, 0 if disabled.
|
||||
* Writing 1 enables WoL, 0 disables it.
|
||||
* Auto power-on after AC power loss (AUPO key).
|
||||
* When non-zero the machine boots automatically when AC is restored
|
||||
* after an unclean power loss. Useful for always-on servers / home labs.
|
||||
*/
|
||||
static int
|
||||
asmc_wol_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
asmc_aupo_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
device_t dev = (device_t)arg1;
|
||||
uint8_t aupo;
|
||||
int val, error;
|
||||
|
||||
/* Read current AUPO value */
|
||||
if (asmc_key_read(dev, ASMC_KEY_AUPO, &aupo, 1) != 0)
|
||||
return (EIO);
|
||||
|
||||
@@ -2358,10 +2357,7 @@ asmc_wol_sysctl(SYSCTL_HANDLER_ARGS)
|
||||
if (error != 0 || req->newptr == NULL)
|
||||
return (error);
|
||||
|
||||
/* Clamp to 0 or 1 */
|
||||
aupo = (val != 0) ? 1 : 0;
|
||||
|
||||
/* Write AUPO */
|
||||
if (asmc_key_write(dev, ASMC_KEY_AUPO, &aupo, 1) != 0)
|
||||
return (EIO);
|
||||
|
||||
|
||||
@@ -175,7 +175,9 @@ struct asmc_softc {
|
||||
#define ASMC_KEY_CLAMSHELL "MSLD" /* RO; 1 byte */
|
||||
|
||||
/*
|
||||
* Auto power on / Wake-on-LAN.
|
||||
* Auto power-on after AC power loss (AUPO).
|
||||
* When set, the machine boots automatically when AC power is restored
|
||||
* after an unclean power loss. This is NOT Wake-on-LAN.
|
||||
*/
|
||||
#define ASMC_KEY_AUPO "AUPO" /* RW; 1 byte */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user