rules.h: Use more consistent naming

Use 'ENV' consistently and drop the redundant 'STAGE' in the naming.

Change-Id: I51f2a7e70eefad12aa214e92f23e5fd2edf46698
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64296
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Arthur Heymans 2022-05-12 18:01:13 +02:00 committed by Julius Werner
parent 94223c4165
commit 6acc05ed31
8 changed files with 19 additions and 19 deletions

View File

@ -142,7 +142,7 @@ void ec_clr_bit(u8 addr, u8 bit)
void ec_set_ports(u16 cmd_reg, u16 data_reg) void ec_set_ports(u16 cmd_reg, u16 data_reg)
{ {
if (!ENV_STAGE_HAS_DATA_SECTION) if (!ENV_HAS_DATA_SECTION)
return; return;
ec_cmd_reg = cmd_reg; ec_cmd_reg = cmd_reg;

View File

@ -268,15 +268,15 @@
/* Indicates memory layout is determined with arch/x86/car.ld. */ /* Indicates memory layout is determined with arch/x86/car.ld. */
#define ENV_CACHE_AS_RAM (ENV_ROMSTAGE_OR_BEFORE && !CONFIG(RESET_VECTOR_IN_RAM)) #define ENV_CACHE_AS_RAM (ENV_ROMSTAGE_OR_BEFORE && !CONFIG(RESET_VECTOR_IN_RAM))
/* No .data sections with execute-in-place from ROM. */ /* No .data sections with execute-in-place from ROM. */
#define ENV_STAGE_HAS_DATA_SECTION !ENV_CACHE_AS_RAM #define ENV_HAS_DATA_SECTION !ENV_CACHE_AS_RAM
#else #else
/* Both .data and .bss, sometimes SRAM not DRAM. */ /* Both .data and .bss, sometimes SRAM not DRAM. */
#define ENV_STAGE_HAS_DATA_SECTION 1 #define ENV_HAS_DATA_SECTION 1
#define ENV_CACHE_AS_RAM 0 #define ENV_CACHE_AS_RAM 0
#endif #endif
/* Currently rmodules, ramstage and smm have heap. */ /* Currently rmodules, ramstage and smm have heap. */
#define ENV_STAGE_HAS_HEAP_SECTION (ENV_RMODULE || ENV_RAMSTAGE || ENV_SMM) #define ENV_HAS_HEAP_SECTION (ENV_RMODULE || ENV_RAMSTAGE || ENV_SMM)
/* Set USER_SPACE in the makefile for the rare code that runs in userspace */ /* Set USER_SPACE in the makefile for the rare code that runs in userspace */
#if defined(__USER_SPACE__) #if defined(__USER_SPACE__)
@ -293,21 +293,21 @@
#endif #endif
#if ENV_X86 #if ENV_X86
#define STAGE_HAS_SPINLOCKS !ENV_ROMSTAGE_OR_BEFORE #define ENV_HAS_SPINLOCKS !ENV_ROMSTAGE_OR_BEFORE
#elif ENV_RISCV #elif ENV_RISCV
#define STAGE_HAS_SPINLOCKS 1 #define ENV_HAS_SPINLOCKS 1
#else #else
#define STAGE_HAS_SPINLOCKS 0 #define ENV_HAS_SPINLOCKS 0
#endif #endif
/* When set <arch/smp/spinlock.h> is included for the spinlock implementation. */ /* When set <arch/smp/spinlock.h> is included for the spinlock implementation. */
#define ENV_STAGE_SUPPORTS_SMP (CONFIG(SMP) && STAGE_HAS_SPINLOCKS) #define ENV_SUPPORTS_SMP (CONFIG(SMP) && ENV_HAS_SPINLOCKS)
#if ENV_X86 && CONFIG(COOP_MULTITASKING) && (ENV_RAMSTAGE || ENV_ROMSTAGE) #if ENV_X86 && CONFIG(COOP_MULTITASKING) && (ENV_RAMSTAGE || ENV_ROMSTAGE)
/* TODO: Enable in all x86 stages */ /* TODO: Enable in all x86 stages */
#define ENV_STAGE_SUPPORTS_COOP 1 #define ENV_SUPPORTS_COOP 1
#else #else
#define ENV_STAGE_SUPPORTS_COOP 0 #define ENV_SUPPORTS_COOP 0
#endif #endif
/** /**

View File

@ -1,7 +1,7 @@
#ifndef SMP_SPINLOCK_H #ifndef SMP_SPINLOCK_H
#define SMP_SPINLOCK_H #define SMP_SPINLOCK_H
#if ENV_STAGE_SUPPORTS_SMP #if ENV_SUPPORTS_SMP
#include <arch/smp/spinlock.h> #include <arch/smp/spinlock.h>
#else /* !CONFIG_SMP */ #else /* !CONFIG_SMP */

View File

@ -32,7 +32,7 @@ typedef __WINT_TYPE__ wint_t;
#define DEVTREE_CONST #define DEVTREE_CONST
#endif #endif
#if ENV_STAGE_HAS_DATA_SECTION #if ENV_HAS_DATA_SECTION
#define MAYBE_STATIC_NONZERO static #define MAYBE_STATIC_NONZERO static
#else #else
#define MAYBE_STATIC_NONZERO #define MAYBE_STATIC_NONZERO

View File

@ -37,7 +37,7 @@ int thread_run_until(struct thread_handle *handle, enum cb_err (*func)(void *),
/* Waits until the thread has terminated and returns the error code */ /* Waits until the thread has terminated and returns the error code */
enum cb_err thread_join(struct thread_handle *handle); enum cb_err thread_join(struct thread_handle *handle);
#if ENV_STAGE_SUPPORTS_COOP #if ENV_SUPPORTS_COOP
struct thread { struct thread {
int id; int id;

View File

@ -19,7 +19,7 @@
#include <thread.h> #include <thread.h>
#include <timestamp.h> #include <timestamp.h>
#if ENV_STAGE_HAS_DATA_SECTION #if ENV_HAS_DATA_SECTION
struct mem_pool cbfs_cache = struct mem_pool cbfs_cache =
MEM_POOL_INIT(_cbfs_cache, REGION_SIZE(cbfs_cache), CONFIG_CBFS_CACHE_ALIGN); MEM_POOL_INIT(_cbfs_cache, REGION_SIZE(cbfs_cache), CONFIG_CBFS_CACHE_ALIGN);
#else #else
@ -363,7 +363,7 @@ static enum cb_err get_preload_rdev(struct region_device *rdev, const char *name
enum cb_err err; enum cb_err err;
struct cbfs_preload_context *context; struct cbfs_preload_context *context;
if (!CONFIG(CBFS_PRELOAD) || !ENV_STAGE_SUPPORTS_COOP) if (!CONFIG(CBFS_PRELOAD) || !ENV_SUPPORTS_COOP)
return CB_ERR_ARG; return CB_ERR_ARG;
context = find_cbfs_preload_context(name); context = find_cbfs_preload_context(name);

View File

@ -72,7 +72,7 @@
#endif #endif
/* Include data, bss, and heap in that order. Not defined for all stages. */ /* Include data, bss, and heap in that order. Not defined for all stages. */
#if ENV_STAGE_HAS_DATA_SECTION #if ENV_HAS_DATA_SECTION
.data . : { .data . : {
. = ALIGN(ARCH_CACHELINE_ALIGN_SIZE); . = ALIGN(ARCH_CACHELINE_ALIGN_SIZE);
_data = .; _data = .;
@ -130,7 +130,7 @@
} }
#endif #endif
#if ENV_STAGE_HAS_HEAP_SECTION #if ENV_HAS_HEAP_SECTION
.heap . : { .heap . : {
. = ALIGN(ARCH_POINTER_ALIGN_SIZE); . = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_heap = .; _heap = .;

View File

@ -47,7 +47,7 @@ static struct bdk_devicetree_key_value *bdk_config_duplicate(
*/ */
int bdk_config_set_fdt(const struct bdk_devicetree_key_value *fdt) int bdk_config_set_fdt(const struct bdk_devicetree_key_value *fdt)
{ {
if (ENV_STAGE_HAS_HEAP_SECTION) if (ENV_HAS_HEAP_SECTION)
config_fdt = bdk_config_duplicate(fdt, 0); config_fdt = bdk_config_duplicate(fdt, 0);
else else
config_fdt = (void *)fdt; config_fdt = (void *)fdt;
@ -203,7 +203,7 @@ void bdk_config_set_int(int64_t value, bdk_config_t cfg_item, ...)
/* Make sure the correct access function was called */ /* Make sure the correct access function was called */
assert(config_info[cfg_item].ctype == BDK_CONFIG_TYPE_INT); assert(config_info[cfg_item].ctype == BDK_CONFIG_TYPE_INT);
if (!ENV_STAGE_HAS_HEAP_SECTION) if (!ENV_HAS_HEAP_SECTION)
return; return;
if (!config_fdt) if (!config_fdt)