]> git.ozlabs.org Git - petitboot/blob - discover/ipmi.h
discover: Display warning if saving config fails
[petitboot] / discover / ipmi.h
1 #ifndef _IPMI_H
2 #define _IPMI_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 #include <types/types.h>
8
9 enum ipmi_netfn {
10         IPMI_NETFN_CHASSIS      = 0x0,
11         IPMI_NETFN_SE           = 0x04,
12         IPMI_NETFN_APP          = 0x06,
13         IPMI_NETFN_TRANSPORT    = 0x0c,
14         IPMI_NETFN_AMI          = 0x3a,
15 };
16
17 enum ipmi_cmd {
18         IPMI_CMD_CHASSIS_SET_SYSTEM_BOOT_OPTIONS        = 0x08,
19         IPMI_CMD_CHASSIS_GET_SYSTEM_BOOT_OPTIONS        = 0x09,
20         IPMI_CMD_SENSOR_SET                             = 0x30,
21         IPMI_CMD_TRANSPORT_GET_LAN_PARAMS               = 0x02,
22         IPMI_CMD_APP_GET_DEVICE_ID                      = 0x01,
23         IPMI_CMD_APP_GET_DEVICE_ID_GOLDEN               = 0x1a,
24 };
25
26 enum ipmi_sensor_ids {
27         IPMI_SENSOR_ID_OS_BOOT          = 0x1F,
28 };
29
30 struct ipmi;
31
32 static const int ipmi_timeout = 10000; /* milliseconds. */
33
34 bool ipmi_present(void);
35 bool ipmi_bootdev_is_valid(int x);
36 struct ipmi *ipmi_open(void *ctx);
37
38 int ipmi_transaction(struct ipmi *ipmi, uint8_t netfn, uint8_t cmd,
39                 uint8_t *req_buf, uint16_t req_len,
40                 uint8_t *resp_buf, uint16_t *resp_len,
41                 int timeout_ms);
42
43 int parse_ipmi_interface_override(struct config *config, uint8_t *buf,
44                                 uint16_t len);
45 void ipmi_get_bmc_mac(struct ipmi *ipmi, uint8_t *buf);
46 void ipmi_get_bmc_versions(struct ipmi *ipmi, struct system_info *info);
47
48
49 #endif /* _IPMI_H */