xref: /openbmc/linux/drivers/misc/mei/hw.h (revision 61a1aea7)
1ffc2825cSGreg Kroah-Hartman /*
2ffc2825cSGreg Kroah-Hartman  *
3ffc2825cSGreg Kroah-Hartman  * Intel Management Engine Interface (Intel MEI) Linux driver
4ffc2825cSGreg Kroah-Hartman  * Copyright (c) 2003-2012, Intel Corporation.
5ffc2825cSGreg Kroah-Hartman  *
6ffc2825cSGreg Kroah-Hartman  * This program is free software; you can redistribute it and/or modify it
7ffc2825cSGreg Kroah-Hartman  * under the terms and conditions of the GNU General Public License,
8ffc2825cSGreg Kroah-Hartman  * version 2, as published by the Free Software Foundation.
9ffc2825cSGreg Kroah-Hartman  *
10ffc2825cSGreg Kroah-Hartman  * This program is distributed in the hope it will be useful, but WITHOUT
11ffc2825cSGreg Kroah-Hartman  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12ffc2825cSGreg Kroah-Hartman  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13ffc2825cSGreg Kroah-Hartman  * more details.
14ffc2825cSGreg Kroah-Hartman  *
15ffc2825cSGreg Kroah-Hartman  */
16ffc2825cSGreg Kroah-Hartman 
17ffc2825cSGreg Kroah-Hartman #ifndef _MEI_HW_TYPES_H_
18ffc2825cSGreg Kroah-Hartman #define _MEI_HW_TYPES_H_
19ffc2825cSGreg Kroah-Hartman 
20ffc2825cSGreg Kroah-Hartman #include <linux/uuid.h>
21ffc2825cSGreg Kroah-Hartman 
22ffc2825cSGreg Kroah-Hartman /*
233870c320STomas Winkler  * Timeouts in Seconds
24ffc2825cSGreg Kroah-Hartman  */
257d93e58dSTomas Winkler #define MEI_HW_READY_TIMEOUT        2  /* Timeout on ready message */
263870c320STomas Winkler #define MEI_CONNECT_TIMEOUT         3  /* HPS: at least 2 seconds */
27ffc2825cSGreg Kroah-Hartman 
283870c320STomas Winkler #define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
293870c320STomas Winkler #define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
30ffc2825cSGreg Kroah-Hartman 
313870c320STomas Winkler #define MEI_IAMTHIF_STALL_TIMER    12  /* HPS */
323870c320STomas Winkler #define MEI_IAMTHIF_READ_TIMER     10  /* HPS */
33ffc2825cSGreg Kroah-Hartman 
34ba9cdd0eSTomas Winkler #define MEI_PGI_TIMEOUT            1  /* PG Isolation time response 1 sec */
357d93e58dSTomas Winkler #define MEI_HBM_TIMEOUT            1   /* 1 second */
36ffc2825cSGreg Kroah-Hartman 
37ffc2825cSGreg Kroah-Hartman /*
38ffc2825cSGreg Kroah-Hartman  * MEI Version
39ffc2825cSGreg Kroah-Hartman  */
4061a1aea7STomas Winkler #define HBM_MINOR_VERSION                   1
41ffc2825cSGreg Kroah-Hartman #define HBM_MAJOR_VERSION                   1
42ffc2825cSGreg Kroah-Hartman 
43ee7e5afdSTomas Winkler /*
44ee7e5afdSTomas Winkler  * MEI version with PGI support
45ee7e5afdSTomas Winkler  */
46ee7e5afdSTomas Winkler #define HBM_MINOR_VERSION_PGI               1
47ee7e5afdSTomas Winkler #define HBM_MAJOR_VERSION_PGI               1
48ee7e5afdSTomas Winkler 
49ffc2825cSGreg Kroah-Hartman /* Host bus message command opcode */
50ffc2825cSGreg Kroah-Hartman #define MEI_HBM_CMD_OP_MSK                  0x7f
51ffc2825cSGreg Kroah-Hartman /* Host bus message command RESPONSE */
52ffc2825cSGreg Kroah-Hartman #define MEI_HBM_CMD_RES_MSK                 0x80
53ffc2825cSGreg Kroah-Hartman 
54ffc2825cSGreg Kroah-Hartman /*
55ffc2825cSGreg Kroah-Hartman  * MEI Bus Message Command IDs
56ffc2825cSGreg Kroah-Hartman  */
57ffc2825cSGreg Kroah-Hartman #define HOST_START_REQ_CMD                  0x01
58ffc2825cSGreg Kroah-Hartman #define HOST_START_RES_CMD                  0x81
59ffc2825cSGreg Kroah-Hartman 
60ffc2825cSGreg Kroah-Hartman #define HOST_STOP_REQ_CMD                   0x02
61ffc2825cSGreg Kroah-Hartman #define HOST_STOP_RES_CMD                   0x82
62ffc2825cSGreg Kroah-Hartman 
63ffc2825cSGreg Kroah-Hartman #define ME_STOP_REQ_CMD                     0x03
64ffc2825cSGreg Kroah-Hartman 
65ffc2825cSGreg Kroah-Hartman #define HOST_ENUM_REQ_CMD                   0x04
66ffc2825cSGreg Kroah-Hartman #define HOST_ENUM_RES_CMD                   0x84
67ffc2825cSGreg Kroah-Hartman 
68ffc2825cSGreg Kroah-Hartman #define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
69ffc2825cSGreg Kroah-Hartman #define HOST_CLIENT_PROPERTIES_RES_CMD      0x85
70ffc2825cSGreg Kroah-Hartman 
71ffc2825cSGreg Kroah-Hartman #define CLIENT_CONNECT_REQ_CMD              0x06
72ffc2825cSGreg Kroah-Hartman #define CLIENT_CONNECT_RES_CMD              0x86
73ffc2825cSGreg Kroah-Hartman 
74ffc2825cSGreg Kroah-Hartman #define CLIENT_DISCONNECT_REQ_CMD           0x07
75ffc2825cSGreg Kroah-Hartman #define CLIENT_DISCONNECT_RES_CMD           0x87
76ffc2825cSGreg Kroah-Hartman 
77ffc2825cSGreg Kroah-Hartman #define MEI_FLOW_CONTROL_CMD                0x08
78ffc2825cSGreg Kroah-Hartman 
794fcbc99bSTomas Winkler #define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
804fcbc99bSTomas Winkler #define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
814fcbc99bSTomas Winkler #define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
824fcbc99bSTomas Winkler #define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b
834fcbc99bSTomas Winkler 
84ffc2825cSGreg Kroah-Hartman /*
85ffc2825cSGreg Kroah-Hartman  * MEI Stop Reason
86ffc2825cSGreg Kroah-Hartman  * used by hbm_host_stop_request.reason
87ffc2825cSGreg Kroah-Hartman  */
88ffc2825cSGreg Kroah-Hartman enum mei_stop_reason_types {
89ffc2825cSGreg Kroah-Hartman 	DRIVER_STOP_REQUEST = 0x00,
90ffc2825cSGreg Kroah-Hartman 	DEVICE_D1_ENTRY = 0x01,
91ffc2825cSGreg Kroah-Hartman 	DEVICE_D2_ENTRY = 0x02,
92ffc2825cSGreg Kroah-Hartman 	DEVICE_D3_ENTRY = 0x03,
93ffc2825cSGreg Kroah-Hartman 	SYSTEM_S1_ENTRY = 0x04,
94ffc2825cSGreg Kroah-Hartman 	SYSTEM_S2_ENTRY = 0x05,
95ffc2825cSGreg Kroah-Hartman 	SYSTEM_S3_ENTRY = 0x06,
96ffc2825cSGreg Kroah-Hartman 	SYSTEM_S4_ENTRY = 0x07,
97ffc2825cSGreg Kroah-Hartman 	SYSTEM_S5_ENTRY = 0x08
98ffc2825cSGreg Kroah-Hartman };
99ffc2825cSGreg Kroah-Hartman 
100ffc2825cSGreg Kroah-Hartman /*
101ffc2825cSGreg Kroah-Hartman  * Client Connect Status
102ffc2825cSGreg Kroah-Hartman  * used by hbm_client_connect_response.status
103ffc2825cSGreg Kroah-Hartman  */
104285e2996SAlexander Usyskin enum mei_cl_connect_status {
105285e2996SAlexander Usyskin 	MEI_CL_CONN_SUCCESS          = 0x00,
106285e2996SAlexander Usyskin 	MEI_CL_CONN_NOT_FOUND        = 0x01,
107285e2996SAlexander Usyskin 	MEI_CL_CONN_ALREADY_STARTED  = 0x02,
108285e2996SAlexander Usyskin 	MEI_CL_CONN_OUT_OF_RESOURCES = 0x03,
109285e2996SAlexander Usyskin 	MEI_CL_CONN_MESSAGE_SMALL    = 0x04
110ffc2825cSGreg Kroah-Hartman };
111ffc2825cSGreg Kroah-Hartman 
112ffc2825cSGreg Kroah-Hartman /*
113ffc2825cSGreg Kroah-Hartman  * Client Disconnect Status
114ffc2825cSGreg Kroah-Hartman  */
115285e2996SAlexander Usyskin enum  mei_cl_disconnect_status {
116285e2996SAlexander Usyskin 	MEI_CL_DISCONN_SUCCESS = 0x00
117ffc2825cSGreg Kroah-Hartman };
118ffc2825cSGreg Kroah-Hartman 
119ffc2825cSGreg Kroah-Hartman /*
120ffc2825cSGreg Kroah-Hartman  *  MEI BUS Interface Section
121ffc2825cSGreg Kroah-Hartman  */
122ffc2825cSGreg Kroah-Hartman struct mei_msg_hdr {
123ffc2825cSGreg Kroah-Hartman 	u32 me_addr:8;
124ffc2825cSGreg Kroah-Hartman 	u32 host_addr:8;
125ffc2825cSGreg Kroah-Hartman 	u32 length:9;
126479327fcSTomas Winkler 	u32 reserved:5;
127479327fcSTomas Winkler 	u32 internal:1;
128ffc2825cSGreg Kroah-Hartman 	u32 msg_complete:1;
129ffc2825cSGreg Kroah-Hartman } __packed;
130ffc2825cSGreg Kroah-Hartman 
131ffc2825cSGreg Kroah-Hartman 
132ffc2825cSGreg Kroah-Hartman struct mei_bus_message {
133ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
134ffc2825cSGreg Kroah-Hartman 	u8 data[0];
135ffc2825cSGreg Kroah-Hartman } __packed;
136ffc2825cSGreg Kroah-Hartman 
137cd51ed64STomas Winkler /**
138cd51ed64STomas Winkler  * struct hbm_cl_cmd - client specific host bus command
139cd51ed64STomas Winkler  *	CONNECT, DISCONNECT, and FlOW CONTROL
140cd51ed64STomas Winkler  *
141cd51ed64STomas Winkler  * @hbm_cmd - bus message command header
142cd51ed64STomas Winkler  * @me_addr - address of the client in ME
143cd51ed64STomas Winkler  * @host_addr - address of the client in the driver
144cd51ed64STomas Winkler  * @data
145cd51ed64STomas Winkler  */
146cd51ed64STomas Winkler struct mei_hbm_cl_cmd {
147cd51ed64STomas Winkler 	u8 hbm_cmd;
148cd51ed64STomas Winkler 	u8 me_addr;
149cd51ed64STomas Winkler 	u8 host_addr;
150cd51ed64STomas Winkler 	u8 data;
151cd51ed64STomas Winkler };
152cd51ed64STomas Winkler 
153ffc2825cSGreg Kroah-Hartman struct hbm_version {
154ffc2825cSGreg Kroah-Hartman 	u8 minor_version;
155ffc2825cSGreg Kroah-Hartman 	u8 major_version;
156ffc2825cSGreg Kroah-Hartman } __packed;
157ffc2825cSGreg Kroah-Hartman 
158ffc2825cSGreg Kroah-Hartman struct hbm_host_version_request {
159ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
160ffc2825cSGreg Kroah-Hartman 	u8 reserved;
161ffc2825cSGreg Kroah-Hartman 	struct hbm_version host_version;
162ffc2825cSGreg Kroah-Hartman } __packed;
163ffc2825cSGreg Kroah-Hartman 
164ffc2825cSGreg Kroah-Hartman struct hbm_host_version_response {
165ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
166ffc2825cSGreg Kroah-Hartman 	u8 host_version_supported;
167ffc2825cSGreg Kroah-Hartman 	struct hbm_version me_max_version;
168ffc2825cSGreg Kroah-Hartman } __packed;
169ffc2825cSGreg Kroah-Hartman 
170ffc2825cSGreg Kroah-Hartman struct hbm_host_stop_request {
171ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
172ffc2825cSGreg Kroah-Hartman 	u8 reason;
173ffc2825cSGreg Kroah-Hartman 	u8 reserved[2];
174ffc2825cSGreg Kroah-Hartman } __packed;
175ffc2825cSGreg Kroah-Hartman 
176ffc2825cSGreg Kroah-Hartman struct hbm_host_stop_response {
177ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
178ffc2825cSGreg Kroah-Hartman 	u8 reserved[3];
179ffc2825cSGreg Kroah-Hartman } __packed;
180ffc2825cSGreg Kroah-Hartman 
181ffc2825cSGreg Kroah-Hartman struct hbm_me_stop_request {
182ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
183ffc2825cSGreg Kroah-Hartman 	u8 reason;
184ffc2825cSGreg Kroah-Hartman 	u8 reserved[2];
185ffc2825cSGreg Kroah-Hartman } __packed;
186ffc2825cSGreg Kroah-Hartman 
187ffc2825cSGreg Kroah-Hartman struct hbm_host_enum_request {
188ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
189ffc2825cSGreg Kroah-Hartman 	u8 reserved[3];
190ffc2825cSGreg Kroah-Hartman } __packed;
191ffc2825cSGreg Kroah-Hartman 
192ffc2825cSGreg Kroah-Hartman struct hbm_host_enum_response {
193ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
194ffc2825cSGreg Kroah-Hartman 	u8 reserved[3];
195ffc2825cSGreg Kroah-Hartman 	u8 valid_addresses[32];
196ffc2825cSGreg Kroah-Hartman } __packed;
197ffc2825cSGreg Kroah-Hartman 
198ffc2825cSGreg Kroah-Hartman struct mei_client_properties {
199ffc2825cSGreg Kroah-Hartman 	uuid_le protocol_name;
200ffc2825cSGreg Kroah-Hartman 	u8 protocol_version;
201ffc2825cSGreg Kroah-Hartman 	u8 max_number_of_connections;
202ffc2825cSGreg Kroah-Hartman 	u8 fixed_address;
203ffc2825cSGreg Kroah-Hartman 	u8 single_recv_buf;
204ffc2825cSGreg Kroah-Hartman 	u32 max_msg_length;
205ffc2825cSGreg Kroah-Hartman } __packed;
206ffc2825cSGreg Kroah-Hartman 
207ffc2825cSGreg Kroah-Hartman struct hbm_props_request {
208ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
209ffc2825cSGreg Kroah-Hartman 	u8 address;
210ffc2825cSGreg Kroah-Hartman 	u8 reserved[2];
211ffc2825cSGreg Kroah-Hartman } __packed;
212ffc2825cSGreg Kroah-Hartman 
213ffc2825cSGreg Kroah-Hartman 
214ffc2825cSGreg Kroah-Hartman struct hbm_props_response {
215ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
216ffc2825cSGreg Kroah-Hartman 	u8 address;
217ffc2825cSGreg Kroah-Hartman 	u8 status;
218ffc2825cSGreg Kroah-Hartman 	u8 reserved[1];
219ffc2825cSGreg Kroah-Hartman 	struct mei_client_properties client_properties;
220ffc2825cSGreg Kroah-Hartman } __packed;
221ffc2825cSGreg Kroah-Hartman 
222aeba4a06STomas Winkler /**
2234fcbc99bSTomas Winkler  * struct hbm_power_gate - power gate request/response
2244fcbc99bSTomas Winkler  *
2254fcbc99bSTomas Winkler  * @hbm_cmd - bus message command header
2264fcbc99bSTomas Winkler  * @reserved[3]
2274fcbc99bSTomas Winkler  */
2284fcbc99bSTomas Winkler struct hbm_power_gate {
2294fcbc99bSTomas Winkler 	u8 hbm_cmd;
2304fcbc99bSTomas Winkler 	u8 reserved[3];
2314fcbc99bSTomas Winkler } __packed;
2324fcbc99bSTomas Winkler 
2334fcbc99bSTomas Winkler /**
234aeba4a06STomas Winkler  * struct hbm_client_connect_request - connect/disconnect request
235aeba4a06STomas Winkler  *
236aeba4a06STomas Winkler  * @hbm_cmd - bus message command header
237aeba4a06STomas Winkler  * @me_addr - address of the client in ME
238aeba4a06STomas Winkler  * @host_addr - address of the client in the driver
239aeba4a06STomas Winkler  * @reserved
240aeba4a06STomas Winkler  */
241ffc2825cSGreg Kroah-Hartman struct hbm_client_connect_request {
242ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
243ffc2825cSGreg Kroah-Hartman 	u8 me_addr;
244ffc2825cSGreg Kroah-Hartman 	u8 host_addr;
245ffc2825cSGreg Kroah-Hartman 	u8 reserved;
246ffc2825cSGreg Kroah-Hartman } __packed;
247ffc2825cSGreg Kroah-Hartman 
248aeba4a06STomas Winkler /**
249aeba4a06STomas Winkler  * struct hbm_client_connect_response - connect/disconnect response
250aeba4a06STomas Winkler  *
251aeba4a06STomas Winkler  * @hbm_cmd - bus message command header
252aeba4a06STomas Winkler  * @me_addr - address of the client in ME
253aeba4a06STomas Winkler  * @host_addr - address of the client in the driver
254aeba4a06STomas Winkler  * @status - status of the request
255aeba4a06STomas Winkler  */
256ffc2825cSGreg Kroah-Hartman struct hbm_client_connect_response {
257ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
258ffc2825cSGreg Kroah-Hartman 	u8 me_addr;
259ffc2825cSGreg Kroah-Hartman 	u8 host_addr;
260ffc2825cSGreg Kroah-Hartman 	u8 status;
261ffc2825cSGreg Kroah-Hartman } __packed;
262ffc2825cSGreg Kroah-Hartman 
263ffc2825cSGreg Kroah-Hartman 
264ffc2825cSGreg Kroah-Hartman #define MEI_FC_MESSAGE_RESERVED_LENGTH           5
265ffc2825cSGreg Kroah-Hartman 
266ffc2825cSGreg Kroah-Hartman struct hbm_flow_control {
267ffc2825cSGreg Kroah-Hartman 	u8 hbm_cmd;
268ffc2825cSGreg Kroah-Hartman 	u8 me_addr;
269ffc2825cSGreg Kroah-Hartman 	u8 host_addr;
270ffc2825cSGreg Kroah-Hartman 	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
271ffc2825cSGreg Kroah-Hartman } __packed;
272ffc2825cSGreg Kroah-Hartman 
273ffc2825cSGreg Kroah-Hartman 
274ffc2825cSGreg Kroah-Hartman #endif
275