From 9fbdb2b19295380e0f222e62c12f1b2a2b58540d Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Tue, 28 Mar 2023 10:47:27 +0800 Subject: soc/mediatek/mt8188: Reduce lastbus configuration size by 1280 bytes Original lastbus configuration consumes constant memory size by allocating 16 and 8 members arrays and the utilization is bad. Refactor the lastbus structs to save memory usage. BRANCH=none BUG=none TEST=bootblock.raw.bin size is reduced from 60328 bytes to 59048 bytes. Change-Id: I07ff9ff7c75f03219e1792b92b62814293ef43fe Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/74061 Reviewed-by: Yidi Lin Reviewed-by: Rex-BC Chen Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/include/soc/lastbus_v2.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/soc/mediatek/common') diff --git a/src/soc/mediatek/common/include/soc/lastbus_v2.h b/src/soc/mediatek/common/include/soc/lastbus_v2.h index d58da76b57..8146debf4e 100644 --- a/src/soc/mediatek/common/include/soc/lastbus_v2.h +++ b/src/soc/mediatek/common/include/soc/lastbus_v2.h @@ -3,8 +3,6 @@ #ifndef SOC_MEDIATEK_COMMON_LASTBUS_V2_H #define SOC_MEDIATEK_COMMON_LASTBUS_V2_H -#define NR_MAX_LASTBUS_IDLE_MASK 8 -#define NR_MAX_LASTBUS_MONITOR 16 #define TIMEOUT_THRES_SHIFT 16 #define TIMEOUT_TYPE_SHIFT 1 #define LASTBUS_TIMEOUT_CLR 0x0200 @@ -23,7 +21,7 @@ struct lastbus_monitor { size_t num_ports; u16 bus_freq_mhz; size_t num_idle_mask; - struct lastbus_idle_mask idle_masks[NR_MAX_LASTBUS_IDLE_MASK]; + const struct lastbus_idle_mask *idle_masks; }; struct lastbus_config { @@ -31,7 +29,7 @@ struct lastbus_config { unsigned int timeout_ms; unsigned int timeout_type; unsigned int num_used_monitors; - struct lastbus_monitor monitors[NR_MAX_LASTBUS_MONITOR]; + const struct lastbus_monitor *monitors; }; void lastbus_init(void); -- cgit v1.2.3