hw.h 8.1 KB
Newer Older
1 2 3
/*
 *
 * Intel Management Engine Interface (Intel MEI) Linux driver
4
 * Copyright (c) 2003-2012, Intel Corporation.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 */

#ifndef _MEI_HW_TYPES_H_
#define _MEI_HW_TYPES_H_

#include <linux/uuid.h>

/*
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 29
#define MEI_CL_CONNECT_TIMEOUT     15  /* HPS: Client Connect Timeout */
#define MEI_CLIENTS_INIT_TIMEOUT   15  /* HPS: Clients Enumeration Timeout */
30

31 32
#define MEI_IAMTHIF_STALL_TIMER    12  /* HPS */
#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 39

/*
 * MEI Version
 */
40
#define HBM_MINOR_VERSION                   1
41 42
#define HBM_MAJOR_VERSION                   1

43 44 45 46 47 48
/*
 * MEI version with PGI support
 */
#define HBM_MINOR_VERSION_PGI               1
#define HBM_MAJOR_VERSION_PGI               1

T
Tomas Winkler 已提交
49 50 51 52 53 54
/*
 * MEI version with Dynamic clients support
 */
#define HBM_MINOR_VERSION_DC               0
#define HBM_MAJOR_VERSION_DC               2

55 56 57 58 59
/* Host bus message command opcode */
#define MEI_HBM_CMD_OP_MSK                  0x7f
/* Host bus message command RESPONSE */
#define MEI_HBM_CMD_RES_MSK                 0x80

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
/*
 * MEI Bus Message Command IDs
 */
#define HOST_START_REQ_CMD                  0x01
#define HOST_START_RES_CMD                  0x81

#define HOST_STOP_REQ_CMD                   0x02
#define HOST_STOP_RES_CMD                   0x82

#define ME_STOP_REQ_CMD                     0x03

#define HOST_ENUM_REQ_CMD                   0x04
#define HOST_ENUM_RES_CMD                   0x84

#define HOST_CLIENT_PROPERTIES_REQ_CMD      0x05
#define HOST_CLIENT_PROPERTIES_RES_CMD      0x85

#define CLIENT_CONNECT_REQ_CMD              0x06
#define CLIENT_CONNECT_RES_CMD              0x86

#define CLIENT_DISCONNECT_REQ_CMD           0x07
#define CLIENT_DISCONNECT_RES_CMD           0x87

83
#define MEI_FLOW_CONTROL_CMD                0x08
84

85 86 87 88 89
#define MEI_PG_ISOLATION_ENTRY_REQ_CMD      0x0a
#define MEI_PG_ISOLATION_ENTRY_RES_CMD      0x8a
#define MEI_PG_ISOLATION_EXIT_REQ_CMD       0x0b
#define MEI_PG_ISOLATION_EXIT_RES_CMD       0x8b

T
Tomas Winkler 已提交
90 91
#define MEI_HBM_ADD_CLIENT_REQ_CMD          0x0f
#define MEI_HBM_ADD_CLIENT_RES_CMD          0x8f
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
/*
 * MEI Stop Reason
 * used by hbm_host_stop_request.reason
 */
enum mei_stop_reason_types {
	DRIVER_STOP_REQUEST = 0x00,
	DEVICE_D1_ENTRY = 0x01,
	DEVICE_D2_ENTRY = 0x02,
	DEVICE_D3_ENTRY = 0x03,
	SYSTEM_S1_ENTRY = 0x04,
	SYSTEM_S2_ENTRY = 0x05,
	SYSTEM_S3_ENTRY = 0x06,
	SYSTEM_S4_ENTRY = 0x07,
	SYSTEM_S5_ENTRY = 0x08
};

108 109

/**
110
 * enum mei_hbm_status  - mei host bus messages return values
111
 *
112 113 114 115 116 117 118 119
 * @MEI_HBMS_SUCCESS           : status success
 * @MEI_HBMS_CLIENT_NOT_FOUND  : client not found
 * @MEI_HBMS_ALREADY_EXISTS    : connection already established
 * @MEI_HBMS_REJECTED          : connection is rejected
 * @MEI_HBMS_INVALID_PARAMETER : invalid parameter
 * @MEI_HBMS_NOT_ALLOWED       : operation not allowed
 * @MEI_HBMS_ALREADY_STARTED   : system is already started
 * @MEI_HBMS_NOT_STARTED       : system not started
A
Alexander Usyskin 已提交
120 121
 *
 * @MEI_HBMS_MAX               : sentinel
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
 */
enum mei_hbm_status {
	MEI_HBMS_SUCCESS           = 0,
	MEI_HBMS_CLIENT_NOT_FOUND  = 1,
	MEI_HBMS_ALREADY_EXISTS    = 2,
	MEI_HBMS_REJECTED          = 3,
	MEI_HBMS_INVALID_PARAMETER = 4,
	MEI_HBMS_NOT_ALLOWED       = 5,
	MEI_HBMS_ALREADY_STARTED   = 6,
	MEI_HBMS_NOT_STARTED       = 7,

	MEI_HBMS_MAX
};


137 138 139 140
/*
 * Client Connect Status
 * used by hbm_client_connect_response.status
 */
141
enum mei_cl_connect_status {
142 143 144 145 146
	MEI_CL_CONN_SUCCESS          = MEI_HBMS_SUCCESS,
	MEI_CL_CONN_NOT_FOUND        = MEI_HBMS_CLIENT_NOT_FOUND,
	MEI_CL_CONN_ALREADY_STARTED  = MEI_HBMS_ALREADY_EXISTS,
	MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED,
	MEI_CL_CONN_MESSAGE_SMALL    = MEI_HBMS_INVALID_PARAMETER,
147 148 149 150 151
};

/*
 * Client Disconnect Status
 */
