bootmode: add display_init_required()

Some of the Chrome OS boards were directly calling vboot
called in some form after contorting around #ifdef preprocessor
macros. The reasoning is that Chrome OS doesn't always do display
initialization during startup. It's runtime dependent. While
this is a requirement that doesn't mean vboot functions should be
sprinkled around in the mainboard and chipset code. Instead provide
one function, display_init_required(), that provides the policy
for determining display initialization action. For Chrome OS
devices this function honors vboot_skip_display_init() and all
other configurations default to initializing display.

Change-Id: I403213e22c0e621e148773597a550addfbaf3f7e
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/11490
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Aaron Durbin 2015-09-02 09:21:36 -05:00
parent 5fc6f90ef7
commit bc98cc66b2
9 changed files with 42 additions and 36 deletions

View File

@ -30,6 +30,8 @@ int get_wipeout_mode_switch(void);
int get_lid_switch(void); int get_lid_switch(void);
/* Return 1 if display initialization is required. 0 if not. */
int display_init_required(void);
int gfx_get_init_done(void); int gfx_get_init_done(void);
void gfx_set_init_done(int done); void gfx_set_init_done(int done);

View File

@ -19,9 +19,7 @@
#include <rules.h> #include <rules.h>
#include <bootmode.h> #include <bootmode.h>
#if CONFIG_CHROMEOS || CONFIG_VBOOT_VERIFY_FIRMWARE
#include <vendorcode/google/chromeos/chromeos.h> #include <vendorcode/google/chromeos/chromeos.h>
#endif
#if CONFIG_BOOTMODE_STRAPS #if CONFIG_BOOTMODE_STRAPS
int developer_mode_enabled(void) int developer_mode_enabled(void)
@ -78,3 +76,13 @@ void gfx_set_init_done(int done)
gfx_init_done = done; gfx_init_done = done;
} }
#endif #endif
int display_init_required(void)
{
/* For Chrome OS always honor vboot_skip_display_init(). */
if (IS_ENABLED(CONFIG_CHROMEOS))
return !vboot_skip_display_init();
/* By default always initialize display. */
return 1;
}

View File

@ -18,7 +18,9 @@
*/ */
#include <arch/mmu.h> #include <arch/mmu.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <delay.h>
#include <device/device.h> #include <device/device.h>
#include <memrange.h> #include <memrange.h>
#include <soc/addressmap.h> #include <soc/addressmap.h>
@ -32,9 +34,6 @@
#include <soc/nvidia/tegra/dc.h> #include <soc/nvidia/tegra/dc.h>
#include <soc/display.h> #include <soc/display.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <delay.h>
static const struct pad_config sdmmc3_pad[] = { static const struct pad_config sdmmc3_pad[] = {
/* MMC3(SDCARD) */ /* MMC3(SDCARD) */
PAD_CFG_SFIO(SDMMC3_CLK, PINMUX_INPUT_ENABLE, SDMMC3), PAD_CFG_SFIO(SDMMC3_CLK, PINMUX_INPUT_ENABLE, SDMMC3),
@ -184,7 +183,7 @@ static void mainboard_init(device_t dev)
i2c_init(I2C1_BUS); /* for max98090 codec */ i2c_init(I2C1_BUS); /* for max98090 codec */
/* if panel needs to bringup */ /* if panel needs to bringup */
if (!vboot_skip_display_init()) if (display_init_required())
configure_display_blocks(); configure_display_blocks();
} }

View File

@ -19,6 +19,7 @@
#include <arch/mmu.h> #include <arch/mmu.h>
#include <boardid.h> #include <boardid.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <cbmem.h> #include <cbmem.h>
#include <delay.h> #include <delay.h>
@ -281,7 +282,7 @@ static void mainboard_init(device_t dev)
soc_configure_pads(lcd_gpio_padcfgs, ARRAY_SIZE(lcd_gpio_padcfgs)); soc_configure_pads(lcd_gpio_padcfgs, ARRAY_SIZE(lcd_gpio_padcfgs));
/* if panel needs to bringup */ /* if panel needs to bringup */
if (!vboot_skip_display_init()) if (display_init_required())
configure_display_blocks(); configure_display_blocks();
} }

View File

@ -20,7 +20,9 @@
#include <arch/io.h> #include <arch/io.h>
#include <arch/mmu.h> #include <arch/mmu.h>
#include <bootmode.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <delay.h>
#include <device/device.h> #include <device/device.h>
#include <device/i2c.h> #include <device/i2c.h>
#include <soc/addressmap.h> #include <soc/addressmap.h>
@ -36,12 +38,6 @@
#include <soc/pmc.h> #include <soc/pmc.h>
#include <soc/power.h> #include <soc/power.h>
#if IS_ENABLED(CONFIG_CHROMEOS)
#include <vendorcode/google/chromeos/vboot_handoff.h>
#include <vendorcode/google/chromeos/vboot2/misc.h>
#endif
#include <delay.h>
#include "gpio.h" #include "gpio.h"
#include "pmic.h" #include "pmic.h"
@ -202,9 +198,7 @@ static void mainboard_init(device_t dev)
setup_audio(); setup_audio();
/* if panel needs to bringup */ /* if panel needs to bringup */
#if IS_ENABLED(CONFIG_CHROMEOS) if (display_init_required())
if (!vboot_skip_display_init())
#endif
configure_display_blocks(); configure_display_blocks();
powergate_unused_partitions(); powergate_unused_partitions();

