Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /* Copyright (c) 2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2018-2020 Linaro Ltd.
0005  */
0006 #ifndef _IPA_QMI_MSG_H_
0007 #define _IPA_QMI_MSG_H_
0008 
0009 /* === Only "ipa_qmi" and "ipa_qmi_msg.c" should include this file === */
0010 
0011 #include <linux/types.h>
0012 #include <linux/soc/qcom/qmi.h>
0013 
0014 /* Request/response/indication QMI message ids used for IPA.  Receiving
0015  * end issues a response for requests; indications require no response.
0016  */
0017 #define IPA_QMI_INDICATION_REGISTER 0x20    /* modem -> AP request */
0018 #define IPA_QMI_INIT_DRIVER     0x21    /* AP -> modem request */
0019 #define IPA_QMI_INIT_COMPLETE       0x22    /* AP -> modem indication */
0020 #define IPA_QMI_DRIVER_INIT_COMPLETE    0x35    /* modem -> AP request */
0021 
0022 /* The maximum size required for message types.  These sizes include
0023  * the message data, along with type (1 byte) and length (2 byte)
0024  * information for each field.  The qmi_send_*() interfaces require
0025  * the message size to be provided.
0026  */
0027 #define IPA_QMI_INDICATION_REGISTER_REQ_SZ  20  /* -> server handle */
0028 #define IPA_QMI_INDICATION_REGISTER_RSP_SZ  7   /* <- server handle */
0029 #define IPA_QMI_INIT_DRIVER_REQ_SZ      162 /* client handle -> */
0030 #define IPA_QMI_INIT_DRIVER_RSP_SZ      25  /* client handle <- */
0031 #define IPA_QMI_INIT_COMPLETE_IND_SZ        7   /* <- server handle */
0032 #define IPA_QMI_DRIVER_INIT_COMPLETE_REQ_SZ 4   /* -> server handle */
0033 #define IPA_QMI_DRIVER_INIT_COMPLETE_RSP_SZ 7   /* <- server handle */
0034 
0035 /* Maximum size of messages we expect the AP to receive (max of above) */
0036 #define IPA_QMI_SERVER_MAX_RCV_SZ       8
0037 #define IPA_QMI_CLIENT_MAX_RCV_SZ       25
0038 
0039 /* Request message for the IPA_QMI_INDICATION_REGISTER request */
0040 struct ipa_indication_register_req {
0041     u8 master_driver_init_complete_valid;
0042     u8 master_driver_init_complete;
0043     u8 data_usage_quota_reached_valid;
0044     u8 data_usage_quota_reached;
0045     u8 ipa_mhi_ready_ind_valid;
0046     u8 ipa_mhi_ready_ind;
0047     u8 endpoint_desc_ind_valid;
0048     u8 endpoint_desc_ind;
0049     u8 bw_change_ind_valid;
0050     u8 bw_change_ind;
0051 };
0052 
0053 /* The response to a IPA_QMI_INDICATION_REGISTER request consists only of
0054  * a standard QMI response.
0055  */
0056 struct ipa_indication_register_rsp {
0057     struct qmi_response_type_v01 rsp;
0058 };
0059 
0060 /* Request message for the IPA_QMI_DRIVER_INIT_COMPLETE request */
0061 struct ipa_driver_init_complete_req {
0062     u8 status;
0063 };
0064 
0065 /* The response to a IPA_QMI_DRIVER_INIT_COMPLETE request consists only
0066  * of a standard QMI response.
0067  */
0068 struct ipa_driver_init_complete_rsp {
0069     struct qmi_response_type_v01 rsp;
0070 };
0071 
0072 /* The message for the IPA_QMI_INIT_COMPLETE_IND indication consists
0073  * only of a standard QMI response.
0074  */
0075 struct ipa_init_complete_ind {
0076     struct qmi_response_type_v01 status;
0077 };
0078 
0079 /* The AP tells the modem its platform type.  We assume Android. */
0080 enum ipa_platform_type {
0081     IPA_QMI_PLATFORM_TYPE_INVALID       = 0x0,  /* Invalid */
0082     IPA_QMI_PLATFORM_TYPE_TN        = 0x1,  /* Data card */
0083     IPA_QMI_PLATFORM_TYPE_LE        = 0x2,  /* Data router */
0084     IPA_QMI_PLATFORM_TYPE_MSM_ANDROID   = 0x3,  /* Android MSM */
0085     IPA_QMI_PLATFORM_TYPE_MSM_WINDOWS   = 0x4,  /* Windows MSM */
0086     IPA_QMI_PLATFORM_TYPE_MSM_QNX_V01   = 0x5,  /* QNX MSM */
0087 };
0088 
0089 /* This defines the start and end offset of a range of memory.  The start
0090  * value is a byte offset relative to the start of IPA shared memory.  The
0091  * end value is the last addressable unit *within* the range.  Typically
0092  * the end value is in units of bytes, however it can also be a maximum
0093  * array index value.
0094  */
0095 struct ipa_mem_bounds {
0096     u32 start;
0097     u32 end;
0098 };
0099 
0100 /* This defines the location and size of an array.  The start value
0101  * is an offset relative to the start of IPA shared memory.  The
0102  * size of the array is implied by the number of entries (the entry
0103  * size is assumed to be known).
0104  */
0105 struct ipa_mem_array {
0106     u32 start;
0107     u32 count;
0108 };
0109 
0110 /* This defines the location and size of a range of memory.  The
0111  * start is an offset relative to the start of IPA shared memory.
0112  * This differs from the ipa_mem_bounds structure in that the size
0113  * (in bytes) of the memory region is specified rather than the
0114  * offset of its last byte.
0115  */
0116 struct ipa_mem_range {
0117     u32 start;
0118     u32 size;
0119 };
0120 
0121 /* The message for the IPA_QMI_INIT_DRIVER request contains information
0122  * from the AP that affects modem initialization.
0123  */
0124 struct ipa_init_modem_driver_req {
0125     u8          platform_type_valid;
0126     u32         platform_type;  /* enum ipa_platform_type */
0127 
0128     /* Modem header table information.  This defines the IPA shared
0129      * memory in which the modem may insert header table entries.
0130      */
0131     u8          hdr_tbl_info_valid;
0132     struct ipa_mem_bounds   hdr_tbl_info;
0133 
0134     /* Routing table information.  These define the location and maximum
0135      * *index* (not byte) for the modem portion of non-hashable IPv4 and
0136      * IPv6 routing tables.  The start values are byte offsets relative
0137      * to the start of IPA shared memory.
0138      */
0139     u8          v4_route_tbl_info_valid;
0140     struct ipa_mem_bounds   v4_route_tbl_info;
0141     u8          v6_route_tbl_info_valid;
0142     struct ipa_mem_bounds   v6_route_tbl_info;
0143 
0144     /* Filter table information.  These define the location of the
0145      * non-hashable IPv4 and IPv6 filter tables.  The start values are
0146      * byte offsets relative to the start of IPA shared memory.
0147      */
0148     u8          v4_filter_tbl_start_valid;
0149     u32         v4_filter_tbl_start;
0150     u8          v6_filter_tbl_start_valid;
0151     u32         v6_filter_tbl_start;
0152 
0153     /* Modem memory information.  This defines the location and
0154      * size of memory available for the modem to use.
0155      */
0156     u8          modem_mem_info_valid;
0157     struct ipa_mem_range    modem_mem_info;
0158 
0159     /* This defines the destination endpoint on the AP to which
0160      * the modem driver can send control commands.  Must be less
0161      * than ipa_endpoint_max().
0162      */
0163     u8          ctrl_comm_dest_end_pt_valid;
0164     u32         ctrl_comm_dest_end_pt;
0165 
0166     /* This defines whether the modem should load the microcontroller
0167      * or not.  It is unnecessary to reload it if the modem is being
0168      * restarted.
0169      *
0170      * NOTE: this field is named "is_ssr_bootup" elsewhere.
0171      */
0172     u8          skip_uc_load_valid;
0173     u8          skip_uc_load;
0174 
0175     /* Processing context memory information.  This defines the memory in
0176      * which the modem may insert header processing context table entries.
0177      */
0178     u8          hdr_proc_ctx_tbl_info_valid;
0179     struct ipa_mem_bounds   hdr_proc_ctx_tbl_info;
0180 
0181     /* Compression command memory information.  This defines the memory
0182      * in which the modem may insert compression/decompression commands.
0183      */
0184     u8          zip_tbl_info_valid;
0185     struct ipa_mem_bounds   zip_tbl_info;
0186 
0187     /* Routing table information.  These define the location and maximum
0188      * *index* (not byte) for the modem portion of hashable IPv4 and IPv6
0189      * routing tables (if supported by hardware).  The start values are
0190      * byte offsets relative to the start of IPA shared memory.
0191      */
0192     u8          v4_hash_route_tbl_info_valid;
0193     struct ipa_mem_bounds   v4_hash_route_tbl_info;
0194     u8          v6_hash_route_tbl_info_valid;
0195     struct ipa_mem_bounds   v6_hash_route_tbl_info;
0196 
0197     /* Filter table information.  These define the location and size
0198      * of hashable IPv4 and IPv6 filter tables (if supported by hardware).
0199      * The start values are byte offsets relative to the start of IPA
0200      * shared memory.
0201      */
0202     u8          v4_hash_filter_tbl_start_valid;
0203     u32         v4_hash_filter_tbl_start;
0204     u8          v6_hash_filter_tbl_start_valid;
0205     u32         v6_hash_filter_tbl_start;
0206 
0207     /* Statistics information.  These define the locations of the
0208      * first and last statistics sub-regions.  (IPA v4.0 and above)
0209      */
0210     u8          hw_stats_quota_base_addr_valid;
0211     u32         hw_stats_quota_base_addr;
0212     u8          hw_stats_quota_size_valid;
0213     u32         hw_stats_quota_size;
0214     u8          hw_stats_drop_base_addr_valid;
0215     u32         hw_stats_drop_base_addr;
0216     u8          hw_stats_drop_size_valid;
0217     u32         hw_stats_drop_size;
0218 };
0219 
0220 /* The response to a IPA_QMI_INIT_DRIVER request begins with a standard
0221  * QMI response, but contains other information as well.  Currently we
0222  * simply wait for the INIT_DRIVER transaction to complete and
0223  * ignore any other data that might be returned.
0224  */
0225 struct ipa_init_modem_driver_rsp {
0226     struct qmi_response_type_v01    rsp;
0227 
0228     /* This defines the destination endpoint on the modem to which
0229      * the AP driver can send control commands.  Must be less than
0230      * ipa_endpoint_max().
0231      */
0232     u8              ctrl_comm_dest_end_pt_valid;
0233     u32             ctrl_comm_dest_end_pt;
0234 
0235     /* This defines the default endpoint.  The AP driver is not
0236      * required to configure the hardware with this value.  Must
0237      * be less than ipa_endpoint_max().
0238      */
0239     u8              default_end_pt_valid;
0240     u32             default_end_pt;
0241 
0242     /* This defines whether a second handshake is required to complete
0243      * initialization.
0244      */
0245     u8              modem_driver_init_pending_valid;
0246     u8              modem_driver_init_pending;
0247 };
0248 
0249 /* Message structure definitions defined in "ipa_qmi_msg.c" */
0250 extern struct qmi_elem_info ipa_indication_register_req_ei[];
0251 extern struct qmi_elem_info ipa_indication_register_rsp_ei[];
0252 extern struct qmi_elem_info ipa_driver_init_complete_req_ei[];
0253 extern struct qmi_elem_info ipa_driver_init_complete_rsp_ei[];
0254 extern struct qmi_elem_info ipa_init_complete_ind_ei[];
0255 extern struct qmi_elem_info ipa_mem_bounds_ei[];
0256 extern struct qmi_elem_info ipa_mem_array_ei[];
0257 extern struct qmi_elem_info ipa_mem_range_ei[];
0258 extern struct qmi_elem_info ipa_init_modem_driver_req_ei[];
0259 extern struct qmi_elem_info ipa_init_modem_driver_rsp_ei[];
0260 
0261 #endif /* !_IPA_QMI_MSG_H_ */