summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-01-24 13:27:43 -0800
committerGerrit <chrome-bot@google.com>2012-01-24 15:04:46 -0800
commit5fd35971de5e9fe2a7988519dc8d13ea3af0c0c5 (patch)
treea9c2151a66b163e85258fe6629129f07ea7d9cfb
parent506649c5cd6f7943b2e0565325b2db8346b55f47 (diff)
downloadvboot-5fd35971de5e9fe2a7988519dc8d13ea3af0c0c5.tar.gz
Be aggressive in saving locale to nvram.
On x86 platforms, the power button and lid switch events have to be handled by coreboot SMM code, because it needs to interact with the southbridge and/or EC, and U-Boot doesn't have a way to do that. Once the kernel takes over, it sends an SMI to that code which tells it to start delivering ACPI events instead of whatever pre-ACPI handling it has been doing. U-Boot doesn't have any code to handle either case, and adding it would either be a major undertaking (adding ACPI support to U-Boot!), or would require creating yet another special-purpose interface just for our U-Boot (yuck). It's much simpler to just make vboot_reference be more aggressive about writing to the nvram for this one case where it matters. OTOH, ARM will need U-Boot to handle the lid switch and power button via GPIOs since it uses only U-Boot and has no SMI handler. This change isn't necessary for ARM, but shouldn't hurt either. BUG=chrome-os-partner:7689 TEST=manual 1. Boot to dev-mode screen or recovery screen. 2. Press arrow keys to change locale. 3. Power off (press power button or yank A/C & battery) 4. Power on again. The BIOS screen locale should still be set to your last choice before powering off. Change-Id: I9008811c3be71de47ff1c6899e81955cf0560a52 Reviewed-on: https://gerrit.chromium.org/gerrit/14721 Tested-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--firmware/lib/vboot_api_kernel.c5
-rw-r--r--firmware/lib/vboot_display.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c
index 35cdbcdb..8ed22cbf 100644
--- a/firmware/lib/vboot_api_kernel.c
+++ b/firmware/lib/vboot_api_kernel.c
@@ -127,8 +127,11 @@ VbError_t VbBootDeveloper(VbCommonParams* cparams, LoadKernelParams* p) {
do {
uint32_t key;
- if (VbExIsShutdownRequested())
+ if (VbExIsShutdownRequested()) {
+ VBDEBUG(("VbBootDeveloper() - shutdown is requested!\n"));
+ VbAudioClose(audio);
return VBERROR_SHUTDOWN_REQUESTED;
+ }
key = VbExKeyboardRead();
switch (key) {
diff --git a/firmware/lib/vboot_display.c b/firmware/lib/vboot_display.c
index 7ec0c409..5e705c7e 100644
--- a/firmware/lib/vboot_display.c
+++ b/firmware/lib/vboot_display.c
@@ -605,6 +605,14 @@ VbError_t VbCheckDisplayKey(VbCommonParams* cparams, uint32_t key,
loc = (loc > 0 ? loc - 1 : count - 1);
VBDEBUG(("VbCheckDisplayKey() - change localization to %d\n", (int)loc));
VbNvSet(vncptr, VBNV_LOCALIZATION_INDEX, loc);
+ /* Workaround for coreboot on x86, which will power off asynchronously
+ * without giving us a chance to react. This is not an example of the Right
+ * Way to do things. See chrome-os-partner:7689, and the commit message
+ * that made this change.
+ */
+ VbNvTeardown(vncptr); /* really only computes checksum */
+ if (vncptr->raw_changed)
+ VbExNvStorageWrite(vncptr->raw);
/* Force redraw of current screen */
return VbDisplayScreen(cparams, disp_current_screen, 1, vncptr);