18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2003-2020, Intel Corporation. All rights reserved 48c2ecf20Sopenharmony_ci * Intel Management Engine Interface (Intel MEI) Linux driver 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef _MEI_HW_TYPES_H_ 88c2ecf20Sopenharmony_ci#define _MEI_HW_TYPES_H_ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/uuid.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci/* 138c2ecf20Sopenharmony_ci * Timeouts in Seconds 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_ci#define MEI_HW_READY_TIMEOUT 2 /* Timeout on ready message */ 168c2ecf20Sopenharmony_ci#define MEI_CONNECT_TIMEOUT 3 /* HPS: at least 2 seconds */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define MEI_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */ 198c2ecf20Sopenharmony_ci#define MEI_CLIENTS_INIT_TIMEOUT 15 /* HPS: Clients Enumeration Timeout */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define MEI_PGI_TIMEOUT 1 /* PG Isolation time response 1 sec */ 228c2ecf20Sopenharmony_ci#define MEI_D0I3_TIMEOUT 5 /* D0i3 set/unset max response time */ 238c2ecf20Sopenharmony_ci#define MEI_HBM_TIMEOUT 1 /* 1 second */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* 268c2ecf20Sopenharmony_ci * MEI Version 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION 2 298c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION 2 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci/* 328c2ecf20Sopenharmony_ci * MEI version with PGI support 338c2ecf20Sopenharmony_ci */ 348c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_PGI 1 358c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_PGI 1 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* 388c2ecf20Sopenharmony_ci * MEI version with Dynamic clients support 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_DC 0 418c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_DC 2 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci/* 448c2ecf20Sopenharmony_ci * MEI version with immediate reply to enum request support 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_IE 0 478c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_IE 2 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* 508c2ecf20Sopenharmony_ci * MEI version with disconnect on connection timeout support 518c2ecf20Sopenharmony_ci */ 528c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_DOT 0 538c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_DOT 2 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* 568c2ecf20Sopenharmony_ci * MEI version with notification support 578c2ecf20Sopenharmony_ci */ 588c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_EV 0 598c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_EV 2 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* 628c2ecf20Sopenharmony_ci * MEI version with fixed address client support 638c2ecf20Sopenharmony_ci */ 648c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_FA 0 658c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_FA 2 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* 688c2ecf20Sopenharmony_ci * MEI version with OS ver message support 698c2ecf20Sopenharmony_ci */ 708c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_OS 0 718c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_OS 2 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci/* 748c2ecf20Sopenharmony_ci * MEI version with dma ring support 758c2ecf20Sopenharmony_ci */ 768c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_DR 1 778c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_DR 2 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* 808c2ecf20Sopenharmony_ci * MEI version with vm tag support 818c2ecf20Sopenharmony_ci */ 828c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_VT 2 838c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_VT 2 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci/* 868c2ecf20Sopenharmony_ci * MEI version with capabilities message support 878c2ecf20Sopenharmony_ci */ 888c2ecf20Sopenharmony_ci#define HBM_MINOR_VERSION_CAP 2 898c2ecf20Sopenharmony_ci#define HBM_MAJOR_VERSION_CAP 2 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/* Host bus message command opcode */ 928c2ecf20Sopenharmony_ci#define MEI_HBM_CMD_OP_MSK 0x7f 938c2ecf20Sopenharmony_ci/* Host bus message command RESPONSE */ 948c2ecf20Sopenharmony_ci#define MEI_HBM_CMD_RES_MSK 0x80 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci/* 978c2ecf20Sopenharmony_ci * MEI Bus Message Command IDs 988c2ecf20Sopenharmony_ci */ 998c2ecf20Sopenharmony_ci#define HOST_START_REQ_CMD 0x01 1008c2ecf20Sopenharmony_ci#define HOST_START_RES_CMD 0x81 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci#define HOST_STOP_REQ_CMD 0x02 1038c2ecf20Sopenharmony_ci#define HOST_STOP_RES_CMD 0x82 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define ME_STOP_REQ_CMD 0x03 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define HOST_ENUM_REQ_CMD 0x04 1088c2ecf20Sopenharmony_ci#define HOST_ENUM_RES_CMD 0x84 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci#define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05 1118c2ecf20Sopenharmony_ci#define HOST_CLIENT_PROPERTIES_RES_CMD 0x85 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define CLIENT_CONNECT_REQ_CMD 0x06 1148c2ecf20Sopenharmony_ci#define CLIENT_CONNECT_RES_CMD 0x86 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci#define CLIENT_DISCONNECT_REQ_CMD 0x07 1178c2ecf20Sopenharmony_ci#define CLIENT_DISCONNECT_RES_CMD 0x87 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define MEI_FLOW_CONTROL_CMD 0x08 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define MEI_PG_ISOLATION_ENTRY_REQ_CMD 0x0a 1228c2ecf20Sopenharmony_ci#define MEI_PG_ISOLATION_ENTRY_RES_CMD 0x8a 1238c2ecf20Sopenharmony_ci#define MEI_PG_ISOLATION_EXIT_REQ_CMD 0x0b 1248c2ecf20Sopenharmony_ci#define MEI_PG_ISOLATION_EXIT_RES_CMD 0x8b 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define MEI_HBM_ADD_CLIENT_REQ_CMD 0x0f 1278c2ecf20Sopenharmony_ci#define MEI_HBM_ADD_CLIENT_RES_CMD 0x8f 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#define MEI_HBM_NOTIFY_REQ_CMD 0x10 1308c2ecf20Sopenharmony_ci#define MEI_HBM_NOTIFY_RES_CMD 0x90 1318c2ecf20Sopenharmony_ci#define MEI_HBM_NOTIFICATION_CMD 0x11 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci#define MEI_HBM_DMA_SETUP_REQ_CMD 0x12 1348c2ecf20Sopenharmony_ci#define MEI_HBM_DMA_SETUP_RES_CMD 0x92 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci#define MEI_HBM_CAPABILITIES_REQ_CMD 0x13 1378c2ecf20Sopenharmony_ci#define MEI_HBM_CAPABILITIES_RES_CMD 0x93 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci/* 1408c2ecf20Sopenharmony_ci * MEI Stop Reason 1418c2ecf20Sopenharmony_ci * used by hbm_host_stop_request.reason 1428c2ecf20Sopenharmony_ci */ 1438c2ecf20Sopenharmony_cienum mei_stop_reason_types { 1448c2ecf20Sopenharmony_ci DRIVER_STOP_REQUEST = 0x00, 1458c2ecf20Sopenharmony_ci DEVICE_D1_ENTRY = 0x01, 1468c2ecf20Sopenharmony_ci DEVICE_D2_ENTRY = 0x02, 1478c2ecf20Sopenharmony_ci DEVICE_D3_ENTRY = 0x03, 1488c2ecf20Sopenharmony_ci SYSTEM_S1_ENTRY = 0x04, 1498c2ecf20Sopenharmony_ci SYSTEM_S2_ENTRY = 0x05, 1508c2ecf20Sopenharmony_ci SYSTEM_S3_ENTRY = 0x06, 1518c2ecf20Sopenharmony_ci SYSTEM_S4_ENTRY = 0x07, 1528c2ecf20Sopenharmony_ci SYSTEM_S5_ENTRY = 0x08 1538c2ecf20Sopenharmony_ci}; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci/** 1578c2ecf20Sopenharmony_ci * enum mei_hbm_status - mei host bus messages return values 1588c2ecf20Sopenharmony_ci * 1598c2ecf20Sopenharmony_ci * @MEI_HBMS_SUCCESS : status success 1608c2ecf20Sopenharmony_ci * @MEI_HBMS_CLIENT_NOT_FOUND : client not found 1618c2ecf20Sopenharmony_ci * @MEI_HBMS_ALREADY_EXISTS : connection already established 1628c2ecf20Sopenharmony_ci * @MEI_HBMS_REJECTED : connection is rejected 1638c2ecf20Sopenharmony_ci * @MEI_HBMS_INVALID_PARAMETER : invalid parameter 1648c2ecf20Sopenharmony_ci * @MEI_HBMS_NOT_ALLOWED : operation not allowed 1658c2ecf20Sopenharmony_ci * @MEI_HBMS_ALREADY_STARTED : system is already started 1668c2ecf20Sopenharmony_ci * @MEI_HBMS_NOT_STARTED : system not started 1678c2ecf20Sopenharmony_ci * 1688c2ecf20Sopenharmony_ci * @MEI_HBMS_MAX : sentinel 1698c2ecf20Sopenharmony_ci */ 1708c2ecf20Sopenharmony_cienum mei_hbm_status { 1718c2ecf20Sopenharmony_ci MEI_HBMS_SUCCESS = 0, 1728c2ecf20Sopenharmony_ci MEI_HBMS_CLIENT_NOT_FOUND = 1, 1738c2ecf20Sopenharmony_ci MEI_HBMS_ALREADY_EXISTS = 2, 1748c2ecf20Sopenharmony_ci MEI_HBMS_REJECTED = 3, 1758c2ecf20Sopenharmony_ci MEI_HBMS_INVALID_PARAMETER = 4, 1768c2ecf20Sopenharmony_ci MEI_HBMS_NOT_ALLOWED = 5, 1778c2ecf20Sopenharmony_ci MEI_HBMS_ALREADY_STARTED = 6, 1788c2ecf20Sopenharmony_ci MEI_HBMS_NOT_STARTED = 7, 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci MEI_HBMS_MAX 1818c2ecf20Sopenharmony_ci}; 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci/* 1858c2ecf20Sopenharmony_ci * Client Connect Status 1868c2ecf20Sopenharmony_ci * used by hbm_client_connect_response.status 1878c2ecf20Sopenharmony_ci */ 1888c2ecf20Sopenharmony_cienum mei_cl_connect_status { 1898c2ecf20Sopenharmony_ci MEI_CL_CONN_SUCCESS = MEI_HBMS_SUCCESS, 1908c2ecf20Sopenharmony_ci MEI_CL_CONN_NOT_FOUND = MEI_HBMS_CLIENT_NOT_FOUND, 1918c2ecf20Sopenharmony_ci MEI_CL_CONN_ALREADY_STARTED = MEI_HBMS_ALREADY_EXISTS, 1928c2ecf20Sopenharmony_ci MEI_CL_CONN_OUT_OF_RESOURCES = MEI_HBMS_REJECTED, 1938c2ecf20Sopenharmony_ci MEI_CL_CONN_MESSAGE_SMALL = MEI_HBMS_INVALID_PARAMETER, 1948c2ecf20Sopenharmony_ci MEI_CL_CONN_NOT_ALLOWED = MEI_HBMS_NOT_ALLOWED, 1958c2ecf20Sopenharmony_ci}; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci/* 1988c2ecf20Sopenharmony_ci * Client Disconnect Status 1998c2ecf20Sopenharmony_ci */ 2008c2ecf20Sopenharmony_cienum mei_cl_disconnect_status { 2018c2ecf20Sopenharmony_ci MEI_CL_DISCONN_SUCCESS = MEI_HBMS_SUCCESS 2028c2ecf20Sopenharmony_ci}; 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci/** 2058c2ecf20Sopenharmony_ci * enum mei_ext_hdr_type - extended header type used in 2068c2ecf20Sopenharmony_ci * extended header TLV 2078c2ecf20Sopenharmony_ci * 2088c2ecf20Sopenharmony_ci * @MEI_EXT_HDR_NONE: sentinel 2098c2ecf20Sopenharmony_ci * @MEI_EXT_HDR_VTAG: vtag header 2108c2ecf20Sopenharmony_ci */ 2118c2ecf20Sopenharmony_cienum mei_ext_hdr_type { 2128c2ecf20Sopenharmony_ci MEI_EXT_HDR_NONE = 0, 2138c2ecf20Sopenharmony_ci MEI_EXT_HDR_VTAG = 1, 2148c2ecf20Sopenharmony_ci}; 2158c2ecf20Sopenharmony_ci 2168c2ecf20Sopenharmony_ci/** 2178c2ecf20Sopenharmony_ci * struct mei_ext_hdr - extend header descriptor (TLV) 2188c2ecf20Sopenharmony_ci * @type: enum mei_ext_hdr_type 2198c2ecf20Sopenharmony_ci * @length: length excluding descriptor 2208c2ecf20Sopenharmony_ci * @ext_payload: payload of the specific extended header 2218c2ecf20Sopenharmony_ci * @hdr: place holder for actual header 2228c2ecf20Sopenharmony_ci */ 2238c2ecf20Sopenharmony_cistruct mei_ext_hdr { 2248c2ecf20Sopenharmony_ci u8 type; 2258c2ecf20Sopenharmony_ci u8 length; 2268c2ecf20Sopenharmony_ci u8 ext_payload[2]; 2278c2ecf20Sopenharmony_ci u8 hdr[]; 2288c2ecf20Sopenharmony_ci}; 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci/** 2318c2ecf20Sopenharmony_ci * struct mei_ext_meta_hdr - extend header meta data 2328c2ecf20Sopenharmony_ci * @count: number of headers 2338c2ecf20Sopenharmony_ci * @size: total size of the extended header list excluding meta header 2348c2ecf20Sopenharmony_ci * @reserved: reserved 2358c2ecf20Sopenharmony_ci * @hdrs: extended headers TLV list 2368c2ecf20Sopenharmony_ci */ 2378c2ecf20Sopenharmony_cistruct mei_ext_meta_hdr { 2388c2ecf20Sopenharmony_ci u8 count; 2398c2ecf20Sopenharmony_ci u8 size; 2408c2ecf20Sopenharmony_ci u8 reserved[2]; 2418c2ecf20Sopenharmony_ci struct mei_ext_hdr hdrs[]; 2428c2ecf20Sopenharmony_ci}; 2438c2ecf20Sopenharmony_ci 2448c2ecf20Sopenharmony_ci/* 2458c2ecf20Sopenharmony_ci * Extended header iterator functions 2468c2ecf20Sopenharmony_ci */ 2478c2ecf20Sopenharmony_ci/** 2488c2ecf20Sopenharmony_ci * mei_ext_hdr - extended header iterator begin 2498c2ecf20Sopenharmony_ci * 2508c2ecf20Sopenharmony_ci * @meta: meta header of the extended header list 2518c2ecf20Sopenharmony_ci * 2528c2ecf20Sopenharmony_ci * Return: 2538c2ecf20Sopenharmony_ci * The first extended header 2548c2ecf20Sopenharmony_ci */ 2558c2ecf20Sopenharmony_cistatic inline struct mei_ext_hdr *mei_ext_begin(struct mei_ext_meta_hdr *meta) 2568c2ecf20Sopenharmony_ci{ 2578c2ecf20Sopenharmony_ci return meta->hdrs; 2588c2ecf20Sopenharmony_ci} 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci/** 2618c2ecf20Sopenharmony_ci * mei_ext_last - check if the ext is the last one in the TLV list 2628c2ecf20Sopenharmony_ci * 2638c2ecf20Sopenharmony_ci * @meta: meta header of the extended header list 2648c2ecf20Sopenharmony_ci * @ext: a meta header on the list 2658c2ecf20Sopenharmony_ci * 2668c2ecf20Sopenharmony_ci * Return: true if ext is the last header on the list 2678c2ecf20Sopenharmony_ci */ 2688c2ecf20Sopenharmony_cistatic inline bool mei_ext_last(struct mei_ext_meta_hdr *meta, 2698c2ecf20Sopenharmony_ci struct mei_ext_hdr *ext) 2708c2ecf20Sopenharmony_ci{ 2718c2ecf20Sopenharmony_ci return (u8 *)ext >= (u8 *)meta + sizeof(*meta) + (meta->size * 4); 2728c2ecf20Sopenharmony_ci} 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci/** 2758c2ecf20Sopenharmony_ci *mei_ext_next - following extended header on the TLV list 2768c2ecf20Sopenharmony_ci * 2778c2ecf20Sopenharmony_ci * @ext: current extend header 2788c2ecf20Sopenharmony_ci * 2798c2ecf20Sopenharmony_ci * Context: The function does not check for the overflows, 2808c2ecf20Sopenharmony_ci * one should call mei_ext_last before. 2818c2ecf20Sopenharmony_ci * 2828c2ecf20Sopenharmony_ci * Return: The following extend header after @ext 2838c2ecf20Sopenharmony_ci */ 2848c2ecf20Sopenharmony_cistatic inline struct mei_ext_hdr *mei_ext_next(struct mei_ext_hdr *ext) 2858c2ecf20Sopenharmony_ci{ 2868c2ecf20Sopenharmony_ci return (struct mei_ext_hdr *)(ext->hdr + (ext->length * 4)); 2878c2ecf20Sopenharmony_ci} 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/** 2908c2ecf20Sopenharmony_ci * struct mei_msg_hdr - MEI BUS Interface Section 2918c2ecf20Sopenharmony_ci * 2928c2ecf20Sopenharmony_ci * @me_addr: device address 2938c2ecf20Sopenharmony_ci * @host_addr: host address 2948c2ecf20Sopenharmony_ci * @length: message length 2958c2ecf20Sopenharmony_ci * @reserved: reserved 2968c2ecf20Sopenharmony_ci * @extended: message has extended header 2978c2ecf20Sopenharmony_ci * @dma_ring: message is on dma ring 2988c2ecf20Sopenharmony_ci * @internal: message is internal 2998c2ecf20Sopenharmony_ci * @msg_complete: last packet of the message 3008c2ecf20Sopenharmony_ci * @extension: extension of the header 3018c2ecf20Sopenharmony_ci */ 3028c2ecf20Sopenharmony_cistruct mei_msg_hdr { 3038c2ecf20Sopenharmony_ci u32 me_addr:8; 3048c2ecf20Sopenharmony_ci u32 host_addr:8; 3058c2ecf20Sopenharmony_ci u32 length:9; 3068c2ecf20Sopenharmony_ci u32 reserved:3; 3078c2ecf20Sopenharmony_ci u32 extended:1; 3088c2ecf20Sopenharmony_ci u32 dma_ring:1; 3098c2ecf20Sopenharmony_ci u32 internal:1; 3108c2ecf20Sopenharmony_ci u32 msg_complete:1; 3118c2ecf20Sopenharmony_ci u32 extension[]; 3128c2ecf20Sopenharmony_ci} __packed; 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci/* The length is up to 9 bits */ 3158c2ecf20Sopenharmony_ci#define MEI_MSG_MAX_LEN_MASK GENMASK(9, 0) 3168c2ecf20Sopenharmony_ci 3178c2ecf20Sopenharmony_cistruct mei_bus_message { 3188c2ecf20Sopenharmony_ci u8 hbm_cmd; 3198c2ecf20Sopenharmony_ci u8 data[]; 3208c2ecf20Sopenharmony_ci} __packed; 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci/** 3238c2ecf20Sopenharmony_ci * struct hbm_cl_cmd - client specific host bus command 3248c2ecf20Sopenharmony_ci * CONNECT, DISCONNECT, and FlOW CONTROL 3258c2ecf20Sopenharmony_ci * 3268c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 3278c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 3288c2ecf20Sopenharmony_ci * @host_addr: address of the client in the driver 3298c2ecf20Sopenharmony_ci * @data: generic data 3308c2ecf20Sopenharmony_ci */ 3318c2ecf20Sopenharmony_cistruct mei_hbm_cl_cmd { 3328c2ecf20Sopenharmony_ci u8 hbm_cmd; 3338c2ecf20Sopenharmony_ci u8 me_addr; 3348c2ecf20Sopenharmony_ci u8 host_addr; 3358c2ecf20Sopenharmony_ci u8 data; 3368c2ecf20Sopenharmony_ci}; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_cistruct hbm_version { 3398c2ecf20Sopenharmony_ci u8 minor_version; 3408c2ecf20Sopenharmony_ci u8 major_version; 3418c2ecf20Sopenharmony_ci} __packed; 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_cistruct hbm_host_version_request { 3448c2ecf20Sopenharmony_ci u8 hbm_cmd; 3458c2ecf20Sopenharmony_ci u8 reserved; 3468c2ecf20Sopenharmony_ci struct hbm_version host_version; 3478c2ecf20Sopenharmony_ci} __packed; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_cistruct hbm_host_version_response { 3508c2ecf20Sopenharmony_ci u8 hbm_cmd; 3518c2ecf20Sopenharmony_ci u8 host_version_supported; 3528c2ecf20Sopenharmony_ci struct hbm_version me_max_version; 3538c2ecf20Sopenharmony_ci} __packed; 3548c2ecf20Sopenharmony_ci 3558c2ecf20Sopenharmony_cistruct hbm_host_stop_request { 3568c2ecf20Sopenharmony_ci u8 hbm_cmd; 3578c2ecf20Sopenharmony_ci u8 reason; 3588c2ecf20Sopenharmony_ci u8 reserved[2]; 3598c2ecf20Sopenharmony_ci} __packed; 3608c2ecf20Sopenharmony_ci 3618c2ecf20Sopenharmony_cistruct hbm_host_stop_response { 3628c2ecf20Sopenharmony_ci u8 hbm_cmd; 3638c2ecf20Sopenharmony_ci u8 reserved[3]; 3648c2ecf20Sopenharmony_ci} __packed; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_cistruct hbm_me_stop_request { 3678c2ecf20Sopenharmony_ci u8 hbm_cmd; 3688c2ecf20Sopenharmony_ci u8 reason; 3698c2ecf20Sopenharmony_ci u8 reserved[2]; 3708c2ecf20Sopenharmony_ci} __packed; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci/** 3738c2ecf20Sopenharmony_ci * enum hbm_host_enum_flags - enumeration request flags (HBM version >= 2.0) 3748c2ecf20Sopenharmony_ci * 3758c2ecf20Sopenharmony_ci * @MEI_HBM_ENUM_F_ALLOW_ADD: allow dynamic clients add 3768c2ecf20Sopenharmony_ci * @MEI_HBM_ENUM_F_IMMEDIATE_ENUM: allow FW to send answer immediately 3778c2ecf20Sopenharmony_ci */ 3788c2ecf20Sopenharmony_cienum hbm_host_enum_flags { 3798c2ecf20Sopenharmony_ci MEI_HBM_ENUM_F_ALLOW_ADD = BIT(0), 3808c2ecf20Sopenharmony_ci MEI_HBM_ENUM_F_IMMEDIATE_ENUM = BIT(1), 3818c2ecf20Sopenharmony_ci}; 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_ci/** 3848c2ecf20Sopenharmony_ci * struct hbm_host_enum_request - enumeration request from host to fw 3858c2ecf20Sopenharmony_ci * 3868c2ecf20Sopenharmony_ci * @hbm_cmd : bus message command header 3878c2ecf20Sopenharmony_ci * @flags : request flags 3888c2ecf20Sopenharmony_ci * @reserved: reserved 3898c2ecf20Sopenharmony_ci */ 3908c2ecf20Sopenharmony_cistruct hbm_host_enum_request { 3918c2ecf20Sopenharmony_ci u8 hbm_cmd; 3928c2ecf20Sopenharmony_ci u8 flags; 3938c2ecf20Sopenharmony_ci u8 reserved[2]; 3948c2ecf20Sopenharmony_ci} __packed; 3958c2ecf20Sopenharmony_ci 3968c2ecf20Sopenharmony_cistruct hbm_host_enum_response { 3978c2ecf20Sopenharmony_ci u8 hbm_cmd; 3988c2ecf20Sopenharmony_ci u8 reserved[3]; 3998c2ecf20Sopenharmony_ci u8 valid_addresses[32]; 4008c2ecf20Sopenharmony_ci} __packed; 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci/** 4038c2ecf20Sopenharmony_ci * struct mei_client_properties - mei client properties 4048c2ecf20Sopenharmony_ci * 4058c2ecf20Sopenharmony_ci * @protocol_name: guid of the client 4068c2ecf20Sopenharmony_ci * @protocol_version: client protocol version 4078c2ecf20Sopenharmony_ci * @max_number_of_connections: number of possible connections. 4088c2ecf20Sopenharmony_ci * @fixed_address: fixed me address (0 if the client is dynamic) 4098c2ecf20Sopenharmony_ci * @single_recv_buf: 1 if all connections share a single receive buffer. 4108c2ecf20Sopenharmony_ci * @vt_supported: the client support vtag 4118c2ecf20Sopenharmony_ci * @reserved: reserved 4128c2ecf20Sopenharmony_ci * @max_msg_length: MTU of the client 4138c2ecf20Sopenharmony_ci */ 4148c2ecf20Sopenharmony_cistruct mei_client_properties { 4158c2ecf20Sopenharmony_ci uuid_le protocol_name; 4168c2ecf20Sopenharmony_ci u8 protocol_version; 4178c2ecf20Sopenharmony_ci u8 max_number_of_connections; 4188c2ecf20Sopenharmony_ci u8 fixed_address; 4198c2ecf20Sopenharmony_ci u8 single_recv_buf:1; 4208c2ecf20Sopenharmony_ci u8 vt_supported:1; 4218c2ecf20Sopenharmony_ci u8 reserved:6; 4228c2ecf20Sopenharmony_ci u32 max_msg_length; 4238c2ecf20Sopenharmony_ci} __packed; 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_cistruct hbm_props_request { 4268c2ecf20Sopenharmony_ci u8 hbm_cmd; 4278c2ecf20Sopenharmony_ci u8 me_addr; 4288c2ecf20Sopenharmony_ci u8 reserved[2]; 4298c2ecf20Sopenharmony_ci} __packed; 4308c2ecf20Sopenharmony_ci 4318c2ecf20Sopenharmony_cistruct hbm_props_response { 4328c2ecf20Sopenharmony_ci u8 hbm_cmd; 4338c2ecf20Sopenharmony_ci u8 me_addr; 4348c2ecf20Sopenharmony_ci u8 status; 4358c2ecf20Sopenharmony_ci u8 reserved; 4368c2ecf20Sopenharmony_ci struct mei_client_properties client_properties; 4378c2ecf20Sopenharmony_ci} __packed; 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_ci/** 4408c2ecf20Sopenharmony_ci * struct hbm_add_client_request - request to add a client 4418c2ecf20Sopenharmony_ci * might be sent by fw after enumeration has already completed 4428c2ecf20Sopenharmony_ci * 4438c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 4448c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 4458c2ecf20Sopenharmony_ci * @reserved: reserved 4468c2ecf20Sopenharmony_ci * @client_properties: client properties 4478c2ecf20Sopenharmony_ci */ 4488c2ecf20Sopenharmony_cistruct hbm_add_client_request { 4498c2ecf20Sopenharmony_ci u8 hbm_cmd; 4508c2ecf20Sopenharmony_ci u8 me_addr; 4518c2ecf20Sopenharmony_ci u8 reserved[2]; 4528c2ecf20Sopenharmony_ci struct mei_client_properties client_properties; 4538c2ecf20Sopenharmony_ci} __packed; 4548c2ecf20Sopenharmony_ci 4558c2ecf20Sopenharmony_ci/** 4568c2ecf20Sopenharmony_ci * struct hbm_add_client_response - response to add a client 4578c2ecf20Sopenharmony_ci * sent by the host to report client addition status to fw 4588c2ecf20Sopenharmony_ci * 4598c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 4608c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 4618c2ecf20Sopenharmony_ci * @status: if HBMS_SUCCESS then the client can now accept connections. 4628c2ecf20Sopenharmony_ci * @reserved: reserved 4638c2ecf20Sopenharmony_ci */ 4648c2ecf20Sopenharmony_cistruct hbm_add_client_response { 4658c2ecf20Sopenharmony_ci u8 hbm_cmd; 4668c2ecf20Sopenharmony_ci u8 me_addr; 4678c2ecf20Sopenharmony_ci u8 status; 4688c2ecf20Sopenharmony_ci u8 reserved; 4698c2ecf20Sopenharmony_ci} __packed; 4708c2ecf20Sopenharmony_ci 4718c2ecf20Sopenharmony_ci/** 4728c2ecf20Sopenharmony_ci * struct hbm_power_gate - power gate request/response 4738c2ecf20Sopenharmony_ci * 4748c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 4758c2ecf20Sopenharmony_ci * @reserved: reserved 4768c2ecf20Sopenharmony_ci */ 4778c2ecf20Sopenharmony_cistruct hbm_power_gate { 4788c2ecf20Sopenharmony_ci u8 hbm_cmd; 4798c2ecf20Sopenharmony_ci u8 reserved[3]; 4808c2ecf20Sopenharmony_ci} __packed; 4818c2ecf20Sopenharmony_ci 4828c2ecf20Sopenharmony_ci/** 4838c2ecf20Sopenharmony_ci * struct hbm_client_connect_request - connect/disconnect request 4848c2ecf20Sopenharmony_ci * 4858c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 4868c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 4878c2ecf20Sopenharmony_ci * @host_addr: address of the client in the driver 4888c2ecf20Sopenharmony_ci * @reserved: reserved 4898c2ecf20Sopenharmony_ci */ 4908c2ecf20Sopenharmony_cistruct hbm_client_connect_request { 4918c2ecf20Sopenharmony_ci u8 hbm_cmd; 4928c2ecf20Sopenharmony_ci u8 me_addr; 4938c2ecf20Sopenharmony_ci u8 host_addr; 4948c2ecf20Sopenharmony_ci u8 reserved; 4958c2ecf20Sopenharmony_ci} __packed; 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci/** 4988c2ecf20Sopenharmony_ci * struct hbm_client_connect_response - connect/disconnect response 4998c2ecf20Sopenharmony_ci * 5008c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 5018c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 5028c2ecf20Sopenharmony_ci * @host_addr: address of the client in the driver 5038c2ecf20Sopenharmony_ci * @status: status of the request 5048c2ecf20Sopenharmony_ci */ 5058c2ecf20Sopenharmony_cistruct hbm_client_connect_response { 5068c2ecf20Sopenharmony_ci u8 hbm_cmd; 5078c2ecf20Sopenharmony_ci u8 me_addr; 5088c2ecf20Sopenharmony_ci u8 host_addr; 5098c2ecf20Sopenharmony_ci u8 status; 5108c2ecf20Sopenharmony_ci} __packed; 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci 5138c2ecf20Sopenharmony_ci#define MEI_FC_MESSAGE_RESERVED_LENGTH 5 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_cistruct hbm_flow_control { 5168c2ecf20Sopenharmony_ci u8 hbm_cmd; 5178c2ecf20Sopenharmony_ci u8 me_addr; 5188c2ecf20Sopenharmony_ci u8 host_addr; 5198c2ecf20Sopenharmony_ci u8 reserved[MEI_FC_MESSAGE_RESERVED_LENGTH]; 5208c2ecf20Sopenharmony_ci} __packed; 5218c2ecf20Sopenharmony_ci 5228c2ecf20Sopenharmony_ci#define MEI_HBM_NOTIFICATION_START 1 5238c2ecf20Sopenharmony_ci#define MEI_HBM_NOTIFICATION_STOP 0 5248c2ecf20Sopenharmony_ci/** 5258c2ecf20Sopenharmony_ci * struct hbm_notification_request - start/stop notification request 5268c2ecf20Sopenharmony_ci * 5278c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 5288c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 5298c2ecf20Sopenharmony_ci * @host_addr: address of the client in the driver 5308c2ecf20Sopenharmony_ci * @start: start = 1 or stop = 0 asynchronous notifications 5318c2ecf20Sopenharmony_ci */ 5328c2ecf20Sopenharmony_cistruct hbm_notification_request { 5338c2ecf20Sopenharmony_ci u8 hbm_cmd; 5348c2ecf20Sopenharmony_ci u8 me_addr; 5358c2ecf20Sopenharmony_ci u8 host_addr; 5368c2ecf20Sopenharmony_ci u8 start; 5378c2ecf20Sopenharmony_ci} __packed; 5388c2ecf20Sopenharmony_ci 5398c2ecf20Sopenharmony_ci/** 5408c2ecf20Sopenharmony_ci * struct hbm_notification_response - start/stop notification response 5418c2ecf20Sopenharmony_ci * 5428c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 5438c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 5448c2ecf20Sopenharmony_ci * @host_addr: - address of the client in the driver 5458c2ecf20Sopenharmony_ci * @status: (mei_hbm_status) response status for the request 5468c2ecf20Sopenharmony_ci * - MEI_HBMS_SUCCESS: successful stop/start 5478c2ecf20Sopenharmony_ci * - MEI_HBMS_CLIENT_NOT_FOUND: if the connection could not be found. 5488c2ecf20Sopenharmony_ci * - MEI_HBMS_ALREADY_STARTED: for start requests for a previously 5498c2ecf20Sopenharmony_ci * started notification. 5508c2ecf20Sopenharmony_ci * - MEI_HBMS_NOT_STARTED: for stop request for a connected client for whom 5518c2ecf20Sopenharmony_ci * asynchronous notifications are currently disabled. 5528c2ecf20Sopenharmony_ci * 5538c2ecf20Sopenharmony_ci * @start: start = 1 or stop = 0 asynchronous notifications 5548c2ecf20Sopenharmony_ci * @reserved: reserved 5558c2ecf20Sopenharmony_ci */ 5568c2ecf20Sopenharmony_cistruct hbm_notification_response { 5578c2ecf20Sopenharmony_ci u8 hbm_cmd; 5588c2ecf20Sopenharmony_ci u8 me_addr; 5598c2ecf20Sopenharmony_ci u8 host_addr; 5608c2ecf20Sopenharmony_ci u8 status; 5618c2ecf20Sopenharmony_ci u8 start; 5628c2ecf20Sopenharmony_ci u8 reserved[3]; 5638c2ecf20Sopenharmony_ci} __packed; 5648c2ecf20Sopenharmony_ci 5658c2ecf20Sopenharmony_ci/** 5668c2ecf20Sopenharmony_ci * struct hbm_notification - notification event 5678c2ecf20Sopenharmony_ci * 5688c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 5698c2ecf20Sopenharmony_ci * @me_addr: address of the client in ME 5708c2ecf20Sopenharmony_ci * @host_addr: address of the client in the driver 5718c2ecf20Sopenharmony_ci * @reserved: reserved for alignment 5728c2ecf20Sopenharmony_ci */ 5738c2ecf20Sopenharmony_cistruct hbm_notification { 5748c2ecf20Sopenharmony_ci u8 hbm_cmd; 5758c2ecf20Sopenharmony_ci u8 me_addr; 5768c2ecf20Sopenharmony_ci u8 host_addr; 5778c2ecf20Sopenharmony_ci u8 reserved; 5788c2ecf20Sopenharmony_ci} __packed; 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci/** 5818c2ecf20Sopenharmony_ci * struct hbm_dma_mem_dscr - dma ring 5828c2ecf20Sopenharmony_ci * 5838c2ecf20Sopenharmony_ci * @addr_hi: the high 32bits of 64 bit address 5848c2ecf20Sopenharmony_ci * @addr_lo: the low 32bits of 64 bit address 5858c2ecf20Sopenharmony_ci * @size : size in bytes (must be power of 2) 5868c2ecf20Sopenharmony_ci */ 5878c2ecf20Sopenharmony_cistruct hbm_dma_mem_dscr { 5888c2ecf20Sopenharmony_ci u32 addr_hi; 5898c2ecf20Sopenharmony_ci u32 addr_lo; 5908c2ecf20Sopenharmony_ci u32 size; 5918c2ecf20Sopenharmony_ci} __packed; 5928c2ecf20Sopenharmony_ci 5938c2ecf20Sopenharmony_cienum { 5948c2ecf20Sopenharmony_ci DMA_DSCR_HOST = 0, 5958c2ecf20Sopenharmony_ci DMA_DSCR_DEVICE = 1, 5968c2ecf20Sopenharmony_ci DMA_DSCR_CTRL = 2, 5978c2ecf20Sopenharmony_ci DMA_DSCR_NUM, 5988c2ecf20Sopenharmony_ci}; 5998c2ecf20Sopenharmony_ci 6008c2ecf20Sopenharmony_ci/** 6018c2ecf20Sopenharmony_ci * struct hbm_dma_setup_request - dma setup request 6028c2ecf20Sopenharmony_ci * 6038c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 6048c2ecf20Sopenharmony_ci * @reserved: reserved for alignment 6058c2ecf20Sopenharmony_ci * @dma_dscr: dma descriptor for HOST, DEVICE, and CTRL 6068c2ecf20Sopenharmony_ci */ 6078c2ecf20Sopenharmony_cistruct hbm_dma_setup_request { 6088c2ecf20Sopenharmony_ci u8 hbm_cmd; 6098c2ecf20Sopenharmony_ci u8 reserved[3]; 6108c2ecf20Sopenharmony_ci struct hbm_dma_mem_dscr dma_dscr[DMA_DSCR_NUM]; 6118c2ecf20Sopenharmony_ci} __packed; 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci/** 6148c2ecf20Sopenharmony_ci * struct hbm_dma_setup_response - dma setup response 6158c2ecf20Sopenharmony_ci * 6168c2ecf20Sopenharmony_ci * @hbm_cmd: bus message command header 6178c2ecf20Sopenharmony_ci * @status: 0 on success; otherwise DMA setup failed. 6188c2ecf20Sopenharmony_ci * @reserved: reserved for alignment 6198c2ecf20Sopenharmony_ci */ 6208c2ecf20Sopenharmony_cistruct hbm_dma_setup_response { 6218c2ecf20Sopenharmony_ci u8 hbm_cmd; 6228c2ecf20Sopenharmony_ci u8 status; 6238c2ecf20Sopenharmony_ci u8 reserved[2]; 6248c2ecf20Sopenharmony_ci} __packed; 6258c2ecf20Sopenharmony_ci 6268c2ecf20Sopenharmony_ci/** 6278c2ecf20Sopenharmony_ci * struct mei_dma_ring_ctrl - dma ring control block 6288c2ecf20Sopenharmony_ci * 6298c2ecf20Sopenharmony_ci * @hbuf_wr_idx: host circular buffer write index in slots 6308c2ecf20Sopenharmony_ci * @reserved1: reserved for alignment 6318c2ecf20Sopenharmony_ci * @hbuf_rd_idx: host circular buffer read index in slots 6328c2ecf20Sopenharmony_ci * @reserved2: reserved for alignment 6338c2ecf20Sopenharmony_ci * @dbuf_wr_idx: device circular buffer write index in slots 6348c2ecf20Sopenharmony_ci * @reserved3: reserved for alignment 6358c2ecf20Sopenharmony_ci * @dbuf_rd_idx: device circular buffer read index in slots 6368c2ecf20Sopenharmony_ci * @reserved4: reserved for alignment 6378c2ecf20Sopenharmony_ci */ 6388c2ecf20Sopenharmony_cistruct hbm_dma_ring_ctrl { 6398c2ecf20Sopenharmony_ci u32 hbuf_wr_idx; 6408c2ecf20Sopenharmony_ci u32 reserved1; 6418c2ecf20Sopenharmony_ci u32 hbuf_rd_idx; 6428c2ecf20Sopenharmony_ci u32 reserved2; 6438c2ecf20Sopenharmony_ci u32 dbuf_wr_idx; 6448c2ecf20Sopenharmony_ci u32 reserved3; 6458c2ecf20Sopenharmony_ci u32 dbuf_rd_idx; 6468c2ecf20Sopenharmony_ci u32 reserved4; 6478c2ecf20Sopenharmony_ci} __packed; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci/* virtual tag supported */ 6508c2ecf20Sopenharmony_ci#define HBM_CAP_VT BIT(0) 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci/** 6538c2ecf20Sopenharmony_ci * struct hbm_capability_request - capability request from host to fw 6548c2ecf20Sopenharmony_ci * 6558c2ecf20Sopenharmony_ci * @hbm_cmd : bus message command header 6568c2ecf20Sopenharmony_ci * @capability_requested: bitmask of capabilities requested by host 6578c2ecf20Sopenharmony_ci */ 6588c2ecf20Sopenharmony_cistruct hbm_capability_request { 6598c2ecf20Sopenharmony_ci u8 hbm_cmd; 6608c2ecf20Sopenharmony_ci u8 capability_requested[3]; 6618c2ecf20Sopenharmony_ci} __packed; 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_ci/** 6648c2ecf20Sopenharmony_ci * struct hbm_capability_response - capability response from fw to host 6658c2ecf20Sopenharmony_ci * 6668c2ecf20Sopenharmony_ci * @hbm_cmd : bus message command header 6678c2ecf20Sopenharmony_ci * @capability_granted: bitmask of capabilities granted by FW 6688c2ecf20Sopenharmony_ci */ 6698c2ecf20Sopenharmony_cistruct hbm_capability_response { 6708c2ecf20Sopenharmony_ci u8 hbm_cmd; 6718c2ecf20Sopenharmony_ci u8 capability_granted[3]; 6728c2ecf20Sopenharmony_ci} __packed; 6738c2ecf20Sopenharmony_ci 6748c2ecf20Sopenharmony_ci#endif 675