CBMEM: Always select CAR_MIGRATION
If romstage does not make cbmem_initialize() call, linker should optimize the code for CAR migration away. This simplifies design of CBMEM console by a considerable amount. As console buffer is now migrated within cbmem_initialize() call there is no longer need for cbmemc_reinit() call made at end of romstage. Change-Id: I8675ecaafb641fa02675e9ba3f374caa8e240f1d Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3916 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@google.com>
This commit is contained in:
parent
de1fe7f655
commit
cbf5bdfe67
|
@ -47,7 +47,7 @@ void __attribute__((weak)) backup_top_of_ram(uint64_t ramtop)
|
|||
|
||||
/* This is for compatibility with old boards only. Any new chipset and board
|
||||
* must implement get_top_of_ram() for both romstage and ramstage to support
|
||||
* features like CAR_MIGRATION and CBMEM_CONSOLE.
|
||||
* early features like COLLECT_TIMESTAMPS and CBMEM_CONSOLE.
|
||||
*/
|
||||
void set_top_of_ram(uint64_t ramtop)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@ config CPU_SPECIFIC_OPTIONS
|
|||
#select AP_IN_SIPI_WAIT
|
||||
select TSC_SYNC_MFENCE
|
||||
select CPU_INTEL_FIRMWARE_INTERFACE_TABLE
|
||||
select CAR_MIGRATION
|
||||
|
||||
config BOOTBLOCK_CPU_INIT
|
||||
string
|
||||
|
|
|
@ -278,7 +278,6 @@ void romstage_common(const struct romstage_params *params)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
}
|
||||
|
||||
|
|
|
@ -115,12 +115,3 @@ config X86_AMD_FIXED_MTRRS
|
|||
help
|
||||
This option informs the MTRR code to use the RdMem and WrMem fields
|
||||
in the fixed MTRR MSRs.
|
||||
|
||||
config CAR_MIGRATION
|
||||
def_bool n
|
||||
depends on DYNAMIC_CBMEM || EARLY_CBMEM_INIT
|
||||
help
|
||||
Migrate the cache-as-ram variables to CBMEM once CBMEM is set up
|
||||
in romstage. This option is only needed if one will be doing more
|
||||
work in romstage after the cache-as-ram is torn down aside from
|
||||
loading ramstage.
|
||||
|
|
|
@ -1 +1 @@
|
|||
romstage-$(CONFIG_CAR_MIGRATION) += car.c
|
||||
romstage-$(CONFIG_CACHE_AS_RAM) += car.c
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#define CAR_CBMEM
|
||||
#endif
|
||||
|
||||
#if CONFIG_CAR_MIGRATION && defined(__PRE_RAM__)
|
||||
#if defined(__PRE_RAM__)
|
||||
#define CAR_MIGRATE_ATTR __attribute__ ((used,section (".car.migrate")))
|
||||
|
||||
/* Call migrate_fn_() when CAR globals are migrated. */
|
||||
|
|
|
@ -59,13 +59,13 @@ enum timestamp_id {
|
|||
void timestamp_init(tsc_t base);
|
||||
void timestamp_add(enum timestamp_id id, tsc_t ts_time);
|
||||
void timestamp_add_now(enum timestamp_id id);
|
||||
void timestamp_sync(void);
|
||||
void timestamp_reinit(void);
|
||||
tsc_t get_initial_timestamp(void);
|
||||
#else
|
||||
#define timestamp_init(base)
|
||||
#define timestamp_add(id, time)
|
||||
#define timestamp_add_now(id)
|
||||
#define timestamp_sync()
|
||||
#define timestamp_reinit()
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,17 +45,6 @@ static struct cbmem_console *cbmem_console_p CAR_GLOBAL;
|
|||
|
||||
static struct cbmem_console car_cbmem_console CAR_CBMEM;
|
||||
|
||||
/*
|
||||
* Once DRAM is initialized and the cache as ram mode is disabled, while still
|
||||
* running from ROM, the console buffer in the cache as RAM area becomes
|
||||
* unavailable.
|
||||
*
|
||||
* By this time the console log buffer is already available in
|
||||
* CBMEM. The location at 0x600 is used as the redirect pointer allowing to
|
||||
* find out where the actual console log buffer is.
|
||||
*/
|
||||
#define CBMEM_CONSOLE_REDIRECT (*((struct cbmem_console **)0x600))
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
|
@ -69,30 +58,12 @@ static u8 static_console[40000];
|
|||
|
||||
static inline struct cbmem_console *current_console(void)
|
||||
{
|
||||
#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
|
||||
return car_get_var(cbmem_console_p);
|
||||
#else
|
||||
/*
|
||||
* This check allows to tell if the cache as RAM mode has been exited
|
||||
* or not. If it has been exited, the real memory is being used
|
||||
* (resulting in the variable on the stack located below
|
||||
* DCACHE_RAM_BASE), use the redirect pointer to find out where the
|
||||
* actual console buffer is.
|
||||
*/
|
||||
if ((uintptr_t)__builtin_frame_address(0) <
|
||||
(uintptr_t)CONFIG_DCACHE_RAM_BASE)
|
||||
return CBMEM_CONSOLE_REDIRECT;
|
||||
return car_get_var(cbmem_console_p);
|
||||
#endif /* CONFIG_CAR_MIGRATION */
|
||||
}
|
||||
|
||||
static inline void current_console_set(struct cbmem_console *new_console_p)
|
||||
{
|
||||
#if CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
|
||||
car_set_var(cbmem_console_p, new_console_p);
|
||||
#else
|
||||
CBMEM_CONSOLE_REDIRECT = new_console_p;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void init_console_ptr(void *storage, u32 total_space)
|
||||
|
@ -193,7 +164,7 @@ static void copy_console_buffer(struct cbmem_console *new_cons_p)
|
|||
new_cons_p->buffer_cursor = cursor;
|
||||
}
|
||||
|
||||
static void cbmemc_reinit_(void)
|
||||
void cbmemc_reinit(void)
|
||||
{
|
||||
struct cbmem_console *cbm_cons_p = NULL;
|
||||
|
||||
|
@ -221,12 +192,5 @@ static void cbmemc_reinit_(void)
|
|||
current_console_set(cbm_cons_p);
|
||||
}
|
||||
|
||||
void cbmemc_reinit(void)
|
||||
{
|
||||
#if !CONFIG_CAR_MIGRATION || !defined(__PRE_RAM__)
|
||||
cbmemc_reinit_();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Call cbmemc_reinit_() at CAR migration time. */
|
||||
CAR_MIGRATE(cbmemc_reinit_)
|
||||
/* Call cbmemc_reinit() at CAR migration time. */
|
||||
CAR_MIGRATE(cbmemc_reinit)
|
||||
|
|
|
@ -177,7 +177,7 @@ static boot_state_t bs_post_device(void *arg)
|
|||
{
|
||||
timestamp_add_now(TS_DEVICE_DONE);
|
||||
|
||||
timestamp_sync();
|
||||
timestamp_reinit();
|
||||
|
||||
return BS_OS_RESUME_CHECK;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ void timestamp_init(tsc_t base)
|
|||
#endif
|
||||
}
|
||||
|
||||
void timestamp_sync(void)
|
||||
void timestamp_reinit(void)
|
||||
{
|
||||
if (!boot_cpu())
|
||||
return;
|
||||
|
@ -154,3 +154,6 @@ void timestamp_sync(void)
|
|||
if (ts_table)
|
||||
timestamp_do_sync();
|
||||
}
|
||||
|
||||
/* Call timestamp_reinit at CAR migration time. */
|
||||
CAR_MIGRATE(timestamp_reinit)
|
||||
|
|
|
@ -974,7 +974,6 @@ void pci_ehci_read_resources(struct device *dev)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_CAR_MIGRATION
|
||||
#if !defined(__PRE_RAM__) && !defined(__SMM__)
|
||||
static int get_usbdebug_from_cbmem(struct ehci_debug_info *info)
|
||||
{
|
||||
|
@ -1004,7 +1003,6 @@ static void migrate_ehci_debug(void)
|
|||
}
|
||||
CAR_MIGRATE(migrate_ehci_debug);
|
||||
#endif
|
||||
#endif /* CONFIG_CAR_MIGRATION */
|
||||
|
||||
unsigned long pci_ehci_base_regs(pci_devfn_t sdev)
|
||||
{
|
||||
|
@ -1036,7 +1034,7 @@ int usbdebug_init(void)
|
|||
{
|
||||
struct ehci_debug_info *dbg_info = dbgp_ehci_info();
|
||||
|
||||
#if CONFIG_CAR_MIGRATION && !defined(__PRE_RAM__) && !defined(__SMM__)
|
||||
#if !defined(__PRE_RAM__) && !defined(__SMM__)
|
||||
if (!get_usbdebug_from_cbmem(dbg_info))
|
||||
return 0;
|
||||
#endif
|
||||
|
|
|
@ -51,11 +51,6 @@ void main(unsigned long bist)
|
|||
cbmem_was_initted = !cbmem_initialize();
|
||||
|
||||
timestamp_init(rdtsc());
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_START_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -53,11 +53,6 @@ void main(unsigned long bist)
|
|||
cbmem_was_initted = !cbmem_initialize();
|
||||
|
||||
timestamp_init(rdtsc());
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_START_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -273,10 +273,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -316,10 +316,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -274,10 +274,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -326,10 +326,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -328,10 +328,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -322,10 +322,5 @@ void main(unsigned long bist)
|
|||
}
|
||||
#endif
|
||||
post_code(0x3f);
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -343,11 +343,6 @@ void main(unsigned long bist)
|
|||
}
|
||||
#endif
|
||||
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -347,11 +347,6 @@ void main(unsigned long bist)
|
|||
}
|
||||
#endif
|
||||
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -347,10 +347,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -354,10 +354,5 @@ void main(unsigned long bist)
|
|||
#if CONFIG_CHROMEOS
|
||||
init_chromeos(boot_mode);
|
||||
#endif
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
#if CONFIG_CONSOLE_CBMEM
|
||||
/* Keep this the last thing this function does. */
|
||||
cbmemc_reinit();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -95,7 +95,6 @@ void main(unsigned long bist)
|
|||
|
||||
/* We got RAM working, now we can write the timestamps to RAM */
|
||||
cbmem_initialize();
|
||||
timestamp_sync();
|
||||
timestamp_add_now(TS_END_ROMSTAGE);
|
||||
/* FIXME: See if this is needed or take this out please */
|
||||
/* Disable Memcard and SDIO */
|
||||
|
|
Loading…
Reference in New Issue