Skip to content

Commit

Permalink
clean-up: Remove the no more necessary ENV_HAS_DATA_SECTION flag
Browse files Browse the repository at this point in the history
With commit b7832de ("x86: Add .data
section support for pre-memory stages"), the `ENV_HAS_DATA_SECTION'
flag and its derivatives can now be removed from the code.

Change-Id: Ic0afac76264a9bd4a9c93ca35c90bd84e9b747a2
Signed-off-by: Jeremy Compostella <[email protected]>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/77291
Reviewed-by: Julius Werner <[email protected]>
Reviewed-by: Maximilian Brune <[email protected]>
Tested-by: build bot (Jenkins) <[email protected]>
  • Loading branch information
jeremy-compostella authored and felixheld committed Sep 18, 2023
1 parent 4712f5d commit f65ae74
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 26 deletions.
3 changes: 0 additions & 3 deletions src/ec/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ void ec_clr_bit(u8 addr, u8 bit)

void ec_set_ports(u16 cmd_reg, u16 data_reg)
{
if (!ENV_HAS_DATA_SECTION)
return;

ec_cmd_reg = cmd_reg;
ec_data_reg = data_reg;
}
2 changes: 1 addition & 1 deletion src/ec/google/chromeec/ec_boardid.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

uint32_t board_id(void)
{
MAYBE_STATIC_NONZERO uint32_t id = BOARD_ID_INIT;
static uint32_t id = BOARD_ID_INIT;

if (id == BOARD_ID_INIT) {
if (google_chromeec_get_board_version(&id))
Expand Down
2 changes: 1 addition & 1 deletion src/ec/google/chromeec/ec_skuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

uint32_t google_chromeec_get_board_sku(void)
{
MAYBE_STATIC_NONZERO uint32_t sku_id = CROS_SKU_UNKNOWN;
static uint32_t sku_id = CROS_SKU_UNKNOWN;

if (sku_id != CROS_SKU_UNKNOWN)
return sku_id;
Expand Down
2 changes: 1 addition & 1 deletion src/ec/google/wilco/boardid.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

uint32_t board_id(void)
{
MAYBE_STATIC_NONZERO uint32_t id = BOARD_ID_INIT;
static uint32_t id = BOARD_ID_INIT;

if (id == BOARD_ID_INIT) {
uint8_t ec_id;
Expand Down
2 changes: 1 addition & 1 deletion src/ec/intel/board_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static uint32_t get_board_id_via_ext_ec(void)
/* Get Board ID via EC I/O port write/read */
int get_rvp_board_id(void)
{
MAYBE_STATIC_NONZERO int id = BOARD_ID_UNKNOWN;
static int id = BOARD_ID_UNKNOWN;

if (CONFIG(EC_GOOGLE_CHROMEEC)) { /* CHROME_EC */
id = get_board_id_via_ext_ec();
Expand Down
3 changes: 0 additions & 3 deletions src/include/rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,6 @@
#define ENV_CACHE_AS_RAM 0
#endif

/* Indicates .data section support. */
#define ENV_HAS_DATA_SECTION 1

/* Indicates if the stage uses the _data and _bss regions defined in
* arch/x86/car.ld */
#define ENV_SEPARATE_DATA_AND_BSS (ENV_CACHE_AS_RAM && (ENV_BOOTBLOCK || !CONFIG(NO_XIP_EARLY_STAGES)))
Expand Down
6 changes: 0 additions & 6 deletions src/include/stddef.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ typedef __WINT_TYPE__ wint_t;
#define DEVTREE_CONST
#endif

#if ENV_HAS_DATA_SECTION
#define MAYBE_STATIC_NONZERO static
#else
#define MAYBE_STATIC_NONZERO
#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).
Expand Down
4 changes: 0 additions & 4 deletions src/lib/cbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@
#include <thread.h>
#include <timestamp.h>

#if ENV_HAS_DATA_SECTION
struct mem_pool cbfs_cache =
MEM_POOL_INIT(_cbfs_cache, REGION_SIZE(cbfs_cache), CONFIG_CBFS_CACHE_ALIGN);
#else
struct mem_pool cbfs_cache = MEM_POOL_INIT(NULL, 0, 0);
#endif

static void switch_to_postram_cache(int unused)
{
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/intel/adlrvp/board_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static uint32_t get_board_id_via_ext_ec(void)
/* Get Board ID via EC I/O port write/read */
int get_board_id(void)
{
MAYBE_STATIC_NONZERO int id = -1;
static int id = -1;

if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC)) {
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/intel/glkrvp/boardid.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

uint32_t board_id(void)
{
MAYBE_STATIC_NONZERO int id = -1;
static int id = -1;
if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC))
id = variant_board_id();
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/intel/glkrvp/variants/baseboard/boardid.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

int variant_board_id(void)
{
MAYBE_STATIC_NONZERO uint32_t id = BOARD_ID_INIT;
static uint32_t id = BOARD_ID_INIT;

if (CONFIG(EC_GOOGLE_CHROMEEC)) {
if (id == BOARD_ID_INIT) {
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/intel/jasperlake_rvp/board_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static uint32_t get_board_id_via_ext_ec(void)
*/
int get_board_id(void)
{
MAYBE_STATIC_NONZERO int id = -1;
static int id = -1;

if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC)) {
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/intel/kblrvp/board_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
int get_ec_boardinfo(void)
{
MAYBE_STATIC_NONZERO int ec_info = -1;
static int ec_info = -1;
if (ec_info < 0) {
uint8_t buffer[2];
uint8_t index;
Expand Down
2 changes: 1 addition & 1 deletion src/mainboard/intel/tglrvp/board_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static uint32_t get_board_id_via_ext_ec(void)
/* Get Board ID via EC I/O port write/read */
int get_board_id(void)
{
MAYBE_STATIC_NONZERO int id = -1;
static int id = -1;

if (id < 0) {
if (CONFIG(EC_GOOGLE_CHROMEEC)) {
Expand Down

0 comments on commit f65ae74

Please sign in to comment.