1*64516f63SM Chetan Kumar /* SPDX-License-Identifier: GPL-2.0-only 2*64516f63SM Chetan Kumar * 3*64516f63SM Chetan Kumar * Copyright (C) 2020-21 Intel Corporation. 4*64516f63SM Chetan Kumar */ 5*64516f63SM Chetan Kumar 6*64516f63SM Chetan Kumar #ifndef IOSM_IPC_PROTOCOL_OPS_H 7*64516f63SM Chetan Kumar #define IOSM_IPC_PROTOCOL_OPS_H 8*64516f63SM Chetan Kumar 9*64516f63SM Chetan Kumar #define SIZE_MASK 0x00FFFFFF 10*64516f63SM Chetan Kumar #define COMPLETION_STATUS 24 11*64516f63SM Chetan Kumar #define RESET_BIT 7 12*64516f63SM Chetan Kumar 13*64516f63SM Chetan Kumar /** 14*64516f63SM Chetan Kumar * enum ipc_mem_td_cs - Completion status of a TD 15*64516f63SM Chetan Kumar * @IPC_MEM_TD_CS_INVALID: Initial status - td not yet used. 16*64516f63SM Chetan Kumar * @IPC_MEM_TD_CS_PARTIAL_TRANSFER: More data pending -> next TD used for this 17*64516f63SM Chetan Kumar * @IPC_MEM_TD_CS_END_TRANSFER: IO transfer is complete. 18*64516f63SM Chetan Kumar * @IPC_MEM_TD_CS_OVERFLOW: IO transfer to small for the buff to write 19*64516f63SM Chetan Kumar * @IPC_MEM_TD_CS_ABORT: TD marked as abort and shall be discarded 20*64516f63SM Chetan Kumar * by AP. 21*64516f63SM Chetan Kumar * @IPC_MEM_TD_CS_ERROR: General error. 22*64516f63SM Chetan Kumar */ 23*64516f63SM Chetan Kumar enum ipc_mem_td_cs { 24*64516f63SM Chetan Kumar IPC_MEM_TD_CS_INVALID, 25*64516f63SM Chetan Kumar IPC_MEM_TD_CS_PARTIAL_TRANSFER, 26*64516f63SM Chetan Kumar IPC_MEM_TD_CS_END_TRANSFER, 27*64516f63SM Chetan Kumar IPC_MEM_TD_CS_OVERFLOW, 28*64516f63SM Chetan Kumar IPC_MEM_TD_CS_ABORT, 29*64516f63SM Chetan Kumar IPC_MEM_TD_CS_ERROR, 30*64516f63SM Chetan Kumar }; 31*64516f63SM Chetan Kumar 32*64516f63SM Chetan Kumar /** 33*64516f63SM Chetan Kumar * enum ipc_mem_msg_cs - Completion status of IPC Message 34*64516f63SM Chetan Kumar * @IPC_MEM_MSG_CS_INVALID: Initial status. 35*64516f63SM Chetan Kumar * @IPC_MEM_MSG_CS_SUCCESS: IPC Message completion success. 36*64516f63SM Chetan Kumar * @IPC_MEM_MSG_CS_ERROR: Message send error. 37*64516f63SM Chetan Kumar */ 38*64516f63SM Chetan Kumar enum ipc_mem_msg_cs { 39*64516f63SM Chetan Kumar IPC_MEM_MSG_CS_INVALID, 40*64516f63SM Chetan Kumar IPC_MEM_MSG_CS_SUCCESS, 41*64516f63SM Chetan Kumar IPC_MEM_MSG_CS_ERROR, 42*64516f63SM Chetan Kumar }; 43*64516f63SM Chetan Kumar 44*64516f63SM Chetan Kumar /** 45*64516f63SM Chetan Kumar * struct ipc_msg_prep_args_pipe - struct for pipe args for message preparation 46*64516f63SM Chetan Kumar * @pipe: Pipe to open/close 47*64516f63SM Chetan Kumar */ 48*64516f63SM Chetan Kumar struct ipc_msg_prep_args_pipe { 49*64516f63SM Chetan Kumar struct ipc_pipe *pipe; 50*64516f63SM Chetan Kumar }; 51*64516f63SM Chetan Kumar 52*64516f63SM Chetan Kumar /** 53*64516f63SM Chetan Kumar * struct ipc_msg_prep_args_sleep - struct for sleep args for message 54*64516f63SM Chetan Kumar * preparation 55*64516f63SM Chetan Kumar * @target: 0=host, 1=device 56*64516f63SM Chetan Kumar * @state: 0=enter sleep, 1=exit sleep 57*64516f63SM Chetan Kumar */ 58*64516f63SM Chetan Kumar struct ipc_msg_prep_args_sleep { 59*64516f63SM Chetan Kumar unsigned int target; 60*64516f63SM Chetan Kumar unsigned int state; 61*64516f63SM Chetan Kumar }; 62*64516f63SM Chetan Kumar 63*64516f63SM Chetan Kumar /** 64*64516f63SM Chetan Kumar * struct ipc_msg_prep_feature_set - struct for feature set argument for 65*64516f63SM Chetan Kumar * message preparation 66*64516f63SM Chetan Kumar * @reset_enable: 0=out-of-band, 1=in-band-crash notification 67*64516f63SM Chetan Kumar */ 68*64516f63SM Chetan Kumar struct ipc_msg_prep_feature_set { 69*64516f63SM Chetan Kumar u8 reset_enable; 70*64516f63SM Chetan Kumar }; 71*64516f63SM Chetan Kumar 72*64516f63SM Chetan Kumar /** 73*64516f63SM Chetan Kumar * struct ipc_msg_prep_map - struct for map argument for message preparation 74*64516f63SM Chetan Kumar * @region_id: Region to map 75*64516f63SM Chetan Kumar * @addr: Pcie addr of region to map 76*64516f63SM Chetan Kumar * @size: Size of the region to map 77*64516f63SM Chetan Kumar */ 78*64516f63SM Chetan Kumar struct ipc_msg_prep_map { 79*64516f63SM Chetan Kumar unsigned int region_id; 80*64516f63SM Chetan Kumar unsigned long addr; 81*64516f63SM Chetan Kumar size_t size; 82*64516f63SM Chetan Kumar }; 83*64516f63SM Chetan Kumar 84*64516f63SM Chetan Kumar /** 85*64516f63SM Chetan Kumar * struct ipc_msg_prep_unmap - struct for unmap argument for message preparation 86*64516f63SM Chetan Kumar * @region_id: Region to unmap 87*64516f63SM Chetan Kumar */ 88*64516f63SM Chetan Kumar struct ipc_msg_prep_unmap { 89*64516f63SM Chetan Kumar unsigned int region_id; 90*64516f63SM Chetan Kumar }; 91*64516f63SM Chetan Kumar 92*64516f63SM Chetan Kumar /** 93*64516f63SM Chetan Kumar * struct ipc_msg_prep_args - Union to handle different message types 94*64516f63SM Chetan Kumar * @pipe_open: Pipe open message preparation struct 95*64516f63SM Chetan Kumar * @pipe_close: Pipe close message preparation struct 96*64516f63SM Chetan Kumar * @sleep: Sleep message preparation struct 97*64516f63SM Chetan Kumar * @feature_set: Feature set message preparation struct 98*64516f63SM Chetan Kumar * @map: Memory map message preparation struct 99*64516f63SM Chetan Kumar * @unmap: Memory unmap message preparation struct 100*64516f63SM Chetan Kumar */ 101*64516f63SM Chetan Kumar union ipc_msg_prep_args { 102*64516f63SM Chetan Kumar struct ipc_msg_prep_args_pipe pipe_open; 103*64516f63SM Chetan Kumar struct ipc_msg_prep_args_pipe pipe_close; 104*64516f63SM Chetan Kumar struct ipc_msg_prep_args_sleep sleep; 105*64516f63SM Chetan Kumar struct ipc_msg_prep_feature_set feature_set; 106*64516f63SM Chetan Kumar struct ipc_msg_prep_map map; 107*64516f63SM Chetan Kumar struct ipc_msg_prep_unmap unmap; 108*64516f63SM Chetan Kumar }; 109*64516f63SM Chetan Kumar 110*64516f63SM Chetan Kumar /** 111*64516f63SM Chetan Kumar * enum ipc_msg_prep_type - Enum for message prepare actions 112*64516f63SM Chetan Kumar * @IPC_MSG_PREP_SLEEP: Sleep message preparation type 113*64516f63SM Chetan Kumar * @IPC_MSG_PREP_PIPE_OPEN: Pipe open message preparation type 114*64516f63SM Chetan Kumar * @IPC_MSG_PREP_PIPE_CLOSE: Pipe close message preparation type 115*64516f63SM Chetan Kumar * @IPC_MSG_PREP_FEATURE_SET: Feature set message preparation type 116*64516f63SM Chetan Kumar * @IPC_MSG_PREP_MAP: Memory map message preparation type 117*64516f63SM Chetan Kumar * @IPC_MSG_PREP_UNMAP: Memory unmap message preparation type 118*64516f63SM Chetan Kumar */ 119*64516f63SM Chetan Kumar enum ipc_msg_prep_type { 120*64516f63SM Chetan Kumar IPC_MSG_PREP_SLEEP, 121*64516f63SM Chetan Kumar IPC_MSG_PREP_PIPE_OPEN, 122*64516f63SM Chetan Kumar IPC_MSG_PREP_PIPE_CLOSE, 123*64516f63SM Chetan Kumar IPC_MSG_PREP_FEATURE_SET, 124*64516f63SM Chetan Kumar IPC_MSG_PREP_MAP, 125*64516f63SM Chetan Kumar IPC_MSG_PREP_UNMAP, 126*64516f63SM Chetan Kumar }; 127*64516f63SM Chetan Kumar 128*64516f63SM Chetan Kumar /** 129*64516f63SM Chetan Kumar * struct ipc_rsp - Response to sent message 130*64516f63SM Chetan Kumar * @completion: For waking up requestor 131*64516f63SM Chetan Kumar * @status: Completion status 132*64516f63SM Chetan Kumar */ 133*64516f63SM Chetan Kumar struct ipc_rsp { 134*64516f63SM Chetan Kumar struct completion completion; 135*64516f63SM Chetan Kumar enum ipc_mem_msg_cs status; 136*64516f63SM Chetan Kumar }; 137*64516f63SM Chetan Kumar 138*64516f63SM Chetan Kumar /** 139*64516f63SM Chetan Kumar * enum ipc_mem_msg - Type-definition of the messages. 140*64516f63SM Chetan Kumar * @IPC_MEM_MSG_OPEN_PIPE: AP ->CP: Open a pipe 141*64516f63SM Chetan Kumar * @IPC_MEM_MSG_CLOSE_PIPE: AP ->CP: Close a pipe 142*64516f63SM Chetan Kumar * @IPC_MEM_MSG_ABORT_PIPE: AP ->CP: wait for completion of the 143*64516f63SM Chetan Kumar * running transfer and abort all pending 144*64516f63SM Chetan Kumar * IO-transfers for the pipe 145*64516f63SM Chetan Kumar * @IPC_MEM_MSG_SLEEP: AP ->CP: host enter or exit sleep 146*64516f63SM Chetan Kumar * @IPC_MEM_MSG_FEATURE_SET: AP ->CP: Intel feature configuration 147*64516f63SM Chetan Kumar */ 148*64516f63SM Chetan Kumar enum ipc_mem_msg { 149*64516f63SM Chetan Kumar IPC_MEM_MSG_OPEN_PIPE = 0x01, 150*64516f63SM Chetan Kumar IPC_MEM_MSG_CLOSE_PIPE = 0x02, 151*64516f63SM Chetan Kumar IPC_MEM_MSG_ABORT_PIPE = 0x03, 152*64516f63SM Chetan Kumar IPC_MEM_MSG_SLEEP = 0x04, 153*64516f63SM Chetan Kumar IPC_MEM_MSG_FEATURE_SET = 0xF0, 154*64516f63SM Chetan Kumar }; 155*64516f63SM Chetan Kumar 156*64516f63SM Chetan Kumar /** 157*64516f63SM Chetan Kumar * struct ipc_mem_msg_open_pipe - Message structure for open pipe 158*64516f63SM Chetan Kumar * @tdr_addr: Tdr address 159*64516f63SM Chetan Kumar * @tdr_entries: Tdr entries 160*64516f63SM Chetan Kumar * @pipe_nr: Pipe number 161*64516f63SM Chetan Kumar * @type_of_message: Message type 162*64516f63SM Chetan Kumar * @irq_vector: MSI vector number 163*64516f63SM Chetan Kumar * @accumulation_backoff: Time in usec for data accumalation 164*64516f63SM Chetan Kumar * @completion_status: Message Completion Status 165*64516f63SM Chetan Kumar */ 166*64516f63SM Chetan Kumar struct ipc_mem_msg_open_pipe { 167*64516f63SM Chetan Kumar __le64 tdr_addr; 168*64516f63SM Chetan Kumar __le16 tdr_entries; 169*64516f63SM Chetan Kumar u8 pipe_nr; 170*64516f63SM Chetan Kumar u8 type_of_message; 171*64516f63SM Chetan Kumar __le32 irq_vector; 172*64516f63SM Chetan Kumar __le32 accumulation_backoff; 173*64516f63SM Chetan Kumar __le32 completion_status; 174*64516f63SM Chetan Kumar }; 175*64516f63SM Chetan Kumar 176*64516f63SM Chetan Kumar /** 177*64516f63SM Chetan Kumar * struct ipc_mem_msg_close_pipe - Message structure for close pipe 178*64516f63SM Chetan Kumar * @reserved1: Reserved 179*64516f63SM Chetan Kumar * @reserved2: Reserved 180*64516f63SM Chetan Kumar * @pipe_nr: Pipe number 181*64516f63SM Chetan Kumar * @type_of_message: Message type 182*64516f63SM Chetan Kumar * @reserved3: Reserved 183*64516f63SM Chetan Kumar * @reserved4: Reserved 184*64516f63SM Chetan Kumar * @completion_status: Message Completion Status 185*64516f63SM Chetan Kumar */ 186*64516f63SM Chetan Kumar struct ipc_mem_msg_close_pipe { 187*64516f63SM Chetan Kumar __le32 reserved1[2]; 188*64516f63SM Chetan Kumar __le16 reserved2; 189*64516f63SM Chetan Kumar u8 pipe_nr; 190*64516f63SM Chetan Kumar u8 type_of_message; 191*64516f63SM Chetan Kumar __le32 reserved3; 192*64516f63SM Chetan Kumar __le32 reserved4; 193*64516f63SM Chetan Kumar __le32 completion_status; 194*64516f63SM Chetan Kumar }; 195*64516f63SM Chetan Kumar 196*64516f63SM Chetan Kumar /** 197*64516f63SM Chetan Kumar * struct ipc_mem_msg_abort_pipe - Message structure for abort pipe 198*64516f63SM Chetan Kumar * @reserved1: Reserved 199*64516f63SM Chetan Kumar * @reserved2: Reserved 200*64516f63SM Chetan Kumar * @pipe_nr: Pipe number 201*64516f63SM Chetan Kumar * @type_of_message: Message type 202*64516f63SM Chetan Kumar * @reserved3: Reserved 203*64516f63SM Chetan Kumar * @reserved4: Reserved 204*64516f63SM Chetan Kumar * @completion_status: Message Completion Status 205*64516f63SM Chetan Kumar */ 206*64516f63SM Chetan Kumar struct ipc_mem_msg_abort_pipe { 207*64516f63SM Chetan Kumar __le32 reserved1[2]; 208*64516f63SM Chetan Kumar __le16 reserved2; 209*64516f63SM Chetan Kumar u8 pipe_nr; 210*64516f63SM Chetan Kumar u8 type_of_message; 211*64516f63SM Chetan Kumar __le32 reserved3; 212*64516f63SM Chetan Kumar __le32 reserved4; 213*64516f63SM Chetan Kumar __le32 completion_status; 214*64516f63SM Chetan Kumar }; 215*64516f63SM Chetan Kumar 216*64516f63SM Chetan Kumar /** 217*64516f63SM Chetan Kumar * struct ipc_mem_msg_host_sleep - Message structure for sleep message. 218*64516f63SM Chetan Kumar * @reserved1: Reserved 219*64516f63SM Chetan Kumar * @target: 0=host, 1=device, host or EP devie 220*64516f63SM Chetan Kumar * is the message target 221*64516f63SM Chetan Kumar * @state: 0=enter sleep, 1=exit sleep, 222*64516f63SM Chetan Kumar * 2=enter sleep no protocol 223*64516f63SM Chetan Kumar * @reserved2: Reserved 224*64516f63SM Chetan Kumar * @type_of_message: Message type 225*64516f63SM Chetan Kumar * @reserved3: Reserved 226*64516f63SM Chetan Kumar * @reserved4: Reserved 227*64516f63SM Chetan Kumar * @completion_status: Message Completion Status 228*64516f63SM Chetan Kumar */ 229*64516f63SM Chetan Kumar struct ipc_mem_msg_host_sleep { 230*64516f63SM Chetan Kumar __le32 reserved1[2]; 231*64516f63SM Chetan Kumar u8 target; 232*64516f63SM Chetan Kumar u8 state; 233*64516f63SM Chetan Kumar u8 reserved2; 234*64516f63SM Chetan Kumar u8 type_of_message; 235*64516f63SM Chetan Kumar __le32 reserved3; 236*64516f63SM Chetan Kumar __le32 reserved4; 237*64516f63SM Chetan Kumar __le32 completion_status; 238*64516f63SM Chetan Kumar }; 239*64516f63SM Chetan Kumar 240*64516f63SM Chetan Kumar /** 241*64516f63SM Chetan Kumar * struct ipc_mem_msg_feature_set - Message structure for feature_set message 242*64516f63SM Chetan Kumar * @reserved1: Reserved 243*64516f63SM Chetan Kumar * @reserved2: Reserved 244*64516f63SM Chetan Kumar * @reset_enable: 0=out-of-band, 1=in-band-crash notification 245*64516f63SM Chetan Kumar * @type_of_message: Message type 246*64516f63SM Chetan Kumar * @reserved3: Reserved 247*64516f63SM Chetan Kumar * @reserved4: Reserved 248*64516f63SM Chetan Kumar * @completion_status: Message Completion Status 249*64516f63SM Chetan Kumar */ 250*64516f63SM Chetan Kumar struct ipc_mem_msg_feature_set { 251*64516f63SM Chetan Kumar __le32 reserved1[2]; 252*64516f63SM Chetan Kumar __le16 reserved2; 253*64516f63SM Chetan Kumar u8 reset_enable; 254*64516f63SM Chetan Kumar u8 type_of_message; 255*64516f63SM Chetan Kumar __le32 reserved3; 256*64516f63SM Chetan Kumar __le32 reserved4; 257*64516f63SM Chetan Kumar __le32 completion_status; 258*64516f63SM Chetan Kumar }; 259*64516f63SM Chetan Kumar 260*64516f63SM Chetan Kumar /** 261*64516f63SM Chetan Kumar * struct ipc_mem_msg_common - Message structure for completion status update. 262*64516f63SM Chetan Kumar * @reserved1: Reserved 263*64516f63SM Chetan Kumar * @reserved2: Reserved 264*64516f63SM Chetan Kumar * @type_of_message: Message type 265*64516f63SM Chetan Kumar * @reserved3: Reserved 266*64516f63SM Chetan Kumar * @reserved4: Reserved 267*64516f63SM Chetan Kumar * @completion_status: Message Completion Status 268*64516f63SM Chetan Kumar */ 269*64516f63SM Chetan Kumar struct ipc_mem_msg_common { 270*64516f63SM Chetan Kumar __le32 reserved1[2]; 271*64516f63SM Chetan Kumar u8 reserved2[3]; 272*64516f63SM Chetan Kumar u8 type_of_message; 273*64516f63SM Chetan Kumar __le32 reserved3; 274*64516f63SM Chetan Kumar __le32 reserved4; 275*64516f63SM Chetan Kumar __le32 completion_status; 276*64516f63SM Chetan Kumar }; 277*64516f63SM Chetan Kumar 278*64516f63SM Chetan Kumar /** 279*64516f63SM Chetan Kumar * union ipc_mem_msg_entry - Union with all possible messages. 280*64516f63SM Chetan Kumar * @open_pipe: Open pipe message struct 281*64516f63SM Chetan Kumar * @close_pipe: Close pipe message struct 282*64516f63SM Chetan Kumar * @abort_pipe: Abort pipe message struct 283*64516f63SM Chetan Kumar * @host_sleep: Host sleep message struct 284*64516f63SM Chetan Kumar * @feature_set: Featuer set message struct 285*64516f63SM Chetan Kumar * @common: Used to access msg_type and to set the completion status 286*64516f63SM Chetan Kumar */ 287*64516f63SM Chetan Kumar union ipc_mem_msg_entry { 288*64516f63SM Chetan Kumar struct ipc_mem_msg_open_pipe open_pipe; 289*64516f63SM Chetan Kumar struct ipc_mem_msg_close_pipe close_pipe; 290*64516f63SM Chetan Kumar struct ipc_mem_msg_abort_pipe abort_pipe; 291*64516f63SM Chetan Kumar struct ipc_mem_msg_host_sleep host_sleep; 292*64516f63SM Chetan Kumar struct ipc_mem_msg_feature_set feature_set; 293*64516f63SM Chetan Kumar struct ipc_mem_msg_common common; 294*64516f63SM Chetan Kumar }; 295*64516f63SM Chetan Kumar 296*64516f63SM Chetan Kumar /* Transfer descriptor definition. */ 297*64516f63SM Chetan Kumar struct ipc_protocol_td { 298*64516f63SM Chetan Kumar union { 299*64516f63SM Chetan Kumar /* 0 : 63 - 64-bit address of a buffer in host memory. */ 300*64516f63SM Chetan Kumar dma_addr_t address; 301*64516f63SM Chetan Kumar struct { 302*64516f63SM Chetan Kumar /* 0 : 31 - 32 bit address */ 303*64516f63SM Chetan Kumar __le32 address; 304*64516f63SM Chetan Kumar /* 32 : 63 - corresponding descriptor */ 305*64516f63SM Chetan Kumar __le32 desc; 306*64516f63SM Chetan Kumar } __packed shm; 307*64516f63SM Chetan Kumar } buffer; 308*64516f63SM Chetan Kumar 309*64516f63SM Chetan Kumar /* 0 - 2nd byte - Size of the buffer. 310*64516f63SM Chetan Kumar * The host provides the size of the buffer queued. 311*64516f63SM Chetan Kumar * The EP device reads this value and shall update 312*64516f63SM Chetan Kumar * it for downlink transfers to indicate the 313*64516f63SM Chetan Kumar * amount of data written in buffer. 314*64516f63SM Chetan Kumar * 3rd byte - This field provides the completion status 315*64516f63SM Chetan Kumar * of the TD. When queuing the TD, the host sets 316*64516f63SM Chetan Kumar * the status to 0. The EP device updates this 317*64516f63SM Chetan Kumar * field when completing the TD. 318*64516f63SM Chetan Kumar */ 319*64516f63SM Chetan Kumar __le32 scs; 320*64516f63SM Chetan Kumar 321*64516f63SM Chetan Kumar /* 0th - nr of following descriptors 322*64516f63SM Chetan Kumar * 1 - 3rd byte - reserved 323*64516f63SM Chetan Kumar */ 324*64516f63SM Chetan Kumar __le32 next; 325*64516f63SM Chetan Kumar } __packed; 326*64516f63SM Chetan Kumar 327*64516f63SM Chetan Kumar /** 328*64516f63SM Chetan Kumar * ipc_protocol_msg_prep - Prepare message based upon message type 329*64516f63SM Chetan Kumar * @ipc_imem: iosm_protocol instance 330*64516f63SM Chetan Kumar * @msg_type: message prepare type 331*64516f63SM Chetan Kumar * @args: message arguments 332*64516f63SM Chetan Kumar * 333*64516f63SM Chetan Kumar * Return: 0 on success and failure value on error 334*64516f63SM Chetan Kumar */ 335*64516f63SM Chetan Kumar int ipc_protocol_msg_prep(struct iosm_imem *ipc_imem, 336*64516f63SM Chetan Kumar enum ipc_msg_prep_type msg_type, 337*64516f63SM Chetan Kumar union ipc_msg_prep_args *args); 338*64516f63SM Chetan Kumar 339*64516f63SM Chetan Kumar /** 340*64516f63SM Chetan Kumar * ipc_protocol_msg_hp_update - Function for head pointer update 341*64516f63SM Chetan Kumar * of message ring 342*64516f63SM Chetan Kumar * @ipc_imem: iosm_protocol instance 343*64516f63SM Chetan Kumar */ 344*64516f63SM Chetan Kumar void ipc_protocol_msg_hp_update(struct iosm_imem *ipc_imem); 345*64516f63SM Chetan Kumar 346*64516f63SM Chetan Kumar /** 347*64516f63SM Chetan Kumar * ipc_protocol_msg_process - Function for processing responses 348*64516f63SM Chetan Kumar * to IPC messages 349*64516f63SM Chetan Kumar * @ipc_imem: iosm_protocol instance 350*64516f63SM Chetan Kumar * @irq: IRQ vector 351*64516f63SM Chetan Kumar * 352*64516f63SM Chetan Kumar * Return: True on success, false if error 353*64516f63SM Chetan Kumar */ 354*64516f63SM Chetan Kumar bool ipc_protocol_msg_process(struct iosm_imem *ipc_imem, int irq); 355*64516f63SM Chetan Kumar 356*64516f63SM Chetan Kumar /** 357*64516f63SM Chetan Kumar * ipc_protocol_ul_td_send - Function for sending the data to CP 358*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 359*64516f63SM Chetan Kumar * @pipe: Pipe instance 360*64516f63SM Chetan Kumar * @p_ul_list: uplink sk_buff list 361*64516f63SM Chetan Kumar * 362*64516f63SM Chetan Kumar * Return: true in success, false in case of error 363*64516f63SM Chetan Kumar */ 364*64516f63SM Chetan Kumar bool ipc_protocol_ul_td_send(struct iosm_protocol *ipc_protocol, 365*64516f63SM Chetan Kumar struct ipc_pipe *pipe, 366*64516f63SM Chetan Kumar struct sk_buff_head *p_ul_list); 367*64516f63SM Chetan Kumar 368*64516f63SM Chetan Kumar /** 369*64516f63SM Chetan Kumar * ipc_protocol_ul_td_process - Function for processing the sent data 370*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 371*64516f63SM Chetan Kumar * @pipe: Pipe instance 372*64516f63SM Chetan Kumar * 373*64516f63SM Chetan Kumar * Return: sk_buff instance 374*64516f63SM Chetan Kumar */ 375*64516f63SM Chetan Kumar struct sk_buff *ipc_protocol_ul_td_process(struct iosm_protocol *ipc_protocol, 376*64516f63SM Chetan Kumar struct ipc_pipe *pipe); 377*64516f63SM Chetan Kumar 378*64516f63SM Chetan Kumar /** 379*64516f63SM Chetan Kumar * ipc_protocol_dl_td_prepare - Function for providing DL TDs to CP 380*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 381*64516f63SM Chetan Kumar * @pipe: Pipe instance 382*64516f63SM Chetan Kumar * 383*64516f63SM Chetan Kumar * Return: true in success, false in case of error 384*64516f63SM Chetan Kumar */ 385*64516f63SM Chetan Kumar bool ipc_protocol_dl_td_prepare(struct iosm_protocol *ipc_protocol, 386*64516f63SM Chetan Kumar struct ipc_pipe *pipe); 387*64516f63SM Chetan Kumar 388*64516f63SM Chetan Kumar /** 389*64516f63SM Chetan Kumar * ipc_protocol_dl_td_process - Function for processing the DL data 390*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 391*64516f63SM Chetan Kumar * @pipe: Pipe instance 392*64516f63SM Chetan Kumar * 393*64516f63SM Chetan Kumar * Return: sk_buff instance 394*64516f63SM Chetan Kumar */ 395*64516f63SM Chetan Kumar struct sk_buff *ipc_protocol_dl_td_process(struct iosm_protocol *ipc_protocol, 396*64516f63SM Chetan Kumar struct ipc_pipe *pipe); 397*64516f63SM Chetan Kumar 398*64516f63SM Chetan Kumar /** 399*64516f63SM Chetan Kumar * ipc_protocol_get_head_tail_index - Function for getting Head and Tail 400*64516f63SM Chetan Kumar * pointer index of given pipe 401*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 402*64516f63SM Chetan Kumar * @pipe: Pipe Instance 403*64516f63SM Chetan Kumar * @head: head pointer index of the given pipe 404*64516f63SM Chetan Kumar * @tail: tail pointer index of the given pipe 405*64516f63SM Chetan Kumar */ 406*64516f63SM Chetan Kumar void ipc_protocol_get_head_tail_index(struct iosm_protocol *ipc_protocol, 407*64516f63SM Chetan Kumar struct ipc_pipe *pipe, u32 *head, 408*64516f63SM Chetan Kumar u32 *tail); 409*64516f63SM Chetan Kumar /** 410*64516f63SM Chetan Kumar * ipc_protocol_get_ipc_status - Function for getting the IPC Status 411*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 412*64516f63SM Chetan Kumar * 413*64516f63SM Chetan Kumar * Return: Returns IPC State 414*64516f63SM Chetan Kumar */ 415*64516f63SM Chetan Kumar enum ipc_mem_device_ipc_state ipc_protocol_get_ipc_status(struct iosm_protocol 416*64516f63SM Chetan Kumar *ipc_protocol); 417*64516f63SM Chetan Kumar 418*64516f63SM Chetan Kumar /** 419*64516f63SM Chetan Kumar * ipc_protocol_pipe_cleanup - Function to cleanup pipe resources 420*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 421*64516f63SM Chetan Kumar * @pipe: Pipe instance 422*64516f63SM Chetan Kumar */ 423*64516f63SM Chetan Kumar void ipc_protocol_pipe_cleanup(struct iosm_protocol *ipc_protocol, 424*64516f63SM Chetan Kumar struct ipc_pipe *pipe); 425*64516f63SM Chetan Kumar 426*64516f63SM Chetan Kumar /** 427*64516f63SM Chetan Kumar * ipc_protocol_get_ap_exec_stage - Function for getting AP Exec Stage 428*64516f63SM Chetan Kumar * @ipc_protocol: pointer to struct iosm protocol 429*64516f63SM Chetan Kumar * 430*64516f63SM Chetan Kumar * Return: returns BOOT Stages 431*64516f63SM Chetan Kumar */ 432*64516f63SM Chetan Kumar enum ipc_mem_exec_stage 433*64516f63SM Chetan Kumar ipc_protocol_get_ap_exec_stage(struct iosm_protocol *ipc_protocol); 434*64516f63SM Chetan Kumar 435*64516f63SM Chetan Kumar /** 436*64516f63SM Chetan Kumar * ipc_protocol_pm_dev_get_sleep_notification - Function for getting Dev Sleep 437*64516f63SM Chetan Kumar * notification 438*64516f63SM Chetan Kumar * @ipc_protocol: iosm_protocol instance 439*64516f63SM Chetan Kumar * 440*64516f63SM Chetan Kumar * Return: Returns dev PM State 441*64516f63SM Chetan Kumar */ 442*64516f63SM Chetan Kumar u32 ipc_protocol_pm_dev_get_sleep_notification(struct iosm_protocol 443*64516f63SM Chetan Kumar *ipc_protocol); 444*64516f63SM Chetan Kumar #endif 445