blob: 7c34eb1b30fdbab5fdca4d5572e06ae1e0f6889c [file] [log] [blame]
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2018
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* mcf_struct.h
*
* Project:
* --------
* UMOLYA
*
* Description:
* ------------
* MD Configuration Framework structure definition.
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#ifndef __MCF_STRUCT_H
#define __MCF_STRUCT_H
#include "kal_public_defs.h"
#include "ps_public_enum.h"
#include "mcf_enum.h"
#include "ps_public_struct.h"
/*------------------------------------------------------------------------------
* Constant definition.
*----------------------------------------------------------------------------*/
#define MCF_MAX_OTA_FILE_SIZE (128 * 1024)
#define MCF_MAX_TLVOTA_FILE_SIZE (192 * 1024)
#define MCF_MAX_INI_FILE_SIZE (16 * 1024)
#define MCF_MAX_FILE_SIZE ((MCF_MAX_TLVOTA_FILE_SIZE > MCF_MAX_OTA_FILE_SIZE) ? MCF_MAX_TLVOTA_FILE_SIZE : MCF_MAX_OTA_FILE_SIZE)
#define MCF_MAX_DHL_LOGGING_NUM 1000
#define MCF_MAX_DHL_LOGGING_LEN 120
#define MCF_FILE_MAX_MD_PATH_LEN 64
#define MCF_FILE_MAX_AP_PATH_LEN 128
#define MCF_FILE_MAX_NAME_LEN 128
#define MCF_FILE_MAX_SW_VERSION_LEN 128
#define MCF_FILE_MAX_GEN_TIME_LEN 64
#define MCF_FILE_MAX_TAG_NAME_NUM 128
#define MCF_FILE_MAX_TOOL_VERSION_LEN 32
#define MCF_SW_VERNO_LEN 128
#define MCF_SW_BUILD_TIME_LEN 64
#define MCF_MAX_TAG_NUM 50
#define MCF_MAX_INI_ITEM_LEN 32
#define MCF_MAX_INI_ITEM_VALUE_LEN 64
#ifdef __MCF_COMBINE_FILE_SUPPORT__
#define MCF_MAX_MEM_MALLOC_SIZE (2 * MCF_MAX_FILE_SIZE)
#else
#define MCF_MAX_MEM_MALLOC_SIZE 1024
#endif
#define MCF_BOOT_TRACE_BUFFER_SIZE (1024 * 36) / 4
/* MCF File operation bit mask */
#define MCF_FILE_OP_NONE 0
#define MCF_FILE_OP_CHECKSUM 1<<0
#define MCF_FILE_OP_AES_128 1<<1
#define MCF_FILE_OP_NOT_RESET_LID 1<<2
#define MCF_FILE_OP_AES_256 1<<3
#define MCF_FILE_OP_SHA256_RSA2048 1<<4
#define MCF_FILE_OP_SHA384_RSA3072 1<<5
/*------------------------------------------------------------------------------
* Data structure defintion.
*----------------------------------------------------------------------------*/
#define MCF_DECLARE_OBJECT \
kal_int32 ref_count; \
kal_int32 reader_cnt; \
kal_int32 writer_cnt;
typedef struct _mcf_file_info_t {
kal_uint8 path_type;
kal_char name[MCF_FILE_MAX_NAME_LEN];
kal_char sw_version[MCF_FILE_MAX_SW_VERSION_LEN];
kal_uint8 sw_version_len;
kal_char gen_time[MCF_FILE_MAX_GEN_TIME_LEN];
kal_uint8 gen_time_len;
kal_uint64 last_mod_time;
kal_uint32 checksum;
} mcf_file_info_t;
typedef struct _mcf_tlvota_file_t {
MCF_DECLARE_OBJECT
kal_uint8 path_type;
kal_uint8 reserved[3];
kal_char relative_path_name[MCF_FILE_MAX_NAME_LEN];
kal_uint8 buff[MCF_MAX_TLVOTA_FILE_SIZE];
kal_uint32 sbp_id;
protocol_id_enum ps_id;
kal_uint8 mcc[MAX_MCC_STR_LEN];
kal_uint8 mnc[MAX_MNC_STR_LEN];
kal_uint8 iccid[21];
kal_uint64 last_mod_time;
mcf_file_info_t last_file;
mcf_file_info_t temp_file;
} mcf_tlvota_file_t;
typedef struct _mcf_ota_file_t {
MCF_DECLARE_OBJECT
kal_uint8 path_type;
kal_uint8 reserved[3];
kal_char relative_path_name[MCF_FILE_MAX_NAME_LEN];
kal_uint8 buff[MCF_MAX_OTA_FILE_SIZE];
kal_uint64 last_mod_time;
} mcf_ota_file_t;
typedef struct _mcf_ini_file_t {
kal_uint8 path_type;
kal_uint8 reserved[3];
kal_char relative_path_name[MCF_FILE_MAX_NAME_LEN];
kal_uint8 buff[MCF_MAX_INI_FILE_SIZE];
kal_uint8 tmp_buff[MCF_MAX_INI_FILE_SIZE];
kal_uint64 last_mod_time;
} mcf_ini_file_t;
typedef struct _mcf_t {
kal_uint8 reserved[2];
kal_bool is_ignore_dsbp[MAX_SIM_NUM];
mcf_tlvota_file_t tlvota_file[MAX_SIM_NUM];
mcf_ota_file_t ota_file;
mcf_tlvota_file_t general_tlvota_file;
mcf_ini_file_t ini_file;
kal_int32 dsbp_cnf_cnt;
kal_int32 dsbp_ind_cnt;
kal_bool dsbp_cnf_ret;
kal_bool dsbp_ind_ret;
kal_bool is_critical;
kal_bool is_dsbp_ongoing[MAX_SIM_NUM];
kal_bool general_is_ignore_dsbp;
} mcf_t;
typedef struct _mcf_common_t {
kal_uint32 boot_trace_flag;
kal_uint8 reserved[2];
kal_uint32 boot_trace_buff[MCF_BOOT_TRACE_BUFFER_SIZE];
kal_uint32 *boot_trace_buff_ptr;
kal_bool boot_trace_full;
kal_bool is_em_on;
kal_bool update_tlvota[MAX_SIM_NUM];
kal_bool update_general_tlvota[MAX_SIM_NUM];
kal_bool is_iccid;
kal_uint32 ota_api_duration;
mcf_ota_result_e tlvota_result[MAX_SIM_NUM];
} mcf_common_t;
/*
* OTA file of tool related structure
*/
typedef struct _mcf_tool_file_info_t {
kal_uint16 file_version;
kal_uint16 total_len;
kal_char file_type[8];
kal_uint32 operation_mask;
kal_uint16 item_num;
kal_uint8 sw_version_len;
kal_uint8 gen_time_len;
kal_uint32 file_size;
kal_uint8 tool_version_len;
kal_uint8 reserved[11];
kal_uint32 checksum;
kal_char buff_start;
kal_uint8 reserved_2[3];
} mcf_tool_file_info_t;
typedef struct _mcf_tool_ota_file_item_t {
kal_uint16 total_len;
kal_uint16 lid;
kal_char lid_version[4];
kal_uint16 record_idx;
kal_uint16 item_tag_len;
kal_uint8 is_bit_op;
kal_uint8 reserved[3];
union {
struct {
kal_uint8 len;
kal_uint8 value_len;
kal_uint8 reserved[2];
} bit;
struct {
kal_uint16 value_len;
kal_uint8 reserved[2];
} byte;
} op;
kal_char buff_start;
kal_uint8 reserved_2[3];
} mcf_tool_ota_file_item_t;
typedef struct _mcf_tool_tlvota_file_item_t {
kal_uint16 total_len;
kal_uint16 lid;
kal_char lid_version[4];
kal_uint8 tag_type;
kal_uint8 tag_len;
kal_uint16 item_tag_len;
kal_uint8 is_bit_op;
kal_uint8 reserved[3];
union {
struct {
kal_uint8 len;
kal_uint8 value_len;
kal_uint8 reserved[2];
} bit;
struct {
kal_uint16 value_len;
kal_uint8 reserved[2];
} byte;
} op;
kal_char buff_start;
kal_uint8 reserved_2[3];
} mcf_tool_tlvota_file_item_t;
/* MCF2.0 file Item*/
typedef struct {
kal_uint16 total_len;
kal_uint8 reserved[2];
kal_uint32 global_id;
kal_uint16 record_idx;
kal_uint8 reserved_2[2];
kal_uint16 array_index_len;
kal_uint16 value_len;
kal_char buff_start;
} mcf_tool_gid_ota_file_item_t;
typedef struct {
kal_uint16 total_len;
kal_uint8 reserved[2];
kal_uint32 global_id;
kal_uint8 tag_type;
kal_uint8 tag_len;
kal_uint8 reserved_2[2];
kal_uint16 array_index_len;
kal_uint16 value_len;
kal_char buff_start;
} mcf_tool_gid_tlvota_file_item_t;
/*
* SBP related structure
*/
typedef struct _mcf_tlvota_tag_t {
kal_uint16 tag_type;
kal_uint16 tag_len;
kal_char *tag;
kal_uint8 reserved[3];
} mcf_tlvota_tag_t;
typedef struct _mcf_tlvota_sbp_tag_t {
kal_uint32 sbp_id;
kal_uint8 mcc[MAX_MCC_STR_LEN];
kal_uint8 mnc[MAX_MNC_STR_LEN];
} mcf_tlvota_sbp_tag_t;
/*
* Local parameter structure for ILM
*/
typedef struct _mcf_l4c_report_state_ind_struct {
LOCAL_PARA_HDR
mcf_l4c_report_type_e type;
kal_uint32 result;
} mcf_l4c_report_state_ind_struct;
typedef struct {
LOCAL_PARA_HDR
kal_uint8 src_id;
module_type src_mod_id;
kal_uint8 reserved[3];
kal_uint32 config_op;
kal_bool is_dsbp_retry;
} mcf_l4bsbp_trigger_dsbp_ind_struct;
typedef struct {
LOCAL_PARA_HDR
kal_uint8 src_id;
module_type src_mod_id;
kal_uint8 ps_id;
kal_uint8 reserved[2];
mcf_trigger_dsbp_result_e result;
kal_uint32 config_op;
kal_bool is_dsbp_retry;
} mcf_l4bsbp_trigger_dsbp_cnf_struct;
typedef struct {
LOCAL_PARA_HDR
module_type src_mod_id;
kal_uint8 ps_id;
kal_uint8 reserved[3];
mcf_trigger_dsbp_result_e result;
kal_uint32 config_op;
kal_bool is_dsbp_retry;
} mcf_l4bsbp_trigger_dsbp_result_ind_struct;
/*
* MCF dump related structure
*/
typedef struct _mcf_dump_lid_header_struct {
kal_char sync_token[8];
kal_uint8 header_version;
kal_uint8 content_type;
kal_uint8 operation_mask;
kal_uint8 reserved;
kal_uint32 content_len;
kal_uint16 lid;
kal_uint16 record_idx;
kal_char lid_version[4];
kal_uint32 checksum;
kal_uint8 buff_start[0];
} mcf_dump_lid_header_struct;
typedef struct _mcf_custom_dump_param_struct {
kal_uint16 lid;
mcf_ota_type_enum type;
protocol_id_enum ps_id;
kal_uint32 sbp_id;
kal_uint8 mcc[MAX_MCC_STR_LEN];
kal_uint8 mnc[MAX_MNC_STR_LEN];
kal_uint8 iccid[21];
kal_uint16 record_idx;
kal_uint8 *buffer;
kal_uint32 *size;
} mcf_custom_dump_param_struct;
typedef kal_bool (*MCF_DUMP_FUNC)(mcf_custom_dump_param_struct *param_ptr);
typedef struct _mcf_dump_param_struct {
kal_uint16 lid;
kal_uint32 ntfy_type;
MCF_DUMP_FUNC dump_func_ptr;
} mcf_dump_param_struct;
typedef struct _mcf_boot_trace_value_struct {
kal_uint32 size;
MCF_TYPE_ENUM type;
union {
kal_uint32 integer;
kal_uint32 string;
kal_uint32 value;
} type_u;
} mcf_boot_trace_value_struct;
typedef struct _mcf_boot_trace_struct {
kal_uint32 guard_pattern;
kal_uint32 trace_enum;
kal_uint32 total_num;
mcf_boot_trace_value_struct value_ptr;
} mcf_boot_trace_struct;
typedef struct _mcf_tag_info_struct {
kal_bool is_bit;
kal_int32 array_size[5];
kal_uint8 arr_cnt;
kal_uint16 upper_vsize;
} mcf_tag_info_struct;
typedef struct _mcf_merge_link_list_struct {
struct _mcf_merge_link_list_struct *pre_node;
void *data;
struct _mcf_merge_link_list_struct *next_node;
} mcf_merge_link_list_struct;
typedef struct _mcf_digest {
kal_uint32 sequence;
kal_uint32 digest_len;
kal_uint8 digest_value[384]; // max sha 384
} mcf_digest;
#endif /* __MCF_STRUCT_H */