mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
librem_mini,librem_mini_v2: Don't use three values for auto poweron
PureBoot doesn't have any other three-valued settings and this doesn't present very well in the config UI. Instead make this a two-valued setting; drop the mode that forces the EC setting to "stay off" at every boot because this is the default. When disabling automatic power-on, disable the EC BRAM setting too. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
5e555359a4
commit
e9a5b27e6c
@ -1,22 +1,16 @@
|
||||
#!/bin/ash
|
||||
#!/bin/bash
|
||||
set -o pipefail
|
||||
|
||||
. /tmp/config
|
||||
|
||||
# Set the Mini v2 EC's automatic power-on setting.
|
||||
# CONFIG_AUTOMATIC_POWERON is three-valued:
|
||||
# y - enable automatic power on in EC
|
||||
# n - disable automatic power on in EC
|
||||
# <blank> - don't configure EC, could be configured from OS
|
||||
|
||||
# EC BRAM bank 1
|
||||
BRAMADDR=0x360
|
||||
BRAMDATA=0x361
|
||||
|
||||
# If CONFIG_AUTOMATIC_POWERON is set, always set the EC BRAM setting during
|
||||
# boot. It persists as long as the RTC battery is set, but set it during every
|
||||
# boot for robustness in case the battery is temporarily removed, or the user
|
||||
# toggles in config-gui and then does not flash, etc.
|
||||
if [ "$CONFIG_AUTOMATIC_POWERON" = "y" ]; then
|
||||
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
|
||||
outb "$BRAMDATA" 0x00 # 0 -> automatic power on
|
||||
elif [ "$CONFIG_AUTOMATIC_POWERON" = "n" ]; then
|
||||
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
|
||||
outb "$BRAMDATA" 0x01 # 1 -> stay off
|
||||
set_ec_poweron.sh y
|
||||
fi
|
||||
|
||||
# Don't disable the setting in the EC BRAM though if CONFIG_AUTOMATIC_POWERON
|
||||
# is not enabled. The default is disabled anyway, and the OS could configure
|
||||
# it.
|
||||
|
16
boards/librem_mini/initrd/bin/set_ec_poweron.sh
Executable file
16
boards/librem_mini/initrd/bin/set_ec_poweron.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set the EC BRAM setting for automatic power-on.
|
||||
# If $1 is 'y', enable automatic power-on. Otherwise, disable it.
|
||||
|
||||
# EC BRAM bank 1
|
||||
BRAMADDR=0x360
|
||||
BRAMDATA=0x361
|
||||
|
||||
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
|
||||
if [ "$1" = "y" ]; then
|
||||
outb "$BRAMDATA" 0x00 # 0 -> automatic power-on
|
||||
else
|
||||
outb "$BRAMDATA" 0x01 # 1 -> stay off
|
||||
fi
|
||||
|
@ -1,22 +1,16 @@
|
||||
#!/bin/ash
|
||||
#!/bin/bash
|
||||
set -o pipefail
|
||||
|
||||
. /tmp/config
|
||||
|
||||
# Set the Mini v2 EC's automatic power-on setting.
|
||||
# CONFIG_AUTOMATIC_POWERON is three-valued:
|
||||
# y - enable automatic power on in EC
|
||||
# n - disable automatic power on in EC
|
||||
# <blank> - don't configure EC, could be configured from OS
|
||||
|
||||
# EC BRAM bank 1
|
||||
BRAMADDR=0x360
|
||||
BRAMDATA=0x361
|
||||
|
||||
# If CONFIG_AUTOMATIC_POWERON is set, always set the EC BRAM setting during
|
||||
# boot. It persists as long as the RTC battery is set, but set it during every
|
||||
# boot for robustness in case the battery is temporarily removed, or the user
|
||||
# toggles in config-gui and then does not flash, etc.
|
||||
if [ "$CONFIG_AUTOMATIC_POWERON" = "y" ]; then
|
||||
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
|
||||
outb "$BRAMDATA" 0x00 # 0 -> automatic power on
|
||||
elif [ "$CONFIG_AUTOMATIC_POWERON" = "n" ]; then
|
||||
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
|
||||
outb "$BRAMDATA" 0x01 # 1 -> stay off
|
||||
set_ec_poweron.sh y
|
||||
fi
|
||||
|
||||
# Don't disable the setting in the EC BRAM though if CONFIG_AUTOMATIC_POWERON
|
||||
# is not enabled. The default is disabled anyway, and the OS could configure
|
||||
# it.
|
||||
|
16
boards/librem_mini_v2/initrd/bin/set_ec_poweron.sh
Executable file
16
boards/librem_mini_v2/initrd/bin/set_ec_poweron.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set the EC BRAM setting for automatic power-on.
|
||||
# If $1 is 'y', enable automatic power-on. Otherwise, disable it.
|
||||
|
||||
# EC BRAM bank 1
|
||||
BRAMADDR=0x360
|
||||
BRAMDATA=0x361
|
||||
|
||||
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
|
||||
if [ "$1" = "y" ]; then
|
||||
outb "$BRAMDATA" 0x00 # 0 -> automatic power-on
|
||||
else
|
||||
outb "$BRAMDATA" 0x01 # 1 -> stay off
|
||||
fi
|
||||
|
@ -435,6 +435,11 @@ while true; do
|
||||
|
||||
set_user_config "CONFIG_AUTOMATIC_POWERON" "n"
|
||||
|
||||
# Disable the EC BRAM setting too, otherwise it persists until
|
||||
# manually disabled. On the off chance the user does not actually
|
||||
# flash this change, we'll enable it again during boot.
|
||||
set_ec_poweron.sh n
|
||||
|
||||
whiptail --title 'Config change successful' \
|
||||
--msgbox "Automatic power-on disabled;\nsave the config change and reboot for it to go into effect." 0 80
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user