heads/boards/librem_mini/initrd/bin/set_ec_poweron.sh
Thierry Laurion 61843d890b
Unify upstream board config defaults
- Upstream boards will not deactivate TPM DUK
- Upstream will not force BRAND_NAME which currently defaults to Heads
- Upstream will not deactivate Qr code on screen output on HOTP sealing
- Upstream will not offer OEM reset defaults (deprecated and now default anyway)

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
2023-12-19 13:05:46 -05:00

23 lines
620 B
Bash
Executable File

#!/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
if [ "$1" = "y" ]; then
BRAM_VALUE="0x00" # 0 -> automatic power-on
else
BRAM_VALUE="0x01" # 1 -> stay off
fi
outb "$BRAMADDR" 0x29 # Select byte at offset 29h
outb "$BRAMDATA" "$BRAM_VALUE"
# There's also a 16-bit checksum at offset 3eh in bank 1. The only byte
# included in the checksum is the automatic power-on setting, so the value is
# the same, and the upper 8 bits remain 0.
outb "$BRAMADDR" 0x3e
outb "$BRAMDATA" "$BRAM_VALUE"