^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * ISHTP bus layer messages handling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2003-2016, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef _ISHTP_HBM_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define _ISHTP_HBM_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/uuid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) struct ishtp_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) struct ishtp_msg_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct ishtp_cl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Timeouts in Seconds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define ISHTP_INTEROP_TIMEOUT 7 /* Timeout on ready message */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define ISHTP_CL_CONNECT_TIMEOUT 15 /* HPS: Client Connect Timeout */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * ISHTP Version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define HBM_MINOR_VERSION 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define HBM_MAJOR_VERSION 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /* Host bus message command opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define ISHTP_HBM_CMD_OP_MSK 0x7f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* Host bus message command RESPONSE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define ISHTP_HBM_CMD_RES_MSK 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * ISHTP Bus Message Command IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define HOST_START_REQ_CMD 0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define HOST_START_RES_CMD 0x81
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define HOST_STOP_REQ_CMD 0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define HOST_STOP_RES_CMD 0x82
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define FW_STOP_REQ_CMD 0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define HOST_ENUM_REQ_CMD 0x04
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define HOST_ENUM_RES_CMD 0x84
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define HOST_CLIENT_PROPERTIES_REQ_CMD 0x05
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define HOST_CLIENT_PROPERTIES_RES_CMD 0x85
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define CLIENT_CONNECT_REQ_CMD 0x06
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define CLIENT_CONNECT_RES_CMD 0x86
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define CLIENT_DISCONNECT_REQ_CMD 0x07
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define CLIENT_DISCONNECT_RES_CMD 0x87
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define ISHTP_FLOW_CONTROL_CMD 0x08
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define DMA_BUFFER_ALLOC_NOTIFY 0x11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define DMA_BUFFER_ALLOC_RESPONSE 0x91
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define DMA_XFER 0x12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define DMA_XFER_ACK 0x92
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * ISHTP Stop Reason
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * used by hbm_host_stop_request.reason
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define DRIVER_STOP_REQUEST 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * ISHTP BUS Interface Section
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct ishtp_msg_hdr {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) uint32_t fw_addr:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) uint32_t host_addr:8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) uint32_t length:9;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) uint32_t reserved:6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) uint32_t msg_complete:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct ishtp_bus_message {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) uint8_t data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * struct hbm_cl_cmd - client specific host bus command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * CONNECT, DISCONNECT, and FlOW CONTROL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * @hbm_cmd - bus message command header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * @fw_addr - address of the fw client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * @host_addr - address of the client in the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * @data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct ishtp_hbm_cl_cmd {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) uint8_t fw_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) uint8_t host_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) uint8_t data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct hbm_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) uint8_t minor_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) uint8_t major_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct hbm_host_version_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) uint8_t reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct hbm_version host_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct hbm_host_version_response {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) uint8_t host_version_supported;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct hbm_version fw_max_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) struct hbm_host_stop_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) uint8_t reason;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) uint8_t reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct hbm_host_stop_response {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) uint8_t reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct hbm_host_enum_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) uint8_t reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct hbm_host_enum_response {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) uint8_t reserved[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) uint8_t valid_addresses[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct ishtp_client_properties {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) guid_t protocol_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) uint8_t protocol_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) uint8_t max_number_of_connections;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) uint8_t fixed_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) uint8_t single_recv_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) uint32_t max_msg_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) uint8_t dma_hdr_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define ISHTP_CLIENT_DMA_ENABLED 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) uint8_t reserved4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) uint8_t reserved5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) uint8_t reserved6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct hbm_props_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) uint8_t address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) uint8_t reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct hbm_props_response {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) uint8_t address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) uint8_t status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) uint8_t reserved[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct ishtp_client_properties client_properties;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) * struct hbm_client_connect_request - connect/disconnect request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) * @hbm_cmd - bus message command header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * @fw_addr - address of the fw client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * @host_addr - address of the client in the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * @reserved
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) struct hbm_client_connect_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) uint8_t fw_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) uint8_t host_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) uint8_t reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) * struct hbm_client_connect_response - connect/disconnect response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) * @hbm_cmd - bus message command header
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) * @fw_addr - address of the fw client
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * @host_addr - address of the client in the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * @status - status of the request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct hbm_client_connect_response {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) uint8_t fw_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) uint8_t host_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) uint8_t status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define ISHTP_FC_MESSAGE_RESERVED_LENGTH 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) struct hbm_flow_control {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) uint8_t hbm_cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) uint8_t fw_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) uint8_t host_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) uint8_t reserved[ISHTP_FC_MESSAGE_RESERVED_LENGTH];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) struct dma_alloc_notify {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) uint8_t hbm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) uint8_t status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) uint8_t reserved[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) uint32_t buf_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) uint64_t buf_address;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* [...] May come more size/address pairs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct dma_xfer_hbm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) uint8_t hbm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) uint8_t fw_client_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) uint8_t host_client_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) uint8_t reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) uint64_t msg_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) uint32_t msg_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) uint32_t reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) /* System state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #define ISHTP_SYSTEM_STATE_CLIENT_ADDR 13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #define SYSTEM_STATE_SUBSCRIBE 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) #define SYSTEM_STATE_STATUS 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) #define SYSTEM_STATE_QUERY_SUBSCRIBERS 0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) #define SYSTEM_STATE_STATE_CHANGE_REQ 0x4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) /*indicates suspend and resume states*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) #define SUSPEND_STATE_BIT (1<<1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) struct ish_system_states_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) uint32_t cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) uint32_t cmd_status; /*responses will have this set*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct ish_system_states_subscribe {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct ish_system_states_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) uint32_t states;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) struct ish_system_states_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct ish_system_states_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) uint32_t supported_states;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) uint32_t states_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) struct ish_system_states_query_subscribers {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) struct ish_system_states_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) struct ish_system_states_state_change_req {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) struct ish_system_states_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) uint32_t requested_states;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) uint32_t states_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * enum ishtp_hbm_state - host bus message protocol state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * @ISHTP_HBM_IDLE : protocol not started
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * @ISHTP_HBM_START : start request message was sent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * @ISHTP_HBM_ENUM_CLIENTS : enumeration request was sent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * @ISHTP_HBM_CLIENT_PROPERTIES : acquiring clients properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) enum ishtp_hbm_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) ISHTP_HBM_IDLE = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) ISHTP_HBM_START,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) ISHTP_HBM_STARTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) ISHTP_HBM_ENUM_CLIENTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) ISHTP_HBM_CLIENT_PROPERTIES,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) ISHTP_HBM_WORKING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) ISHTP_HBM_STOPPED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) static inline void ishtp_hbm_hdr(struct ishtp_msg_hdr *hdr, size_t length)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) hdr->host_addr = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) hdr->fw_addr = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) hdr->length = length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) hdr->msg_complete = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) hdr->reserved = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) int ishtp_hbm_start_req(struct ishtp_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) int ishtp_hbm_start_wait(struct ishtp_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) int ishtp_hbm_cl_flow_control_req(struct ishtp_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) struct ishtp_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) int ishtp_hbm_cl_disconnect_req(struct ishtp_device *dev, struct ishtp_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) int ishtp_hbm_cl_connect_req(struct ishtp_device *dev, struct ishtp_cl *cl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) void ishtp_hbm_enum_clients_req(struct ishtp_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) void bh_hbm_work_fn(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) void recv_hbm(struct ishtp_device *dev, struct ishtp_msg_hdr *ishtp_hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) void recv_fixed_cl_msg(struct ishtp_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) struct ishtp_msg_hdr *ishtp_hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) void ishtp_hbm_dispatch(struct ishtp_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) struct ishtp_bus_message *hdr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) void ishtp_query_subscribers(struct ishtp_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) /* Exported I/F */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) void ishtp_send_suspend(struct ishtp_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) void ishtp_send_resume(struct ishtp_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) #endif /* _ISHTP_HBM_H_ */