e60ff619215984c58da52293df3315ad9de773ce
[petitboot] / discover / ipmi.h
1 #ifndef _IPMI_H
2 #define _IPMI_H
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 enum ipmi_netfn {
8         IPMI_NETFN_CHASSIS = 0x0,
9 };
10
11 enum ipmi_cmd {
12         IPMI_CMD_CHASSIS_SET_SYSTEM_BOOT_OPTIONS        = 0x08,
13         IPMI_CMD_CHASSIS_GET_SYSTEM_BOOT_OPTIONS        = 0x09,
14 };
15
16 enum ipmi_bootdev {
17         IPMI_BOOTDEV_NONE = 0x00,
18         IPMI_BOOTDEV_NETWORK = 0x01,
19         IPMI_BOOTDEV_DISK = 0x2,
20         IPMI_BOOTDEV_SAFE = 0x3,
21         IPMI_BOOTDEV_CDROM = 0x5,
22         IPMI_BOOTDEV_SETUP = 0x6,
23 };
24
25 struct ipmi;
26
27 bool ipmi_present(void);
28 bool ipmi_bootdev_is_valid(int x);
29 struct ipmi *ipmi_open(void *ctx);
30
31 int ipmi_transaction(struct ipmi *ipmi, uint8_t netfn, uint8_t cmd,
32                 uint8_t *req_buf, uint16_t req_len,
33                 uint8_t *resp_buf, uint16_t *resp_len,
34                 int timeout_ms);
35
36 #endif /* _IPMI_H */