| 1 |
|
| 2 |
|
| 3 |
#ifndef __IPMI_OPS_H |
| 4 |
#define __IPMI_OPS_H |
| 5 |
|
| 6 |
#include <types.h> |
| 7 |
#include "ipmi_if.h" |
| 8 |
#define IPMI_BMC_RESET_WDG_TIMER 0x22 |
| 9 |
#define IPMI_BMC_SET_WDG_TIMER 0x24 |
| 10 |
#define IPMI_BMC_GET_WDG_TIMER 0x25 |
| 11 |
#define IPMI_BMC_GET_SYSTEM_GUID 0x37 |
| 12 |
|
| 13 |
|
| 14 |
enum ipmi_bmc_timeout_action_type { |
| 15 |
TIMEOUT_NO_ACTION = 0x00, |
| 16 |
TIMEOUT_HARD_RESET = 0x01, |
| 17 |
TIMEOUT_POWER_DOWN = 0x02, |
| 18 |
TIMEOUT_POWER_CYCLE = 0x03, |
| 19 |
}; |
| 20 |
|
| 21 |
struct ipmi_wdt_req { |
| 22 |
uint8_t timer_use; |
| 23 |
uint8_t timer_actions; |
| 24 |
uint8_t pretimeout_interval; |
| 25 |
uint8_t timer_use_expiration_flags_clr; |
| 26 |
uint16_t initial_countdown_val; |
| 27 |
} __packed; |
| 28 |
|
| 29 |
struct ipmi_wdt_rsp { |
| 30 |
struct ipmi_rsp resp; |
| 31 |
struct ipmi_wdt_req data; |
| 32 |
uint16_t present_countdown_val; |
| 33 |
} __packed; |
| 34 |
|
| 35 |
struct ipmi_get_system_guid_rsp { |
| 36 |
struct ipmi_rsp resp; |
| 37 |
uint8_t data[16]; |
| 38 |
} __packed; |
| 39 |
|
| 40 |
struct ipmi_read_fru_data_req { |
| 41 |
uint8_t fru_device_id; |
| 42 |
uint16_t fru_offset; |
| 43 |
uint8_t count; |
| 44 |
} __packed; |
| 45 |
|
| 46 |
struct ipmi_read_fru_data_rsp { |
| 47 |
struct ipmi_rsp resp; |
| 48 |
uint8_t count; |
| 49 |
uint8_t data[CONFIG_IPMI_FRU_SINGLE_RW_SZ]; |
| 50 |
} __packed; |
| 51 |
|
| 52 |
struct standard_spec_sel_rec { |
| 53 |
uint32_t timestamp; |
| 54 |
uint16_t gen_id; |
| 55 |
uint8_t evm_rev; |
| 56 |
uint8_t sensor_type; |
| 57 |
uint8_t sensor_num; |
| 58 |
uint8_t event_dir_type; |
| 59 |
uint8_t event_data[3]; |
| 60 |
} __packed; |
| 61 |
|
| 62 |
struct oem_ts_spec_sel_rec { |
| 63 |
uint32_t timestamp; |
| 64 |
uint8_t manf_id[3]; |
| 65 |
uint8_t oem_defined[6]; |
| 66 |
} __packed; |
| 67 |
|
| 68 |
struct oem_nots_spec_sel_rec { |
| 69 |
uint8_t oem_defined[13]; |
| 70 |
} __packed; |
| 71 |
|
| 72 |
|
| 73 |
struct sel_event_record { |
| 74 |
uint16_t record_id; |
| 75 |
uint8_t record_type; |
| 76 |
union{ |
| 77 |
struct standard_spec_sel_rec standard_type; |
| 78 |
struct oem_ts_spec_sel_rec oem_ts_type; |
| 79 |
struct oem_nots_spec_sel_rec oem_nots_type; |
| 80 |
} sel_type; |
| 81 |
} __packed; |
| 82 |
|
| 83 |
struct ipmi_add_sel_rsp { |
| 84 |
struct ipmi_rsp resp; |
| 85 |
uint16_t record_id; |
| 86 |
} __packed; |
| 87 |
|
| 88 |
|
| 89 |
#define PRODUCT_MAN_TYPE_LEN_OFFSET 3 |
| 90 |
#define BOARD_MAN_TYPE_LEN_OFFSET 6 |
| 91 |
#define CHASSIS_TYPE_OFFSET 2 |
| 92 |
|
| 93 |
struct ipmi_fru_common_hdr { |
| 94 |
uint8_t format_version; |
| 95 |
uint8_t internal_use_area_offset; |
| 96 |
uint8_t chassis_area_offset; |
| 97 |
uint8_t board_area_offset; |
| 98 |
uint8_t product_area_offset; |
| 99 |
uint8_t multirecord_area_offset; |
| 100 |
uint8_t pad; |
| 101 |
uint8_t checksum; |
| 102 |
} __packed; |
| 103 |
|
| 104 |
|
| 105 |
struct fru_product_info { |
| 106 |
char *manufacturer; |
| 107 |
char *product_name; |
| 108 |
char *product_partnumber; |
| 109 |
char *product_version; |
| 110 |
char *serial_number; |
| 111 |
char *asset_tag; |
| 112 |
char *fru_file_id; |
| 113 |
char **product_custom; |
| 114 |
size_t custom_count; |
| 115 |
}; |
| 116 |
|
| 117 |
struct fru_board_info { |
| 118 |
char *manufacturer; |
| 119 |
char *product_name; |
| 120 |
char *serial_number; |
| 121 |
char *part_number; |
| 122 |
char *fru_file_id; |
| 123 |
char **board_custom; |
| 124 |
size_t custom_count; |
| 125 |
}; |
| 126 |
|
| 127 |
struct fru_chassis_info { |
| 128 |
uint8_t chassis_type; |
| 129 |
char *chassis_partnumber; |
| 130 |
char *serial_number; |
| 131 |
char **chassis_custom; |
| 132 |
size_t custom_count; |
| 133 |
}; |
| 134 |
|
| 135 |
struct fru_info_str { |
| 136 |
struct fru_product_info prod_info; |
| 137 |
struct fru_board_info board_info; |
| 138 |
struct fru_chassis_info chassis_info; |
| 139 |
}; |
| 140 |
|
| 141 |
enum typecode { |
| 142 |
BINARY = 0, |
| 143 |
BCD_PLUS = 1, |
| 144 |
ASCII_6BIT = 2, |
| 145 |
ASCII_8BIT = 3, |
| 146 |
}; |
| 147 |
|
| 148 |
enum fru_area { |
| 149 |
INTERNAL_USE_AREA = 0, |
| 150 |
CHASSIS_INFO_AREA = 1, |
| 151 |
BOARD_INFO_AREA = 2, |
| 152 |
PRODUCT_INFO_AREA = 3, |
| 153 |
MULTIRECORD_INFO_AREA = 4, |
| 154 |
}; |
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
enum cb_err ipmi_init_and_start_bmc_wdt(const int port, uint16_t countdown, |
| 161 |
uint8_t action); |
| 162 |
|
| 163 |
enum cb_err ipmi_stop_bmc_wdt(const int port); |
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
enum cb_err ipmi_get_system_guid(const int port, uint8_t *uuid); |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
void read_fru_areas(const int port, uint8_t id, uint16_t offset, |
| 172 |
struct fru_info_str *fru_info_str); |
| 173 |
|
| 174 |
|
| 175 |
void read_fru_one_area(const int port, uint8_t id, uint16_t offset, |
| 176 |
struct fru_info_str *fru_info_str, enum fru_area fru_area); |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
enum cb_err ipmi_add_sel(const int port, struct sel_event_record *sel); |
| 181 |
|
| 182 |
|
| 183 |
void print_fru_areas(struct fru_info_str *fru_info_str); |
| 184 |
#endif |