/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* 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
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013 by Delphix. All rights reserved.
*/
#include <mdb/mdb_modapi.h>
#include <sys/evtchn_impl.h>
#include "intr_common.h"
typedef struct mdb_shared_info {
static int
update_tables(void)
{
mdb_warn("failed to read irq_info");
return (0);
}
mdb_warn("failed to read virq_info");
return (0);
}
mdb_warn("failed to read evtchn_to_irq");
return (0);
}
mdb_warn("failed to read autovect");
return (0);
}
mdb_warn("failed to read xen_uppc_irq_shared_table");
return (0);
}
mdb_warn("failed to read HYPERVISOR_shared_info");
return (0);
}
shared_info_addr, 0) == -1)
return (0);
return (1);
}
static char *
{
mdb_warn("failed to read child dip");
return ("-");
}
while (dev_info.devi_parent != 0) {
break;
return ("ISA");
return ("PCI");
}
return ("-");
}
static const char *
{
int i;
for (i = 0; i < NR_VIRQS; i++) {
break;
}
switch (i) {
case VIRQ_TIMER:
return ("virq:timer");
case VIRQ_DEBUG:
return ("virq:debug");
case VIRQ_CONSOLE:
return ("virq:console");
case VIRQ_DOM_EXC:
return ("virq:dom exc");
case VIRQ_DEBUGGER:
return ("virq:debugger");
default:
break;
}
return ("virq:?");
}
static const char *
{
case IRQT_UNBOUND:
return ("unset");
case IRQT_PIRQ:
return ("pirq");
case IRQT_VIRQ:
if (extended)
return ("virq");
case IRQT_IPI:
return ("ipi");
case IRQT_EVTCHN:
return ("evtchn");
case IRQT_DEV_EVTCHN:
return ("device");
}
return ("?");
}
static void
print_isr(int i)
{
return;
mdb_printf(", ");
}
}
static int
evtchn_masked(int i)
{
}
static int
evtchn_pending(int i)
{
}
static void
{
if (option_flags & INTR_DISPLAY_INTRSTAT) {
mdb_printf("%-3d ", 0);
print_isr(i);
mdb_printf("\n");
return;
}
mdb_printf("%-3d 0x%2x %-6d %6d/%-2d %-3s %-6s %-5d ",
irq_type(i, 0), shared_tbl[i]);
print_isr(i);
mdb_printf("\n");
}
static void
ec_interrupt_dump(int i)
{
return;
if (option_flags & INTR_DISPLAY_INTRSTAT) {
mdb_printf("%-3d ", 0);
print_isr(i);
mdb_printf("\n");
return;
}
case IRQT_EVTCHN:
case IRQT_VIRQ:
} else {
}
break;
case IRQT_IPI:
break;
case IRQT_DEV_EVTCHN:
break;
}
/* IRQ */
mdb_printf("%3d ", i);
/* Vector */
mdb_printf("- ");
/* Evtchn */
/* IPL */
/* Bus */
/* Type */
/* Share */
mdb_printf("- ");
print_isr(i);
mdb_printf("\n");
}
/*
* uppc_interrupt_dump:
* Dump uppc(7d) interrupt information.
*/
/* ARGSUSED */
int
{
int i;
option_flags = 0;
return (DCMD_USAGE);
if (!update_tables())
return (DCMD_ERR);
/*
* By default, on all x86 systems ::interrupts from xen_uppc(7d) gets
* loaded first. For APIC systems the ::interrupts from xpv_psm(7d)
* ought to be executed. Confusion stems as both modules export the
* same dcmd.
*/
for (i = 0; i < MAX_ISA_IRQ + 1; i++)
if (shared_tbl[i]) {
break;
}
NULL) == 0) {
return (mdb_call_dcmd("xpv_psm`interrupts",
}
}
/* Print the header first */
mdb_printf("%<u>CPU ");
else
mdb_printf("%<u>IRQ Vect Evtchn IPL(lo/hi) Bus Type Share ");
"Driver Name(s)" : "ISR(s)");
for (i = 0; i < NR_IRQS; i++) {
continue;
/* Read the entry, if invalid continue */
continue;
continue;
}
}
return (DCMD_OK);
}
static void
evtchn_dump(int i)
{
if (irq == INVALID_IRQ) {
mdb_printf("%-4d", 0);
mdb_printf("\n");
return;
}
/* Type */
/* Evtchn */
mdb_printf("%-7d", i);
/* IRQ */
/* IPL */
/* CPU */
mdb_printf("%-4d", 0);
/* ISR */
mdb_printf("\n");
}
/* ARGSUSED */
static int
{
int i;
option_flags = 0;
return (DCMD_USAGE);
if (!update_tables())
return (DCMD_ERR);
/*
* By default, on all x86 systems ::evtchns from xen_uppc(7d) gets
* loaded first. For APIC systems the ::evtchns from xpv_psm(7d)
* ought to be executed. Confusion stems as both modules export the
* same dcmd.
*/
for (i = 0; i < MAX_ISA_IRQ + 1; i++)
if (shared_tbl[i]) {
break;
}
NULL) == 0) {
return (mdb_call_dcmd("xpv_psm`evtchns",
}
}
if (flags & DCMD_ADDRSPEC) {
/*
* Note: we allow the invalid evtchn 0, as it can help catch if
* we incorrectly try to configure it.
*/
if ((int)addr >= NR_EVENT_CHANNELS) {
return (DCMD_ERR);
}
}
mdb_printf("%<u>Type Evtchn IRQ IPL(lo/hi) CPU "
"Masked Pending ");
"Driver Name(s)" : "ISR(s)");
if (flags & DCMD_ADDRSPEC) {
evtchn_dump((int)addr);
return (DCMD_OK);
}
for (i = 0; i < NR_EVENT_CHANNELS; i++) {
if (evtchn_tbl[i] == INVALID_IRQ)
continue;
evtchn_dump(i);
}
return (DCMD_OK);
}
static void
evtchns_help(void)
{
mdb_printf("Print valid event channels\n"
"If %<u>addr%</u> is given, interpret it as an evtchn to print "
"details of.\n"
"By default, only interrupt service routine names are printed.\n\n"
"Switches:\n"
" -d instead of ISR, print <driver_name><instance#>\n");
}
/*
* MDB module linkage information:
*/
evtchns_help },
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}