Browse Source

Remove MAYBE_STATIC_BSS and ENV_STAGE_HAS_BSS_SECTION

After removal of CAR_MIGRATION there are no more reasons
to carry around ENV_STAGE_HAS_BSS_SECTION=n case.

Replace 'MAYBE_STATIC_BSS' with 'static' and remove explicit
zero-initializers.

Change-Id: I14dd9f52da5b06f0116bd97496cf794e5e71bc37
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40535
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
changes/35/40535/4
Kyösti Mälkki 1 year ago
committed by Patrick Georgi
parent
commit
fcbbb91116
  1. 2
      src/arch/x86/car.ld
  2. 2
      src/device/device_const.c
  3. 2
      src/drivers/pc80/rtc/option.c
  4. 2
      src/ec/google/chromeec/ec.c
  5. 2
      src/ec/google/chromeec/ec_lpc.c
  6. 3
      src/include/rules.h
  7. 6
      src/include/stddef.h
  8. 2
      src/lib/imd_cbmem.c
  9. 2
      src/lib/lzma.c
  10. 2
      src/lib/program.ld
  11. 4
      src/mainboard/google/stout/chromeos.c
  12. 4
      src/security/tpm/tspi/log.c
  13. 2
      src/soc/intel/baytrail/northcluster.c
  14. 2
      src/soc/intel/braswell/northcluster.c
  15. 2
      toolchain.inc

2
src/arch/x86/car.ld

@ -62,13 +62,11 @@
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_bss = .;
#if ENV_STAGE_HAS_BSS_SECTION
/* Allow global uninitialized variables for stages without CAR teardown. */
*(.bss)
*(.bss.*)
*(.sbss)
*(.sbss.*)
#endif
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_ebss = .;
_car_unallocated_start = .;

2
src/device/device_const.c

@ -227,7 +227,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_BSS DEVTREE_CONST struct bus *pci_root = NULL;
static DEVTREE_CONST struct bus *pci_root;
if (pci_root)
return pci_root;

2
src/drivers/pc80/rtc/option.c

@ -52,7 +52,7 @@ static enum cb_err get_cmos_value(unsigned long bit, unsigned long length,
static enum cb_err locate_cmos_layout(struct region_device *rdev)
{
uint32_t cbfs_type = CBFS_COMPONENT_CMOS_LAYOUT;
MAYBE_STATIC_BSS struct cbfsf fh = {};
static struct cbfsf fh;
/*
* In case VBOOT is enabled and this function is called from SMM,

2
src/ec/google/chromeec/ec.c

@ -1343,7 +1343,7 @@ static void google_chromeec_log_uptimeinfo(void)
/* Cache and retrieve the EC image type (ro or rw) */
enum ec_image google_chromeec_get_current_image(void)
{
MAYBE_STATIC_BSS enum ec_image ec_image_type = EC_IMAGE_UNKNOWN;
static enum ec_image ec_image_type = EC_IMAGE_UNKNOWN;
if (ec_image_type != EC_IMAGE_UNKNOWN)
return ec_image_type;

2
src/ec/google/chromeec/ec_lpc.c

@ -387,7 +387,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_BSS int command_version = 0;
static int command_version;
if (command_version <= 0)
command_version = google_chromeec_command_version();

3
src/include/rules.h

@ -252,12 +252,9 @@
#define ENV_CACHE_AS_RAM (ENV_ROMSTAGE_OR_BEFORE && !CONFIG(RESET_VECTOR_IN_RAM))
/* No .data sections with execute-in-place from ROM. */
#define ENV_STAGE_HAS_DATA_SECTION !ENV_CACHE_AS_RAM
/* No .bss sections for stage with CAR teardown. */
#define ENV_STAGE_HAS_BSS_SECTION 1
#else
/* Both .data and .bss, sometimes SRAM not DRAM. */
#define ENV_STAGE_HAS_DATA_SECTION 1
#define ENV_STAGE_HAS_BSS_SECTION 1
#define ENV_CACHE_AS_RAM 0
#endif

6
src/include/stddef.h

@ -41,12 +41,6 @@ typedef unsigned int wint_t;
#define MAYBE_STATIC_NONZERO
#endif
#if ENV_STAGE_HAS_BSS_SECTION
#define MAYBE_STATIC_BSS static
#else
#define MAYBE_STATIC_BSS
#endif
/* Provide a pointer to address 0 that thwarts any "accessing this is
* undefined behaviour and do whatever" trickery in compilers.
* Use when you _really_ need to read32(zeroptr) (ie. read address 0).

2
src/lib/imd_cbmem.c

@ -19,7 +19,7 @@ static struct imd imd;
void *cbmem_top(void)
{
if (ENV_ROMSTAGE) {
MAYBE_STATIC_BSS void *top = NULL;
static void *top;
if (top)
return top;
top = cbmem_top_chipset();

2
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_BSS unsigned char scratchpad[15980];
static unsigned char scratchpad[15980];
const unsigned char *cp;
if (srcn < data_offset) {

2
src/lib/program.ld

@ -112,7 +112,7 @@
}
#endif
#if ENV_STAGE_HAS_BSS_SECTION && !ENV_CACHE_AS_RAM
#if !ENV_CACHE_AS_RAM
.bss . : {
. = ALIGN(ARCH_POINTER_ALIGN_SIZE);
_bss = .;

4
src/mainboard/google/stout/chromeos.c

@ -53,8 +53,8 @@ int get_lid_switch(void)
*/
int get_recovery_mode_switch(void)
{
MAYBE_STATIC_BSS int ec_in_rec_mode = 0;
MAYBE_STATIC_BSS int ec_rec_flag_good = 0;
static int ec_in_rec_mode;
static int ec_rec_flag_good;
if (ec_rec_flag_good)
return ec_in_rec_mode;

4
src/security/tpm/tspi/log.c

@ -11,7 +11,7 @@
static struct tcpa_table *tcpa_cbmem_init(void)
{
MAYBE_STATIC_BSS struct tcpa_table *tclt = NULL;
static struct tcpa_table *tclt;
if (tclt)
return tclt;
@ -32,7 +32,7 @@ static struct tcpa_table *tcpa_cbmem_init(void)
struct tcpa_table *tcpa_log_init(void)
{
MAYBE_STATIC_BSS struct tcpa_table *tclt = NULL;
static struct tcpa_table *tclt;
/* We are dealing here with pre CBMEM environment.
* If cbmem isn't available use CAR or SRAM */

2
src/soc/intel/baytrail/northcluster.c

@ -51,7 +51,7 @@
uint32_t nc_read_top_of_low_memory(void)
{
MAYBE_STATIC_BSS uint32_t tolm = 0;
static uint32_t tolm;
if (tolm)
return tolm;

2
src/soc/intel/braswell/northcluster.c

@ -56,7 +56,7 @@
uint32_t nc_read_top_of_low_memory(void)
{
MAYBE_STATIC_BSS uint32_t tolm = 0;
static uint32_t tolm;
if (tolm)
return tolm;

2
toolchain.inc

@ -55,7 +55,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_BSS to share data in cache-as-ram
# Store larger buffers in BSS, use static to share data in cache-as-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

Loading…
Cancel
Save