pci_kstats.c revision d48713b83f032afcef6785303e68f293eacd5671
/*
* 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"
/*
* Kstat support for X86 PCI driver
*/
#include <sys/mach_intr.h>
typedef struct pci_kstat_private {
static struct {
} pci_ks_template = {
{ "name", KSTAT_DATA_CHAR },
{ "type", KSTAT_DATA_CHAR },
{ "cpu", KSTAT_DATA_UINT64 },
{ "pil", KSTAT_DATA_UINT64 },
{ "time", KSTAT_DATA_UINT64 },
{ "ino", KSTAT_DATA_UINT64 },
{ "cookie", KSTAT_DATA_UINT64 },
{ "devpath", KSTAT_DATA_STRING },
{ "buspath", KSTAT_DATA_STRING },
};
static char ih_devpath[MAXPATHLEN];
static char ih_buspath[MAXPATHLEN];
static uint32_t pci_ks_inst;
static kmutex_t pci_ks_template_lock;
/*ARGSUSED*/
static int
{
int maxlen =
/*
* ih_p->ih_vector really has an IRQ. Ask pci_get_intr_from_vecirq to
* return a vector since that's what PCItool will require intrd to use.
*
* PCItool will change the CPU routing of the IRQ that vector maps to.
*
* Note that although possibly multiple vectors can map to an IRQ, the
* vector returned below will always be the same for a given IRQ
* specified, and so all kstats for a given IRQ will report the same
* value for the ino field.
*
* ---
*
* Check for the enabled state, since kstats are set up when the ISR is
* added, not enabled. There may be a period where interrupts are not
* enabled even though they may have been added.
*
* It is also possible that the vector is for a dummy interrupt.
* pci_get_intr_from_vecirq will return failure in this case.
*/
DDI_SUCCESS) ||
/* Interrupt is user-bound. Remove kstat. */
(void) taskq_dispatch(system_taskq,
return (0);
}
/*
* Interrupt is valid (not a dummy), not user-bound to a specific cpu,
* and enabled. Update kstat fields.
*/
/* CPU won't be user bound at this point. */
return (0);
}
{
sizeof (pci_ks_template) / sizeof (kstat_named_t),
}
}
/*
* This function is invoked in two ways:
* - Thru taskq thread via pci_ih_ks_update to remove kstats for user-bound
* interrupts.
* - From the REMISR introp when an interrupt is being removed.
*/
void
{
if (ksp) {
/*
* Delete the kstat before removing the private pointer, to
* prevent a kstat update from coming after private is freed.
*/
}
}