From edb53663dd476b4f8cf43bdfe510cc8512d9b089 Mon Sep 17 00:00:00 2001 From: Dino Li Date: Mon, 29 Jun 2015 17:35:11 +0800 Subject: [PATCH] nds32: remove macro "RO" "RO" is a workaround for GP base instructions. And now we have added "-mno-gp-direct" option in the NDS32 toolchain. So the compiler would not generate GP base instructions directly, and we can remove this "RO". Signed-off-by: Dino Li BRANCH=none BUG=chrome-os-partner:24378 TEST=console "version" and "gpioget" Change-Id: I23cb6374fb8eb57081d713bf5c70b80a87dd2fb5 Signed-off-by: Dino Li Reviewed-on: https://chromium-review.googlesource.com/281862 Reviewed-by: Vincent Palatin Reviewed-by: Alec Berg --- common/gpio.c | 2 +- common/system.c | 6 +++--- core/nds32/config_core.h | 13 ------------- include/common.h | 8 -------- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/common/gpio.c b/common/gpio.c index c411584161..7e6f18144d 100644 --- a/common/gpio.c +++ b/common/gpio.c @@ -64,7 +64,7 @@ static int last_val_changed(int i, int v) void gpio_config_module(enum module_id id, int enable) { const struct gpio_alt_func *af = gpio_alt_funcs; - int count = RO(gpio_alt_funcs_count); + int count = gpio_alt_funcs_count; int i; /* Set module's pins to alternate functions */ diff --git a/common/system.c b/common/system.c index 7ac9e7695f..e3c72855a0 100644 --- a/common/system.c +++ b/common/system.c @@ -544,7 +544,7 @@ const char *system_get_version(enum system_image_copy_t copy) /* Handle version of current image */ if (copy == active_copy || copy == SYSTEM_IMAGE_UNKNOWN) - return &RO(version_data).version[0]; + return &version_data.version[0]; if (active_copy == SYSTEM_IMAGE_UNKNOWN) return ""; @@ -590,8 +590,8 @@ const char *system_get_version(enum system_image_copy_t copy) /* Make sure the version struct cookies match before returning the * version string. */ - if (v->cookie1 == RO(version_data).cookie1 && - v->cookie2 == RO(version_data).cookie2) + if (v->cookie1 == version_data.cookie1 && + v->cookie2 == version_data.cookie2) return v->version; return ""; diff --git a/core/nds32/config_core.h b/core/nds32/config_core.h index f2e16eaf79..0bf6595611 100644 --- a/core/nds32/config_core.h +++ b/core/nds32/config_core.h @@ -16,17 +16,4 @@ */ #define CONFIG_SOFTWARE_CLZ -/* - * Force the compiler to use a proper relocation when accessing an external - * variable in a read-only section. - * TODO(crosbug.com/p/24378): remove me when the nds32 toolchain bug is fixed. - */ -#undef RO -#define RO(var) \ -({ \ - typeof(var) *__ptr_val; \ - asm volatile("la %0, " #var "\n" : "=r"(__ptr_val)); \ - ((typeof(var))(*__ptr_val)); \ -}) - #endif /* __CROS_EC_CONFIG_CORE_H */ diff --git a/include/common.h b/include/common.h index af451a3ec9..a372b8cf0d 100644 --- a/include/common.h +++ b/include/common.h @@ -135,12 +135,4 @@ enum ec_error_list { #define test_export_static static #endif -/* - * accessor allowing to override some read only data accesses. - * used to workaround a buggy toolchain (cf http://crosbug.com/p/24378) - */ -#ifndef RO -#define RO(var) var -#endif - #endif /* __CROS_EC_COMMON_H */