Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 1 | #ifndef __HOST_IPMI_SEN_HANDLER_H__ |
| 2 | #define __HOST_IPMI_SEN_HANDLER_H__ |
| 3 | |
Chris Austen | 0012e9b | 2015-10-22 01:37:46 -0500 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 6 | // IPMI commands for net functions. |
| 7 | enum ipmi_netfn_sen_cmds |
| 8 | { |
Chris Austen | 10ccc0f | 2015-12-10 18:27:04 -0600 | [diff] [blame] | 9 | IPMI_CMD_GET_SENSOR_READING = 0x2D, |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 10 | IPMI_CMD_GET_SENSOR_TYPE = 0x2F, |
| 11 | IPMI_CMD_SET_SENSOR = 0x30, |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 12 | }; |
| 13 | |
Emily Shaffer | 1fabf22 | 2017-04-05 08:53:21 -0700 | [diff] [blame] | 14 | // Discrete sensor types. |
| 15 | enum ipmi_sensor_types |
| 16 | { |
| 17 | IPMI_SENSOR_TEMP = 0x01, |
| 18 | IPMI_SENSOR_VOLTAGE = 0x02, |
| 19 | IPMI_SENSOR_CURRENT = 0x03, |
| 20 | IPMI_SENSOR_FAN = 0x04, |
| 21 | }; |
| 22 | |
Chris Austen | 0012e9b | 2015-10-22 01:37:46 -0500 | [diff] [blame] | 23 | #define MAX_DBUS_PATH 128 |
| 24 | struct dbus_interface_t { |
| 25 | uint8_t sensornumber; |
| 26 | uint8_t sensortype; |
| 27 | |
| 28 | char bus[MAX_DBUS_PATH]; |
| 29 | char path[MAX_DBUS_PATH]; |
| 30 | char interface[MAX_DBUS_PATH]; |
| 31 | }; |
Tom | d700e76 | 2016-09-20 18:24:13 +0530 | [diff] [blame] | 32 | |
| 33 | int set_sensor_dbus_state_s(uint8_t , const char *, const char *); |
| 34 | int set_sensor_dbus_state_y(uint8_t , const char *, const uint8_t); |
Emily Shaffer | 2ae09b9 | 2017-04-05 15:09:41 -0700 | [diff] [blame] | 35 | int find_openbmc_path(uint8_t , dbus_interface_t *); |
Tom | 0573237 | 2016-09-06 17:21:23 +0530 | [diff] [blame] | 36 | |
Tom Joseph | be703f7 | 2017-03-09 12:34:35 +0530 | [diff] [blame] | 37 | /** |
| 38 | * @struct SetSensorReadingReq |
| 39 | * |
| 40 | * IPMI Request data for Set Sensor Reading and Event Status Command |
| 41 | */ |
| 42 | struct SetSensorReadingReq |
| 43 | { |
| 44 | uint8_t number; |
| 45 | uint8_t operation; |
| 46 | uint8_t reading; |
| 47 | uint8_t assertOffset0_7; |
| 48 | uint8_t assertOffset8_14; |
| 49 | uint8_t deassertOffset0_7; |
| 50 | uint8_t deassertOffset8_14; |
| 51 | uint8_t eventData1; |
| 52 | uint8_t eventData2; |
| 53 | uint8_t eventData3; |
| 54 | } __attribute__((packed)); |
| 55 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 56 | #endif |