From 4f928444812f5ed2aa810d08ec603b859a6d63c0 Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Fri, 2 Jan 2015 15:46:57 -0800 Subject: chromeos: add get_recovery_mode_from_vbnv() to vbnv_flash The first platform that used flash-backed VBNV data has a physical recovery switch, get_recovery_mode_from_vbnv() was never implemented. This patch adds get_recovery_mode_from_vbnv() similarly to how it's implemented for other vbnv storage in other places. BUG=chrome-os-partner:34436 BRANCH=none TEST=needs testing Change-Id: Ifd795c5c1ff0f23619fd2125b4795571af03ece1 Signed-off-by: Stefan Reinauer Original-Commit-Id: 09f1bf96089bf9d159e4220c1f4d99388d709545 Original-Signed-off-by: David Hendricks Original-Change-Id: I9cf18c988eaa4b7e720d6c66a02b1c5c63b473e9 Original-Reviewed-on: https://chromium-review.googlesource.com/239978 Original-Reviewed-by: Julius Werner Reviewed-on: http://review.coreboot.org/9563 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/vendorcode/google/chromeos/vbnv_flash.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/vendorcode') diff --git a/src/vendorcode/google/chromeos/vbnv_flash.c b/src/vendorcode/google/chromeos/vbnv_flash.c index e880ed4d5c..97a2a82d1b 100644 --- a/src/vendorcode/google/chromeos/vbnv_flash.c +++ b/src/vendorcode/google/chromeos/vbnv_flash.c @@ -15,6 +15,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * TODO: Make this CAR-friendly in case we use it on x86 some day. */ #include @@ -25,6 +27,7 @@ #include #include #include "chromeos.h" +#include "vbnv_layout.h" #if IS_ENABLED(CONFIG_VBOOT_VERIFY_FIRMWARE) #define BLOB_SIZE VBNV_BLOCK_SIZE @@ -189,3 +192,10 @@ void save_vbnv(const uint8_t *vbnv_copy) printk(BIOS_ERR, "failed to save nvdata\n"); } } + +int get_recovery_mode_from_vbnv(void) +{ + if (!is_initialized()) + init_vbnv(); + return cache[RECOVERY_OFFSET]; +} -- cgit v1.2.3