summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/device/device_const.c2
-rw-r--r--src/ec/google/chromeec/ec_boardid.c2
-rw-r--r--src/ec/google/chromeec/ec_lpc.c2
-rw-r--r--src/ec/google/wilco/boardid.c2
-rw-r--r--src/include/stddef.h13
-rw-r--r--src/lib/lzma.c2
-rw-r--r--src/lib/timestamp.c2
-rw-r--r--src/mainboard/google/stout/chromeos.c4
-rw-r--r--src/mainboard/intel/glkrvp/boardid.c2
-rw-r--r--src/mainboard/intel/glkrvp/variants/baseboard/boardid.c2
-rw-r--r--src/mainboard/intel/icelake_rvp/board_id.c2
-rw-r--r--src/mainboard/intel/kblrvp/board_id.c2
-rw-r--r--src/security/tpm/tspi/log.c4
-rw-r--r--src/soc/intel/baytrail/northcluster.c2
-rw-r--r--src/soc/intel/braswell/northcluster.c2
-rw-r--r--toolchain.inc2
16 files changed, 26 insertions, 21 deletions
diff --git a/src/device/device_const.c b/src/device/device_const.c
index c472aeaa79..0712d0c639 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -204,7 +204,7 @@ DEVTREE_CONST struct device *pcidev_path_on_bus(unsigned int bus, pci_devfn_t de
DEVTREE_CONST struct bus *pci_root_bus(void)
{
DEVTREE_CONST struct device *pci_domain;
- MAYBE_STATIC DEVTREE_CONST struct bus *pci_root = NULL;
+ MAYBE_STATIC_BSS DEVTREE_CONST struct bus *pci_root = NULL;
if (pci_root)
return pci_root;
diff --git a/src/ec/google/chromeec/ec_boardid.c b/src/ec/google/chromeec/ec_boardid.c
index 01e3c90e3a..1307ce17b6 100644
--- a/src/ec/google/chromeec/ec_boardid.c
+++ b/src/ec/google/chromeec/ec_boardid.c
@@ -18,7 +18,7 @@
uint32_t board_id(void)
{
- MAYBE_STATIC uint32_t id = BOARD_ID_INIT;
+ MAYBE_STATIC_NONZERO uint32_t id = BOARD_ID_INIT;
if (id == BOARD_ID_INIT) {
if (google_chromeec_get_board_version(&id))
diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c
index feea9dd483..1d7e7ee7c8 100644
--- a/src/ec/google/chromeec/ec_lpc.c
+++ b/src/ec/google/chromeec/ec_lpc.c
@@ -401,7 +401,7 @@ void google_chromeec_ioport_range(uint16_t *out_base, size_t *out_size)
int google_chromeec_command(struct chromeec_command *cec_command)
{
- MAYBE_STATIC int command_version = 0;
+ MAYBE_STATIC_BSS int command_version = 0;
if (command_version <= 0)
command_version = google_chromeec_command_version();
diff --git a/src/ec/google/wilco/boardid.c b/src/ec/google/wilco/boardid.c
index e602e6e0c7..2a7e5755ea 100644
--- a/src/ec/google/wilco/boardid.c
+++ b/src/ec/google/wilco/boardid.c
@@ -18,7 +18,7 @@
uint32_t board_id(void)
{
- MAYBE_STATIC uint32_t id = BOARD_ID_INIT;
+ MAYBE_STATIC_NONZERO uint32_t id = BOARD_ID_INIT;
if (id == BOARD_ID_INIT) {
uint8_t ec_id;
diff --git a/src/include/stddef.h b/src/include/stddef.h
index 7cae2e6dc8..a2c9c50cd2 100644
--- a/src/include/stddef.h
+++ b/src/include/stddef.h
@@ -35,11 +35,16 @@ typedef unsigned int wint_t;
#define DEVTREE_CONST
#endif
-/* Work around non-writable data segment in execute-in-place romstage on x86. */
-#if defined(__PRE_RAM__) && CONFIG(ARCH_X86)
-#define MAYBE_STATIC
+#if ENV_STAGE_HAS_DATA_SECTION
+#define MAYBE_STATIC_NONZERO static
#else
-#define MAYBE_STATIC static
+#define MAYBE_STATIC_NONZERO
+#endif
+
+#if ENV_STAGE_HAS_BSS_SECTION
+#define MAYBE_STATIC_BSS static
+#else
+#define MAYBE_STATIC_BSS
#endif
#ifndef __ROMCC__
diff --git a/src/lib/lzma.c b/src/lib/lzma.c
index eecbb267d2..71c016ebcd 100644
--- a/src/lib/lzma.c
+++ b/src/lib/lzma.c
@@ -26,7 +26,7 @@ size_t ulzman(const void *src, size_t srcn, void *dst, size_t dstn)
int res;
CLzmaDecoderState state;
SizeT mallocneeds;
- MAYBE_STATIC unsigned char scratchpad[15980];
+ MAYBE_STATIC_BSS unsigned char scratchpad[15980];
const unsigned char *cp;
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 1319b86670..89152fd264 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -128,7 +128,7 @@ static int timestamp_should_run(void)
static struct timestamp_table *timestamp_table_get(void)
{
- MAYBE_STATIC struct timestamp_table *ts_table = NULL;
+ MAYBE_STATIC_BSS struct timestamp_table *ts_table = NULL;
struct timestamp_cache *ts_cache;
if (ts_table != NULL)
diff --git a/src/mainboard/google/stout/chromeos.c b/src/mainboard/google/stout/chromeos.c
index 44784b4fe9..09144507b8 100644
--- a/src/mainboard/google/stout/chromeos.c
+++ b/src/mainboard/google/stout/chromeos.c
@@ -71,8 +71,8 @@ int get_lid_switch(void)
*/
int get_recovery_mode_switch(void)
{
- MAYBE_STATIC int ec_in_rec_mode = 0;
- MAYBE_STATIC int ec_rec_flag_good = 0;
+ MAYBE_STATIC_BSS int ec_in_rec_mode = 0;
+ MAYBE_STATIC_BSS int ec_rec_flag_good = 0;
if (ec_rec_flag_good)
return ec_in_rec_mode;
diff --git a/src/mainboard/intel/glkrvp/boardid.c b/src/mainboard/intel/glkrvp/boardid.c
index 0676eaca32..1a7b3e383f 100644
--- a/src/mainboard/intel/glkrvp/boardid.c
+++ b/src/mainboard/intel/glkrvp/boardid.c
@@ -25,7 +25,7 @@
uint32_t board_id(void)
{
- MAYBE_STATIC int id = -1;
+ MAYBE_STATIC_NONZERO int id = -1;
if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC))
id = variant_board_id();
diff --git a/src/mainboard/intel/glkrvp/variants/baseboard/boardid.c b/src/mainboard/intel/glkrvp/variants/baseboard/boardid.c
index 69a0a9116a..89a736f1bf 100644
--- a/src/mainboard/intel/glkrvp/variants/baseboard/boardid.c
+++ b/src/mainboard/intel/glkrvp/variants/baseboard/boardid.c
@@ -19,7 +19,7 @@
int variant_board_id(void)
{
- MAYBE_STATIC uint32_t id = BOARD_ID_INIT;
+ MAYBE_STATIC_NONZERO uint32_t id = BOARD_ID_INIT;
if (CONFIG(EC_GOOGLE_CHROMEEC)) {
if (id == BOARD_ID_INIT) {
diff --git a/src/mainboard/intel/icelake_rvp/board_id.c b/src/mainboard/intel/icelake_rvp/board_id.c
index b56f047008..c0def22d38 100644
--- a/src/mainboard/intel/icelake_rvp/board_id.c
+++ b/src/mainboard/intel/icelake_rvp/board_id.c
@@ -31,7 +31,7 @@ static int get_board_id_via_ext_ec(void)
/* Get Board ID via EC I/O port write/read */
int get_board_id(void)
{
- MAYBE_STATIC int id = -1;
+ MAYBE_STATIC_NONZERO int id = -1;
if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC))
diff --git a/src/mainboard/intel/kblrvp/board_id.c b/src/mainboard/intel/kblrvp/board_id.c
index a978e0ff86..dc5afcfbcf 100644
--- a/src/mainboard/intel/kblrvp/board_id.c
+++ b/src/mainboard/intel/kblrvp/board_id.c
@@ -22,7 +22,7 @@
*/
int get_ec_boardinfo(void)
{
- MAYBE_STATIC int ec_info = -1;
+ MAYBE_STATIC_NONZERO int ec_info = -1;
if (ec_info < 0) {
uint8_t buffer[2];
uint8_t index;
diff --git a/src/security/tpm/tspi/log.c b/src/security/tpm/tspi/log.c
index 4019962a22..99e6a434fc 100644
--- a/src/security/tpm/tspi/log.c
+++ b/src/security/tpm/tspi/log.c
@@ -26,7 +26,7 @@
static struct tcpa_table *tcpa_cbmem_init(void)
{
- MAYBE_STATIC struct tcpa_table *tclt = NULL;
+ MAYBE_STATIC_BSS struct tcpa_table *tclt = NULL;
if (tclt)
return tclt;
@@ -47,7 +47,7 @@ static struct tcpa_table *tcpa_cbmem_init(void)
static struct tcpa_table *tcpa_log_init(void)
{
- MAYBE_STATIC struct tcpa_table *tclt = NULL;
+ MAYBE_STATIC_BSS struct tcpa_table *tclt = NULL;
/* We are dealing here with pre CBMEM environment.
* If cbmem isn't available use CAR or SRAM */
diff --git a/src/soc/intel/baytrail/northcluster.c b/src/soc/intel/baytrail/northcluster.c
index 5f33c86c9b..654d2371e7 100644
--- a/src/soc/intel/baytrail/northcluster.c
+++ b/src/soc/intel/baytrail/northcluster.c
@@ -64,7 +64,7 @@
uint32_t nc_read_top_of_low_memory(void)
{
- MAYBE_STATIC uint32_t tolm = 0;
+ MAYBE_STATIC_BSS uint32_t tolm = 0;
if (tolm)
return tolm;
diff --git a/src/soc/intel/braswell/northcluster.c b/src/soc/intel/braswell/northcluster.c
index 8a5f02e48d..e3e3aa79ff 100644
--- a/src/soc/intel/braswell/northcluster.c
+++ b/src/soc/intel/braswell/northcluster.c
@@ -71,7 +71,7 @@
uint32_t nc_read_top_of_low_memory(void)
{
- MAYBE_STATIC uint32_t tolm = 0;
+ MAYBE_STATIC_BSS uint32_t tolm = 0;
if (tolm)
return tolm;
diff --git a/toolchain.inc b/toolchain.inc
index 875cb20387..4c0408ccfd 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -72,7 +72,7 @@ CFLAGS_ppc64 +=
# stack use, we use 1.5K as heuristic, assuming that we typically have lots
# of tiny stack frames and the odd large one.
#
-# Store larger buffers in BSS, use MAYBE_STATIC to share code with __PRE_RAM__
+# Store larger buffers in BSS, use MAYBE_STATIC_BSS to share code with __PRE_RAM__
# on x86.
# Since GCCs detection of dynamic array bounds unfortunately seems to be
# very basic, you'll sometimes have to use a static upper bound for the