📄 ipmi_entity.h
字号:
int val);void ipmi_entity_set_bridge(ipmi_entity_t *ent, int val);void ipmi_entity_set_IPMB_event_generator(ipmi_entity_t *ent, int val);void ipmi_entity_set_IPMB_event_receiver(ipmi_entity_t *ent, int val);void ipmi_entity_set_FRU_inventory_device(ipmi_entity_t *ent, int val);void ipmi_entity_set_SEL_device(ipmi_entity_t *ent, int val);void ipmi_entity_set_SDR_repository_device(ipmi_entity_t *ent, int val);void ipmi_entity_set_sensor_device(ipmi_entity_t *ent, int val);typedef void (*ipmi_entity_cleanup_oem_info_cb)(ipmi_entity_t *entity, void *oem_info);void ipmi_entity_set_oem_info(ipmi_entity_t *entity, void *oem_info, ipmi_entity_cleanup_oem_info_cb cleanup_handler);void *ipmi_entity_get_oem_info(ipmi_entity_t *entity);/* This pointer is kept in the data structure. You should use a static string here, which should always be doable, I think. If not, a management interface needs to be added for this. */void ipmi_entity_set_entity_id_string(ipmi_entity_t *ent, char *str);/* Return the FRU for this entity, or NULL if it doesn't have one or the fetch has not completed. */ipmi_fru_t *ipmi_entity_get_fru(ipmi_entity_t *ent);/* Fetch the FRUs for this entity. */int ipmi_entity_fetch_frus(ipmi_entity_t *ent);/* Set the entity as hot-swappable. */int ipmi_entity_set_hot_swappable(ipmi_entity_t *ent, int val);/* Hot-swap state callbacks. */typedef struct ipmi_entity_hot_swap_s{ /* Fetch the value of the current hot-swap state for the entity. */ int (*get_hot_swap_state)(ipmi_entity_t *ent, ipmi_entity_hot_swap_state_cb handler, void *cb_data); /* Set the auto-activate value for the entity. If auto_act is larger than can be timed with this mechanism, this routine should return EINVAL. */ int (*set_auto_activate)(ipmi_entity_t *ent, ipmi_timeout_t auto_act, ipmi_entity_cb done, void *cb_data); int (*get_auto_activate)(ipmi_entity_t *ent, ipmi_entity_time_cb handler, void *cb_data); /* Set the auto-deactivate value for the entity. If auto_deact is larger than can be timed with this mechanism, this routine should return EINVAL */ int (*set_auto_deactivate)(ipmi_entity_t *ent, ipmi_timeout_t auto_act, ipmi_entity_cb done, void *cb_data); int (*get_auto_deactivate)(ipmi_entity_t *ent, ipmi_entity_time_cb handler, void *cb_data); int (*set_activation_requested)(ipmi_entity_t *ent, ipmi_entity_cb done, void *cb_data); int (*activate)(ipmi_entity_t *ent, ipmi_entity_cb done, void *cb_data); int (*deactivate)(ipmi_entity_t *ent, ipmi_entity_cb done, void *cb_data); int (*get_hot_swap_indicator)(ipmi_entity_t *ent, ipmi_entity_val_cb handler, void *cb_data); int (*set_hot_swap_indicator)(ipmi_entity_t *ent, int val, ipmi_entity_cb done, void *cb_data); int (*get_hot_swap_requester)(ipmi_entity_t *ent, ipmi_entity_val_cb handler, void *cb_data); /* Audit the hot-swap state to make sure it is correct. */ int (*check_hot_swap_state)(ipmi_entity_t *ent);} ipmi_entity_hot_swap_t;/* Call all the hot-swap handlers associated with the entity */void ipmi_entity_call_hot_swap_handlers(ipmi_entity_t *ent, enum ipmi_hot_swap_states last_state, enum ipmi_hot_swap_states curr_state, ipmi_event_t **event, int *handled);/* Set the hot-swap control state machine. */void ipmi_entity_set_hot_swap_control(ipmi_entity_t *ent, ipmi_entity_hot_swap_t *cbs);/* There is a built-in hot-swap engine for entities that will be used if all the right things are set on a entity and a hot-swap control state machine is not already installed (get_hot_swap_state is not NULL). If an entity has a presence sensor and other criteria are not met, a simplified (active/inactive) hot-swap state machine is implemented. If an entity has the following, then an inactive state is added with possible setting of auto-activate. Note that these need to be there even if the entity is not present: * A presence sensor * A power control with "ipmi_control_is_hot_swap_power" returning true If a power control is present, the initial setting of the power control will depend on the auto-activate setting. If it is not zero (IPMI_TIMEOUT_NOW) then the power will be set off. If the following are present, then the extraction pending state will be used: * A presence sensor * A discrete sensor with "ipmi_sensor_is_hot_swap_requester" returning true. This sensor may appear later, it does not have to always be present. Also, if this is present or becomes available while in insertion-pending state, an opposite transition will disable the value. If a hot-swap indicator appears (an LED control with one LED for which "ipmi_control_is_hot_swap_indicator" returns true, it will be automatically controlled. This control does not have to be present all the time, but should generally appear except in not present state.*//* Operations and callbacks for entity operations. Operations on a entity that can be delayed should be serialized (to avoid user confusion and for handling multi-part operations properly), thus each entity has an operation queue, only one operation at a time may be running. If you want to do an operation that requires sending a message and getting a response, you must put that operation into the opq. When the handler you registered in the opq is called, you can actually perform the operation. When your operation completes (no matter what, you must call it, even if the operation fails), you must call ipmi_entity_opq_done. The entity will be locked properly for your callback. To handle the entity locking for you for command responses, you can send the message with ipmi_entity_send_command, it will return the response when it comes in to your handler with the entity locked. */typedef void (*ipmi_entity_rsp_cb)(ipmi_entity_t *entity, int err, ipmi_msg_t *rsp, void *cb_data);typedef struct ipmi_entity_op_info_s{ ipmi_entity_id_t __entity_id; ipmi_entity_t *__entity; void *__cb_data; ipmi_entity_cb __handler; ipmi_entity_rsp_cb __rsp_handler; ipmi_msg_t *__rsp; ipmi_msg_t *__msg; int __err; int __lun;} ipmi_entity_op_info_t;/* Add an operation to the entity operation queue. If nothing is in the operation queue, the handler will be performed immediately. If something else is currently being operated on, the operation will be queued until other operations before it have been completed. Then the handler will be called. */int ipmi_entity_add_opq(ipmi_entity_t *entity, ipmi_entity_cb handler, ipmi_entity_op_info_t *info, void *cb_data);/* When an operation is completed (even if it fails), this *MUST* be called to cause the next operation to run. */void ipmi_entity_opq_done(ipmi_entity_t *entity);/* Send an IPMI command to a specific MC. The response handler will be called with the entity locked. */int ipmi_entity_send_command(ipmi_entity_t *entity, ipmi_mcid_t mcid, unsigned int lun, ipmi_msg_t *msg, ipmi_entity_rsp_cb handler, ipmi_entity_op_info_t *info, void *cb_data);/* Locks for the entity. */void ipmi_entity_lock(ipmi_entity_t *ent);void ipmi_entity_unlock(ipmi_entity_t *ent);#endif /* _IPMI_ENTITY_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -