Revert "CBMEM: Always have early initialisation"

This reverts commit de1fe7f655.

While things appeared to work, there were actually invalid references
to CAR storage after CAR was torn down on boards without
EARLY_CBMEM_INIT. It was discussed use of CAR_GLOBAL should be
restricted to boards that handle CAR migration properly.

Change-Id: I9969d2ea79c334a7f95a0dbb7c78065720e6ccae
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3968
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
Kyösti Mälkki 2013-10-11 22:08:02 +03:00
parent cf18c856aa
commit f8bf5a10c5
20 changed files with 42 additions and 5 deletions

View File

@ -170,9 +170,19 @@ config INCLUDE_CONFIG_FILE
config 0x8d740 raw 3324 config 0x8d740 raw 3324
(empty) 0x8e480 null 3610440 (empty) 0x8e480 null 3610440
config EARLY_CBMEM_INIT
bool
default n
help
Make coreboot initialize the CBMEM structures while running in ROM
stage. This is useful when the ROM stage wants to communicate
some, for instance, execution timestamps. It needs support in
romstage.c and should be enabled by the board's Kconfig.
config DYNAMIC_CBMEM config DYNAMIC_CBMEM
bool "The CBMEM space is dynamically grown." bool "The CBMEM space is dynamically grown."
default n default n
select EARLY_CBMEM_INIT
help help
Instead of reserving a static amount of CBMEM space the CBMEM Instead of reserving a static amount of CBMEM space the CBMEM
area grows dynamically. CBMEM can be used both in romstage (after area grows dynamically. CBMEM can be used both in romstage (after
@ -180,7 +190,7 @@ config DYNAMIC_CBMEM
config COLLECT_TIMESTAMPS config COLLECT_TIMESTAMPS
bool "Create a table of timestamps collected during boot" bool "Create a table of timestamps collected during boot"
default n depends on (EARLY_CBMEM_INIT || DYNAMIC_CBMEM)
help help
Make coreboot create a table of timer-ID/timer-value pairs to Make coreboot create a table of timer-ID/timer-value pairs to
allow measuring time spent at different phases of the boot process. allow measuring time spent at different phases of the boot process.

View File

@ -1,4 +1,5 @@
romstage-y += cbmem.c romstage-$(CONFIG_EARLY_CBMEM_INIT) += cbmem.c
romstage-$(CONFIG_HAVE_ACPI_RESUME) += cbmem.c
ramstage-y += boot.c ramstage-y += boot.c
ramstage-$(CONFIG_MULTIBOOT) += multiboot.c ramstage-$(CONFIG_MULTIBOOT) += multiboot.c

View File

@ -274,6 +274,7 @@ config CONSOLE_NE2K_IO_PORT
boundary, qemu needs broader align) boundary, qemu needs broader align)
config CONSOLE_CBMEM config CONSOLE_CBMEM
depends on (EARLY_CBMEM_INIT || DYNAMIC_CBMEM)
bool "Send console output to a CBMEM buffer" bool "Send console output to a CBMEM buffer"
default n default n
help help

View File

@ -1 +1,2 @@
romstage-$(CONFIG_CACHE_AS_RAM) += car.c romstage-$(CONFIG_EARLY_CBMEM_INIT) += car.c
romstage-$(CONFIG_HAVE_ACPI_RESUME) += car.c

View File

@ -50,7 +50,7 @@ romstage-$(CONFIG_CONSOLE_SERIAL8250MEM) += uart8250mem.c
romstage-$(CONFIG_CONSOLE_NE2K) += ne2k.c romstage-$(CONFIG_CONSOLE_NE2K) += ne2k.c
romstage-$(CONFIG_SPKMODEM) += spkmodem.c romstage-$(CONFIG_SPKMODEM) += spkmodem.c
ifeq ($(CONFIG_CACHE_AS_RAM),y) ifeq ($(CONFIG_EARLY_CBMEM_INIT),y)
romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
romstage-$(CONFIG_USBDEBUG) += usbdebug.c romstage-$(CONFIG_USBDEBUG) += usbdebug.c
@ -108,7 +108,8 @@ ramstage-y += dynamic_cbmem.c
romstage-y += dynamic_cbmem.c romstage-y += dynamic_cbmem.c
else else
ramstage-y += cbmem.c ramstage-y += cbmem.c
romstage-$(CONFIG_CACHE_AS_RAM) += cbmem.c romstage-$(CONFIG_EARLY_CBMEM_INIT) += cbmem.c
romstage-$(CONFIG_HAVE_ACPI_RESUME) += cbmem.c
endif # CONFIG_DYNAMIC_CBMEM endif # CONFIG_DYNAMIC_CBMEM
ramstage-y += cbmem_info.c ramstage-y += cbmem_info.c

View File

@ -95,6 +95,7 @@ void cbmem_late_set_table(uint64_t base, uint64_t size)
* - suspend/resume backup memory * - suspend/resume backup memory
*/ */
#if CONFIG_EARLY_CBMEM_INIT || !defined(__PRE_RAM__)
static void cbmem_init(void) static void cbmem_init(void)
{ {
uint64_t baseaddr, size; uint64_t baseaddr, size;
@ -119,6 +120,7 @@ static void cbmem_init(void)
.size = size - CBMEM_TOC_RESERVED .size = size - CBMEM_TOC_RESERVED
}; };
} }
#endif
int cbmem_reinit(void) int cbmem_reinit(void)
{ {
@ -218,6 +220,7 @@ void *cbmem_find(u32 id)
return (void *)NULL; return (void *)NULL;
} }
#if CONFIG_EARLY_CBMEM_INIT || !defined(__PRE_RAM__)
/* Returns True if it was not initialized before. */ /* Returns True if it was not initialized before. */
int cbmem_initialize(void) int cbmem_initialize(void)
{ {
@ -241,6 +244,7 @@ int cbmem_initialize(void)
return rv; return rv;
} }
#endif
#ifndef __PRE_RAM__ #ifndef __PRE_RAM__
static void init_cbmem_post_device(void *unused) static void init_cbmem_post_device(void *unused)

View File

@ -11,6 +11,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select BOARD_ROMSIZE_KB_256 select BOARD_ROMSIZE_KB_256
select EARLY_CBMEM_INIT
select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT
config MAINBOARD_DIR config MAINBOARD_DIR

View File

@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES
# select HAVE_ACPI_RESUME # select HAVE_ACPI_RESUME
select BOARD_ROMSIZE_KB_256 select BOARD_ROMSIZE_KB_256
select EARLY_CBMEM_INIT
select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT
config MAINBOARD_DIR config MAINBOARD_DIR

View File

@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_SMI_HANDLER select HAVE_SMI_HANDLER
select GFXUMA select GFXUMA
select CHROMEOS select CHROMEOS
select EARLY_CBMEM_INIT
# Workaround for EC/KBC IRQ1. # Workaround for EC/KBC IRQ1.
select SERIRQ_CONTINUOUS_MODE select SERIRQ_CONTINUOUS_MODE

View File

@ -16,6 +16,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select CHROMEOS select CHROMEOS
select SERIRQ_CONTINUOUS_MODE select SERIRQ_CONTINUOUS_MODE
select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT
select EARLY_CBMEM_INIT
select MARK_GRAPHICS_MEM_WRCOMB select MARK_GRAPHICS_MEM_WRCOMB
config MAINBOARD_DIR config MAINBOARD_DIR

View File

@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_SMI_HANDLER select HAVE_SMI_HANDLER
select GFXUMA select GFXUMA
select CHROMEOS select CHROMEOS
select EARLY_CBMEM_INIT
# Workaround for EC/KBC IRQ1. # Workaround for EC/KBC IRQ1.
select SERIRQ_CONTINUOUS_MODE select SERIRQ_CONTINUOUS_MODE

View File

