CHAPTER 7. ENTITIES
Generic FRU Data Interface
The generic FRU interface represents the FRU data as a tree-structured hierarchy of data. Each level of the tree has a “node”. The fields in a node are indexed by number and may contain both data elements and sub-nodes.
Two types of nodes exist. A record node is a set of named fields. The “name” of each field will be returned and the “intval” when the node itself is fetched will be −1. An array node contains a set of unnamed elements. The “name” of each field will be returned as NULL and the “intval” will be the number of elements in the array.
T h e n o d e s a r e r e f c o u n t e d . I f y o u a r e g i v e n a n o d e , y o u m u s t f r e e t h e n o d e u s i n g i p m i _ f r u _ p u t _ n o d e when you are done with it. ( )
To fetch the root node of a FRU data object, use the function:
i n t i p m i _ f r u _ g e t _ r o o t _ n o d e ( i p m i _ f r u _ t
i p m i _ f r u _ n o d e _ t * * n o d e ) ;
This function returns the name of the FRU, either “SPD FRU” or “standard FRU” or some other OEM name and the actual root node. If either of these is NULL, it will be ignored. The root node is always a record node.
To fetch individual fields from a record, use:
_ _ _ _ _ _ int ipmi fru node_get field(ipmi fru node t
_ _ enum ipmi fru data_type_e *dtype,
_ *data len,
_ _ ipmi_fru node t
_ **sub node);
The index is a contiguous range from zero that holds every field. So you can iterate through the indexes from 0 until it returns EINVAL to find all the fields. If a field is not present in the FRU data, this will return ENOSYS. Note that later fields may still be present.
The name returns the string name for the index. Note that the indexes may change between release, so don’t rely on absolute numbers. The names will remain the same, so you can rely on those.
The dtype field will be set to the data type. The following values are returned:
IPMI FRU DATA INT sets intval
IPMI FRU DATA TIME sets time
IPMI FRU DATA ASCII sets data and data_len
IPMI FRU DATA BINARY sets data and data_len
IPMI FRU DATA UNICODE sets data and data len