apic.c revision abf601c9b581ed63a268ad83f92233cd0885090a
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stddef.h>
#include <sys/mdb_modapi.h>
/*
* Globals
*/
static char *businfo_array[] = {
" ",
"CBUS",
"CBUSII",
"EISA",
"FUTURE",
"INTERN",
"ISA",
"MBI",
"MBII",
" ",
"MPI",
"MPSA",
"NUBUS",
"PCI",
"PCMCIA",
"TC",
"VL",
"VME",
"XPRESS",
" "
};
/*
* Option usage
*/
int option_flags;
void
interrupt_help(void)
{
mdb_printf("Prints the interrupt usage on the system.\n"
"By default, only interrupt service routine names are printed.\n\n"
"Switches:\n"
" -d instead of ISR, print <driver_name><instance#>\n"
" -i show like intrstat, cpu# ISR/<driver_name><instance#>\n");
}
/*
* get_interrupt_type:
*
* Get some interrupt related useful information
*
*/
static char *
get_interrupt_type(short index)
{
if (index == RESERVE_INDEX)
return ("IPI");
else if (index == ACPI_INDEX)
return ("Fixed");
return ("MSI");
else if (index == MSIX_INDEX)
return ("MSI-X");
else
return ("Fixed");
}
/*
* interrupt_display_info:
*
* Dump interrupt information including shared interrupts.
*/
static void
{
int bus_type;
int share_cnt;
char *intr_type;
char ioapic_iline[10];
char ipl[3];
char cpu_assigned[4];
/* If invalid index; continue */
return;
/* Figure out interrupt type and trigger information */
/* Figure out IOAPIC number and ILINE number */
else {
else
} else
}
} else {
}
/* Print each interrupt entry */
else
mdb_printf("%3d 0x%x %-3s %-5s %-6s%-4s %2d %-9s ",
/* If valid dip found; print driver name */
/*
* Loop thru all the shared IRQs
*/
share_cnt-- > 0) {
if (option_flags & INTR_DISPLAY_DRVR_INST) {
driver_name, sizeof (driver_name)) == 0) {
}
} else
mdb_printf(", ");
}
} else {
mdb_printf("poke_cpu");
}
mdb_printf("\n");
}
/*
* interrupt_dump:
*
* Dump interrupt information.
*/
/* ARGSUSED */
int
{
int i;
option_flags = 0;
return (DCMD_USAGE);
mdb_warn("failed to read apic_irq_table");
return (DCMD_ERR);
}
mdb_warn("failed to read autovect");
return (DCMD_ERR);
}
/* Print the header first */
mdb_printf("%<u>CPU\t ");
else
"Driver Name(s)" : "ISR(s)");
/* Walk all the entries */
for (i = 0; i < APIC_MAX_VECTOR + 1; i++) {
/* Read the entry */
continue;
}
return (DCMD_OK);
}
/*
* MDB module linkage information:
*
* We declare a list of structures describing our dcmds, and a function
* named _mdb_init to return a pointer to our module information.
*/
static const mdb_dcmd_t dcmds[] = {
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
return (&modinfo);
}