summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-02-04 17:22:57 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-05 22:08:27 +0000
commit776e3203cc7ccc9d756d0d8f076b6fc9195cc2b2 (patch)
treecd6c5beac786234193b6dc9a98673f86629208b6
parent324c0920e374aace54949d3b88cb5d741023a0ab (diff)
downloadchrome-ec-776e3203cc7ccc9d756d0d8f076b6fc9195cc2b2.tar.gz
common: move some structures from .rodata to .data
Move the GPIO tables and the USB PRL states from .rodata to .data on boards that support CONFIG_CHIP_DATA_IN_INIT_ROM. This saves 1600 to 1900 bytes of flash space (and reduces RAM space by the similar amount). Boards affected: delbin_npcx796fc eldrid_npcx796fc halvor lindar lingcod magolor_legacy malefor metaknight_legacy terrador todor trondo voema volteer_apmodeentry volteer waddledoo BUG=none BRANCH=none TEST=make buildall TEST=boot Volteer, run gpioget Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I1a9f421981fb8db4d7ddd62b21d609a401862491 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2677087 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
-rw-r--r--chip/npcx/gpio.c2
-rw-r--r--common/gpio.c2
-rw-r--r--common/usbc/usb_prl_sm.c6
-rw-r--r--include/gpio_list.h4
4 files changed, 7 insertions, 7 deletions
diff --git a/chip/npcx/gpio.c b/chip/npcx/gpio.c
index 23f4450ff7..0e05b50570 100644
--- a/chip/npcx/gpio.c
+++ b/chip/npcx/gpio.c
@@ -78,7 +78,7 @@ BUILD_ASSERT(sizeof(struct gpio_alt_map) == 2);
#endif
/* Constants for GPIO alternative mapping */
-const struct gpio_alt_map gpio_alt_table[] = NPCX_ALT_TABLE;
+const __const_data struct gpio_alt_map gpio_alt_table[] = NPCX_ALT_TABLE;
struct gpio_lvol_item {
struct npcx_gpio lvol_gpio[8];
diff --git a/common/gpio.c b/common/gpio.c
index f89be2700d..42a9d2a2e6 100644
--- a/common/gpio.c
+++ b/common/gpio.c
@@ -38,7 +38,7 @@ struct gpio_alt_func {
{GPIO_##pinmask, .func = (function), .module_id = (module), \
.flags = (flagz)},
-static const struct gpio_alt_func gpio_alt_funcs[] = {
+static __const_data const struct gpio_alt_func gpio_alt_funcs[] = {
#include "gpio.wrap"
};
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index 1e443b1430..25872c89ef 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -128,7 +128,7 @@ struct bit_name {
const char *name;
};
-static struct bit_name flag_bit_names[] = {
+static __const_data struct bit_name flag_bit_names[] = {
{ PRL_FLAGS_TX_COMPLETE, "PRL_FLAGS_TX_COMPLETE" },
{ PRL_FLAGS_SINK_NG, "PRL_FLAGS_SINK_NG" },
{ PRL_FLAGS_WAIT_SINK_OK, "PRL_FLAGS_WAIT_SINK_OK" },
@@ -2192,7 +2192,7 @@ static void prl_rx_wait_for_phy_message(const int port, int evt)
}
/* All necessary Protocol Transmit States (Section 6.11.2.2) */
-static const struct usb_state prl_tx_states[] = {
+static __const_data const struct usb_state prl_tx_states[] = {
[PRL_TX_PHY_LAYER_RESET] = {
.entry = prl_tx_phy_layer_reset_entry,
},
@@ -2233,7 +2233,7 @@ static const struct usb_state prl_tx_states[] = {
};
/* All necessary Protocol Hard Reset States (Section 6.11.2.4) */
-static const struct usb_state prl_hr_states[] = {
+static __const_data const struct usb_state prl_hr_states[] = {
[PRL_HR_WAIT_FOR_REQUEST] = {
.entry = prl_hr_wait_for_request_entry,
.run = prl_hr_wait_for_request_run,
diff --git a/include/gpio_list.h b/include/gpio_list.h
index 3c71c3b0e2..6bd43187d9 100644
--- a/include/gpio_list.h
+++ b/include/gpio_list.h
@@ -19,7 +19,7 @@
#define UNIMPLEMENTED(name) {#name, UNIMPLEMENTED_GPIO_BANK, 0, GPIO_DEFAULT},
/* GPIO signal list. */
-const struct gpio_info gpio_list[] = {
+__const_data const struct gpio_info gpio_list[] = {
#include "gpio.wrap"
};
@@ -27,7 +27,7 @@ BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
#define UNUSED(pin) {GPIO_##pin},
/* Unconnected pin list. */
-const struct unused_pin_info unused_pin_list[] = {
+__const_data const struct unused_pin_info unused_pin_list[] = {
#include "gpio.wrap"
};