1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI__LINUX_IPMI_H
20 #define _UAPI__LINUX_IPMI_H
21 #include <linux/ipmi_msgdefs.h>
22 #include <linux/compiler.h>
23 #define IPMI_MAX_ADDR_SIZE 32
24 struct ipmi_addr {
25   int addr_type;
26   short channel;
27   char data[IPMI_MAX_ADDR_SIZE];
28 };
29 #define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
30 struct ipmi_system_interface_addr {
31   int addr_type;
32   short channel;
33   unsigned char lun;
34 };
35 #define IPMI_IPMB_ADDR_TYPE 0x01
36 #define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
37 struct ipmi_ipmb_addr {
38   int addr_type;
39   short channel;
40   unsigned char slave_addr;
41   unsigned char lun;
42 };
43 #define IPMI_LAN_ADDR_TYPE 0x04
44 struct ipmi_lan_addr {
45   int addr_type;
46   short channel;
47   unsigned char privilege;
48   unsigned char session_handle;
49   unsigned char remote_SWID;
50   unsigned char local_SWID;
51   unsigned char lun;
52 };
53 #define IPMI_BMC_CHANNEL 0xf
54 #define IPMI_NUM_CHANNELS 0x10
55 #define IPMI_CHAN_ALL (~0)
56 struct ipmi_msg {
57   unsigned char netfn;
58   unsigned char cmd;
59   unsigned short data_len;
60   unsigned char __user * data;
61 };
62 struct kernel_ipmi_msg {
63   unsigned char netfn;
64   unsigned char cmd;
65   unsigned short data_len;
66   unsigned char * data;
67 };
68 #define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1
69 #define IPMI_TIMEOUT_COMPLETION_CODE 0xC3
70 #define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff
71 #define IPMI_RESPONSE_RECV_TYPE 1
72 #define IPMI_ASYNC_EVENT_RECV_TYPE 2
73 #define IPMI_CMD_RECV_TYPE 3
74 #define IPMI_RESPONSE_RESPONSE_TYPE 4
75 #define IPMI_OEM_RECV_TYPE 5
76 #define IPMI_MAINTENANCE_MODE_AUTO 0
77 #define IPMI_MAINTENANCE_MODE_OFF 1
78 #define IPMI_MAINTENANCE_MODE_ON 2
79 #define IPMI_IOC_MAGIC 'i'
80 struct ipmi_req {
81   unsigned char __user * addr;
82   unsigned int addr_len;
83   long msgid;
84   struct ipmi_msg msg;
85 };
86 #define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, struct ipmi_req)
87 struct ipmi_req_settime {
88   struct ipmi_req req;
89   int retries;
90   unsigned int retry_time_ms;
91 };
92 #define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, struct ipmi_req_settime)
93 struct ipmi_recv {
94   int recv_type;
95   unsigned char __user * addr;
96   unsigned int addr_len;
97   long msgid;
98   struct ipmi_msg msg;
99 };
100 #define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv)
101 #define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv)
102 struct ipmi_cmdspec {
103   unsigned char netfn;
104   unsigned char cmd;
105 };
106 #define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, struct ipmi_cmdspec)
107 #define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, struct ipmi_cmdspec)
108 struct ipmi_cmdspec_chans {
109   unsigned int netfn;
110   unsigned int cmd;
111   unsigned int chans;
112 };
113 #define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, struct ipmi_cmdspec_chans)
114 #define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, struct ipmi_cmdspec_chans)
115 #define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int)
116 struct ipmi_channel_lun_address_set {
117   unsigned short channel;
118   unsigned char value;
119 };
120 #define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
121 #define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
122 #define IPMICTL_SET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
123 #define IPMICTL_GET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
124 #define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
125 #define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
126 #define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
127 #define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int)
128 struct ipmi_timing_parms {
129   int retries;
130   unsigned int retry_time_ms;
131 };
132 #define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, struct ipmi_timing_parms)
133 #define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, struct ipmi_timing_parms)
134 #define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int)
135 #define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int)
136 #endif
137