[coreboot-gerrit] Patch set updated for coreboot: chromeos: vboot-related functions move to common vboot code

Paul Kocialkowski (contact@paulk.fr) gerrit at coreboot.org
Wed Sep 16 16:41:19 CET 2015


Paul Kocialkowski (contact at paulk.fr) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11497

-gerrit

commit bb404a4f3dba20455a05ad38ad9526c07b44d9f4
Author: Paul Kocialkowski <contact at paulk.fr>
Date:   Thu Sep 3 11:41:14 2015 +0200

    chromeos: vboot-related functions move to common vboot code
    
    This moves a few vboot-prefixed functions that were defined in chromeos.c to
    vboot_common.c, since those are only relevant to vboot and depend on the vboot
    handoff data. This allows more separation between CONFIG_CHROMEOS and what
    CONFIG_CHROMEOS selects, so that each separate option (such as
    CONFIG_VBOOT_VERIFY_FIRMWARE) can be enabled separately.
    
    Thus, the actual definitions of these functions will only be declared when
    CONFIG_VBOOT_VERIFY_FIRMWARE is set, so the check before calling
    vboot_skip_display_init in bootmode was also adapted.
    
    Change-Id: I52f8a408645566dac0a2100e819c8ed5d3d88ea5
    Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
---
 src/lib/bootmode.c                            |  2 +-
 src/vendorcode/google/chromeos/chromeos.c     | 32 ---------------------------
 src/vendorcode/google/chromeos/chromeos.h     | 10 ++++-----
 src/vendorcode/google/chromeos/vboot_common.c | 27 ++++++++++++++++++++++
 4 files changed, 33 insertions(+), 38 deletions(-)

diff --git a/src/lib/bootmode.c b/src/lib/bootmode.c
index f2ff72a..d0aa40e 100644
--- a/src/lib/bootmode.c
+++ b/src/lib/bootmode.c
@@ -80,7 +80,7 @@ void gfx_set_init_done(int done)
 int display_init_required(void)
 {
 	/* For Chrome OS always honor vboot_skip_display_init(). */
-	if (IS_ENABLED(CONFIG_CHROMEOS))
+	if (IS_ENABLED(CONFIG_VBOOT_VERIFY_FIRMWARE))
 		return !vboot_skip_display_init();
 
 	/* By default always initialize display. */
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c
index c2190b7..4864b8c 100644
--- a/src/vendorcode/google/chromeos/chromeos.c
+++ b/src/vendorcode/google/chromeos/chromeos.c
@@ -20,38 +20,6 @@
 #include <stddef.h>
 #include <string.h>
 #include "chromeos.h"
-#include <boot/coreboot_tables.h>
-#include <cbfs.h>
-#include <cbmem.h>
-#include <console/console.h>
-#include "vboot_handoff.h"
-
-static int vboot_handoff_flag(uint32_t flag)
-{
-	struct vboot_handoff *vbho;
-
-	vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
-
-	if (vbho == NULL)
-		return 0;
-
-	return !!(vbho->init_params.out_flags & flag);
-}
-
-int vboot_skip_display_init(void)
-{
-	return !vboot_handoff_flag(VB_INIT_OUT_ENABLE_DISPLAY);
-}
-
-int vboot_enable_developer(void)
-{
-	return vboot_handoff_flag(VB_INIT_OUT_ENABLE_DEVELOPER);
-}
-
-int vboot_enable_recovery(void)
-{
-	return vboot_handoff_flag(VB_INIT_OUT_ENABLE_RECOVERY);
-}
 
 int __attribute__((weak)) clear_recovery_mode_switch(void)
 {
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 798ab3e..15513eb 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -45,15 +45,10 @@ void elog_add_boot_reason(void);
 /* functions implemented in watchdog.c */
 void elog_add_watchdog_reset(void);
 void reboot_from_watchdog(void);
-
-int vboot_enable_developer(void);
-int vboot_enable_recovery(void);
-int vboot_skip_display_init(void);
 #else
 static inline void elog_add_boot_reason(void) { return; }
 static inline void elog_add_watchdog_reset(void) { return; }
 static inline void reboot_from_watchdog(void) { return; }
-static inline int vboot_skip_display_init(void) { return 0; }
 #endif /* CONFIG_CHROMEOS */
 
 struct romstage_handoff;
@@ -61,11 +56,16 @@ struct romstage_handoff;
 #if CONFIG_VBOOT_VERIFY_FIRMWARE
 /* Returns 0 on success < 0 on error. */
 int vboot_get_handoff_info(void **addr, uint32_t *size);
+
+int vboot_enable_developer(void);
+int vboot_enable_recovery(void);
+int vboot_skip_display_init(void);
 #else /* CONFIG_VBOOT_VERIFY_FIRMWARE */
 static inline int vboot_get_handoff_info(void **addr, uint32_t *size)
 {
 	return -1;
 }
+static inline int vboot_skip_display_init(void) { return 0; }
 #endif /* CONFIG_VBOOT_VERIFY_FIRMWARE */
 
 #include "gnvs.h"
diff --git a/src/vendorcode/google/chromeos/vboot_common.c b/src/vendorcode/google/chromeos/vboot_common.c
index 2fd29b6..1c216d0 100644
--- a/src/vendorcode/google/chromeos/vboot_common.c
+++ b/src/vendorcode/google/chromeos/vboot_common.c
@@ -55,6 +55,33 @@ int vboot_get_handoff_info(void **addr, uint32_t *size)
 	return 0;
 }
 
+static int vboot_handoff_flag(uint32_t flag)
+{
+	struct vboot_handoff *vbho;
+
+	vbho = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
+
+	if (vbho == NULL)
+		return 0;
+
+	return !!(vbho->init_params.out_flags & flag);
+}
+
+int vboot_skip_display_init(void)
+{
+	return !vboot_handoff_flag(VB_INIT_OUT_ENABLE_DISPLAY);
+}
+
+int vboot_enable_developer(void)
+{
+	return vboot_handoff_flag(VB_INIT_OUT_ENABLE_DEVELOPER);
+}
+
+int vboot_enable_recovery(void)
+{
+	return vboot_handoff_flag(VB_INIT_OUT_ENABLE_RECOVERY);
+}
+
 void vboot_reboot(void)
 {
 	if (IS_ENABLED(CONFIG_CONSOLE_CBMEM_DUMP_TO_UART))



More information about the coreboot-gerrit mailing list