@ -296,7 +296,11 @@ void main(unsigned long bist)
post_code(0x3e); post_code(0x3e);
MCHBAR16(SSKPD) = 0xCAFE; MCHBAR16(SSKPD) = 0xCAFE;
#if CONFIG_EARLY_CBMEM_INIT
cbmem_was_initted = !cbmem_initialize(); cbmem_was_initted = !cbmem_initialize();
#else
cbmem_was_initted = cbmem_reinit();
#endif
#if CONFIG_HAVE_ACPI_RESUME #if CONFIG_HAVE_ACPI_RESUME
/* If there is no high memory area, we didn't boot before, so /* If there is no high memory area, we didn't boot before, so

View File

@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select GFXUMA select GFXUMA
#select CHROMEOS #select CHROMEOS
select EARLY_CBMEM_INIT
config MAINBOARD_DIR config MAINBOARD_DIR
string string

View File

@ -14,6 +14,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select HAVE_SMI_HANDLER select HAVE_SMI_HANDLER
select GFXUMA select GFXUMA
select EARLY_CBMEM_INIT
select ENABLE_VMX select ENABLE_VMX
select HAVE_MRC select HAVE_MRC

View File

@ -21,6 +21,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select CHANNEL_XOR_RANDOMIZATION select CHANNEL_XOR_RANDOMIZATION
select HAVE_ACPI_TABLES select HAVE_ACPI_TABLES
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select EARLY_CBMEM_INIT
config MAINBOARD_DIR config MAINBOARD_DIR
string string
default lenovo/t60 default lenovo/t60

View File

@ -24,6 +24,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select USE_OPTION_TABLE select USE_OPTION_TABLE
select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT
select EARLY_CBMEM_INIT
config MAINBOARD_DIR config MAINBOARD_DIR
string string

View File

@ -15,6 +15,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select SOUTHBRIDGE_INTEL_BD82X6X select SOUTHBRIDGE_INTEL_BD82X6X
select SUPERIO_SMSC_MEC1308 select SUPERIO_SMSC_MEC1308
select DRIVERS_GENERIC_IOAPIC select DRIVERS_GENERIC_IOAPIC
select EARLY_CBMEM_INIT
select HAVE_MRC select HAVE_MRC
config MAINBOARD_DIR config MAINBOARD_DIR

View File

@ -13,6 +13,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
select NORTHBRIDGE_INTEL_SANDYBRIDGE select NORTHBRIDGE_INTEL_SANDYBRIDGE
select SOUTHBRIDGE_INTEL_BD82X6X select SOUTHBRIDGE_INTEL_BD82X6X
select SUPERIO_ITE_IT8772F select SUPERIO_ITE_IT8772F
select EARLY_CBMEM_INIT
select HAVE_MRC select HAVE_MRC
config MAINBOARD_DIR config MAINBOARD_DIR

View File

@ -94,7 +94,9 @@ void main(unsigned long bist)
print_debug("We passed RAM verify\n"); print_debug("We passed RAM verify\n");
/* We got RAM working, now we can write the timestamps to RAM */ /* We got RAM working, now we can write the timestamps to RAM */
#if CONFIG_EARLY_CBMEM_INIT
cbmem_initialize(); cbmem_initialize();
#endif
timestamp_add_now(TS_END_ROMSTAGE); timestamp_add_now(TS_END_ROMSTAGE);
/* FIXME: See if this is needed or take this out please */ /* FIXME: See if this is needed or take this out please */
/* Disable Memcard and SDIO */ /* Disable Memcard and SDIO */

View File

@ -58,6 +58,7 @@ static void save_mrc_data(struct pei_data *pei_data)
{ {
u16 c1, c2, checksum; u16 c1, c2, checksum;
#if CONFIG_EARLY_CBMEM_INIT
struct mrc_data_container *mrcdata; struct mrc_data_container *mrcdata;
int output_len = ALIGN(pei_data->mrc_output_len, 16); int output_len = ALIGN(pei_data->mrc_output_len, 16);
@ -83,6 +84,7 @@ static void save_mrc_data(struct pei_data *pei_data)
mrcdata->mrc_checksum = compute_ip_checksum(mrcdata->mrc_data, mrcdata->mrc_checksum = compute_ip_checksum(mrcdata->mrc_data,
mrcdata->mrc_data_size); mrcdata->mrc_data_size);
#endif
/* Save the MRC seed values to CMOS */ /* Save the MRC seed values to CMOS */
cmos_write32(CMOS_OFFSET_MRC_SEED, pei_data->scrambler_seed); cmos_write32(CMOS_OFFSET_MRC_SEED, pei_data->scrambler_seed);