soc/intel/xeon_sp: Advertise DIMMs on skylake_sp as well
[coreboot.git] / src / drivers / ipmi / ipmi_ops.h
blob788ae85d76d784077caff5e2b8676a645ddf6740
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifndef __IPMI_OPS_H
4 #define __IPMI_OPS_H
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
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 */
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;
29 struct ipmi_wdt_rsp {
30 struct ipmi_rsp resp;
31 struct ipmi_wdt_req data;
32 uint16_t present_countdown_val;
33 } __packed;
35 struct ipmi_get_system_guid_rsp {
36 struct ipmi_rsp resp;
37 uint8_t data[16];
38 } __packed;
40 struct ipmi_read_fru_data_req {
41 uint8_t fru_device_id;
42 uint16_t fru_offset;
43 uint8_t count; /* count to read, 1-based. */
44 } __packed;
46 struct ipmi_read_fru_data_rsp {
47 struct ipmi_rsp resp;
48 uint8_t count; /* count returned, 1-based. */
49 uint8_t data[CONFIG_IPMI_FRU_SINGLE_RW_SZ];
50 } __packed;
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;
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;
68 struct oem_nots_spec_sel_rec {
69 uint8_t oem_defined[13];
70 } __packed;
72 /* SEL Event Record */
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;
83 struct ipmi_add_sel_rsp {
84 struct ipmi_rsp resp;
85 uint16_t record_id;
86 } __packed;
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;
100 uint8_t pad;
101 uint8_t checksum;
102 } __packed;
104 /* The fru_xxx_info only declares the strings that may be added to SMBIOS. */
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; /* Number of custom fields */
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;
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;
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;
141 enum typecode {
142 BINARY = 0,
143 BCD_PLUS = 1,
144 ASCII_6BIT = 2,
145 ASCII_8BIT = 3,
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,
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,
161 uint8_t action);
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);
184 #endif