Add predefined __ROMSTAGE__ and __RAMSTAGE__ macros

This patch adds the macros __ROMSTAGE__ and __RAMSTAGE__ which get
predefined in their respective stages by make, so that we have one
specific macro for every stage. It also renames __BOOT_BLOCK__ and
__VER_STAGE__ to __BOOTBLOCK__ and __VERSTAGE__ for consistency.

This change is intended to provided finer control and clearer
communication of intent after we added a new (optional) stage that falls
under __PRE_RAM__, and will hopefully provide some robustness for the
future (we don't want to end up always checking for romstage with #if
defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__) &&
!defined(__VER_STAGE__) && !defined(__YET_ANOTHER_PRERAM_STAGE__)). The
__PRE_RAM__ macro stays as it is since many features do in fact need to
differentiate on whether RAM is available. (Some also depend on whether
RAM is available at the end of a stage, in which case #if
!defined(__PRE_RAM__) || defined(__ROMSTAGE__) should now be
authoritative.)

It's unfeasable to change all existing occurences of __PRE_RAM__ that
would be better described with __ROMSTAGE__, so this patch only
demonstratively changes a few obvious ones in core code.

BUG=None
TEST=None (tested together with dependent patch).

Change-Id: I6a1f25f7077328a8b5201a79b18fc4c2e22d0b06
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/219172
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Julius Werner 2014-09-15 22:10:33 -07:00 committed by chrome-internal-fetch
commit a4ad042746
16 changed files with 24 additions and 37 deletions

View file

@ -85,7 +85,7 @@ void selfboot(void *entry);
/* Defined in individual arch / board implementation. */
int init_default_cbfs_media(struct cbfs_media *media);
#if CONFIG_RELOCATABLE_RAMSTAGE && defined(__PRE_RAM__)
#if CONFIG_RELOCATABLE_RAMSTAGE && defined(__ROMSTAGE__)
/* The cache_loaded_ramstage() and load_cached_ramstage() functions are defined
* to be weak so that board and chipset code may override them. Their job is to
* cache and load the ramstage for quick S3 resume. By default a copy of the

View file

@ -84,8 +84,8 @@ void __attribute__ ((noreturn)) die(const char *msg);
int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
int vprintk(int msg_level, const char *fmt, va_list args);
#if defined(__BOOT_BLOCK__) && !CONFIG_BOOTBLOCK_CONSOLE || \
(defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__)) && !CONFIG_EARLY_CONSOLE
#if defined(__BOOTBLOCK__) && !CONFIG_BOOTBLOCK_CONSOLE || \
(defined(__PRE_RAM__) && !defined(__BOOTBLOCK__)) && !CONFIG_EARLY_CONSOLE
static inline void printk(int LEVEL, const char *fmt, ...);
static inline void printk(int LEVEL, const char *fmt, ...) {

View file

@ -40,7 +40,7 @@ struct romstage_handoff {
uint32_t ramstage_entry_point;
};
#if defined(__PRE_RAM__)
#if defined(__ROMSTAGE__)
/* The romstage_handoff_find_or_add() function provides the necessary logic
* for initializng the romstage_handoff structure in cbmem. Different components
* of the romstage may be responsible for setting up different fields. Therefore