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

@ -111,7 +111,7 @@ VB_SOURCE := vboot_reference
INCLUDES += -I$(VB_SOURCE)/firmware/2lib/include
INCLUDES += -I$(VB_SOURCE)/firmware/include
verstage-generic-ccopts += -D__PRE_RAM__ -D__VER_STAGE__
verstage-generic-ccopts += -D__PRE_RAM__ -D__VERSTAGE__
ifeq ($(CONFIG_RETURN_FROM_VERSTAGE),y)
bootblock-y += verstub.c chromeos.c

View file

@ -107,7 +107,7 @@ int vboot_skip_display_init(void)
#endif
}
#ifdef __PRE_RAM__
#ifdef __ROMSTAGE__
void __attribute__((weak)) save_chromeos_gpios(void)
{
// Can be implemented by a mainboard

View file

@ -32,7 +32,7 @@ int get_write_protect_state(void);
/*for mainboard use only*/
void setup_chromeos_gpios(void);
#ifdef __PRE_RAM__
#ifdef __ROMSTAGE__
void __attribute__((weak)) save_chromeos_gpios(void);
#endif