152
enum  mei_cl_disconnect_status {
153
	MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS
154 155 156 157 158 159 160 161 162
};

/*
 *  MEI BUS Interface Section
 */
struct mei_msg_hdr {
	u32 me_addr:8;
	u32 host_addr:8;
	u32 length:9;
163 164
	u32 reserved:5;
	u32 internal:1;
165 166 167 168 169
	u32 msg_complete:1;
} __packed;


struct mei_bus_message {
170 171
	u8 hbm_cmd;
	u8 data[0];
172 173
} __packed;

174 175 176 177
/**
 * struct hbm_cl_cmd - client specific host bus command
 *	CONNECT, DISCONNECT, and FlOW CONTROL
 *
178 179 180 181
 * @hbm_cmd: bus message command header
 * @me_addr: address of the client in ME
 * @host_addr: address of the client in the driver
 * @data: generic data
182 183 184 185 186 187 188 189
 */
struct mei_hbm_cl_cmd {
	u8 hbm_cmd;
	u8 me_addr;
	u8 host_addr;
	u8 data;
};

190 191 192 193 194 195
struct hbm_version {
	u8 minor_version;
	u8 major_version;
} __packed;

struct hbm_host_version_request {
196
	u8 hbm_cmd;
197 198 199 200 201
	u8 reserved;
	struct hbm_version host_version;
} __packed;

struct hbm_host_version_response {
202
	u8 hbm_cmd;
203
	u8 host_version_supported;
204 205 206 207
	struct hbm_version me_max_version;
} __packed;

struct hbm_host_stop_request {
208
	u8 hbm_cmd;
209 210 211 212 213
	u8 reason;
	u8 reserved[2];
} __packed;

struct hbm_host_stop_response {
214
	u8 hbm_cmd;
215 216 217 218
	u8 reserved[3];
} __packed;

struct hbm_me_stop_request {
219
	u8 hbm_cmd;
220 221 222 223
	u8 reason;
	u8 reserved[2];
} __packed;

T
Tomas Winkler 已提交
224 225 226 227 228 229 230
/**
 * struct hbm_host_enum_request -  enumeration request from host to fw
 *
 * @hbm_cmd: bus message command header
 * @allow_add: allow dynamic clients add HBM version >= 2.0
 * @reserved: reserved
 */
231
struct hbm_host_enum_request {
232
	u8 hbm_cmd;
T
Tomas Winkler 已提交
233 234
	u8 allow_add;
	u8 reserved[2];
235 236 237
} __packed;

struct hbm_host_enum_response {
238
	u8 hbm_cmd;
239 240 241 242 243 244 245 246 247 248 249 250 251 252
	u8 reserved[3];
	u8 valid_addresses[32];
} __packed;

struct mei_client_properties {
	uuid_le protocol_name;
	u8 protocol_version;
	u8 max_number_of_connections;
	u8 fixed_address;
	u8 single_recv_buf;
	u32 max_msg_length;
} __packed;

struct hbm_props_request {
253
	u8 hbm_cmd;
254
	u8 me_addr;
255 256 257 258
	u8 reserved[2];
} __packed;

struct hbm_props_response {
259
	u8 hbm_cmd;
260
	u8 me_addr;
261 262 263 264 265
	u8 status;
	u8 reserved[1];
	struct mei_client_properties client_properties;
} __packed;

T
Tomas Winkler 已提交
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
/**
 * struct hbm_add_client_request - request to add a client
 *     might be sent by fw after enumeration has already completed
 *
 * @hbm_cmd: bus message command header
 * @me_addr: address of the client in ME
 * @reserved: reserved
 * @client_properties: client properties
 */
struct hbm_add_client_request {
	u8 hbm_cmd;
	u8 me_addr;
	u8 reserved[2];
	struct mei_client_properties client_properties;
} __packed;

/**
 * struct hbm_add_client_response - response to add a client
 *     sent by the host to report client addition status to fw
 *
 * @hbm_cmd: bus message command header
 * @me_addr: address of the client in ME
 * @status: if HBMS_SUCCESS then the client can now accept connections.
 * @reserved: reserved
 */
struct hbm_add_client_response {
	u8 hbm_cmd;
	u8 me_addr;
	u8 status;
	u8 reserved[1];
} __packed;

298 299 300
/**
 * struct hbm_power_gate - power gate request/response
 *
301 302
 * @hbm_cmd: bus message command header
 * @reserved: reserved
303 304 305 306 307 308
 */
struct hbm_power_gate {
	u8 hbm_cmd;
	u8 reserved[3];
} __packed;

309 310 311
/**
 * struct hbm_client_connect_request - connect/disconnect request
 *
312 313 314 315
 * @hbm_cmd: bus message command header
 * @me_addr: address of the client in ME
 * @host_addr: address of the client in the driver
 * @reserved: reserved
316
 */
317
struct hbm_client_connect_request {
318
	u8 hbm_cmd;
319 320 321 322 323
	u8 me_addr;
	u8 host_addr;
	u8 reserved;
} __packed;

324 325 326
/**
 * struct hbm_client_connect_response - connect/disconnect response
 *
327 328 329 330
 * @hbm_cmd: bus message command header
 * @me_addr: address of the client in ME
 * @host_addr: address of the client in the driver
 * @status: status of the request
331
 */
332
struct hbm_client_connect_response {
333
	u8 hbm_cmd;
334 335 336 337 338 339 340 341 342
	u8 me_addr;
	u8 host_addr;
	u8 status;
} __packed;


#define MEI_FC_MESSAGE_RESERVED_LENGTH           5

struct hbm_flow_control {
343
	u8 hbm_cmd;
344 345 346 347 348 349 350
	u8 me_addr;
	u8 host_addr;
	u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH];
} __packed;


#endif