/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* IPMI entities are a strange beast. A reasonable assumption for those
* unfamiliar with the spec would be that there was a command to iterate over
* all entities, and a command to iterate over sensors associated with each
* entity. Instead, the entire IPMI world is derived from the SDR repository.
* Entities only exist in the sense that they are referenced by a SDR record.
*
* In addition, entities can be associated into groups, and determining entity
* presence is quite complicated. The IPMI spec dedicates an entire chapter
* (40) to the process of handling sensor associations.
*
* The above logic is implemented via the ipmi_entity_present() function. We
* make a first pass over the SDR repository to discover entities, creating
* entity groups and associating SDR records with the each.
*
* We don't currently support device-relative entities.
*/
#include <libipmi.h>
#include <ipmi_impl.h>
#include <stddef.h>
typedef struct ipmi_entity_sdr {
const char *ies_name;
typedef struct ipmi_entity_impl {
((ipmi_entity_impl_t *)((char *)(ep) - \
static int
{
sizeof (ipmi_entity_impl_t))) == NULL)
return (-1);
}
/*
* This should never happen. However, we want to be tolerant of
* pathologically broken IPMI implementations, so we ignore this
* error, and the first parent wins.
*/
return (0);
}
return (0);
}
static int
{
{
break;
}
{
break;
}
case IPMI_SDR_TYPE_EVENT_ONLY:
{
break;
}
{
break;
}
{
break;
}
{
break;
}
{
break;
}
default:
return (-1);
}
return (0);
}
/*
* This function is responsible for gathering all entities, inserting them into
* the global hash, and establishing any associations.
*/
/*ARGSUSED*/
static int
void *unused)
{
return (0);
sizeof (ipmi_entity_impl_t))) == NULL)
return (-1);
}
if (eap->is_ea_range) {
if (type != 0) {
type, i) != 0)
return (-1);
}
}
if (type != 0) {
type, i) != 0)
return (-1);
}
}
} else {
for (i = 0; i < 4; i++) {
if (type == 0)
continue;
instance) != 0)
return (-1);
}
}
} else {
sizeof (ipmi_entity_sdr_t))) == NULL)
return (-1);
}
return (0);
}
/*
* Given a SDR record, return boolean values indicating whether the sensor
* indicates explicit presence.
*
* XXX this should really share code with entity_present()
*/
int
{
break;
break;
default:
return (0);
}
switch (reading_type) {
case IPMI_RT_PRESENT:
break;
case IPMI_RT_SPECIFIC:
switch (sensor_type) {
case IPMI_ST_PROCESSOR:
break;
case IPMI_ST_POWER_SUPPLY:
break;
case IPMI_ST_MEMORY:
break;
case IPMI_ST_BAY:
break;
default:
return (0);
}
break;
default:
return (0);
}
/*
* If we've reached here, then we have a dedicated sensor that
* indicates presence.
*/
return (0);
}
return (-1);
}
return (0);
}
/*
* This function follows the procedure documented in section 40 of the spec.
* To quote the conclusion from section 40.2:
*
* Thus, the steps to detecting an Entity are:
*
* a) Scan the SDRs for sensors associated with the entity.
*
* b) If there is an active sensor that includes a presence bit, or the
* entity has an active Entity Presence sensor, use the sensor to
* determine the presence of the entity.
*
* c) Otherwise, check to see that there is at least one active sensor
* associated with the entity. Do this by doing 'Get Sensor Readings'
* to the sensors associated with the entity until a scanning sensor is
* found.
*
* d) If there are no active sensors directly associated with the entity,
* check the SDRs to see if the entity is a container entity in an
* entity-association. If so, check to see if any of the contained
* entities are present, if so, assume the container entity exists.
* Note that this may need to be iterative, since it's possible to have
* multi-level entity associations.
*
* e) If there are no active sensors for the entity, and the entity is not
* the container entity in an active entity-assocation, then the entity
* is present if (sic) there there is a FRU device for the entity, and
* the FRU device is present.
*
* It should not be considered an error if a FRU device locator record is
* present for a FRU device, but the FRU device is not there.
*
*/
int
{
/* LINTED - alignment */
char *frudata;
/*
* Search the sensors for a present sensor or a discrete sensor that
* indicates presence.
*/
break;
break;
default:
continue;
}
switch (reading_type) {
case IPMI_RT_PRESENT:
break;
case IPMI_RT_SPECIFIC:
switch (sensor_type) {
case IPMI_ST_PROCESSOR:
break;
case IPMI_ST_POWER_SUPPLY:
break;
case IPMI_ST_MEMORY:
break;
case IPMI_ST_BAY:
break;
default:
continue;
}
break;
default:
continue;
}
/*
* If we've reached here, then we have a dedicated sensor that
* indicates presence.
*/
return (0);
}
return (-1);
}
return (0);
}
/*
* No explicit presence sensor was found. See if there is at least one
* active sensor associated with the entity.
*/
break;
break;
default:
continue;
}
continue;
return (-1);
}
if (srp->isr_scanning_enabled) {
return (0);
}
}
/*
* If this entity has children, then it is present if any of its
* children are present.
*/
return (-1);
if (*valp)
return (0);
}
/*
* If the FRU device is present, then the entity is present.
*/
continue;
return (0);
}
return (-1);
}
return (0);
}
static int
{
return (0);
return (-1);
return (0);
}
int
ipmi_entity_t *, void *), void *data)
{
int ret;
if (ipmi_entity_refresh(ihp) != 0)
return (-1);
continue;
return (ret);
}
return (0);
}
int
void *), void *data)
{
/* LINTED - alignment */
int ret;
return (ret);
}
return (0);
}
int
{
/* LINTED - alignment */
int ret;
return (ret);
}
return (0);
}
{
/* LINTED - alignment */
return (NULL);
}
}
{
if (ipmi_entity_refresh(ihp) != 0)
return (NULL);
return (NULL);
}
}
{
return (NULL);
"SDR record %s has no associated entity", name);
return (NULL);
}
}
static const void *
ipmi_entity_hash_convert(const void *p)
{
}
static ulong_t
ipmi_entity_hash_compute(const void *p)
{
}
static int
ipmi_entity_hash_compare(const void *a, const void *b)
{
return (0);
else
return (-1);
}
int
{
ipmi_entity_hash_compare)) == NULL)
return (-1);
return (0);
}
void
{
}
}
}
void
{
}
}