rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * SST_sla.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This Module defines the necessary API needed by software LA. |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * |
| 77 | * removed! |
| 78 | * removed! |
| 79 | * |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * |
| 86 | * removed! |
| 87 | * removed! |
| 88 | * |
| 89 | * removed! |
| 90 | * removed! |
| 91 | * |
| 92 | * removed! |
| 93 | * removed! |
| 94 | * removed! |
| 95 | * |
| 96 | * removed! |
| 97 | * removed! |
| 98 | * removed! |
| 99 | * |
| 100 | * removed! |
| 101 | * removed! |
| 102 | * removed! |
| 103 | * |
| 104 | * removed! |
| 105 | * removed! |
| 106 | * removed! |
| 107 | * |
| 108 | * removed! |
| 109 | * removed! |
| 110 | * removed! |
| 111 | * |
| 112 | * removed! |
| 113 | * removed! |
| 114 | * removed! |
| 115 | * |
| 116 | * removed! |
| 117 | * removed! |
| 118 | * removed! |
| 119 | * |
| 120 | * removed! |
| 121 | * removed! |
| 122 | * removed! |
| 123 | * removed! |
| 124 | * removed! |
| 125 | * removed! |
| 126 | * removed! |
| 127 | * removed! |
| 128 | * removed! |
| 129 | * removed! |
| 130 | * removed! |
| 131 | * |
| 132 | * removed! |
| 133 | * removed! |
| 134 | * removed! |
| 135 | * |
| 136 | * removed! |
| 137 | * removed! |
| 138 | * removed! |
| 139 | * |
| 140 | * removed! |
| 141 | * removed! |
| 142 | * removed! |
| 143 | * |
| 144 | * removed! |
| 145 | * removed! |
| 146 | * removed! |
| 147 | * |
| 148 | * removed! |
| 149 | * removed! |
| 150 | * removed! |
| 151 | * |
| 152 | * removed! |
| 153 | * removed! |
| 154 | * removed! |
| 155 | * |
| 156 | * removed! |
| 157 | * removed! |
| 158 | * removed! |
| 159 | * |
| 160 | * removed! |
| 161 | * removed! |
| 162 | * removed! |
| 163 | * |
| 164 | * removed! |
| 165 | * removed! |
| 166 | * removed! |
| 167 | * |
| 168 | * removed! |
| 169 | * removed! |
| 170 | * removed! |
| 171 | * |
| 172 | * removed! |
| 173 | * removed! |
| 174 | * removed! |
| 175 | * |
| 176 | * removed! |
| 177 | * removed! |
| 178 | * removed! |
| 179 | * |
| 180 | * removed! |
| 181 | * removed! |
| 182 | * removed! |
| 183 | * |
| 184 | * removed! |
| 185 | * removed! |
| 186 | * removed! |
| 187 | * |
| 188 | * removed! |
| 189 | * removed! |
| 190 | * removed! |
| 191 | * |
| 192 | * removed! |
| 193 | * removed! |
| 194 | * removed! |
| 195 | * |
| 196 | * removed! |
| 197 | * removed! |
| 198 | * removed! |
| 199 | * |
| 200 | * removed! |
| 201 | * removed! |
| 202 | * removed! |
| 203 | * |
| 204 | * removed! |
| 205 | * removed! |
| 206 | * removed! |
| 207 | * |
| 208 | * removed! |
| 209 | * removed! |
| 210 | * removed! |
| 211 | * |
| 212 | * removed! |
| 213 | * removed! |
| 214 | * removed! |
| 215 | * |
| 216 | * removed! |
| 217 | * removed! |
| 218 | * removed! |
| 219 | * |
| 220 | * removed! |
| 221 | * removed! |
| 222 | * removed! |
| 223 | * |
| 224 | * removed! |
| 225 | * removed! |
| 226 | * removed! |
| 227 | * |
| 228 | * removed! |
| 229 | * removed! |
| 230 | * removed! |
| 231 | *------------------------------------------------------------------------------ |
| 232 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 233 | *============================================================================ |
| 234 | ****************************************************************************/ |
| 235 | |
| 236 | #ifndef _SST_SLA_ |
| 237 | #define _SST_SLA_ |
| 238 | |
| 239 | #include "us_timer.h" |
| 240 | #include "SST_Concurrent_utility.h" |
| 241 | #include "kal_general_types.h" |
| 242 | #include "swla_public.h" |
| 243 | #include "system_profiler_public.h" |
| 244 | |
| 245 | //#define __LOW_RAM_SWLA__ //wrap with compile option to save overhead in official load |
| 246 | |
| 247 | #define MAX_ADDON_NAME_LENGTH (12) |
| 248 | #define SA_CCCI_SM_NUM (30) |
| 249 | #define SA_CCCI_SM_UNIT_SIZE (12) /* 3 words for ContextID, FRC, CoreID_TCID */ |
| 250 | |
| 251 | /* Type Definition */ |
| 252 | typedef struct SA_LoggingNode_T |
| 253 | { |
| 254 | /* Manadatory information structure member */ |
| 255 | kal_uint32 jobID; |
| 256 | kal_uint32 USCNT; |
| 257 | kal_uint32 CoreIDTCID; |
| 258 | } SA_LoggingNode; |
| 259 | |
| 260 | /* Type Definition */ |
| 261 | typedef struct SA_LoggingThread_T |
| 262 | { |
| 263 | kal_uint32 ThreadID; |
| 264 | kal_uint32 time; |
| 265 | kal_uint32 CoreIDTCID; |
| 266 | } SA_LoggingThread; |
| 267 | |
| 268 | typedef struct SA_AddonInfo_T |
| 269 | { |
| 270 | SYSPROFILER_ADDON_TYPE addonType; |
| 271 | kal_uint32 log_sz; |
| 272 | kal_char ext_name[MAX_ADDON_NAME_LENGTH]; |
| 273 | void (*SLA_AddonInfoInitFunc)(void); |
| 274 | kal_bool SA_SwapOutLogging; |
| 275 | void * SLA_AddonInfoLoggingFunc; |
| 276 | } SA_AddonInfo; |
| 277 | |
| 278 | typedef struct SA_PMCAddonCounter_T |
| 279 | { |
| 280 | kal_uint32 PMC0Counter; |
| 281 | kal_uint32 PMC1Counter; |
| 282 | } SA_PMCAddonCounter; |
| 283 | |
| 284 | typedef struct _SA_ELM_LOG_T |
| 285 | { |
| 286 | kal_uint32 start_frc; |
| 287 | kal_uint32 duration; |
| 288 | kal_uint32 r_trans; |
| 289 | kal_uint32 w_trans; |
| 290 | kal_uint32 r_latency; |
| 291 | kal_uint32 w_latency; |
| 292 | kal_uint32 r_avg_latency; |
| 293 | kal_uint32 w_avg_latency; |
| 294 | } SA_ELM_LOG_T; |
| 295 | |
| 296 | typedef enum |
| 297 | { |
| 298 | SLA_FILTER_IRQ_END = (1u << 0), |
| 299 | SLA_FILTER_NO_CTXSWITCH = (1u << 1), |
| 300 | SLA_FILTER_GIC_END = (1u << 2), |
| 301 | SLA_FILTER_NEST_BEGIN = (1u << 3), |
| 302 | SLA_FILTER_NEST_END = (1u << 4), |
| 303 | SLA_FITLER_SINGLE_LABEL = (1u << 5), |
| 304 | SLA_FILTER_BEGIN_POINT = (1u << 6), |
| 305 | SLA_FILTER_END_POINT = (1u << 7), |
| 306 | SLA_FILTER_VPE1_CHILD_BEGIN = (1u << 8), |
| 307 | SLA_FILTER_VPE1_CHILD_END = (1u << 9), |
| 308 | SLA_FILTER_CPU_FREQUENCY = (1u << 10), |
| 309 | SLA_FILTER_ALL = 0xFF |
| 310 | } SA_FILTER_T; |
| 311 | |
| 312 | |
| 313 | typedef enum |
| 314 | { |
| 315 | SLA_STATE_STOP, |
| 316 | SLA_STATE_PAUSE, |
| 317 | SLA_STATE_RUNNING |
| 318 | } SA_STATE; |
| 319 | |
| 320 | |
| 321 | |
| 322 | extern SA_STATE SA_LoggingState[]; |
| 323 | |
| 324 | |
| 325 | |
| 326 | #define SLA_Current_IsRunning() SLA_IsRunning(kal_get_current_core_id()) |
| 327 | |
| 328 | INLINE INLINE_ALWAYS static kal_bool SLA_IsRunning(kal_uint8 coreID) |
| 329 | { |
| 330 | return (SA_LoggingState[coreID] == SLA_STATE_RUNNING); |
| 331 | } |
| 332 | |
| 333 | INLINE INLINE_ALWAYS static kal_bool SLA_IsStop(kal_uint8 coreID) |
| 334 | { |
| 335 | return (SA_LoggingState[coreID] == SLA_STATE_STOP); |
| 336 | } |
| 337 | |
| 338 | |
| 339 | |
| 340 | /* Prototypes */ |
| 341 | void SLA_RAMLogging(kal_uint32 jobID, kal_uint8 coreID, kal_uint8 TCID, kal_bool EMMlogging) DECLARE_MIPS16; |
| 342 | kal_bool SLA_Register(SYSPROFILER_ADDON_TYPE addonType, kal_uint32 addonSize, kal_char addonName[], void (*SLA_AddonInfoInitFunc)(void), void *SLA_AddonInfoLoggingFunc, kal_bool SA_SwapOutLogging); |
| 343 | |
| 344 | void SLA_RetreiveNode (SA_LoggingNode *NodePtr, kal_uint32 NodeAmount, kal_bool DummyFilterOn); |
| 345 | kal_uint32 SLA_RetreiveNodeByVPETC(SA_LoggingNode *NodePtr, kal_uint32 NodeAmount, SA_FILTER_T DummyFilter, kal_uint32 VPEID, kal_uint32 TCID); |
| 346 | SYSPROFILER_ERROR_CODE SLA_Enable_for_Core(kal_uint32* bufferStartAddress, kal_uint32 bufferSize, kal_uint8 coreID); |
| 347 | SYSPROFILER_ERROR_CODE SLA_Disable_for_Core(kal_uint8 coreID); |
| 348 | kal_uint32 SLA_HookLogging(kal_uint8 VPEID); |
| 349 | void SLA_LoggingLISR(kal_uint32 ID, kal_uint8 VPEID) DECLARE_MIPS16; |
| 350 | SYSPROFILER_ERROR_CODE SLA_RetreiveHeader(kal_uint8 **MADesc, kal_uint32 *szMADesc, kal_uint8 coreID) ; |
| 351 | SYSPROFILER_ERROR_CODE SLA_RetreiveLoggingBuffer(kal_uint8 **startAddr, kal_uint32 *size, kal_uint8 **currPtr, kal_uint8 coreID) ; |
| 352 | |
| 353 | SYSPROFILER_ERROR_CODE SLA_Register_for_Core(SYSPROFILER_ADDON_TYPE addonType, kal_uint32 addonSize, kal_char addonName[], void (*SLA_AddonInfoInitFunc)(void), void *SLA_AddonInfoLoggingFunc, kal_bool SA_SwapOutLogging, kal_uint8 coreID) ; |
| 354 | |
| 355 | #if defined(__SWLA_SNAPSHOT_FEATURE__) |
| 356 | SYSPROFILER_ERROR_CODE SLA_Buffer_Snapshot(SysProfiler_Snapshot_Core* info, kal_uint32* SLA_buff_addr, kal_uint32 SLA_buff_size, kal_uint32* dst_buffer_addr, kal_uint32 dst_buffer_size ); |
| 357 | #endif |
| 358 | #if defined(__SYSTEM_PROFILER_ON__) |
| 359 | void SLA_RetrieveELMInfo(void); |
| 360 | #endif |
| 361 | |
| 362 | #endif /* _SST_SLA_ */ |