sensor_transport.c revision f6e214c7418f43af38bd8c3a557e3d0a1d311cfa
/*
* 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
*/
/*
*/
#include <fm/topo_mod.h>
#include <fm/topo_method.h>
#include <sys/systeminfo.h>
#include <string.h>
#define ST_EREPORT_CLASS "ereport.sensor.failure"
typedef struct sensor_fault {
struct sensor_fault *sf_next;
char *sf_fru;
typedef struct sensor_transport {
/*
* The number of consecutive sensor readings indicating failure that
* we'll tolerate before sending an ereport.
*/
typedef struct st_stats {
} st_stats_t;
st_stats_t st_stats = {
};
static int st_check_component_complaints;
static int have_complained;
static int
{
char *fmri;
return (0);
return (0);
}
/*
* If the resource isn't present, don't bother invoking the sensor
* failure method. It may be that the sensors aren't part of the same
* physical FRU and will report failure if the FRU is no longer there.
*/
return (0);
}
if (!ret) {
return (0);
}
if (err == ETOPO_METHOD_NOTSUP) {
if (!have_complained) {
}
return (0);
}
}
return (0);
}
return (0);
}
predictive = B_TRUE;
continue;
/*
* We need some simple rules to handle the case where
* there are multiple facility nodes that indicate
* a problem with this FRU, but disagree on the values
* of nonrecov, predictive or source:
*
* 1) nonrecov will be set to true if one or more
* facility nodes indicates true. Otherwise it will
* default to false
*
* 2) predictive will default to false and remain false
* if one or more facility nodes indicate false.
*
* 3) source will be set to unknown unless all facility
* nodes agree on the source
*/
"nonrecov", &nonrecov) != 0)
if (predictive == B_TRUE)
"predictive", &predictive) != 0)
}
if (source_diff)
}
/*
* See if we know about this fru.
*/
break;
}
/*
* We add this FRU to our list under two circumstances:
*
* 1. This FRU is faulted and needs to be remembered to
* avoid duplicate ereports.
*
* 2. This is the initial pass, and we want to repair the
* FRU in case it was repaired while we were offline.
*/
} else {
goto out;
}
}
if (faulted)
sfp->sf_num_fails++;
if (faulted) {
/*
* Construct and post the ereport.
*
* XXFM we only post one ereport per fru. It should be possible
* to uniquely identify faulty resources instead and post one
* per resource, even if they share the same FRU.
*/
if (!sfp->sf_last_faulted &&
nonrecov);
rsrc);
}
}
out:
return (0);
}
int st_timeout_verbose = 0;
/*ARGSUSED*/
static void
{
int err;
if (st_timeout_verbose)
topo_strerror(err));
return;
}
/*
* Initialize values in our internal FRU list for this iteration of
* sensor reads. Keep track of whether the FRU was faulted in the
* previous pass so we don't send multiple ereports for the same
* problem.
*/
}
return;
}
/*
* Remove any faults that weren't seen in the last pass.
*/
} else {
}
}
}
static const fmd_prop_t fmd_props[] = {
};
static const fmd_hdl_ops_t fmd_ops = {
NULL, /* fmdo_recv */
st_timeout, /* fmdo_timeout */
NULL, /* fmdo_close */
NULL, /* fmdo_stats */
NULL, /* fmdo_gc */
NULL, /* fmdo_send */
NULL /* fmdo_topo */
};
static const fmd_hdl_info_t fmd_info = {
};
void
{
/*
* The sensor-transport module is currently only supported on x86
* platforms. So to avoid unnecessarily wasting cpu cycles on sparc
* walking the hc scheme tree every 60 seconds, we'll bail out before
* registering the handle.
*/
return;
return;
sizeof (st_stats) / sizeof (fmd_stat_t),
(fmd_stat_t *)&st_stats);
/* kick off the first asynchronous discovery */
}
void
{
}
}
}