View File

@ -20,13 +20,13 @@
*/ */
#include <arch/io.h> #include <arch/io.h>
#include <bootmode.h>
#include <console/console.h> #include <console/console.h>
#include <device/device.h> #include <device/device.h>
#include <soc/nvidia/tegra/dc.h> #include <soc/nvidia/tegra/dc.h>
#include <soc/display.h> #include <soc/display.h>
#include <soc/sdram.h> #include <soc/sdram.h>
#include <symbols.h> #include <symbols.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "chip.h" #include "chip.h"
@ -53,10 +53,10 @@ static void soc_enable(device_t dev)
static void soc_init(device_t dev) static void soc_init(device_t dev)
{ {
if (vboot_skip_display_init()) if (display_init_required())
printk(BIOS_INFO, "Skipping display init.\n");
else
display_startup(dev); display_startup(dev);
else
printk(BIOS_INFO, "Skipping display init.\n");
printk(BIOS_INFO, "CPU: Tegra124\n"); printk(BIOS_INFO, "CPU: Tegra124\n");
} }

View File

@ -22,6 +22,7 @@
#include <arch/cache.h> #include <arch/cache.h>
#include <arch/spintable.h> #include <arch/spintable.h>
#include <cpu/cpu.h> #include <cpu/cpu.h>
#include <bootmode.h>
#include <bootstate.h> #include <bootstate.h>
#include <cbmem.h> #include <cbmem.h>
#include <console/console.h> #include <console/console.h>
@ -34,7 +35,6 @@
#include <soc/nvidia/tegra/apbmisc.h> #include <soc/nvidia/tegra/apbmisc.h>
#include <string.h> #include <string.h>
#include <timer.h> #include <timer.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "chip.h" #include "chip.h"
@ -101,12 +101,13 @@ static void soc_init(device_t dev)
/* Lock down VPR */ /* Lock down VPR */
lock_down_vpr(); lock_down_vpr();
#if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) if (!IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT))
if (vboot_skip_display_init()) return;
printk(BIOS_INFO, "Skipping display init.\n");
else if (display_init_required())
display_startup(dev); display_startup(dev);
#endif else
printk(BIOS_INFO, "Skipping display init.\n");
} }
static struct device_operations soc_ops = { static struct device_operations soc_ops = {

View File

@ -22,6 +22,7 @@
#include <arch/cache.h> #include <arch/cache.h>
#include <arch/spintable.h> #include <arch/spintable.h>
#include <cpu/cpu.h> #include <cpu/cpu.h>
#include <bootmode.h>
#include <bootstate.h> #include <bootstate.h>
#include <cbmem.h> #include <cbmem.h>
#include <console/console.h> #include <console/console.h>
@ -35,7 +36,6 @@
#include <soc/nvidia/tegra/apbmisc.h> #include <soc/nvidia/tegra/apbmisc.h>
#include <string.h> #include <string.h>
#include <timer.h> #include <timer.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <soc/sdram.h> #include <soc/sdram.h>
#include <soc/sdram_configs.h> #include <soc/sdram_configs.h>
@ -92,12 +92,13 @@ static void soc_init(device_t dev)
spintable_init((void *)cfg->spintable_addr); spintable_init((void *)cfg->spintable_addr);
arch_initialize_cpus(dev, &cntrl_ops); arch_initialize_cpus(dev, &cntrl_ops);
#if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) if (!IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT))
if (vboot_skip_display_init()) return;
printk(BIOS_INFO, "Skipping display init.\n");
else if (display_init_required())
display_startup(dev); display_startup(dev);
#endif else
printk(BIOS_INFO, "Skipping display init.\n");
} }
static void soc_noop(device_t dev) static void soc_noop(device_t dev)

View File

@ -18,6 +18,7 @@
*/ */
#include <arch/cache.h> #include <arch/cache.h>
#include <bootmode.h>
#include <cbmem.h> #include <cbmem.h>
#include <console/console.h> #include <console/console.h>
#include <delay.h> #include <delay.h>
@ -30,18 +31,17 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <symbols.h> #include <symbols.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "chip.h" #include "chip.h"
static void soc_init(device_t dev) static void soc_init(device_t dev)
{ {
ram_resource(dev, 0, (uintptr_t)_dram/KiB, sdram_size_mb()*(MiB/KiB)); ram_resource(dev, 0, (uintptr_t)_dram/KiB, sdram_size_mb()*(MiB/KiB));
if (vboot_skip_display_init()) if (display_init_required())
printk(BIOS_INFO, "Skipping display init.\n");
else
rk_display_init(dev, (uintptr_t)_framebuffer, rk_display_init(dev, (uintptr_t)_framebuffer,
_framebuffer_size); _framebuffer_size);
else
printk(BIOS_INFO, "Skipping display init.\n");
} }
static struct device_operations soc_ops = { static struct device_operations soc_ops = {