1 /* SPDX-License-Identifier: GPL-2.0-only */
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
13 /* BMC watchdog timeout action */
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,
20 /* BMC Watchdog timer */
23 uint8_t timer_actions
;
24 uint8_t pretimeout_interval
;
25 uint8_t timer_use_expiration_flags_clr
;
26 uint16_t initial_countdown_val
;
31 struct ipmi_wdt_req data
;
32 uint16_t present_countdown_val
;
35 struct ipmi_get_system_guid_rsp
{
40 struct ipmi_read_fru_data_req
{
41 uint8_t fru_device_id
;
43 uint8_t count
; /* count to read, 1-based. */
46 struct ipmi_read_fru_data_rsp
{
48 uint8_t count
; /* count returned, 1-based. */
49 uint8_t data
[CONFIG_IPMI_FRU_SINGLE_RW_SZ
];
52 struct standard_spec_sel_rec
{
58 uint8_t event_dir_type
;
59 uint8_t event_data
[3];
62 struct oem_ts_spec_sel_rec
{
65 uint8_t oem_defined
[6];
68 struct oem_nots_spec_sel_rec
{
69 uint8_t oem_defined
[13];
72 /* SEL Event Record */
73 struct sel_event_record
{
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
;
83 struct ipmi_add_sel_rsp
{
88 /* Platform Management FRU Information Storage Definition Spec. */
89 #define PRODUCT_MAN_TYPE_LEN_OFFSET 3
90 #define BOARD_MAN_TYPE_LEN_OFFSET 6
91 #define CHASSIS_TYPE_OFFSET 2
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
;
104 /* The fru_xxx_info only declares the strings that may be added to SMBIOS. */
105 struct fru_product_info
{
108 char *product_partnumber
;
109 char *product_version
;
113 char **product_custom
;
114 size_t custom_count
; /* Number of custom fields */
117 struct fru_board_info
{
127 struct fru_chassis_info
{
128 uint8_t chassis_type
;
129 char *chassis_partnumber
;
131 char **chassis_custom
;
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
;
149 INTERNAL_USE_AREA
= 0,
150 CHASSIS_INFO_AREA
= 1,
152 PRODUCT_INFO_AREA
= 3,
153 MULTIRECORD_INFO_AREA
= 4,
156 * Initialize and start BMC FRB2 watchdog timer with the
157 * provided timer countdown and action values.
158 * Returns CB_SUCCESS on success and CB_ERR if an error occurred
160 enum cb_err
ipmi_init_and_start_bmc_wdt(const int port
, uint16_t countdown
,
162 /* Returns CB_SUCCESS on success and CB_ERR if an error occurred */
163 enum cb_err
ipmi_stop_bmc_wdt(const int port
);
165 /* IPMI get BMC system GUID and store it to parameter uuid.
166 * Returns CB_SUCCESS on success and CB_ERR if an error occurred */
167 enum cb_err
ipmi_get_system_guid(const int port
, uint8_t *uuid
);
169 /* Read all FRU inventory areas string data into fru_info_str with
170 * the same FRU device id. */
171 void read_fru_areas(const int port
, uint8_t id
, uint16_t offset
,
172 struct fru_info_str
*fru_info_str
);
174 /* Read a particular FRU inventory area into fru_info_str. */
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
);
178 /* Add a SEL record entry, returns CB_SUCCESS on success and CB_ERR
179 * if an error occurred */
180 enum cb_err
ipmi_add_sel(const int port
, struct sel_event_record
*sel
);
182 /* Print all IPMI read FRU data */
183 void print_fru_areas(struct fru_info_str
*fru_info_str
);