Skip to content

Commit d6e0b43

Browse files
ycsincarlescufi
authored andcommitted
drivers: intc: plic: print ISR(ARG) in shell cmd
Print the ISR & its ARG along with the IRQ and Hits in `plic stats get <intc>` command, i.e. ```CONFIG_SYMTAB=n uart:~$ plic stats get interrupt-controller@c000000 IRQ Hits ISR(ARG) 10 541 0x800054ee(0x80008170) ``` ```CONFIG_SYMTAB=y uart:~$ plic stats get interrupt-controller@c000000 IRQ Hits ISR(ARG) 10 114 uart_ns16550_isr(0x80008230) ``` Signed-off-by: Yong Cong Sin <[email protected]> Signed-off-by: Yong Cong Sin <[email protected]>
1 parent 8a2fe27 commit d6e0b43

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/interrupt_controller/intc_plic.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "sw_isr_common.h"
1919

20+
#include <zephyr/debug/symtab.h>
2021
#include <zephyr/kernel.h>
2122
#include <zephyr/arch/cpu.h>
2223
#include <zephyr/device.h>
@@ -450,6 +451,7 @@ static int cmd_get_stats(const struct shell *sh, size_t argc, char *argv[])
450451
return ret;
451452
}
452453

454+
const struct plic_config *config = dev->config;
453455
const struct plic_data *data = dev->data;
454456
struct plic_stats stat = data->stats;
455457

@@ -458,11 +460,19 @@ static int cmd_get_stats(const struct shell *sh, size_t argc, char *argv[])
458460
shell_print(sh, "IRQ line with > %d hits:", min_hit);
459461
}
460462

461-
shell_print(sh, " IRQ\t Hits");
462-
shell_print(sh, "==================");
463+
shell_print(sh, " IRQ Hits\tISR(ARG)");
463464
for (int i = 0; i < stat.irq_count_len; i++) {
464465
if (stat.irq_count[i] > min_hit) {
465-
shell_print(sh, "%6d\t%10d", i, stat.irq_count[i]);
466+
#ifdef CONFIG_SYMTAB
467+
const char *name =
468+
symtab_find_symbol_name((uintptr_t)config->isr_table[i].isr, NULL);
469+
470+
shell_print(sh, " %4d %10d\t%s(%p)", i, stat.irq_count[i], name,
471+
config->isr_table[i].arg);
472+
#else
473+
shell_print(sh, " %4d %10d\t%p(%p)", i, stat.irq_count[i],
474+
(void *)config->isr_table[i].isr, config->isr_table[i].arg);
475+
#endif /* CONFIG_SYMTAB */
466476
}
467477
}
468478
shell_print(sh, "");

0 commit comments

Comments
 (0)