diff options
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_ks.h | 7 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c | 36 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c | 2 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c | 80 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h | 3 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c | 2 |
6 files changed, 121 insertions, 9 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ks.h b/usr/src/cmd/mdb/common/mdb/mdb_ks.h index e8ebaa46d4..f543a0cee3 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_ks.h +++ b/usr/src/cmd/mdb/common/mdb/mdb_ks.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -66,6 +65,8 @@ extern int mdb_devinfo2statep(uintptr_t, char *, uintptr_t *); extern int mdb_cpu2cpuid(uintptr_t); +extern int mdb_cpuset_find(uintptr_t cpusetp); + /* * Returns a pointer to the top of the soft state struct for the instance * specified, given the address of the global soft state pointer and size diff --git a/usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c b/usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c index 1a9dd361ef..e5498db180 100644 --- a/usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c +++ b/usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -594,6 +593,37 @@ mdb_cpu2cpuid(uintptr_t cpup) return (cpu.cpu_id); } +int +mdb_cpuset_find(uintptr_t cpusetp) +{ + ulong_t *cpuset; + size_t nr_words = BT_BITOUL(NCPU); + size_t sz = nr_words * sizeof (ulong_t); + size_t i; + int cpu = -1; + + cpuset = mdb_alloc(sz, UM_SLEEP); + + if (mdb_vread(cpuset, sz, cpusetp) != sz) + goto out; + + for (i = 0; i < nr_words; i++) { + size_t j; + ulong_t m; + + for (j = 0, m = 1; j < BT_NBIPUL; j++, m <<= 1) { + if (cpuset[i] & m) { + cpu = i * BT_NBIPUL + j; + goto out; + } + } + } + +out: + mdb_free(cpuset, sz); + return (cpu); +} + uintptr_t mdb_vnode2page(uintptr_t vp, uintptr_t offset) { diff --git a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c index b305351429..4fa32c19e7 100644 --- a/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c +++ b/usr/src/cmd/mdb/i86pc/modules/pcplusmp/apic.c @@ -240,6 +240,8 @@ interrupt_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) static const mdb_dcmd_t dcmds[] = { { "interrupts", "?[-di]", "print interrupts", interrupt_dump, interrupt_help}, + { "softint", "?[-d]", "print soft interrupts", soft_interrupt_dump, + soft_interrupt_help}, { NULL } }; diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c index 93b1648689..9fb1f0e3d3 100644 --- a/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.c @@ -29,10 +29,12 @@ #include <sys/multidata.h> #include <sys/gld.h> #include <sys/gldpriv.h> +#include <sys/ddi_intr_impl.h> +#include <sys/cpuvar.h> - -int option_flags; -uintptr_t gld_intr_addr; +int option_flags; +uintptr_t gld_intr_addr; +static struct av_head softvec_tbl[LOCK_LEVEL + 1]; void interrupt_help(void) @@ -45,6 +47,15 @@ interrupt_help(void) } void +soft_interrupt_help(void) +{ + mdb_printf("Prints the soft interrupt usage on the system.\n" + "By default, only interrupt service routine names are printed.\n\n" + "Switch:\n" + " -d instead of ISR, print <driver_name><instance#>\n"); +} + +void interrupt_print_isr(uintptr_t vector, uintptr_t arg1, uintptr_t dip) { uintptr_t isr_addr = vector; @@ -78,3 +89,66 @@ interrupt_print_isr(uintptr_t vector, uintptr_t arg1, uintptr_t dip) mdb_printf("%a", isr_addr); } } + + +/* + * This is copied from avintr.c + * NOTE: Ensure that this definition stays in sync + */ +typedef struct av_softinfo { + cpuset_t av_pending; /* pending bitmasks */ +} av_softinfo_t; + +/* ARGSUSED */ +int +soft_interrupt_dump(uintptr_t addr, uint_t flags, int argc, + const mdb_arg_t *argv) +{ + int i; + av_softinfo_t avsoftinfo; + struct autovec avhp; + ddi_softint_hdl_impl_t hdlp; + + option_flags = 0; + if (mdb_getopts(argc, argv, 'd', MDB_OPT_SETBITS, + INTR_DISPLAY_DRVR_INST, &option_flags, NULL) != argc) + return (DCMD_USAGE); + + if (mdb_readvar(&softvec_tbl, "softvect") == -1) { + mdb_warn("failed to read autovect"); + return (DCMD_ERR); + } + + /* Print the header first */ + mdb_printf("%<u>ADDR PEND PIL ARG1 " + "ARG2 ISR(s)%</u>\n"); + + /* Walk all the entries */ + for (i = 0; i < LOCK_LEVEL + 1; i++) { + /* Read the entry, if invalid continue */ + if (mdb_vread(&avhp, sizeof (struct autovec), + (uintptr_t)softvec_tbl[i].avh_link) == -1) + continue; + + do { + if (!avhp.av_vector || + (mdb_vread(&hdlp, sizeof (ddi_softint_hdl_impl_t), + (uintptr_t)avhp.av_intr_id) == -1) || + (mdb_vread(&avsoftinfo, sizeof (av_softinfo_t), + (uintptr_t)hdlp.ih_pending) == -1)) + continue; + + /* Print each soft interrupt entry */ + mdb_printf("%-16p %-2d %-2d %-16p %-16p", + avhp.av_intr_id, mdb_cpuset_find( + (uintptr_t)avsoftinfo.av_pending) != -1 ? 1 : 0, + avhp.av_prilevel, avhp.av_intarg1, avhp.av_intarg2); + interrupt_print_isr((uintptr_t)avhp.av_vector, + (uintptr_t)avhp.av_intarg1, (uintptr_t)hdlp.ih_dip); + mdb_printf("\n"); + } while (mdb_vread(&avhp, sizeof (struct autovec), + (uintptr_t)avhp.av_link) != -1); + } + + return (DCMD_OK); +} diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h index f0a9cf05d2..74a0b44668 100644 --- a/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/intr_common.h @@ -45,7 +45,10 @@ extern "C" { * Function prototypes */ void interrupt_help(void); +void soft_interrupt_help(void); void interrupt_print_isr(uintptr_t vector, uintptr_t arg1, uintptr_t dip); +int soft_interrupt_dump(uintptr_t addr, uint_t flags, int argc, + const mdb_arg_t *argv); /* * ::interrupts usage related defines and variables diff --git a/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c b/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c index 23c41e3ad0..be910bbcb7 100644 --- a/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c +++ b/usr/src/cmd/mdb/i86pc/modules/uppc/uppc.c @@ -161,6 +161,8 @@ uppc_interrupt_dump(uintptr_t addr, uint_t flags, int argc, static const mdb_dcmd_t dcmds[] = { { "interrupts", "?[-di]", "print interrupts", uppc_interrupt_dump, interrupt_help}, + { "softint", "?[-d]", "print soft interrupts", soft_interrupt_dump, + soft_interrupt_help}, { NULL } }; |
