summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2012-01-24 13:27:43 -0800
committerStefan Reinauer <reinauer@chromium.org>2012-01-24 16:06:17 -0800
commitc4cdebd32f9455cbf07b69bce0d5578b83d5eb0c (patch)
tree26d9dad1d3f9b73815987dae6ac2116b5c053c4d
parent24af1f5893689537cb16c06f1ae170db174cbb99 (diff)
downloadvboot-c4cdebd32f9455cbf07b69bce0d5578b83d5eb0c.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. 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> (cherry picked from commit 5fd35971de5e9fe2a7988519dc8d13ea3af0c0c5) Change-Id: I5d4ba8e8026479305706b4f41cb97458e66d58c0 Reviewed-on: https://gerrit.chromium.org/gerrit/14742 Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@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);