diff options
author | Gabe Black <gabeblack@chromium.org> | 2011-09-22 21:47:15 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@chromium.org> | 2011-09-23 20:31:55 -0700 |
commit | 4421bf3c1574c7d69a4be6a0c448ed401115f3a6 (patch) | |
tree | 2f0cf48d72f979d82026f7eaa6d6ae3fed7abd75 /lib | |
parent | 538a80f565480e6d5b18be846b7dfc5778e9a78a (diff) |
Use the vdat firmware index when setting up the ACPI crossystem data table
Instead of using a hardcoded value, set this field of the table used by the
crossystem ACPI driver to whatever is stored in VDAT.
BUG=chrome-os-partner:5944
BUG=chrome-os-partner:5961
BUG=chrome-os-partner:5962
TEST=Booted on Alex. Verified that corrupting firmware A made crossystem change
mainfw_act to B instead of A.
Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: I01b26508fede3d15e78b584b638e1393c5b03501
Reviewed-on: http://gerrit.chromium.org/gerrit/8189
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Ready: Gabe Black <gabeblack@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chromeos/crossystem_data.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/chromeos/crossystem_data.c b/lib/chromeos/crossystem_data.c index 3720254c868..da53a5e5b12 100644 --- a/lib/chromeos/crossystem_data.c +++ b/lib/chromeos/crossystem_data.c @@ -20,6 +20,10 @@ #include <libfdt.h> #endif +#ifdef CONFIG_X86 +#include <asm/ic/coreboot/sysinfo.h> +#endif + #define CROSSYSTEM_DATA_SIGNATURE "CHROMEOS" /* This is used to keep bootstub and readwite main firmware in sync */ @@ -27,6 +31,18 @@ #define PREFIX "crossystem_data: " +enum VdatFwIndex { + VDAT_RW_A = 0, + VDAT_RW_B = 1, + VDAT_RECOVERY = 0xFF +}; + +enum BinfFwIndex { + BINF_RECOVERY = 0, + BINF_RW_A = 1, + BINF_RW_B = 2 +}; + DECLARE_GLOBAL_DATA_PTR; int crossystem_data_init(crossystem_data_t *cdata, @@ -239,12 +255,24 @@ int crossystem_data_embed_into_fdt(crossystem_data_t *cdata, void *fdt, #endif /* ^^^^ CONFIG_OF_LIBFDT NOT defined ^^^^ */ #ifdef CONFIG_X86 + +static int crossystem_fw_index_vdat_to_binf(int index) +{ + switch (index) { + case VDAT_RW_A: return BINF_RW_A; + case VDAT_RW_B: return BINF_RW_B; + case VDAT_RECOVERY: return BINF_RECOVERY; + default: return BINF_RECOVERY; + } +}; + int crossystem_data_update_acpi(crossystem_data_t *cdata) { const void *fdt = gd->blob; int node_offset, len; const uint32_t *cell; chromeos_acpi_t *acpi_table; + VbSharedDataHeader *vdat = (VbSharedDataHeader *)lib_sysinfo.vdat_addr; node_offset = fdt_path_offset(fdt, "/chromeos-config"); if (node_offset < 0) { @@ -261,7 +289,8 @@ int crossystem_data_update_acpi(crossystem_data_t *cdata) acpi_table = (chromeos_acpi_t *)(uintptr_t)ntohl(*cell); acpi_table->vbt0 = BOOT_REASON_OTHER; - acpi_table->vbt1 = ACTIVE_MAINFW_RW_A; + acpi_table->vbt1 = + crossystem_fw_index_vdat_to_binf(vdat->firmware_index); acpi_table->vbt2 = cdata->active_ec_firmware; acpi_table->vbt3 = (cdata->boot_write_protect_switch ? CHSW_FIRMWARE_WP_DIS : 0) | |