Zhenguo Li | dacff81 | 2021-09-07 19:45:37 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Zhenguo Li | dacff81 | 2021-09-07 19:45:37 +0800 | [diff] [blame] | 3 | #include <console/console.h> |
| 4 | #include <device/mmio.h> |
| 5 | #include <soc/addressmap.h> |
Rex-BC Chen | 2efb614 | 2021-12-06 13:12:44 +0800 | [diff] [blame] | 6 | #include <soc/tracker.h> |
Zhenguo Li | dacff81 | 2021-09-07 19:45:37 +0800 | [diff] [blame] | 7 | #include <soc/tracker_common.h> |
| 8 | |
Rex-BC Chen | ac6070a | 2021-12-02 19:57:46 +0800 | [diff] [blame] | 9 | __weak void tracker_setup(void) |
| 10 | { |
| 11 | /* do nothing. */ |
| 12 | } |
| 13 | |
Zhenguo Li | dacff81 | 2021-09-07 19:45:37 +0800 | [diff] [blame] | 14 | static void tracker_dump_data(void) |
| 15 | { |
| 16 | int i, j, k; |
| 17 | int size; |
| 18 | uintptr_t reg; |
| 19 | struct tracker *tra; |
| 20 | |
| 21 | for (j = 0; j < TRACKER_NUM; j++) { |
| 22 | tra = &tracker_data[j]; |
| 23 | |
| 24 | if (!(read32((void *)(tra->base_addr)) & tra->timeout)) |
| 25 | continue; |
| 26 | |
| 27 | printk(BIOS_INFO, "**Dump %s debug register start**\n", tra->str); |
| 28 | for (k = 0; k < 2; k++) { |
Zhenguo Li | dacff81 | 2021-09-07 19:45:37 +0800 | [diff] [blame] | 29 | size = 2 * tra->entry; |
| 30 | for (i = 0; i < size; i++) { |
| 31 | reg = tra->base_addr + tra->offset[k] + i * 4; |
| 32 | printk(BIOS_INFO, "%#lx:%#x,", reg, read32((void *)reg)); |
| 33 | |
| 34 | if (i % 4 == 3 || i == size - 1) |
| 35 | printk(BIOS_INFO, "\n"); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | printk(BIOS_INFO, "**Dump %s debug register end**\n", tra->str); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | void bustracker_init(void) |
| 44 | { |
| 45 | tracker_dump_data(); |
Rex-BC Chen | 2efb614 | 2021-12-06 13:12:44 +0800 | [diff] [blame] | 46 | tracker_setup(); |
Zhenguo Li | dacff81 | 2021-09-07 19:45:37 +0800 | [diff] [blame] | 47 | } |