Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / misc / mei / hw.h
1 /*
2  *
3  * Intel Management Engine Interface (Intel MEI) Linux driver
4  * Copyright (c) 2003-2012, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  */
16
17 #ifndef _MEI_HW_TYPES_H_
18 #define _MEI_HW_TYPES_H_
19
20 #include <linux/uuid.h>
21
22 /*
23  * Timeouts in Seconds
24  */
25 #define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
26 #define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
27
28 #define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
29 #define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
30
31 #define MEI_IAMTHIF_STALL_TIMER    12  /* HPS */
32 #define MEI_IAMTHIF_READ_TIMER     10  /* HPS */
33
34 #define MEI_PGI_TIMEOUT            1  /* PG Isolation time response 1 sec */
35 #define MEI_HBM_TIMEOUT            1   /* 1 second */
36
37 /*
38  * MEI Version
39  */
40 #define HBM_MINOR_VERSION                   1
41 #define HBM_MAJOR_VERSION                   1
42
43 /*
44  * MEI version with PGI support
45  */
46 #define HBM_MINOR_VERSION_PGI               1
47 #define HBM_MAJOR_VERSION_PGI               1
48
49 /* Host bus message command opcode */
50 #define MEI_HBM_CMD_OP_MSK                  0x7f
51 /* Host bus message command RESPONSE */
52 #define MEI_HBM_CMD_RES_MSK                 0x80
53
54 /*
55  * MEI Bus Message Command IDs
56  */
57 #define HOST_START_REQ_CMD                  0x01
58 #define HOST_START_RES_CMD                  0x81
59
60 #define HOST_STOP_REQ_CMD                   0x02
61 #define HOST_STOP_RES_CMD                   0x82
62
63 #define ME_STOP_REQ_CMD                     0x03
64
65 #define HOST_ENUM_REQ_CMD                   0x04
66 #define HOST_ENUM_RES_CMD                   0x84
67
68 #define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
69 #define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
70
71 #define CLIENT_CONNECT_REQ_CMD              0x06
72 #define CLIENT_CONNECT_RES_CMD              0x86
73
74 #define CLIENT_DISCONNECT_REQ_CMD           0x07
75 #define CLIENT_DISCONNECT_RES_CMD           0x87
76
77 #define MEI_FLOW_CONTROL_CMD                0x08
78
79 #define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
80 #define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
81 #define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
82 #define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
83
84 /*
85  * MEI Stop Reason
86  * used by hbm_host_stop_request.reason
87  */
88 enum mei_stop_reason_types {
89         DRIVER_STOP_REQUEST = 0x00,
90         DEVICE_D1_ENTRY = 0x01,
91         DEVICE_D2_ENTRY = 0x02,
92         DEVICE_D3_ENTRY = 0x03,
93         SYSTEM_S1_ENTRY = 0x04,
94         SYSTEM_S2_ENTRY = 0x05,
95         SYSTEM_S3_ENTRY = 0x06,
96         SYSTEM_S4_ENTRY = 0x07,
97         SYSTEM_S5_ENTRY = 0x08
98 };
99
100
101 /**
102  * enum mei_hbm_status  - mei host bus messages return values
103  *
104  * @MEI_HBMS_SUCCESS           : status success
105  * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
106  * @MEI_HBMS_ALREADY_EXISTS    : connection already established
107  * @MEI_HBMS_REJECTED          : connection is rejected
108  * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
109  * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
110  * @MEI_HBMS_ALREADY_STARTED   : system is already started
111  * @MEI_HBMS_NOT_STARTED       : system not started
112  *
113  * @MEI_HBMS_MAX               : sentinel
114  */
115 enum mei_hbm_status {
116         MEI_HBMS_SUCCESS           = 0,
117         MEI_HBMS_CLIENT_NOT_FOUND  = 1,
118         MEI_HBMS_ALREADY_EXISTS    = 2,
119         MEI_HBMS_REJECTED          = 3,
120         MEI_HBMS_INVALID_PARAMETER = 4,
121         MEI_HBMS_NOT_ALLOWED       = 5,
122         MEI_HBMS_ALREADY_STARTED   = 6,
123         MEI_HBMS_NOT_STARTED       = 7,
124
125         MEI_HBMS_MAX
126 };
127
128
129 /*
130  * Client Connect Status
131  * used by hbm_client_connect_response.status
132  */
133 enum mei_cl_connect_status {
134         MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
135         MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
136         MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
137         MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
138         MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
139 };
140
141 /*
142  * Client Disconnect Status
143  */
144 enum  mei_cl_disconnect_status {
145         MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
146 };
147
148 /*
149  *  MEI BUS Interface Section
150  */
151 struct mei_msg_hdr {
152         u32 me_addr:8;
153         u32 host_addr:8;
154         u32 length:9;
155         u32 reserved:5;
156         u32 internal:1;
157         u32 msg_complete:1;
158 } __packed;
159
160
161 struct mei_bus_message {
162         u8 hbm_cmd;
163         u8 data[0];
164 } __packed;
165
166 /**
167  * struct hbm_cl_cmd - client specific host bus command
168  *      CONNECT, DISCONNECT, and FlOW CONTROL
169  *
170  * @hbm_cmd: bus message command header
171  * @me_addr: address of the client in ME
172  * @host_addr: address of the client in the driver
173  * @data: generic data
174  */
175 struct mei_hbm_cl_cmd {
176         u8 hbm_cmd;
177         u8 me_addr;
178         u8 host_addr;
179         u8 data;
180 };
181
182 struct hbm_version {
183         u8 minor_version;
184         u8 major_version;
185 } __packed;
186
187 struct hbm_host_version_request {
188         u8 hbm_cmd;
189         u8 reserved;
190         struct hbm_version host_version;
191 } __packed;
192
193 struct hbm_host_version_response {
194         u8 hbm_cmd;
195         u8 host_version_supported;
196         struct hbm_version me_max_version;
197 } __packed;
198
199 struct hbm_host_stop_request {
200         u8 hbm_cmd;
201         u8 reason;
202         u8 reserved[2];
203 } __packed;
204
205 struct hbm_host_stop_response {
206         u8 hbm_cmd;
207         u8 reserved[3];
208 } __packed;
209
210 struct hbm_me_stop_request {
211         u8 hbm_cmd;
212         u8 reason;
213         u8 reserved[2];
214 } __packed;
215
216 struct hbm_host_enum_request {
217         u8 hbm_cmd;
218         u8 reserved[3];
219 } __packed;
220
221 struct hbm_host_enum_response {
222         u8 hbm_cmd;
223         u8 reserved[3];
224         u8 valid_addresses[32];
225 } __packed;
226
227 struct mei_client_properties {
228         uuid_le protocol_name;
229         u8 protocol_version;
230         u8 max_number_of_connections;
231         u8 fixed_address;
232         u8 single_recv_buf;
233         u32 max_msg_length;
234 } __packed;
235
236 struct hbm_props_request {
237         u8 hbm_cmd;
238         u8 me_addr;
239         u8 reserved[2];
240 } __packed;
241
242 struct hbm_props_response {
243         u8 hbm_cmd;
244         u8 me_addr;
245         u8 status;
246         u8 reserved[1];
247         struct mei_client_properties client_properties;
248 } __packed;
249
250 /**
251  * struct hbm_power_gate - power gate request/response
252  *
253  * @hbm_cmd: bus message command header
254  * @reserved: reserved
255  */
256 struct hbm_power_gate {
257         u8 hbm_cmd;
258         u8 reserved[3];
259 } __packed;
260
261 /**
262  * struct hbm_client_connect_request - connect/disconnect request
263  *
264  * @hbm_cmd: bus message command header
265  * @me_addr: address of the client in ME
266  * @host_addr: address of the client in the driver
267  * @reserved: reserved
268  */
269 struct hbm_client_connect_request {
270         u8 hbm_cmd;
271         u8 me_addr;
272         u8 host_addr;
273         u8 reserved;
274 } __packed;
275
276 /**
277  * struct hbm_client_connect_response - connect/disconnect response
278  *
279  * @hbm_cmd: bus message command header
280  * @me_addr: address of the client in ME
281  * @host_addr: address of the client in the driver
282  * @status: status of the request
283  */
284 struct hbm_client_connect_response {
285         u8 hbm_cmd;
286         u8 me_addr;
287         u8 host_addr;
288         u8 status;
289 } __packed;
290
291
292 #define MEI_FC_MESSAGE_RESERVED_LENGTH           5
293
294 struct hbm_flow_control {
295         u8 hbm_cmd;
296         u8 me_addr;
297         u8 host_addr;
298         u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
299 } __packed;
300
301
302 #endif