diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-09-13 10:49:20 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2019-09-14 11:16:17 +0000 |
commit | e3acc8fcf3f1cbf4a527cfcd6aa9aba9bd9d5e2b (patch) | |
tree | e3e162a29482d6b4e0928f2f440881a4e43368d9 /src/lib | |
parent | 4a637802fa6fd8c532ce32e6595298e60e84f6d6 (diff) |
src/: Replace some __PRE_RAM__ use
Change-Id: Iaa56e7b98aad33eeb876edd7465c56c80fd1ac18
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35398
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/cbmem_console.c | 23 | ||||
-rw-r--r-- | src/lib/imd_cbmem.c | 5 | ||||
-rw-r--r-- | src/lib/program.ld | 2 | ||||
-rw-r--r-- | src/lib/reg_script.c | 5 |
4 files changed, 14 insertions, 21 deletions
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 18c3b71b4f..7876ff510a 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -51,16 +51,11 @@ _Static_assert(CONFIG_CONSOLE_CBMEM_BUFFER_SIZE <= MAX_SIZE, static struct cbmem_console *cbmem_console_p CAR_GLOBAL; -#ifdef __PRE_RAM__ /* * While running from ROM, before DRAM is initialized, some area in cache as * RAM space is used for the console buffer storage. The size and location of * the area are defined by the linker script with _(e)preram_cbmem_console. - */ - -#else - -/* + * * When running from RAM, some console output is generated before CBMEM is * reinitialized. This static buffer is used to store that output temporarily, * to be concatenated with the CBMEM console buffer contents accumulated @@ -69,7 +64,6 @@ static struct cbmem_console *cbmem_console_p CAR_GLOBAL; #define STATIC_CONSOLE_SIZE 1024 static u8 static_console[STATIC_CONSOLE_SIZE]; -#endif static struct cbmem_console *current_console(void) { @@ -107,14 +101,13 @@ static void init_console_ptr(void *storage, u32 total_space) void cbmemc_init(void) { -#ifdef __PRE_RAM__ - /* Pre-RAM environments use special buffer placed by linker script. */ - init_console_ptr(_preram_cbmem_console, - REGION_SIZE(preram_cbmem_console)); -#else - /* Post-RAM uses static (BSS) buffer before CBMEM is reinitialized. */ - init_console_ptr(static_console, sizeof(static_console)); -#endif + if (ENV_ROMSTAGE_OR_BEFORE) { + /* Pre-RAM environments use special buffer placed by linker script. */ + init_console_ptr(_preram_cbmem_console, REGION_SIZE(preram_cbmem_console)); + } else { + /* Post-RAM uses static (BSS) buffer before CBMEM is reinitialized. */ + init_console_ptr(static_console, sizeof(static_console)); + } } void cbmemc_tx_byte(unsigned char data) diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c index e5c3e417d3..f04e0862fe 100644 --- a/src/lib/imd_cbmem.c +++ b/src/lib/imd_cbmem.c @@ -172,14 +172,13 @@ int cbmem_initialize_id_size(u32 id, u64 size) if (imd_recover(imd)) return 1; -#if defined(__PRE_RAM__) /* * Lock the imd in romstage on a recovery. The assumption is that * if the imd area was recovered in romstage then S3 resume path * is being taken. */ - imd_lockdown(imd); -#endif + if (ENV_ROMSTAGE) + imd_lockdown(imd); /* Add the specified range first */ if (size) diff --git a/src/lib/program.ld b/src/lib/program.ld index ad364a4b0c..a9d4e48293 100644 --- a/src/lib/program.ld +++ b/src/lib/program.ld @@ -108,7 +108,7 @@ *(.sdata); *(.sdata.*); -#ifdef __PRE_RAM__ +#if ENV_ROMSTAGE_OR_BEFORE PROVIDE(_preram_cbmem_console = .); PROVIDE(_epreram_cbmem_console = _preram_cbmem_console); #elif ENV_RAMSTAGE diff --git a/src/lib/reg_script.c b/src/lib/reg_script.c index 50cf7b6d08..5f4fa9fa11 100644 --- a/src/lib/reg_script.c +++ b/src/lib/reg_script.c @@ -36,7 +36,8 @@ #endif #define POLL_DELAY 100 /* 100us */ -#if defined(__PRE_RAM__) + +#ifdef __SIMPLE_DEVICE__ #define EMPTY_DEV 0 #else #define EMPTY_DEV NULL @@ -68,7 +69,7 @@ reg_script_get_step(struct reg_script_context *ctx) static struct resource *reg_script_get_resource(struct reg_script_context *ctx) { -#if defined(__PRE_RAM__) +#ifdef __SIMPLE_DEVICE__ return NULL; #else struct resource *res; |