diff options
-rw-r--r-- | src/soc/mediatek/common/include/soc/tracker_common.h | 3 | ||||
-rw-r--r-- | src/soc/mediatek/common/tracker.c | 4 | ||||
-rw-r--r-- | src/soc/mediatek/common/tracker_v1.c | 8 | ||||
-rw-r--r-- | src/soc/mediatek/common/tracker_v2.c | 16 |
4 files changed, 20 insertions, 11 deletions
diff --git a/src/soc/mediatek/common/include/soc/tracker_common.h b/src/soc/mediatek/common/include/soc/tracker_common.h index 02694579e1..f1cdb639c9 100644 --- a/src/soc/mediatek/common/include/soc/tracker_common.h +++ b/src/soc/mediatek/common/include/soc/tracker_common.h @@ -16,7 +16,8 @@ struct tracker { uintptr_t base_addr; u32 timeout; u32 entry; - u32 offset[2]; + const u32 *offsets; + u32 offsets_size; const char *str; }; diff --git a/src/soc/mediatek/common/tracker.c b/src/soc/mediatek/common/tracker.c index 3485449b6b..1341d5a134 100644 --- a/src/soc/mediatek/common/tracker.c +++ b/src/soc/mediatek/common/tracker.c @@ -25,10 +25,10 @@ static void tracker_dump_data(void) continue; printk(BIOS_INFO, "**Dump %s debug register start**\n", tra->str); - for (k = 0; k < 2; k++) { + for (k = 0; k < tra->offsets_size; k++) { size = 2 * tra->entry; for (i = 0; i < size; i++) { - reg = tra->base_addr + tra->offset[k] + i * 4; + reg = tra->base_addr + tra->offsets[k] + i * 4; printk(BIOS_INFO, "%#lx:%#x,", reg, read32((void *)reg)); if (i % 4 == 3 || i == size - 1) diff --git a/src/soc/mediatek/common/tracker_v1.c b/src/soc/mediatek/common/tracker_v1.c index 746951b8de..00e5bc81dc 100644 --- a/src/soc/mediatek/common/tracker_v1.c +++ b/src/soc/mediatek/common/tracker_v1.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <commonlib/bsd/helpers.h> #include <soc/addressmap.h> #include <soc/tracker.h> #include <soc/tracker_common.h> @@ -9,13 +10,16 @@ * offset[0] dump from offset 0x100 ~ 0x13C. * offset[1] dump from offset 0x200 ~ 0x23C. */ + +static const u32 offsets[] = { AR_TRACK_OFFSET, AW_TRACK_OFFSET }; + struct tracker tracker_data[TRACKER_NUM] = { [TRACKER_SYSTRACKER] = { .base_addr = DBG_TRACKER_BASE, .timeout = BUS_DBG_CON_TIMEOUT, .entry = SYS_TRACK_ENTRY, - .offset[0] = AR_TRACK_OFFSET, - .offset[1] = AW_TRACK_OFFSET, + .offsets = offsets, + .offsets_size = ARRAY_SIZE(offsets), .str = "systracker", }, }; diff --git a/src/soc/mediatek/common/tracker_v2.c b/src/soc/mediatek/common/tracker_v2.c index fecde161fd..0127916778 100644 --- a/src/soc/mediatek/common/tracker_v2.c +++ b/src/soc/mediatek/common/tracker_v2.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <commonlib/bsd/helpers.h> #include <device/mmio.h> #include <soc/addressmap.h> #include <soc/tracker.h> @@ -18,29 +19,32 @@ * offset[0] dump from offset 0x100 ~ 0x2F8 * offset[1] dump from offset 0x300 ~ 0x4FC */ + +static const u32 offsets[] = { AR_TRACK_OFFSET, AW_TRACK_OFFSET }; + struct tracker tracker_data[TRACKER_NUM] = { [TRACKER_SYSTRACKER] = { .base_addr = DBG_TRACKER_BASE, .timeout = BUS_DBG_CON_TIMEOUT, .entry = SYS_TRACK_ENTRY, - .offset[0] = AR_TRACK_OFFSET, - .offset[1] = AW_TRACK_OFFSET, + .offsets = offsets, + .offsets_size = ARRAY_SIZE(offsets), .str = "systracker", }, [TRACKER_INFRATRACKER] = { .base_addr = INFRA_TRACKER_BASE, .timeout = BUSTRACKER_TIMEOUT, .entry = INFRA_ENTRY_NUM, - .offset[0] = AR_TRACK_OFFSET, - .offset[1] = AW_TRACK_OFFSET, + .offsets = offsets, + .offsets_size = ARRAY_SIZE(offsets), .str = "infra_tracker", }, [TRACKER_PERISYSTRACKER] = { .base_addr = PERI_TRACKER_BASE, .timeout = BUSTRACKER_TIMEOUT, .entry = PERI_ENTRY_NUM, - .offset[0] = AR_TRACK_OFFSET, - .offset[1] = AW_TRACK_OFFSET, + .offsets = offsets, + .offsets_size = ARRAY_SIZE(offsets), .str = "peri_tracker", }, }; |