| /***************************************************************************** |
| * 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) 2001 |
| * |
| *****************************************************************************/ |
| |
| /***************************************************************************** |
| * |
| * Filename: |
| * --------- |
| * ex_memory_manager.h |
| * |
| * Project: |
| * -------- |
| * Moly |
| * |
| * Description: |
| * ------------ |
| * |
| * |
| * 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! |
| *------------------------------------------------------------------------------ |
| * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| *============================================================================ |
| ****************************************************************************/ |
| |
| #ifndef __EX_MEM_MANAGER_H__ |
| #define __EX_MEM_MANAGER_H__ |
| |
| |
| |
| |
| #if !defined(__ASSEMBLER__) |
| #include "ex_mem_manager_public.h" |
| |
| /******************************************************************************* |
| * Define data structure. |
| *******************************************************************************/ |
| typedef enum { |
| EMM_QUERY_FAIL = 0x1, |
| EMM_CHECK_FAIL = 0x2, |
| EMM_NO_CCCI_FAIL = 0x4, |
| EMM_PERMISSION_FAIL = 0x8, |
| EMM_UNSUPPORTED_SRC_TYPE_FAIL = 0x10, |
| EMM_CHECK_SUCCESS = 0x80, |
| } EMM_QUERY_RESULT; |
| |
| typedef enum { |
| EMM_BUF_INMD_FROM_AP = 0x1, |
| EMM_BUF_EXMD_STATIC, |
| EMM_BUF_MAX, |
| } EMM_BUF_SOURCE; |
| |
| #define EMM_MINIMUM_SIZE (sizeof(kal_uint32)) |
| |
| #if defined(__MD97__) || defined(__MD97P__) |
| #define EMM_EXRECORD_LEN (1024*10) |
| /*EMM BOOTUPSTARTUPTRACE_START 76 bytes from EMM Debug info start*/ |
| #define EMM_BOOTUPTRACE_START (EMM_EXRECORD_LEN+76) |
| |
| #define EMM_DBGINFO_LEN 1024 |
| #define EMM_USERDIRINFO_LEN (3*1024) |
| #define EMM_BOOTUPTRACE_LEN (3*1024) |
| |
| #define EMM_IDLETASK_SIZE (352/EMM_MINIMUM_SIZE) |
| #define EMM_SLP_SIZE (68/EMM_MINIMUM_SIZE) |
| #define EMM_DORMANT_SIZE (96/EMM_MINIMUM_SIZE) |
| #define EMM_ELM_SIZE (300/EMM_MINIMUM_SIZE) |
| #define EMM_BUS_SIZE (8*12/EMM_MINIMUM_SIZE) |
| #define EMM_SWLA_SIZE (1440/EMM_MINIMUM_SIZE) |
| #define EMM_NVRAM_DBG_SIZE (616/EMM_MINIMUM_SIZE) |
| #else |
| #error No config yet |
| #endif |
| |
| |
| #define EMM_INFO_TOTAL_LEN (EMM_DBGINFO_LEN+EMM_USERDIRINFO_LEN) |
| |
| |
| /* dont use SYS_MCU_NUM_CORE SYS_MCU_NUM_VPE here because there might different |
| * value for different variant in same generation. use here max value |
| * for this generation */ |
| #if defined(__MD97__) || defined(__MD97P__) |
| #define EMM_CORENUM 4 |
| #define EMM_VPENUM 3 // per core |
| #else |
| #error No config yet |
| #endif |
| |
| |
| #define EMM_BLOCKNUM (EMM_CORENUM) |
| #define EMM_BOOTUPTRACE_BLOCKLEN (((EMM_BOOTUPTRACE_LEN/EMM_BLOCKNUM)>>2)<<2) |
| |
| #define EMM_EXRECORD_WORDLEN (EMM_EXRECORD_LEN/EMM_MINIMUM_SIZE) |
| #define EMM_BOOTUPTRACE_BLOCKWORDLEN (EMM_BOOTUPTRACE_BLOCKLEN/EMM_MINIMUM_SIZE) |
| #define EMM_DBGINFO_WORDLEN (EMM_DBGINFO_LEN/EMM_MINIMUM_SIZE) |
| #define EMM_USERDIRINFO_WORDLEN (EMM_USERDIRINFO_LEN/EMM_MINIMUM_SIZE) |
| |
| |
| #define EMM_INDICATOR 0x12345678 /* magic num */ |
| |
| #define EMM_DIRINFO_GUARD_PATTERN_START(_index) ((0xEDEC << 16) | _index) |
| #define EMM_DIRINFO_GUARD_PATTERN_END(_index) ((0xCEDE << 16) | _index) |
| |
| #define EMM_HS2_TRACE_START_PATTERN 0x48533230 |
| |
| typedef struct _EMM_INFO { |
| EMM_BUF_SOURCE bufSourceType; |
| kal_uint32 u32Mainbuf_Addr; |
| kal_uint32 bufLen; |
| |
| kal_uint32 *pexRecord; |
| kal_uint32 exRecordLen; |
| |
| kal_uint32 *pBootupTraceInfo[EMM_BLOCKNUM]; |
| kal_uint32 BootupTraceWordLen[EMM_BLOCKNUM]; |
| |
| kal_uint32 *pdbgInfo; |
| kal_uint32 dbgInfoWordLen; |
| |
| kal_uint32 *pUserDirInfo; //user direct info |
| kal_uint32 userDirInfoWordLen; //user direct info |
| |
| kal_uint8 bootTraceFinish; |
| kal_uint8 resultFail; |
| } EMM_INFO; |
| |
| typedef struct { |
| kal_uint32 magic_number; |
| kal_uint32 last_write_index[EMM_CORENUM*EMM_VPENUM]; |
| kal_uint32 last_write_vpe; |
| kal_uint32 reserved[2]; // make header 16 byte alignment for better looks |
| kal_uint32 log[EMM_INDEX_MAX]; |
| } EMM_DBGINFO_STRUC; |
| |
| typedef struct _EMM_BUF_CONTENT { |
| kal_uint32 exRecord[EMM_EXRECORD_WORDLEN]; |
| kal_uint32 dbgInfo[EMM_DBGINFO_WORDLEN]; |
| } EMM_BUF_CONTENT; |
| |
| typedef struct _EMM_SWLA_PAIR { |
| kal_char name[4]; |
| kal_uint32 timestamp; |
| kal_uint8 core_id; |
| kal_uint8 tc_id; |
| kal_uint8 reserved[2]; |
| } EMM_SWLA_PAIR; |
| |
| #if defined (__HIF_CCCI_SUPPORT__) && defined(__CCCI_PRODUCT_TYPE_THIN_MODEM__) |
| typedef enum _SAP_SHM_QUERY_RESULT { |
| SAP_SHM_EXRECORD_QUERY_FAIL = 0x1, |
| SAP_SHM_EXRECORD_CHECKING_FAIL = 0x2, |
| SAP_SHM_MEMDUMP_QUERY_FAIL = 0x4, |
| SAP_SHM_MEMDUMP_CHECKING_FAIL = 0x8 |
| } SAP_SHM_QUERY_RESULT; |
| |
| typedef struct _SAP_SHM { |
| kal_uint32 ex_addr; // small ap exception record @ SHM |
| kal_uint32 ex_size; |
| kal_uint32 mem_addr; // small ap 64 MB memory |
| kal_uint32 mem_size; |
| SAP_SHM_QUERY_RESULT resultFail; |
| } SAP_SHM; |
| |
| #define THIN_MODEM_SHM_SAP_EX_STATUS_OFFSET 8 |
| #define THIN_MODEM_SHM_MD_EX_STATUS_OFFSET 12 |
| extern SAP_SHM sap_shm; |
| #endif |
| |
| #define EMM_BUS_SYSINFO_PAD_COMPENSATE_SIZE (\ |
| /*sizeof(pattern)*/ EMM_MINIMUM_SIZE + \ |
| /*sizeof(last_write_index)*/ EMM_MINIMUM_SIZE * (EMM_CORENUM*EMM_VPENUM) + \ |
| /*sizeof(last_write_vpe)*/ EMM_MINIMUM_SIZE + \ |
| /*sizeof(reserved[2])*/ EMM_MINIMUM_SIZE * 2 + \ |
| /*sizeof(EMM_SYSINFO)*/ EMM_MINIMUM_SIZE * EMM_INDEX_MAX \ |
| ) |
| |
| typedef struct _EMM_BUF_SYSINFO { |
| kal_uint32 pattern; |
| kal_uint32 last_write_index[EMM_CORENUM*EMM_VPENUM]; |
| kal_uint32 last_write_vpe; |
| kal_uint32 reserved[2]; |
| kal_uint32 EMM_SYSINFO[EMM_INDEX_MAX]; |
| kal_uint32 pad[(EMM_DBGINFO_LEN - EMM_BUS_SYSINFO_PAD_COMPENSATE_SIZE)/EMM_MINIMUM_SIZE]; |
| kal_uint32 EDE_IDLETASK_HEAD; |
| kal_uint32 EDE_IDLETASK_STEP[EMM_IDLETASK_SIZE]; |
| kal_uint32 EDE_IDLETASK_TAIL; |
| kal_uint32 EDE_SLP_HEAD; |
| kal_uint32 EDE_SLP_STEP[EMM_SLP_SIZE]; |
| kal_uint32 EDE_SLP_TAIL; |
| kal_uint32 EDE_DOR_HEAD; |
| kal_uint32 EDE_DOR_STEP[EMM_DORMANT_SIZE]; |
| kal_uint32 EDE_DOR_TAIL; |
| kal_uint32 EDE_ELM_HEAD; |
| kal_uint32 EDE_ELM_STEP[EMM_ELM_SIZE]; |
| kal_uint32 EDE_ELM_TAIL; |
| kal_uint32 EDE_BUS_HEAD; |
| kal_uint32 EDE_BUS_STEP[EMM_BUS_SIZE]; |
| kal_uint32 EDE_BUS_TAIL; |
| kal_uint32 EDE_SWLA_HEAD; |
| EMM_SWLA_PAIR EDE_SWLA[EMM_CORENUM][EMM_SWLA_SIZE*EMM_MINIMUM_SIZE/sizeof(EMM_SWLA_PAIR)/EMM_CORENUM]; |
| kal_uint32 EDE_SWLA_TAIL; |
| kal_uint32 EDE_NVRAM_DBG_HEAD; |
| kal_uint32 EDE_NVRAM_DBG[EMM_NVRAM_DBG_SIZE]; |
| kal_uint32 EDE_NVRAM_DBG_TAIL; |
| } EMM_SYSINFO_STRUC; |
| |
| #endif /* __ASSEMBLER__ */ |
| #endif /* __EX_MEM_MANAGER_H__ */ |
| |