7.3. ENTITY PRESENCE
t y p e d e f v o i d ( * i p m i _ e n t i t y _ i t e r a t e _ p a r e n t _ c b ) ( i p m i _ e n t i t y _ t * e n t , i p m i _ e n t i t y _ t * p a r e n t ,
*cb_data); *ent, void v o i d i p m i _ e n t i t y _ i t e r a t e _ p a r e n t s ( i p m i _ e n t i t y _ t i p m i _ e n t i t y _ i t e r a t e _ p a r e n t _ c b h a n d l e r ,
* c b _ d a t a ) ;
To discover if an entity is a child (has parent entities) or is a parent (has child entities), you may use the following calls:
i n t i p m i _ e n t i t y _ g e t _ i s _ c h i l d ( i p m i _ e n t i t y _ t * e n t ) ; i n t i p m i _ e n t i t y _ g e t _ i s _ p a r e n t ( i p m i _ e n t i t y _ t * e n t ) ;
An entity identified in an SDR may or may not be present in the system. IPMI specifies an algorithm for detecting whether an entity is present. Unfortunately, this algorithm is extremely complicated. The algorithm is given in stages:
If the entity has a presence sensor attached (sensor type 25h) or a bit in some sensor that is attached to it that shows presense (sensor type 21h bit 02h, sensor type 08h bit 00h, or sensor type 29h bit 02h), that sensor should always be present and will tell if the entity is present. A presence sensor or bit will override all other entity detection methods; it directly tells if the entity is present or not.
If a FRU device for the entity is specified and is operational, then the entity is present.
The entity is present if at least one sensor is available and scanning is enabled on that sensor.
The entity is present if the entity is a parent entity and at least one of its children is present.
Otherwise the entity is not present.
Entity presence may also affect whether the sensors attached to the entity are present. The sensor SDRs have a flag that specifies whether the sensor is present even if the entity is not present.
Entity Presence in
OpenIPMI handles detection of entity presence for the user. If you have an entity pointer or entity id, you can directly query to see if the entity is present using:
int ipmi_entity_is_present(ipmi_entity_t *ent); int ipmi_entity_id_is_present(ipmi_entity_id_t id, int *present);
_ _ _ typedef int (*ipmi entity_presence change_cb)(ipmi entity_t *entity,
If you need to know when an entity becomes present or absent, you may use the following callback registration: