chromeos: vboot and chromeos dependency removal for sw write protect state

This removes the dependency on chromeos and vboot for the sw write protect state
function: vboot_get_sw_write_protect, renamed to get_sw_write_protect_state to
both reflect this change and become consistent with the definition of
get_write_protect_state that is already in use.

Change-Id: I47ce31530a03f6749e0f370e5d868466318b3bb6
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-on: http://review.coreboot.org/11496
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Paul Kocialkowski 2015-09-03 11:27:27 +02:00 committed by Stefan Reinauer
parent d738b14597
commit a40032780f
7 changed files with 6 additions and 13 deletions

View File

@ -23,6 +23,7 @@
/* functions implemented per mainboard: */ /* functions implemented per mainboard: */
void init_bootmode_straps(void); void init_bootmode_straps(void);
int get_write_protect_state(void); int get_write_protect_state(void);
int get_sw_write_protect_state(void);
int get_developer_mode_switch(void); int get_developer_mode_switch(void);
int get_recovery_mode_switch(void); int get_recovery_mode_switch(void);
int clear_recovery_mode_switch(void); int clear_recovery_mode_switch(void);

View File

@ -362,11 +362,9 @@ void ramstage_cache_invalid(void)
#endif #endif
} }
#if CONFIG_CHROMEOS int get_sw_write_protect_state(void)
int vboot_get_sw_write_protect(void)
{ {
u8 status; u8 status;
/* Return unprotected status if status read fails. */ /* Return unprotected status if status read fails. */
return (early_spi_read_wpsr(&status) ? 0 : !!(status & 0x80)); return (early_spi_read_wpsr(&status) ? 0 : !!(status & 0x80));
} }
#endif

View File

@ -147,13 +147,11 @@ void ramstage_cache_invalid(void)
#endif #endif
} }
#if CONFIG_CHROMEOS int get_sw_write_protect_state(void)
int vboot_get_sw_write_protect(void)
{ {
u8 status; u8 status;
/* Return unprotected status if status read fails. */ /* Return unprotected status if status read fails. */
return (early_spi_read_wpsr(&status) ? 0 : !!(status & 0x80)); return (early_spi_read_wpsr(&status) ? 0 : !!(status & 0x80));
} }
#endif
void __attribute__((weak)) mainboard_pre_console_init(void) {} void __attribute__((weak)) mainboard_pre_console_init(void) {}

View File

@ -68,15 +68,13 @@ void soc_romstage_init(struct romstage_params *params)
pch_early_init(); pch_early_init();
} }
#if IS_ENABLED(CONFIG_CHROMEOS) int get_sw_write_protect_state(void)
int vboot_get_sw_write_protect(void)
{ {
u8 status; u8 status;
/* Return unprotected status if status read fails. */ /* Return unprotected status if status read fails. */
return early_spi_read_wpsr(&status) ? 0 : !!(status & 0x80); return early_spi_read_wpsr(&status) ? 0 : !!(status & 0x80);
} }
#endif
/* UPD parameters to be initialized before MemoryInit */ /* UPD parameters to be initialized before MemoryInit */
void soc_memory_init_params(struct romstage_params *params, void soc_memory_init_params(struct romstage_params *params,

View File

@ -65,7 +65,7 @@ void __attribute__((weak)) save_chromeos_gpios(void)
// Can be implemented by a mainboard // Can be implemented by a mainboard
} }
int __attribute__((weak)) vboot_get_sw_write_protect(void) int __attribute__((weak)) get_sw_write_protect_state(void)
{ {
// Can be implemented by a platform / mainboard // Can be implemented by a platform / mainboard
return 0; return 0;

View File

@ -68,8 +68,6 @@ static inline int vboot_get_handoff_info(void **addr, uint32_t *size)
} }
#endif /* CONFIG_VBOOT_VERIFY_FIRMWARE */ #endif /* CONFIG_VBOOT_VERIFY_FIRMWARE */
int vboot_get_sw_write_protect(void);
#include "gnvs.h" #include "gnvs.h"
struct device; struct device;

View File

@ -61,7 +61,7 @@ static void fill_vboot_handoff(struct vboot_handoff *vboot_handoff,
if (get_write_protect_state()) if (get_write_protect_state())
vb_sd->flags |= VBSD_BOOT_FIRMWARE_WP_ENABLED; vb_sd->flags |= VBSD_BOOT_FIRMWARE_WP_ENABLED;
if (vboot_get_sw_write_protect()) if (get_sw_write_protect_state())
vb_sd->flags |= VBSD_BOOT_FIRMWARE_SW_WP_ENABLED; vb_sd->flags |= VBSD_BOOT_FIRMWARE_SW_WP_ENABLED;
if (vb2_sd->recovery_reason) { if (vb2_sd->recovery_reason) {