etm_filter.c revision 25351652d920ae27c5a56c199da581033ce763f6
/*
* 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.
*/
/*
* Description:
* Find the ldom that own the resource specified in the detector field
* of the ereport.
*/
#include <pthread.h>
#include <stdio.h>
#include <strings.h>
#include "etm_filter.h"
/* ARGSUSED */
static int
{
int i; /* temp counter */
int n; /* temp size of new vector */
int err; /* temp error var */
char *str; /* topo node value */
etm_prc_t *p; /* temp pointer */
/* pciexrc node */
return (TOPO_WALK_NEXT);
&err) != 0)
return (TOPO_WALK_NEXT);
/* physical id and bus address of a root complex */
/*
* prc vector is full, so double its size
*/
if (etm_rc_cnt >= etm_rc_max) {
for (i = 0, p = rcl; i < n; i++, p++) {
p->prc_id = -1;
p->prc_status = -1;
}
etm_rc_max * sizeof (etm_prc_t));
}
etm_rc_max = n;
}
if (etm_rc_cnt >= etm_rc_max) {
}
/* Add the rc at the end of the list */
p = etm_rcs + etm_rc_cnt;
p->prc_cfg_handle = ba;
etm_rc_cnt++;
return (TOPO_WALK_NEXT);
}
/*
* etm_pciexrc_init()
* Description:
* Walk through the topology to find the pciexrc nodes. Then save the
* physical instances and bus addreses in a vector.
*/
static void
{
int err; /* topo error */
return;
return;
}
}
/*
* etm_update_prc()
* Description:
* Query ldmd for the ldom id
*/
void
{
return;
/* call libldom to find the ldom id */
if (prc->prc_status) {
return;
}
/* cache the ldom id */
}
}
/*
* etm_find_ldom_id()
* Description:
* Find the ldom name and the domain id that owns the resource specified in
* the ereport detector
*/
int
{
char *str; /* temp string */
char *s; /* temp string */
int i; /* loop counter */
int ins; /* instance number */
/* check paramters */
return (-1);
}
/* must be an ereport */
return (-1);
}
/* the detector is of hc-scheme */
return (-1);
}
return (-1);
}
/*
* Find the pciexrc and extract the instance number
*/
return (-1);
}
for (i = 0; i < sz; i++) {
break;
}
}
if (i >= sz) {
return (-1);
}
(void) pthread_mutex_lock(&etm_rc_lock);
/* search the entry by the physical instance number */
i++, prc++) {
/* update the cached entry */
if (prc->prc_status != 0) {
}
/* check for cached ldom name */
(void) pthread_mutex_unlock(&etm_rc_lock);
return (0);
}
break;
}
}
if (i >= etm_rc_cnt) {
}
(void) pthread_mutex_unlock(&etm_rc_lock);
return (-1);
} /* etm_find_ldom_id */
/*
* etm_find_ldom_name()
* Description:
* Find the ldom name of a given domain id (did)
*/
int
int name_size)
{
int i; /* loop counter */
(void) pthread_mutex_lock(&etm_rc_lock);
/* visit all the root complexes to find an entry that matches the did */
i++, prc++) {
/* update the cached entry */
if (prc->prc_status != 0) {
}
/* find the cached ldom name */
rc = 0;
break;
}
}
(void) pthread_mutex_unlock(&etm_rc_lock);
return (rc);
} /* etm_find_ldom_name */
/*
* etm_filter_handle_ldom_event()
* Description:
* Invalidate the ldom name in the physical root complex vector.
*/
void
char *name) {
int i; /* loop counter */
/*
* Clear the cached ldom name
*/
switch (event) {
case ETM_ASYNC_EVENT_LDOM_ADD:
(void) pthread_mutex_lock(&etm_rc_lock);
i++, prc++) {
prc->prc_name_sz);
prc->prc_name_sz = 0;
}
}
(void) pthread_mutex_unlock(&etm_rc_lock);
break;
default:
break;
}
}
/* ARGSUSED */
void
etm_rc_cnt = 0;
etm_rc_max = 0;
}
void
int i; /* loop counter */
i++, prc++) {
prc->prc_name_sz = 0;
}
}
}
(void) pthread_mutex_destroy(&etm_rc_lock);
}