There is no reason for having custom IRQ dumping function on ARM
and having such causes maintenance burden when the kernel IRQ
structures change.
So convert ARM to use generic_dump_irq() and remove all the now
unused ARM specific IRQ dumping code.
Signed-off-by: Mika Westerberg <ext-mika.1.westerberg(a)nokia.com>
Cc: jan.karlsson(a)sonyericsson.com
Cc: thomas.fange(a)sonyericsson.com
---
This patch applies on top of my 2 previous patches (the ones you
already queued).
That cleans things up nicely -- queued for the next release.
Thanks,
Dave
arm.c | 326
+----------------------------------------------------------------
1 files changed, 3 insertions(+), 323 deletions(-)
diff --git a/arm.c b/arm.c
index 751fe00..4e6ab3d 100644
--- a/arm.c
+++ b/arm.c
@@ -52,8 +52,6 @@ static ulong arm_get_task_pgd(ulong);
static void arm_cmd_mach(void);
static void arm_display_machine_stats(void);
static int arm_get_smp_cpus(void);
-static void print_irq_member(char *, ulong, char *);
-static void arm_dump_irq(int);
static void arm_init_machspec(void);
static struct line_number_hook arm_line_number_hooks[];
@@ -237,22 +235,15 @@ arm_init(int when)
machdep->line_number_hooks = arm_line_number_hooks;
machdep->value_to_symbol = generic_machdep_value_to_symbol;
machdep->init_kernel_pgd = NULL;
-
- if (symbol_exists("irq_desc"))
- machdep->dump_irq = arm_dump_irq;
+ machdep->dump_irq = generic_dump_irq;
arm_init_machspec();
break;
case POST_GDB:
- if (symbol_exists("irq_desc")) {
+ if (symbol_exists("irq_desc"))
ARRAY_LENGTH_INIT(machdep->nr_irqs, irq_desc,
"irq_desc", NULL, 0);
- if (MEMBER_EXISTS("irq_desc", "name"))
- MEMBER_OFFSET_INIT(irq_desc_t_name, "irq_desc",
- "name");
- }
-
/*
* Registers for idle threads are saved in
* thread_info.cpu_context.
@@ -343,10 +334,7 @@ arm_dump_machdep_table(ulong arg)
fprintf(fp, " uvtop: arm_uvtop()\n");
fprintf(fp, " kvtop: arm_kvtop()\n");
fprintf(fp, " get_task_pgd: arm_get_task_pgd()\n");
- if (symbol_exists("irq_desc"))
- fprintf(fp, " dump_irq: arm_dump_irq()\n");
- else
- fprintf(fp, " dump_irq: NULL\n");
+ fprintf(fp, " dump_irq: generic_dump_irq()\n");
fprintf(fp, " get_stack_frame: arm_get_stack_frame()\n");
fprintf(fp, " get_stackbase: generic_get_stackbase()\n");
fprintf(fp, " get_stacktop: generic_get_stacktop()\n");
@@ -1409,314 +1397,6 @@ arm_get_smp_cpus(void)
return get_cpus_online();
}
-static void
-print_irq_member(char *irq, ulong val, char *ind)
-{
- char buf[BUFSIZE];
- ulong val2;
-
- fprintf(fp, "%17s: %8lx ", irq, val);
- if (val) {
- if (is_kernel_text(val))
- fprintf(fp, "<%s>", value_to_symstr(val, buf, 0));
- else if (readmem(val, KVADDR, &val2,
- sizeof(ulong), ind, RETURN_ON_ERROR|QUIET) &&
- is_kernel_text(val2))
- fprintf(fp, "<%s>", value_to_symstr(val2, buf, 0));
- }
- fprintf(fp, "\n");
-}
-
-/*
- * Do the work for cmd_irq().
- */
-static void
-arm_dump_irq(int irq)
-{
- struct datatype_member datatype_member, *dm;
- ulong irq_desc_addr;
- ulong irq_desc_ptr;
- long len;
- char buf[BUFSIZE];
- int type, status, depth, others;
- ulong handler, action, value;
- ulong tmp1;
-
- dm = &datatype_member;
-
- if (!VALID_STRUCT(irq_desc_t))
- error(FATAL, "cannot determine size of irq_desc\n");
- len = SIZE(irq_desc_t);
-
- if (symbol_exists("irq_desc"))
- irq_desc_addr = symbol_value("irq_desc") + (len * irq);
- else if (symbol_exists("_irq_desc"))
- irq_desc_addr = symbol_value("_irq_desc") + (len * irq);
- else if (symbol_exists("irq_desc_ptrs")) {
- get_symbol_data("irq_desc_ptrs", sizeof(void *), &irq_desc_ptr);
- irq_desc_ptr += (irq * sizeof(void *));
- readmem(irq_desc_ptr, KVADDR, &irq_desc_addr,
- sizeof(void *), "irq_desc_ptrs entry",
- FAULT_ON_ERROR);
- if (!irq_desc_addr) {
- fprintf(fp, " IRQ: %d (unused)\n\n", irq);
- return;
- }
- } else {
- irq_desc_addr = 0;
- error(FATAL,
- "neither irq_desc, _irq_desc, nor irq_desc_ptrs "
- "symbols exist\n");
- }
-
- readmem(irq_desc_addr + OFFSET(irq_desc_t_status), KVADDR,
&status,
- sizeof(int), "irq_desc entry", FAULT_ON_ERROR);
- if (VALID_MEMBER(irq_desc_t_handler))
- readmem(irq_desc_addr + OFFSET(irq_desc_t_handler), KVADDR,
- &handler, sizeof(long), "irq_desc entry",
- FAULT_ON_ERROR);
- else if (VALID_MEMBER(irq_desc_t_chip))
- readmem(irq_desc_addr + OFFSET(irq_desc_t_chip), KVADDR,
- &handler, sizeof(long), "irq_desc entry",
- FAULT_ON_ERROR);
- readmem(irq_desc_addr + OFFSET(irq_desc_t_action), KVADDR,
&action,
- sizeof(long), "irq_desc entry", FAULT_ON_ERROR);
- readmem(irq_desc_addr + OFFSET(irq_desc_t_depth), KVADDR,
&depth,
- sizeof(int), "irq_desc entry", FAULT_ON_ERROR);
-
- if (!action && (handler == (ulong)pc->curcmd_private))
- return;
-
- fprintf(fp, " IRQ: %d\n", irq);
- fprintf(fp, "ADDRESS: %08lx\n", irq_desc_addr);
-
- if (VALID_MEMBER(irq_desc_t_name)) {
- readmem(irq_desc_addr+OFFSET(irq_desc_t_name),
- KVADDR, &tmp1, sizeof(void *),
- "irq_desc name", FAULT_ON_ERROR);
- if (tmp1) {
- fprintf(fp, " NAME: %lx", tmp1);
- BZERO(buf, BUFSIZE);
- if (read_string(tmp1, buf, BUFSIZE-1))
- fprintf(fp, " \"%s\"", buf);
- fprintf(fp, "\n");
- }
- }
-
- type = status & IRQ_TYPE_SENSE_MASK;
- fprintf(fp, " TYPE: %x %s", type, type ? "(" : "");
- others = 0;
-
- if ((type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH)
- fprintf(fp, "%sEDGE_BOTH", others++ ? "|" : "");
- else {
- if (type & IRQ_TYPE_EDGE_RISING)
- fprintf(fp, "%sEDGE_RISING", others++ ? "|" : "");
- if (type & IRQ_TYPE_EDGE_FALLING)
- fprintf(fp, "%sEDGE_FALLING", others++ ? "|" : "");
- }
- if (type & IRQ_TYPE_LEVEL_HIGH)
- fprintf(fp, "%sLEVEL_HIGH", others++ ? "|" : "");
- if (type & IRQ_TYPE_LEVEL_LOW)
- fprintf(fp, "%sLEVEL_LOW", others++ ? "|" : "");
- fprintf(fp, "%s\n", type ? ")" : "");
-
- fprintf(fp, " PROBE: %s\n", status & IRQ_TYPE_PROBE ? "true"
:
"false");
-
- fprintf(fp, " STATUS: %x %s", status, status ? "(" :
"");
- others = 0;
- if (status & IRQ_INPROGRESS) {
- fprintf(fp, "IRQ_INPROGRESS");
- others++;
- }
- if (status & IRQ_DISABLED)
- fprintf(fp, "%sIRQ_DISABLED", others++ ? "|" : "");
- if (status & IRQ_PENDING)
- fprintf(fp, "%sIRQ_PENDING", others++ ? "|" :
"");
- if (status & IRQ_REPLAY)
- fprintf(fp, "%sIRQ_REPLAY", others++ ? "|" :
"");
- if (status & IRQ_AUTODETECT)
- fprintf(fp, "%sIRQ_AUTODETECT", others++ ? "|" :
"");
- if (status & IRQ_WAITING)
- fprintf(fp, "%sIRQ_WAITING", others++ ? "|" :
"");
- if (status & IRQ_LEVEL)
- fprintf(fp, "%sIRQ_LEVEL", others++ ? "|" :
"");
- if (status & IRQ_MASKED)
- fprintf(fp, "%sIRQ_MASKED", others++ ? "|" :
"");
-
- if (status & IRQ_PER_CPU)
- fprintf(fp, "%sIRQ_PER_CPU", others++ ? "|" :
"");
- if (status & IRQ_NOPROBE)
- fprintf(fp, "%sIRQ_NOPROBE", others++ ? "|" :
"");
- if (status & IRQ_NOREQUEST)
- fprintf(fp, "%sIRQ_NOREQUEST", others++ ? "|" :
"");
- if (status & IRQ_NOAUTOEN)
- fprintf(fp, "%sIRQ_NOAUTOEN", others++ ? "|" :
"");
- if (status & IRQ_WAKEUP)
- fprintf(fp, "%sIRQ_WAKEUP", others++ ? "|" :
"");
- if (status & IRQ_MOVE_PENDING)
- fprintf(fp, "%sIRQ_MOVE_PENDING", others++ ? "|" :
"");
- if (status & IRQ_NO_BALANCING)
- fprintf(fp, "%sIRQ_NO_BALANCING", others++ ? "|" :
"");
- if (status & IRQ_SPURIOUS_DISABLED)
- fprintf(fp, "%sIRQ_SPURIOUS_DISABLED", others++ ?
"|"
: "");
- if (status & IRQ_MOVE_PCNTXT)
- fprintf(fp, "%sIRQ_MOVE_PCNTXT", others++ ? "|" :
"");
- if (status & IRQ_AFFINITY_SET)
- fprintf(fp, "%sIRQ_AFFINITY_SET", others++ ? "|" :
"");
-
-
- fprintf(fp, "%s\n", status ? ")" : "");
-
- fprintf(fp, "HANDLER: %8lx ", handler);
- if (value_symbol(handler)) {
- pad_line(fp, VADDR_PRLEN == 8 ? VADDR_PRLEN+2 : VADDR_PRLEN-6, '
');
- fprintf(fp, "<%s>", value_symbol(handler));
- }
- fprintf(fp, "\n");
-
-#define CHECK_HANDLER_OPT_MEMBER_PRT(x) \
- if (VALID_MEMBER(hw_interrupt_type_ ## x)) { \
- readmem(handler+OFFSET(hw_interrupt_type_ ## x), KVADDR, \
- &tmp1, sizeof(void *), "hw_interrupt_type " #x, \
- FAULT_ON_ERROR); \
- print_irq_member(#x, tmp1, #x " indirection"); \
- } else if (VALID_MEMBER(irq_chip_ ## x)) { \
- readmem(handler+OFFSET(irq_chip_ ## x),KVADDR, &tmp1, \
- sizeof(void *), "irq_chip " #x, FAULT_ON_ERROR); \
- print_irq_member(#x, tmp1, #x " indirection"); \
- }
-
-#define CHECK_HANDLER_OPT_MEMBER(x) \
- if (VALID_MEMBER(hw_interrupt_type_ ## x)) \
- readmem(handler+OFFSET(hw_interrupt_type_ ## x), KVADDR, \
- &tmp1, sizeof(void *), "hw_interrupt_type " #x, \
- FAULT_ON_ERROR); \
- else if (VALID_MEMBER(irq_chip_ ## x)) \
- readmem(handler+OFFSET(irq_chip_ ## x),KVADDR, &tmp1, \
- sizeof(void *), "irq_chip " #x, FAULT_ON_ERROR); \
-
-#define CHECK_HANDLER_MEMBER_PRT(x,s1,s2) \
- if (VALID_MEMBER(x)) { \
- readmem(handler+OFFSET(x), KVADDR, &tmp1, sizeof(void *),\
- s1, FAULT_ON_ERROR); \
- print_irq_member(s2, tmp1, s2 " indirection"); \
- }
-
- if (handler) {
- CHECK_HANDLER_OPT_MEMBER(typename);
-
- fprintf(fp, " typename: %lx ", tmp1);
- BZERO(buf, BUFSIZE);
- if (read_string(tmp1, buf, BUFSIZE-1))
- fprintf(fp, "\"%s\"", buf);
- fprintf(fp, "\n");
-
- CHECK_HANDLER_OPT_MEMBER(startup);
-
- print_irq_member("startup", tmp1, "startup indirection");
-
- CHECK_HANDLER_OPT_MEMBER(shutdown);
-
- print_irq_member("shutdown", tmp1, "shutdown indirection");
-
- CHECK_HANDLER_MEMBER_PRT(hw_interrupt_type_handle,
- "hw_interrupt_type handle",
- "handle");
-
- CHECK_HANDLER_OPT_MEMBER(enable);
-
- print_irq_member("enable", tmp1, "enable indirection");
-
- CHECK_HANDLER_OPT_MEMBER(disable);
-
- print_irq_member("disable", tmp1, "disable indirection");
-
- CHECK_HANDLER_OPT_MEMBER(ack);
-
- print_irq_member("ack", tmp1, "ack indirection");
-
- CHECK_HANDLER_MEMBER_PRT(irq_chip_mask, "irq_chip mask","mask");
-
- CHECK_HANDLER_MEMBER_PRT(irq_chip_mask_ack, "irq_chip mask_ack",
- "mask_ack");
-
- CHECK_HANDLER_MEMBER_PRT(irq_chip_unmask, "irq_chip unmask",
- "unmask");
-
- CHECK_HANDLER_MEMBER_PRT(irq_chip_eoi,"irq_chip eoi","eoi");
-
- CHECK_HANDLER_OPT_MEMBER_PRT(startup);
-
- CHECK_HANDLER_OPT_MEMBER_PRT(set_affinity);
-
- CHECK_HANDLER_MEMBER_PRT(irq_chip_retrigger,
- "irq_chip retrigger", "retrigger");
- CHECK_HANDLER_MEMBER_PRT(irq_chip_set_type,
- "irq_chip set_type", "set_type");
- CHECK_HANDLER_MEMBER_PRT(irq_chip_set_wake,
- "irq_chip set_wake", "set_wake");
- }
-
-do_linked_action:
-
- fprintf(fp, " ACTION: ");
- if (value_symbol(action)) {
- fprintf(fp, "%lx ", action);
- pad_line(fp, VADDR_PRLEN == 8 ?
- VADDR_PRLEN+2 : VADDR_PRLEN - 6, ' ');
- fprintf(fp, "<%s>\n", value_symbol(action));
- } else if (action) {
- fprintf(fp, "%8lx\n", action);
- } else {
- fprintf(fp, "(none)\n");
- }
-
- if (action) {
- readmem(action+OFFSET(irqaction_handler), KVADDR,
- &tmp1, sizeof(void *),
- "irqaction handler", FAULT_ON_ERROR);
-
- print_irq_member("handler", tmp1, "handler indirection");
-
- readmem(action+OFFSET(irqaction_flags), KVADDR,
- &value, sizeof(void *),
- "irqaction flags", FAULT_ON_ERROR);
- fprintf(fp, " flags: %8lx\n", value);
-
- if (VALID_MEMBER(irqaction_mask)) {
- readmem(action+OFFSET(irqaction_mask), KVADDR,
- &tmp1, sizeof(void *),
- "irqaction mask", FAULT_ON_ERROR);
- fprintf(fp, " mask: %8lx\n", tmp1);
- }
-
- readmem(action+OFFSET(irqaction_name), KVADDR,
- &tmp1, sizeof(void *),
- "irqaction name", FAULT_ON_ERROR);
- fprintf(fp, " name: %8lx ", tmp1);
- BZERO(buf, BUFSIZE);
- if (read_string(tmp1, buf, BUFSIZE-1))
- fprintf(fp, "\"%s\"", buf);
- fprintf(fp, "\n");
-
- readmem(action+OFFSET(irqaction_dev_id), KVADDR,
- &tmp1, sizeof(void *),
- "irqaction dev_id", FAULT_ON_ERROR);
- fprintf(fp, " dev_id: %8lx\n", tmp1);
-
- readmem(action+OFFSET(irqaction_next), KVADDR,
- &action, sizeof(void *),
- "irqaction dev_id", FAULT_ON_ERROR);
- fprintf(fp, " next: %8lx\n", action);
- }
-
- if (action)
- goto do_linked_action;
-
- fprintf(fp, " DEPTH: %d\n\n", depth);
-}
-
/*
* Initialize ARM specific stuff.
*/
--
1.7.3.2
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility