X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fmt%2Fmt_ss.c;h=cb1ad0b8762a881500e306c62c461ba72fe19003;hb=f73456bd55152c329601f8286ae67fe9875025bc;hp=4127603c575e9302206bcd49f0218f60e1327362;hpb=65443172dd60a6ea312bd3a15959dbf54ad7f045;p=o-du%2Fl2.git diff --git a/src/mt/mt_ss.c b/src/mt/mt_ss.c index 4127603c5..cb1ad0b87 100644 --- a/src/mt/mt_ss.c +++ b/src/mt/mt_ss.c @@ -102,6 +102,12 @@ #include #endif /* SS_WATCHDOG */ +#ifdef SS_USE_WLS_MEM +#include +#include +#include +#endif + /* header/extern include files (.x) */ #include "gen.x" /* general layer */ @@ -153,27 +159,11 @@ #include "sys/syscall.h" #endif -#if defined(RGL_SPECIFIC_CHANGES) || defined(INTEL_WLS) +#if defined(RGL_SPECIFIC_CHANGES) || defined(INTEL_WLS) || defined(SS_USE_WLS_MEM) #include #include #endif -#ifdef INTEL_WLS -void LwrMacRecvPhyMsg(); -#endif - -#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF) -S16 rgBatchProc (Void); -#endif -#ifdef RLC_MAC_DAT_REQ_RBUF -S16 rgDlDatReqBatchProc ARGS(( - Void)); -#endif -#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF) -S16 rgBatchProc ARGS(( - Void)); -#endif - #ifdef TENB_T2K3K_SPECIFIC_CHANGES /* general purpose debug zone */ char my_buffer2[4096 * 4] = { 0 }; @@ -181,7 +171,6 @@ char my_buffer[4096] = { 0 }; int my_buffer_idx = 0; - #define sigsegv_print(x, ...) my_buffer_idx += sprintf(&my_buffer[my_buffer_idx], x "\n", ##__VA_ARGS__) struct sigcontext my_uc_mcontext = { 0 }; @@ -202,14 +191,7 @@ Void cmPrcTmr ARGS((CmTqCp* tqCp, CmTqType* tq, PFV func)); void dump_external(void); -#ifdef ANSI -static Void mtDelSigals -( -Void -) -#else -static Void mtDelSignals() -#endif +static Void mtDelSigals(Void) { struct sigaction sa; @@ -227,79 +209,79 @@ static Void mtDelSignals() } static void signal_segv(int signum, siginfo_t * info, void *ptr) { - static const char *si_codes[3] = { "", "SEGV_MAPERR", "SEGV_ACCERR" }; - int sz; - int i; - ucontext_t *ucontext = (ucontext_t *) ptr; + static const char *si_codes[3] = { "", "SEGV_MAPERR", "SEGV_ACCERR" }; + int sz; + int i; + ucontext_t *ucontext = (ucontext_t *) ptr; #ifdef XEON_SPECIFIC_CHANGES #else - int *p32 = (int *) 0x2fff0000; + int *p32 = (int *) 0x2fff0000; #endif - void *buffer[100]; - char **strings; + void *buffer[100]; + char **strings; - printf("segv ooops @ %p\n", info->si_addr); - my_buffer2[0] = 1; + printf("\nsegv ooops @ %p\n", info->si_addr); + my_buffer2[0] = 1; - printf("Segmentation Fault!\n"); - printf("info.si_signo = %d\n", signum); - printf("info.si_errno = %d\n", info->si_errno); - printf("info.si_code = %d (%s)\n", info->si_code, si_codes[info->si_code]); - printf("info.si_addr = %p\n", info->si_addr); + printf("\nSegmentation Fault!\n"); + printf("\ninfo.si_signo = %d\n", signum); + printf("\ninfo.si_errno = %d\n", info->si_errno); + printf("\ninfo.si_code = %d (%s)\n", info->si_code, si_codes[info->si_code]); + printf("\ninfo.si_addr = %p\n", info->si_addr); - memcpy(&my_uc_mcontext, &ucontext->uc_mcontext, sizeof(struct sigcontext)); + memcpy(&my_uc_mcontext, &ucontext->uc_mcontext, sizeof(struct sigcontext)); - i = 0; + i = 0; #ifndef RGL_SPECIFIC_CHANGES - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r0); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r1); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r2); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r3); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r4); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r5); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r6); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r7); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r8); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r9); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r10); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_fp); - printf("reg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_ip); - printf("reg[sp] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_sp); - printf("reg[lr] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_lr); - printf("reg[pc] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_pc); - printf("reg[cpsr] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_cpsr); -#endif - - printf("Stack trace (non-dedicated):\n"); - - sz = backtrace(buffer, 50); - strings = backtrace_symbols(buffer, sz); - for (i = 0; i < sz; ++i) - printf("%s\n", strings[i]); - - printf("End of stack trace."); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r0); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r1); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r2); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r3); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r4); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r5); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r6); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r7); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r8); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r9); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_r10); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_fp); + printf("\nreg[%02d] = 0x" REGFORMAT, i++, (unsigned int)ucontext->uc_mcontext.arm_ip); + printf("\nreg[sp] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_sp); + printf("\nreg[lr] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_lr); + printf("\nreg[pc] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_pc); + printf("\nreg[cpsr] = 0x" REGFORMAT, (unsigned int)ucontext->uc_mcontext.arm_cpsr); +#endif + + printf("\nStack trace (non-dedicated):\n"); + + sz = backtrace(buffer, 50); + strings = backtrace_symbols(buffer, sz); + for (i = 0; i < sz; ++i) + printf("%s\n", strings[i]); + + printf("\nEnd of stack trace\n"); #ifdef XEON_SPECIFIC_CHANGES #else - p32[0] = 1; + p32[0] = 1; #endif - /* Lets first print our debug information */ - printf("Before dumping our Debug info\n"); - mtStopHndlr(); - printf("After dumping our Debug info\n"); + /* Lets first print our debug information */ + printf("\nBefore dumping our Debug info\n"); + mtStopHndlr(); + printf("\nAfter dumping our Debug info\n"); - /* Disable the signal and make the enodeb to dump. This will make - * eNB to generate the core with dumping the ccpu log - */ - { - char *abc = NULL; - mtDelSigals(); - *abc = 100; - } - /* End printing debug information */ - exit(1); - /*while (1);*/ + /* Disable the signal and make the enodeb to dump. This will make + * eNB to generate the core with dumping the ccpu log + */ + { + char *abc = NULL; + mtDelSigals(); + *abc = 100; + } + /* End printing debug information */ + exit(1); + /*while (1);*/ } #endif /*** TBD: IMPORTANT *** @@ -326,7 +308,7 @@ Buffer *mtTskBuffer2; pthread_t tmpRegTidMap[20]; uint8_t stopBtInfo; - S16 SGlobMemInfoShow(void); +S16 SGlobMemInfoShow(void); #endif /* SS_LOCKLESS_MEMORY */ #ifdef L2_L3_SPLIT @@ -342,8 +324,8 @@ unsigned int tlPost(void *handle); /* mt003.301 Modifications - Moved to ss_gen.x */ #ifdef TENB_T2K3K_SPECIFIC_CHANGES Void *mtTskHdlrT2kL2 ARGS((Void*)); - void mtSigSegvHndlr ARGS((void)); - void mtSigUsr2Hndlr ARGS((void)); +void mtSigSegvHndlr ARGS((void)); +void mtSigUsr2Hndlr ARGS((void)); #endif static S16 ssdSetPthreadAttr ARGS ((S32 tskPrior, pthread_attr_t *attr)); @@ -377,8 +359,8 @@ static Bool fileBasedMemCfg = FALSE; #endif /* mt033.201 - addition of local function to print the statistics such as -* (size vs. numAttempts) and (allocations vs. deallocations) -*/ + * (size vs. numAttempts) and (allocations vs. deallocations) + */ #ifdef SSI_DEBUG_LEVEL1 static S16 SPrintRegMemStats ARGS((Region region)); #endif /* SSI_DEBUG_LEVEL1 */ @@ -400,7 +382,7 @@ static Void *workRcvTsk ARGS((void *)); #ifdef SS_THR_REG_MAP S32 ssCheckAndAddMemoryRegionMap ARGS((pthread_t threadId, - Region region)); + Region region)); S32 ssCheckAndDelMemoryRegionMap ARGS((pthread_t threadId)); #endif /* SS_THR_REG_MAP */ @@ -430,69 +412,123 @@ SsRegCfg cfgRegInfo[SS_MAX_REGS] = { SS_DFLT_REGION, SS_MAX_POOLS_PER_REG - 1, { - { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, - { SS_POOL_STATIC, 0 } + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } } } #ifdef INTEL_WLS , - { - SS_DFLT_REGION + 1, SS_MAX_POOLS_PER_REG - 1, { - { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, - { SS_POOL_STATIC, 0 } + SS_DFLT_REGION + 1, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_STATIC, 0 } + } } - } #endif /* INTEL_WLS */ #ifdef SS_LOCKLESS_MEMORY , - { - SS_DFLT_REGION + 1, SS_MAX_POOLS_PER_REG - 1, { - { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, - { SS_POOL_STATIC, 0 } - } - }, - { - SS_DFLT_REGION + 2, SS_MAX_POOLS_PER_REG - 1, + SS_DFLT_REGION + 1, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + }, { - { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, - { SS_POOL_STATIC, 0 } - } - }, - { - SS_DFLT_REGION + 3, SS_MAX_POOLS_PER_REG - 1, + SS_DFLT_REGION + 2, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + }, { - { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, - { SS_POOL_STATIC, 0 } - } - }, + SS_DFLT_REGION + 3, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + }, + { + SS_DFLT_REGION + 4, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + }, + { + SS_DFLT_REGION + 5, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + }, + { + SS_DFLT_REGION + 6, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + }, + { + SS_DFLT_REGION + 7, SS_MAX_POOLS_PER_REG - 1, { - SS_DFLT_REGION + 4, SS_MAX_POOLS_PER_REG - 1, + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } + } + +#ifndef INTEL_WLS_MEM + , { - { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, - { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, - { SS_POOL_STATIC, 0 } + SS_DFLT_REGION + 8, SS_MAX_POOLS_PER_REG - 1, + { + { SS_POOL_DYNAMIC, MT_POOL_0_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_1_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_2_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_3_DSIZE }, + { SS_POOL_DYNAMIC, MT_POOL_4_DSIZE }, + { SS_POOL_STATIC, 0 } + } } - } +#endif + #endif /* SS_LOCKLESS_MEMORY */ }; /* mt003.301 Modifications - File Based task registration made @@ -502,78 +538,134 @@ SsRegCfg cfgRegInfo[SS_MAX_REGS] = #ifdef SS_LOCKLESS_MEMORY MtDynMemCfg mtDynMemoCfg = { - SS_MAX_REGS, /* number of regions */ - { - { - SS_DFLT_REGION, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - { - /* block size, no. of blocks, Upper threshold, lower threshold */ - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} - } - }, - { - SS_DFLT_REGION + 1, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - { - /* block size, no. of blocks, Upper threshold, lower threshold */ - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} - } - }, - { - SS_DFLT_REGION + 2, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - { - /* block size, no. of blocks, Upper threshold, lower threshold */ - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} - } - }, + SS_MAX_REGS, /* number of regions */ + { + { + SS_DFLT_REGION, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, { - SS_DFLT_REGION + 3, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - { - /* block size, no. of blocks, Upper threshold, lower threshold */ - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} - } - }, + SS_DFLT_REGION + 1, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, + { + SS_DFLT_REGION + 2, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, + { + SS_DFLT_REGION + 3, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, + { + SS_DFLT_REGION + 4, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, { - SS_DFLT_REGION + 4, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - { - /* block size, no. of blocks, Upper threshold, lower threshold */ - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} - } - } + SS_DFLT_REGION + 5, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, + { + SS_DFLT_REGION + 6, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + }, + { + SS_DFLT_REGION + 7, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + } +#ifndef INTEL_WLS_MEM + , + { + SS_DFLT_REGION + 8, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + } +#endif #if ((defined (SPLIT_RLC_DL_TASK)) && (!defined (L2_L3_SPLIT))) - , - { - SS_DFLT_REGION + 4, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - { - /* block size, no. of blocks, Upper threshold, lower threshold */ - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, - {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} - } - } -#endif - } + , + { + SS_DFLT_REGION + 7, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + { + /* block size, no. of blocks, Upper threshold, lower threshold */ + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD}, + {SS_BLK_RELEASE_THRESHOLD, SS_BLK_ACQUIRE_THRESHOLD} + } + } +#endif + } }; @@ -586,12 +678,13 @@ MtGlobMemCfg mtGlobMemoCfg = {MT_BKT_0_DSIZE, (MT_BKT_0_NUMBLKS + MT_BKT_0_NUMBLKS), SS_DFLT_MEM_BLK_SET_SIZE}, {MT_BKT_1_DSIZE, MT_BKT_1_NUMBLKS, SS_DFLT_MEM_BLK_SET_SIZE}, {MT_BKT_2_DSIZE, MT_BKT_2_NUMBLKS, SS_DFLT_MEM_BLK_SET_SIZE}, - {MT_BKT_3_DSIZE, MT_BKT_3_NUMBLKS, SS_DFLT_MEM_BLK_SET_SIZE} + {MT_BKT_3_DSIZE, MT_BKT_3_NUMBLKS, SS_DFLT_MEM_BLK_SET_SIZE}, + {MT_BKT_4_DSIZE, MT_BKT_4_NUMBLKS, SS_DFLT_MEM_BLK_SET_SIZE} #else {1024, 12800 /* MT_BKT_0_NUMBLKS */, SS_DFLT_MEM_BLK_SET_SIZE}, - {1664, 12800 /* MT_BKT_1_NUMBLKS */, SS_DFLT_MEM_BLK_SET_SIZE}, - {4096, 3840 /* MT_BKT_2_NUMBLKS*/, SS_DFLT_MEM_BLK_SET_SIZE}, - {MT_BKT_3_DSIZE, 12800 /* MT_BKT_3_NUMBLKS */, SS_DFLT_MEM_BLK_SET_SIZE} + {1664, 12800 /* MT_BKT_1_NUMBLKS */, SS_DFLT_MEM_BLK_SET_SIZE}, + {4096, 3840 /* MT_BKT_2_NUMBLKS*/, SS_DFLT_MEM_BLK_SET_SIZE}, + {MT_BKT_3_DSIZE, 12800 /* MT_BKT_3_NUMBLKS */, SS_DFLT_MEM_BLK_SET_SIZE} #endif } }; @@ -602,103 +695,159 @@ MtGlobMemCfg mtGlobMemoCfg = MtMemCfg mtMemoCfg = { #ifdef RY_ENBS5SHM - SS_MAX_REGS - 1, /* number of regions */ + SS_MAX_REGS - 1, /* number of regions */ #else #ifndef XEON_SPECIFIC_CHANGES - SS_MAX_REGS, /* number of regions */ + SS_MAX_REGS, /* number of regions */ #else - 2, + 2, #endif #endif - { - { - SS_DFLT_REGION, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - MT_HEAP_SIZE, /* heap size */ + { { + SS_DFLT_REGION, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { #ifndef XEON_SPECIFIC_CHANGES - {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ -#else - {256, 491520}, /* 60 pages of 2M*/ - {512, 12288}, /* 3 pages of 2M */ - {2048, 99328}, /* 97 Pages of 2M */ - {8192, 75008}, /* 293 Pages of 2M */ - {16384, 4096} /* 32 pages of 2M */ + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} +#else + {256, 491520}, /* 60 pages of 2M*/ + {512, 12288}, /* 3 pages of 2M */ + {2048, 99328}, /* 97 Pages of 2M */ + {8192, 75008}, /* 293 Pages of 2M */ + {16384, 4096} /* 32 pages of 2M */ #endif - } - }, + } + }, #ifdef INTEL_WLS #ifndef SS_LOCKLESS_MEMORY - { - SS_DFLT_REGION + 1, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - /*MT_HEAP_SIZE 7194304 */ 10485760, /* heap size */ { - //{MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ - //{MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ - //{MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ - //{MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ - {128, 500000}, - {256, 500000}, - {2048, 200000}, - {4096, 40960}, - {18432, 10240} - } - }, + SS_DFLT_REGION + 1, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + /*MT_HEAP_SIZE 7194304 */ 10485760, /* heap size */ + { + //{MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + //{MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + //{MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + //{MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ + {128, 500000}, + {256, 500000}, + {2048, 200000}, + {4096, 40960}, + {18432, 10240} + } + }, #endif /* SS_LOCKLESS_MEMORY */ #endif /* INTEL_WLS */ #ifdef SS_LOCKLESS_MEMORY - { - SS_DFLT_REGION + 1, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - MT_HEAP_SIZE, /* heap size */ { - {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ - } - }, - { - SS_DFLT_REGION + 2, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - MT_HEAP_SIZE, /* heap size */ + SS_DFLT_REGION + 1, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, { - {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ - } - }, - { - SS_DFLT_REGION + 3, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - MT_HEAP_SIZE, /* heap size */ + SS_DFLT_REGION + 2, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, { - {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ - } - }, + SS_DFLT_REGION + 3, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, + { + SS_DFLT_REGION + 4, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, + { + SS_DFLT_REGION + 5, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, + { + SS_DFLT_REGION + 6, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + }, + { + SS_DFLT_REGION + 7, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ { - SS_DFLT_REGION + 4, /* region id */ - MT_MAX_BKTS, /* number of buckets */ - MT_HEAP_SIZE, /* heap size */ - { - {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ - {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS} /* block size, no. of blocks */ - } + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ } + } +#ifndef INTEL_WLS_MEM + , + { + SS_DFLT_REGION + 8, /* region id */ + MT_MAX_BKTS, /* number of buckets */ + MT_HEAP_SIZE, /* heap size */ + { + {MT_BKT_0_DSIZE, MT_BKT_0_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_1_DSIZE, MT_BKT_1_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_2_DSIZE, MT_BKT_2_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_3_DSIZE, MT_BKT_3_STATIC_NUMBLKS}, /* block size, no. of blocks */ + {MT_BKT_4_DSIZE, MT_BKT_4_STATIC_NUMBLKS} /* block size, no. of blocks */ + } + } +#endif #endif /* SS_LOCKLESS_MEMORY */ - STATIC_MEM_CFG - } + STATIC_MEM_CFG + } }; /* mt003.301 Modifications - File Based task registration made * common for both MULTICORE and NON-MULTICORE @@ -712,15 +861,22 @@ S16 msOptInd; /* SGetOpt vars */ S8 *msOptArg; /* SGetOpt vars */ -#ifdef INTEL_WLS +#if defined (INTEL_WLS) || defined (SS_USE_WLS_MEM) typedef struct _MtRegMemSz { uint32_t reqdSz; uint8_t *startAddr; }MtRegMemSz; +#ifdef SS_USE_WLS_MEM +static MtRegMemSz mtDynMemSz[MT_MAX_BKTS]; +static S16 SPartitionWlsDynMem(); +static S16 SAllocateWlsDynMem(); +#endif +#ifdef INTEL_WLS static MtRegMemSz mtRegMemSz[MT_MAX_BKTS+1]; #endif +#endif /* private variable declarations */ @@ -732,35 +888,53 @@ static CmMmRegCb *mtCMMRegCb[SS_MAX_REGS]; /*mt010.301 - removed veriable defined for FA*/ -#ifdef INTEL_WLS +#if defined (INTEL_WLS) || defined (SS_USE_WLS_MEM) #ifdef NTL_LIB void mtSetNtlHdl(unsigned int hdl) { - osCp.ntl.hdl = hdl; + osCp.ntl.hdl = hdl; } unsigned int mtGetNtlHdl() { - return(osCp.ntl.hdl); + return(osCp.ntl.hdl); } #endif /* NTL_LIB */ - -void * mtGetWlsHdl() +void mtGetWlsHdl(void **hdlr) { - return (osCp.wls.intf); -} + *hdlr = osCp.wls.intf; +} #ifdef XEON_MULTIPLE_CELL_CHANGES S8 gWrWlsDeviceName[MAX_WLS_DEVICE_NAME_LEN]; S16 smWrReadWlsConfigParams (Void); #endif +/*WLS Memory Size variables*/ +#ifdef INTEL_L1_V20_03_ONWARDS +uint64_t nWlsMacMemorySize = 0; +uint64_t nWlsPhyMemorySize = 0; +#endif + static int SOpenWlsIntf() { - void *hdl; - #define WLS_DEVICE_NAME "/dev/wls" + uint8_t i; + void *hdl = NULLP; +#define WLS_DEVICE_NAME "wls0" + + char *my_argv[] = {"gnodeb", "-c3", "--proc-type=auto", "--file-prefix", "gnb0", "--iova-mode=pa"}; + printf("\nCalling rte_eal_init: "); + for (i = 0; i < RTE_DIM(my_argv); i++) + { + printf("%s ", my_argv[i]); + } + printf("\n"); + + if (rte_eal_init(RTE_DIM(my_argv), my_argv) < 0) + rte_panic("\nCannot init EAL\n"); + #ifdef XEON_SPECIFIC_CHANGES #ifdef XEON_MULTIPLE_CELL_CHANGES @@ -769,15 +943,25 @@ static int SOpenWlsIntf() hdl = WLS_Open(WLS_DEVICE_NAME, 1); #endif #else - hdl = WLS_Open(WLS_DEVICE_NAME, WLS_MASTER_CLIENT, (512 *1024 * 1024)); + +#ifdef INTEL_L1_V20_03_ONWARDS + hdl = WLS_Open(WLS_DEVICE_NAME, WLS_MASTER_CLIENT, &nWlsMacMemorySize, &nWlsPhyMemorySize); + if(hdl == NULL) + { + printf("\nERROR: WLS_Open > DEVICE_NAME mismatch. WLS Device Name should be same as 'wls_dev_name' parameter in 'phycfg_xran.xml' file"); + } +#else + hdl = WLS_Open(WLS_DEVICE_NAME, WLS_MASTER_CLIENT, WLS_MEM_SIZE); +#endif /*INTEL_L1_V20_03_ONWARDS*/ + #endif osCp.wls.intf = hdl; if(!osCp.wls.intf) { - printf("Could not open WLS Interface \n"); - return (0); + printf("\nCould not open WLS Interface \n"); + return (0); } return (1); @@ -788,32 +972,26 @@ static int SOpenWlsIntf() #ifndef API_MAIN /* -* -* Fun: main -* -* Desc: This function is the entry point for the final binary. It -* calls SInit() in the common code. It can be replaced by a -* user function if required (SInit() must still be called). -* -* Ret: none on success -* exit on failure -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -int main + * + * Fun: main + * + * Desc: This function is the entry point for the final binary. It + * calls SInit() in the common code. It can be replaced by a + * user function if required (SInit() must still be called). + * + * Ret: none on success + * exit on failure + * + * Notes: + * + * File: mt_ss.c + * + */ + int main ( -int argc, /* argument count */ -char **argv /* argument vector */ -) -#else -int main(argc, argv) -int argc; /* argument count */ -char **argv; /* argument vector */ -#endif + int argc, /* argument count */ + char **argv /* argument vector */ + ) { #ifdef XEON_MULTIPLE_CELL_CHANGES @@ -825,21 +1003,21 @@ char **argv; /* argument vector */ } /* end of if statement */ #endif -#ifdef INTEL_WLS +#if defined (INTEL_WLS) || defined (SS_USE_WLS_MEM) if(!SOpenWlsIntf()) - return (0); + return (0); #endif /* INTEL_WLS */ msArgc = argc; msArgv = argv; /* mt003.301 Modifications */ if( ROK != SInit()) - { - printf("\n SInit failed, SSI could not start \n"); - /* pthread_exit(NULLP);*/ /* Commented to Come out of Main thread*/ + { + printf("\n SInit failed, SSI could not start \n"); + /* pthread_exit(NULLP);*/ /* Commented to Come out of Main thread*/ - return (0); - } + return (0); + } /*mt010.301 cleanup part exposed to user*/ SFini(); return (0); @@ -848,32 +1026,26 @@ char **argv; /* argument vector */ #else /* -* -* Fun: ssMain -* -* Desc: This function is the entry point for the final binary. It -* calls SInit() in the common code. It can be replaced by a -* user function if required (SInit() must still be called). -* -* Ret: none on success -* exit on failure -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -int ssMain + * + * Fun: ssMain + * + * Desc: This function is the entry point for the final binary. It + * calls SInit() in the common code. It can be replaced by a + * user function if required (SInit() must still be called). + * + * Ret: none on success + * exit on failure + * + * Notes: + * + * File: mt_ss.c + * + */ + int ssMain ( -int argc, /* argument count */ -char **argv /* argument vector */ -) -#else -int ssMain(argc, argv) -int argc; /* argument count */ -char **argv; /* argument vector */ -#endif + int argc, /* argument count */ + char **argv /* argument vector */ + ) { @@ -888,31 +1060,24 @@ char **argv; /* argument vector */ #endif /* -* initialization functions -*/ + * initialization functions + */ /* -* -* Fun: Initialize OS control point -* -* Desc: This function initializes MTSS-specific information -* in the OS control point. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitGen -( -void -) -#else -S16 ssdInitGen() -#endif + * + * Fun: Initialize OS control point + * + * Desc: This function initializes MTSS-specific information + * in the OS control point. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitGen(void) { struct sigaction act; sigset_t set; @@ -921,14 +1086,14 @@ S16 ssdInitGen() #endif - /*mt014.301 : 4GMX release related changes*/ + /*mt014.301 : 4GMX release related changes*/ #ifdef SS_4GMX_UCORE uarmInit(); #endif -/* mt005.301 : Cavium changes */ + /* mt005.301 : Cavium changes */ #ifdef SS_SEUM_CAVIUM - /* set group mask for the core */ - cvmx_pow_set_group_mask(cvmx_get_core_num(), SS_CVMX_GRP_MASK); + /* set group mask for the core */ + cvmx_pow_set_group_mask(cvmx_get_core_num(), SS_CVMX_GRP_MASK); #endif /* SS_SEUM_CAVIUM */ osCp.dep.sysTicks = 0; @@ -937,12 +1102,12 @@ S16 ssdInitGen() #ifndef NOCMDLINE /* parse command line */ mtGetOpts(); - /* mt003.301 Additions */ - if(fileBasedMemCfg == TRUE && memConfigured == FALSE) - { - printf("\n File Based Memory configuration failed \n"); - return RFAILED; - } + /* mt003.301 Additions */ + if(fileBasedMemCfg == TRUE && memConfigured == FALSE) + { + printf("\n File Based Memory configuration failed \n"); + return RFAILED; + } #endif #ifndef RGL_SPECIFIC_CHANGES /* ANOOP :: This ssdInitMemInfo() was present in 2.1 */ @@ -984,45 +1149,45 @@ S16 ssdInitGen() /*Initialize SIGSEGV Signal */ #ifdef TENB_T2K3K_SPECIFIC_CHANGES #if 1 - memset(&sa, 0, sizeof(struct sigaction)); - sigemptyset(&sa.sa_mask); - sa.sa_sigaction = signal_segv; - sa.sa_flags = SA_SIGINFO; + memset(&sa, 0, sizeof(struct sigaction)); + sigemptyset(&sa.sa_mask); + sa.sa_sigaction = signal_segv; + sa.sa_flags = SA_SIGINFO; #ifndef XEON_SPECIFIC_CHANGES - sigaction(SIGSEGV, &sa, NULL); + sigaction(SIGSEGV, &sa, NULL); - memset(&sa, 0, sizeof(struct sigaction)); - sigemptyset(&sa.sa_mask); - sa.sa_sigaction = signal_segv; - sa.sa_flags = SA_SIGINFO; + memset(&sa, 0, sizeof(struct sigaction)); + sigemptyset(&sa.sa_mask); + sa.sa_sigaction = signal_segv; + sa.sa_flags = SA_SIGINFO; - sigaction(SIGILL, &sa, NULL); + sigaction(SIGILL, &sa, NULL); #else - if(sigaction(SIGILL, &sa, NULL) != 0) - { - printf("Failed to process sigaction for the SIGILL\n"); - return RFAILED; - } - if(sigaction(SIGSEGV, &sa, NULL) != 0) - { - printf("Failed to process sigaction for the SIGSEGV\n"); - return RFAILED; - } - if(sigaction(SIGABRT, &sa, NULL) != 0) - { - printf("Failed to process sigaction for the SIGABRT\n"); - return RFAILED; - } - if(sigaction(SIGTERM, &sa, NULL) != 0) - { - printf("Failed to process sigaction for the SIGTERM\n"); - return RFAILED; - } - if(sigaction(SIGHUP, &sa, NULL) != 0) - { - printf("Failed to process sigaction for the SIGHUP\n"); - return RFAILED; - } + if(sigaction(SIGILL, &sa, NULL) != 0) + { + printf("\nFailed to process sigaction for the SIGILL\n"); + return RFAILED; + } + if(sigaction(SIGSEGV, &sa, NULL) != 0) + { + printf("\nFailed to process sigaction for the SIGSEGV\n"); + return RFAILED; + } + if(sigaction(SIGABRT, &sa, NULL) != 0) + { + printf("\nFailed to process sigaction for the SIGABRT\n"); + return RFAILED; + } + if(sigaction(SIGTERM, &sa, NULL) != 0) + { + printf("\nFailed to process sigaction for the SIGTERM\n"); + return RFAILED; + } + if(sigaction(SIGHUP, &sa, NULL) != 0) + { + printf("\nFailed to process sigaction for the SIGHUP\n"); + return RFAILED; + } #endif #else signal (SIGSEGV, mtSigSegvHndlr); @@ -1052,26 +1217,19 @@ S16 ssdInitGen() /* -* -* Fun: De-initialize OS control point -* -* Desc: This function reverses the initialization in ssdInitGen(). -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void ssdDeinitGen -( -void -) -#else -Void ssdDeinitGen() -#endif + * + * Fun: De-initialize OS control point + * + * Desc: This function reverses the initialization in ssdInitGen(). + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +Void ssdDeinitGen(void) { @@ -1083,33 +1241,26 @@ Void ssdDeinitGen() #ifdef SS_LOCKLESS_MEMORY #ifdef USE_MALLOC /* -* -* Fun: ssPutDynMemBlkSet -* -* Desc: Returns the set of dynamic Blocks into the global region -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: -* -* File: cm_mem.c -* -*/ -#ifdef ANSI + * + * Fun: ssPutDynMemBlkSet + * + * Desc: Returns the set of dynamic Blocks into the global region + * + * + * Ret: ROK - successful, + * RFAILED - unsuccessful. + * + * Notes: + * + * File: cm_mem.c + * + */ S16 ssPutDynMemBlkSet ( -uint8_t bktIdx, /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem /* Memory set element which is needs to be - added to global region */ -) -#else -S16 ssPutDynMemBlkSet(bktIdx, dynMemSetElem) -uint8_t bktIdx; /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem; /* Memory set element which is needs to be - added to global region */ -#endif + uint8_t bktIdx, /* Index to bucket list */ + CmMmBlkSetElement *dynMemSetElem /* Memory set element which is needs to be + added to global region */ + ) { CmMmGlobRegCb *globReg; CmMmGlobalBktCb *bktCb; @@ -1141,33 +1292,26 @@ CmMmBlkSetElement *dynMemSetElem; /* Memory set element which is needs to be } /* -* -* Fun: ssGetDynMemBlkSet -* -* Desc: Gets the set of dynamic memory blocks from the global region -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: -* -* File: cm_mem.c -* -*/ -#ifdef ANSI + * + * Fun: ssGetDynMemBlkSet + * + * Desc: Gets the set of dynamic memory blocks from the global region + * + * + * Ret: ROK - successful, + * RFAILED - unsuccessful. + * + * Notes: + * + * File: cm_mem.c + * + */ S16 ssGetDynMemBlkSet ( -uint8_t bktIdx, /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem /* Memory set element which is updated - with new set values */ -) -#else -S16 ssGetDynMemBlkSet(bktIdx, dynMemSetElem) -uint8_t bktIdx; /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem; /* Memory set element which is updated - with new set values */ -#endif + uint8_t bktIdx, /* Index to bucket list */ + CmMmBlkSetElement *dynMemSetElem /* Memory set element which is updated + with new set values */ + ) { CmMmGlobRegCb *globReg; @@ -1203,35 +1347,27 @@ CmMmBlkSetElement *dynMemSetElem; /* Memory set element which is updated #else /* -* -* Fun: ssPutDynMemBlkSet -* -* Desc: Returns the set of dynamic Blocks into the global region -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: -* -* File: cm_mem.c -* -*/ -#ifdef ANSI + * + * Fun: ssPutDynMemBlkSet + * + * Desc: Returns the set of dynamic Blocks into the global region + * + * + * Ret: ROK - successful, + * RFAILED - unsuccessful. + * + * Notes: + * + * File: cm_mem.c + * + */ S16 ssPutDynMemBlkSet ( -uint8_t bktIdx, /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem, /* Memory set element which is needs to be - added to global region */ -uint32_t doNotBlockForLock /* Boolean whether to block for lock or not */ -) -#else -S16 ssPutDynMemBlkSet(bktIdx, dynMemSetElem) -uint8_t bktIdx; /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem; /* Memory set element which is needs to be - added to global region */ -uint32_t doNotBlockForLock; /* Boolean whether to block for lock or not */ -#endif + uint8_t bktIdx, /* Index to bucket list */ + CmMmBlkSetElement *dynMemSetElem, /* Memory set element which is needs to be + added to global region */ + uint32_t doNotBlockForLock /* Boolean whether to block for lock or not */ + ) { CmMmGlobRegCb *globReg; CmMmGlobalBktCb *bktCb; @@ -1266,8 +1402,8 @@ uint32_t doNotBlockForLock; /* Boolean whether to block for lstNode = cmLListFirst(&(bktCb->listFreeBktSet)); if(lstNode == NULLP) { - SUnlock(&(bktCb->bucketLock)); - return RFAILED; + SUnlock(&(bktCb->bucketLock)); + return RFAILED; } cmLListDelFrm(&(bktCb->listFreeBktSet), lstNode); @@ -1289,36 +1425,28 @@ uint32_t doNotBlockForLock; /* Boolean whether to block for } /* -* -* Fun: ssGetDynMemBlkSet -* -* Desc: Gets the set of dynamic memory blocks from the global region -* -* -* Ret: ROK - successful, -* RFAILED - unsuccessful. -* -* Notes: The parameter doNotBlockForLock specifies whether to block for lock -* or not -* -* File: cm_mem.c -* -*/ -#ifdef ANSI + * + * Fun: ssGetDynMemBlkSet + * + * Desc: Gets the set of dynamic memory blocks from the global region + * + * + * Ret: ROK - successful, + * RFAILED - unsuccessful. + * + * Notes: The parameter doNotBlockForLock specifies whether to block for lock + * or not + * + * File: cm_mem.c + * + */ S16 ssGetDynMemBlkSet ( -uint8_t bktIdx, /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem, /* Memory set element which is updated - with new set values */ -uint32_t doNotBlockForLock /* Boolean whether to block for lock or not */ -) -#else -S16 ssGetDynMemBlkSet(bktIdx, dynMemSetElem) -uint8_t bktIdx; /* Index to bucket list */ -CmMmBlkSetElement *dynMemSetElem; /* Memory set element which is updated - with new set values */ -uint32_t doNotBlockForLock; /* Boolean whether to block for lock or not */ -#endif + uint8_t bktIdx, /* Index to bucket list */ + CmMmBlkSetElement *dynMemSetElem, /* Memory set element which is updated + with new set values */ + uint32_t doNotBlockForLock /* Boolean whether to block for lock or not */ + ) { CmMmGlobRegCb *globReg; CmMmGlobalBktCb *bktCb; @@ -1352,8 +1480,8 @@ uint32_t doNotBlockForLock; /* Boolean whether to block for if(lstNode == NULLP) { - SUnlock(&(bktCb->bucketLock)); - return RFAILED; + SUnlock(&(bktCb->bucketLock)); + return RFAILED; } /* Delete the node from the valid linked list and copy the values of the @@ -1377,14 +1505,7 @@ uint32_t doNotBlockForLock; /* Boolean whether to block for uint32_t gDynMemAlrm[4]; static uint32_t memoryCheckCounter; -#ifdef ANSI -uint32_t isMemThreshReached( -Region reg -) -#else -uint32_t isMemThreshReached(reg) -Region reg; -#endif +uint32_t isMemThreshReached(Region reg) { CmMmGlobRegCb *globReg; CmMmGlobalBktCb *bktCb; @@ -1403,28 +1524,28 @@ Region reg; if(gDynMemAlrm[bktIdx]) { - // printf ("under memory bktCb->listValidBktSet.count %d bktIdx %d\n",bktCb->listValidBktSet.count ,bktIdx); - SLock(&(bktCb->bucketLock)); - if(bktCb->listValidBktSet.count > 25) - { - gDynMemAlrm[bktIdx] = FALSE; - // printf ("recoverd bktCb->listValidBktSet.count %d bktIdx %d\n",bktCb->listValidBktSet.count ,bktIdx); - } - SUnlock(&(bktCb->bucketLock)); - return RFAILED; + // printf ("\nunder memory bktCb->listValidBktSet.count %d bktIdx %d\n",bktCb->listValidBktSet.count ,bktIdx); + SLock(&(bktCb->bucketLock)); + if(bktCb->listValidBktSet.count > 25) + { + gDynMemAlrm[bktIdx] = FALSE; + // printf ("\nrecoverd bktCb->listValidBktSet.count %d bktIdx %d\n",bktCb->listValidBktSet.count ,bktIdx); + } + SUnlock(&(bktCb->bucketLock)); + return RFAILED; } else { - if(memoryCheckCounter++ >= NUM_CALLS_TO_CHECK_MEM_DYN_AGAIN) - { - // printf ("CHECK bktCb->listValidBktSet.count %d bktIdx %d\n",bktCb->listValidBktSet.count ,bktIdx); - SLock(&(bktCb->bucketLock)); - if(bktCb->listValidBktSet.count < 15 ) - gDynMemAlrm[bktIdx] = TRUE; - memoryCheckCounter = 0; - SUnlock(&(bktCb->bucketLock)); - } + if(memoryCheckCounter++ >= NUM_CALLS_TO_CHECK_MEM_DYN_AGAIN) + { + // printf ("\nCHECK bktCb->listValidBktSet.count %d bktIdx %d\n",bktCb->listValidBktSet.count ,bktIdx); + SLock(&(bktCb->bucketLock)); + if(bktCb->listValidBktSet.count < 15 ) + gDynMemAlrm[bktIdx] = TRUE; + memoryCheckCounter = 0; + SUnlock(&(bktCb->bucketLock)); + } } return ROK; } @@ -1434,29 +1555,21 @@ Region reg; #ifdef SS_USE_ICC_MEMORY /* -* -* Fun: Initialize region/pool tables -* -* Desc: This function initializes MTSS-specific information -* in the region/pool tables and configures the common -* memory manager for use. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void * ssGetIccHdl -( -Region region -) -#else -Void * ssGetIccHdl() -Region region; -#endif + * + * Fun: Initialize region/pool tables + * + * Desc: This function initializes MTSS-specific information + * in the region/pool tables and configures the common + * memory manager for use. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +Void * ssGetIccHdl(Region region) { CmMmDynRegCb *dynRegCb; @@ -1465,7 +1578,7 @@ Region region; { return (NULLP); } - + dynRegCb = (CmMmDynRegCb *)osCp.dynRegionTbl[region].regCb; return (dynRegCb->iccHdl); @@ -1476,6 +1589,53 @@ Region region; RegionMemLeakInfo regMemLeakInfo; #endif /* T2K_MEM_LEAK_DBG */ +#ifdef SS_USE_WLS_MEM +static S16 SPartitionWlsDynMem() +{ + uint32_t i; + uint8_t *bktMemStrtAddr = (uint8_t *)(((uint8_t*)osCp.wls.allocAddr) + (4 * 1024 * 1024)); + + for (i = 0 ; i < mtGlobMemoCfg.numBkts ; i++) + { + mtDynMemSz[i].startAddr = bktMemStrtAddr; + bktMemStrtAddr += mtDynMemSz[i].reqdSz; + } + + printf("\nGlobal Memory Info: \n"); + for (i = 0 ; i < mtGlobMemoCfg.numBkts ; i++) + { + printf("mtDynMemSz[%d]: [0x%016lx]\n", i, (unsigned long int)mtDynMemSz[i].startAddr); + } + return ROK; +} + +static S16 SAllocateWlsDynMem() +{ + uint32_t reqdMemSz; + uint32_t i; + reqdMemSz = 0; + memset(&mtDynMemSz[0], 0, sizeof(mtDynMemSz)); + + for (i = 0 ; i < mtGlobMemoCfg.numBkts ; i++) + { + reqdMemSz += (mtGlobMemoCfg.bkt[i].blkSize * mtGlobMemoCfg.bkt[i].numBlks); + mtDynMemSz[i].reqdSz += (mtGlobMemoCfg.bkt[i].blkSize * mtGlobMemoCfg.bkt[i].numBlks); + } + osCp.wls.allocAddr = WLS_Alloc(osCp.wls.intf, +#ifdef INTEL_L1_V20_03_ONWARDS + nWlsMacMemorySize+nWlsPhyMemorySize); +#elif INTEL_L1_V19_10 + WLS_MEMORY_SIZE); +#else + (reqdMemSz + (4 * 1024 * 1024))); +#endif + printf("\n *************** \n WLS memory: %lx, %d\n", (PTR)osCp.wls.allocAddr, reqdMemSz); + SPartitionWlsDynMem(); + return ROK; +} + +#endif + #ifdef INTEL_WLS S16 SPartitionWlsMemory() @@ -1489,7 +1649,7 @@ S16 SPartitionWlsMemory() long int pageSize[1], hugePageSize; #endif uint32_t numHugePg; - #define DIV_ROUND_OFFSET(X,Y) ( X/Y + ((X%Y)?1:0) ) +#define DIV_ROUND_OFFSET(X,Y) ( X/Y + ((X%Y)?1:0) ) uint8_t *regMemStrtAddr = (uint8_t *)osCp.wls.allocAddr; @@ -1521,18 +1681,18 @@ Void SChkAddrValid(int type, int region, PTR ptr) if(type == 0) //Global { if(ptr < mtRegMemSz[0].startAddr || ptr >= - (mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr + mtGlobMemoCfg.heapSize)) + (mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr + mtGlobMemoCfg.heapSize)) { - printf("****INVALID PTR in Global Region: ptr:%p start:%p end:%p***\n", ptr, mtRegMemSz[0].startAddr, mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr); - *tryPtr = 0; + printf("\n****INVALID PTR in Global Region: ptr:%p start:%p end:%p***\n", ptr, mtRegMemSz[0].startAddr, mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr); + *tryPtr = 0; } } else { if(ptr > mtRegMemSz[0].startAddr && ptr <= mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr ) { - printf("****INVALID PTR in Static Region: ptr:%p start:%p end:%p***\n", ptr, mtRegMemSz[0].startAddr, mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr); - *tryPtr = 0; + printf("\n****INVALID PTR in Static Region: ptr:%p start:%p end:%p***\n", ptr, mtRegMemSz[0].startAddr, mtRegMemSz[mtGlobMemoCfg.numBkts].startAddr); + *tryPtr = 0; } } @@ -1555,8 +1715,8 @@ S16 SPartitionStaticMemory(uint8_t *startAddr) regMemStrtAddr += reqdSz; #ifdef T2K_MEM_LEAK_DBG { /* Since region 1 onwards are used for non wls */ - regMemLeakInfo.regStartAddr[i] = (uint64_t)mtRegMemSz[i].startAddr; - regMemLeakInfo.numActvRegions++; + regMemLeakInfo.regStartAddr[i] = (uint64_t)mtRegMemSz[i].startAddr; + regMemLeakInfo.numActvRegions++; } #endif /* T2K_MEM_LEAK_DBG */ } @@ -1582,8 +1742,8 @@ S16 SAllocateWlsMem() for (j = 0; j < region->numBkts; j++) { - reqdMemSz += region->bkt[j].blkSize * region->bkt[j].numBlks; - mtRegMemSz[i].reqdSz += region->bkt[j].blkSize * region->bkt[j].numBlks; + reqdMemSz += region->bkt[j].blkSize * region->bkt[j].numBlks; + mtRegMemSz[i].reqdSz += region->bkt[j].blkSize * region->bkt[j].numBlks; } } osCp.wls.allocAddr = WLS_Alloc(osCp.wls.intf, (512 *1024 * 1024)); @@ -1617,8 +1777,8 @@ S16 SAllocateStaticMem() for (j = 0; j < region->numBkts; j++) { - reqdMemSz += region->bkt[j].blkSize * region->bkt[j].numBlks; - mtRegMemSz[i].reqdSz += region->bkt[j].blkSize * region->bkt[j].numBlks; + reqdMemSz += region->bkt[j].blkSize * region->bkt[j].numBlks; + mtRegMemSz[i].reqdSz += region->bkt[j].blkSize * region->bkt[j].numBlks; } } @@ -1636,44 +1796,37 @@ S16 SAllocateStaticMem() /* -* -* Fun: Initialize region/pool tables -* -* Desc: This function initializes MTSS-specific information -* in the region/pool tables and configures the common -* memory manager for use. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitMem -( -void -) -#else -S16 ssdInitMem() -#endif + * + * Fun: Initialize region/pool tables + * + * Desc: This function initializes MTSS-specific information + * in the region/pool tables and configures the common + * memory manager for use. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitMem(void) { /* mt018.201 - added local variable */ - uint8_t i; - uint16_t j; - uint8_t k; - MtRegCfg *region; + uint8_t i =0; + uint16_t j =0; + uint8_t k =0; + MtRegCfg *region = NULLP; Txt errMsg[256] = {'\0'}; #ifdef SS_LOCKLESS_MEMORY - CmMmDynRegCb *dynRegCb; + CmMmDynRegCb *dynRegCb =0; #ifdef SS_USE_ICC_MEMORY #else - CmMmGlobRegCb *globReg; - Size memSize; + CmMmGlobRegCb *globReg = NULLP; + Size memSize =0; #endif #endif /* SS_LOCKLESS_MEMORY */ - + /* Use the default SSI memory manager if the ICC memory manager is not * avilable. If ICC memory manager is avilable, it will be used for @@ -1687,18 +1840,18 @@ S16 ssdInitMem() dynRegCb = (CmMmDynRegCb *)calloc(1, sizeof(CmMmDynRegCb)); if(dynRegCb == NULLP) { - return RFAILED; + return RFAILED; } for(k = 0; k < mtDynMemoCfg.region[i].numBkts; k++) { - dynRegCb->bktSize[k] = mtGlobMemoCfg.bkt[k].blkSize; + dynRegCb->bktSize[k] = mtGlobMemoCfg.bkt[k].blkSize; } dynRegCb->region = i; cmMmDynRegInit(dynRegCb); - printf("iccHdl = %lx\n", (PTR)dynRegCb->iccHdl); + printf("\niccHdl = %lx\n", (PTR)dynRegCb->iccHdl); sleep(1); } - /* ysIccHdl = dynRegCb->iccHdl; */ + /* ysIccHdl = dynRegCb->iccHdl; */ #else /* Initialize the global region first */ @@ -1711,17 +1864,26 @@ S16 ssdInitMem() globReg = (CmMmGlobRegCb *)osCp.globRegCb; +#ifdef SS_USE_WLS_MEM + SAllocateWlsDynMem(); +#endif + for(i = 0; i < mtGlobMemoCfg.numBkts; i++) { memSize = (mtGlobMemoCfg.bkt[i].blkSize * mtGlobMemoCfg.bkt[i].numBlks); +#if !defined (INTEL_WLS) && defined (SS_USE_WLS_MEM) + globReg->bktTbl[i].startAddr = (Data *)mtDynMemSz[i].startAddr; + printf("\nStarting Address of Bkt Entry [%d]: [0x%016lx], memSize[%d]\n", i, (unsigned long int)globReg->bktTbl[i].startAddr, memSize); +#else #ifndef INTEL_WLS globReg->bktTbl[i].startAddr = (Data *)calloc(memSize, sizeof(Data)); #else globReg->bktTbl[i].startAddr = (Data *)mtRegMemSz[i].startAddr; +#endif #endif if(globReg->bktTbl[i].startAddr == NULLP) { - return RFAILED; + return RFAILED; } globReg->bktTbl[i].poolId = i; globReg->bktTbl[i].size = mtGlobMemoCfg.bkt[i].blkSize; @@ -1739,28 +1901,29 @@ S16 ssdInitMem() dynRegCb = (CmMmDynRegCb *)calloc(1, sizeof(CmMmDynRegCb)); if(dynRegCb == NULLP) { - return RFAILED; + return RFAILED; } for(k = 0; k < mtDynMemoCfg.region[i].numBkts; k++) { - if((mtDynMemoCfg.region[i].bkt[k].blkSetRelThreshold < - mtDynMemoCfg.region[i].bkt[k].blkSetAcquireThreshold) || - (mtDynMemoCfg.region[i].bkt[k].blkSetAcquireThreshold == 0) || - (mtDynMemoCfg.region[i].bkt[k].blkSetRelThreshold == 0)) - { + if((mtDynMemoCfg.region[i].bkt[k].blkSetRelThreshold < + mtDynMemoCfg.region[i].bkt[k].blkSetAcquireThreshold) || + (mtDynMemoCfg.region[i].bkt[k].blkSetAcquireThreshold == 0) || + (mtDynMemoCfg.region[i].bkt[k].blkSetRelThreshold == 0)) + { #ifdef XEON_SPECIFIC_CHANGES - free(dynRegCb); + free(dynRegCb); #endif - return RFAILED; - } - dynRegCb->bktTbl[k].size = mtGlobMemoCfg.bkt[k].blkSize; - dynRegCb->bktTbl[k].blkSetRelThreshold = mtDynMemoCfg.region[i].bkt[k].blkSetRelThreshold; - dynRegCb->bktTbl[k].blkSetAcquireThreshold = mtDynMemoCfg.region[i].bkt[k].blkSetAcquireThreshold; - dynRegCb->bktTbl[k].bucketSetSize = mtGlobMemoCfg.bkt[k].bucketSetSize; - if(dynRegCb->bktMaxBlkSize < dynRegCb->bktTbl[k].size) - { - dynRegCb->bktMaxBlkSize = dynRegCb->bktTbl[k].size; - } + return RFAILED; + } + dynRegCb->bktTbl[k].poolId = k; + dynRegCb->bktTbl[k].size = mtGlobMemoCfg.bkt[k].blkSize; + dynRegCb->bktTbl[k].blkSetRelThreshold = mtDynMemoCfg.region[i].bkt[k].blkSetRelThreshold; + dynRegCb->bktTbl[k].blkSetAcquireThreshold = mtDynMemoCfg.region[i].bkt[k].blkSetAcquireThreshold; + dynRegCb->bktTbl[k].bucketSetSize = mtGlobMemoCfg.bkt[k].bucketSetSize; + if(dynRegCb->bktMaxBlkSize < dynRegCb->bktTbl[k].size) + { + dynRegCb->bktMaxBlkSize = dynRegCb->bktTbl[k].size; + } } dynRegCb->region = i; dynRegCb->numBkts = mtDynMemoCfg.region[i].numBkts; @@ -1770,24 +1933,24 @@ S16 ssdInitMem() #endif /* SS_LOCKLESS_MEMORY */ #ifdef T2K_MEM_LEAK_DBG - uint8_t reg; - /* Initailize mem leak tool memorys for debguing */ - regMemLeakInfo.numActvRegions=0; - for(reg=0; reg vAddr); - free(mtCMMRegCb[k]); + sprintf(errMsg,"\n ssdInitMem(): Could not allocated memory \ + for the Region:%d control block\n",i); + SPrint(errMsg); + for (k = 0; k < i; k++) + { + cmMmRegDeInit(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]->vAddr); + free(mtCMMRegCb[k]); free(mtCMMRegCfg[k]); - } - return RFAILED; + } + return RFAILED; } mtCMMRegCfg[i] = (CmMmRegCfg *)calloc(1, sizeof(CmMmRegCfg)); @@ -1822,17 +1985,17 @@ S16 ssdInitMem() mlock(mtCMMRegCfg[i], sizeof(CmMmRegCfg)); #endif if (mtCMMRegCfg[i] == NULLP) - { - for (k = 0; k < i; k++) - { - cmMmRegDeInit(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]->vAddr); - free(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]); - } - free(mtCMMRegCb[i]); - return RFAILED; - } + { + for (k = 0; k < i; k++) + { + cmMmRegDeInit(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]->vAddr); + free(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]); + } + free(mtCMMRegCb[i]); + return RFAILED; + } /* allocate space for the region */ @@ -1840,23 +2003,23 @@ S16 ssdInitMem() mtCMMRegCfg[i]->size = region->heapsize; for (j = 0; j < region->numBkts; j++) { -/* mt033.201 - addition for including the header size while computing the total size */ + /* mt033.201 - addition for including the header size while computing the total size */ #ifdef SSI_DEBUG_LEVEL1 - mtCMMRegCfg[i]->size += (region->bkt[j].blkSize + sizeof(CmMmBlkHdr)) *\ - (region->bkt[j].numBlks); + mtCMMRegCfg[i]->size += (region->bkt[j].blkSize + sizeof(CmMmBlkHdr)) *\ + (region->bkt[j].numBlks); #else - mtCMMRegCfg[i]->size += region->bkt[j].blkSize * region->bkt[j].numBlks; + mtCMMRegCfg[i]->size += region->bkt[j].blkSize * region->bkt[j].numBlks; #endif /* SSI_DEBUG_LEVEL1 */ } #ifdef INTEL_WLS mtCMMRegCfg[i]->vAddr = (Data *)mtRegMemSz[i].startAddr; #else mtCMMRegCfg[i]->vAddr = (Data *)calloc(mtCMMRegCfg[i]->size, - sizeof(Data)); + sizeof(Data)); #endif #ifdef XEON_SPECIFIC_CHANGES CM_LOG_DEBUG(CM_LOG_ID_MT, "Static Region-->Bkt[%d] Addr:[%p] RegionId=[%d] Size=[%d] \n", - i, mtCMMRegCfg[i]->vAddr, region->regionId, mtCMMRegCfg[i]->size); + i, mtCMMRegCfg[i]->vAddr, region->regionId, mtCMMRegCfg[i]->size); #endif #ifdef TENB_RTLIN_CHANGES mlock(mtCMMRegCfg[i]->vAddr, mtCMMRegCfg[i]->size*sizeof(Data)); @@ -1864,19 +2027,19 @@ S16 ssdInitMem() if (mtCMMRegCfg[i]->vAddr == NULLP) { - sprintf(errMsg,"\n ssdInitMem(): Could not allocate memory \ - for the Region:%d \n",i); - SPrint(errMsg); - for (k = 0; k < i; k++) - { - cmMmRegDeInit(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]->vAddr); - free(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]); - } - free(mtCMMRegCb[i]); - free(mtCMMRegCfg[i]); - return RFAILED; + sprintf(errMsg,"\n ssdInitMem(): Could not allocate memory \ + for the Region:%d \n",i); + SPrint(errMsg); + for (k = 0; k < i; k++) + { + cmMmRegDeInit(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]->vAddr); + free(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]); + } + free(mtCMMRegCb[i]); + free(mtCMMRegCfg[i]); + return RFAILED; } @@ -1888,90 +2051,82 @@ S16 ssdInitMem() for (j = 0; j < region->numBkts; j++) { - mtCMMRegCfg[i]->bktCfg[j].size = region->bkt[j].blkSize; - mtCMMRegCfg[i]->bktCfg[j].numBlks = region->bkt[j].numBlks; + mtCMMRegCfg[i]->bktCfg[j].size = region->bkt[j].blkSize; + mtCMMRegCfg[i]->bktCfg[j].numBlks = region->bkt[j].numBlks; } /* initialize the CMM */ #ifdef SS_LOCKLESS_MEMORY if (cmMmStatRegInit(region->regionId, mtCMMRegCb[i], mtCMMRegCfg[i]) != ROK) #else - if (cmMmRegInit(region->regionId, mtCMMRegCb[i], mtCMMRegCfg[i]) != ROK) + if (cmMmRegInit(region->regionId, mtCMMRegCb[i], mtCMMRegCfg[i]) != ROK) #endif /* SS_LOCKLESS_MEMORY */ - { - for (k = 0; k < i; k++) - { - cmMmRegDeInit(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]->vAddr); - free(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]); - } - free(mtCMMRegCfg[i]->vAddr); - free(mtCMMRegCb[i]); - free(mtCMMRegCfg[i]); - return RFAILED; - } + { + for (k = 0; k < i; k++) + { + cmMmRegDeInit(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]->vAddr); + free(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]); + } + free(mtCMMRegCfg[i]->vAddr); + free(mtCMMRegCb[i]); + free(mtCMMRegCfg[i]); + return RFAILED; + } /* initialize the STREAMS module */ /* mt019.201: STREAMS module will only apply to DFLT_REGION */ if (region->regionId == 0) { - if (ssStrmCfg(region->regionId, region->regionId) != ROK) - { - for (k = 0; k < i; k++) - { - cmMmRegDeInit(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]->vAddr); - free(mtCMMRegCb[k]); - free(mtCMMRegCfg[k]); - } - cmMmRegDeInit(mtCMMRegCb[i]); - free(mtCMMRegCfg[i]->vAddr); - free(mtCMMRegCb[i]); - free(mtCMMRegCfg[i]); - return RFAILED; - } + if (ssStrmCfg(region->regionId, region->regionId) != ROK) + { + for (k = 0; k < i; k++) + { + cmMmRegDeInit(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]->vAddr); + free(mtCMMRegCb[k]); + free(mtCMMRegCfg[k]); + } + cmMmRegDeInit(mtCMMRegCb[i]); + free(mtCMMRegCfg[i]->vAddr); + free(mtCMMRegCb[i]); + free(mtCMMRegCfg[i]); + return RFAILED; + } } } -/* mt001.301 : Additions */ + /* mt001.301 : Additions */ #ifdef SS_MEM_LEAK_STS cmInitMemLeakMdl(); #endif /* SS_MEM_LEAK_STS */ - return ROK; } /* -* -* Fun: De-initialize region/pool tables -* -* Desc: This function reverses the initialization in ssdInitMem(). -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void ssdDeinitMem -( -void -) -#else -Void ssdDeinitMem() -#endif + * + * Fun: De-initialize region/pool tables + * + * Desc: This function reverses the initialization in ssdInitMem(). + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +Void ssdDeinitMem(void) { /* mt018.201 - added local variables */ uint8_t i; - /* mt008.301 Additions */ + /* mt008.301 Additions */ #ifdef SS_MEM_LEAK_STS - cmDeinitMemLeakMdl(); + cmDeinitMemLeakMdl(); #endif /* SS_MEM_LEAK_STS */ for (i = 0; i < mtMemoCfg.numRegions; i++) @@ -1987,37 +2142,30 @@ Void ssdDeinitMem() /* -* -* Fun: Initialize task table -* -* Desc: This function initializes MTSS-specific information -* in the task table. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitTsk -( -void -) -#else -S16 ssdInitTsk() -#endif + * + * Fun: Initialize task table + * + * Desc: This function initializes MTSS-specific information + * in the task table. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitTsk(void) { -/* mt001.301 : Additions */ -/*mt013.301 :Added SS_AFFINITY_SUPPORT */ + /* mt001.301 : Additions */ + /*mt013.301 :Added SS_AFFINITY_SUPPORT */ #if defined(SS_MULTICORE_SUPPORT) ||defined(SS_AFFINITY_SUPPORT) uint32_t tskInd = 0; #endif /* SS_MULTICORE_SUPPORT || SS_AFFINITY_SUPPORT */ -/*mt013.301 :Added SS_AFFINITY_SUPPORT */ + /*mt013.301 :Added SS_AFFINITY_SUPPORT */ #if defined(SS_MULTICORE_SUPPORT) || defined(SS_AFFINITY_SUPPORT) /* initialize system task information */ for (tskInd = 0; tskInd < SS_MAX_STSKS; tskInd++) @@ -2030,27 +2178,20 @@ S16 ssdInitTsk() /* -* -* Fun: Deinitialize task table -* -* Desc: This function reverses the initialization perfomed in -* ssdInitTsk(). -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void ssdDeinitTsk -( -void -) -#else -Void ssdDeinitTsk() -#endif + * + * Fun: Deinitialize task table + * + * Desc: This function reverses the initialization perfomed in + * ssdInitTsk(). + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +Void ssdDeinitTsk(void) { return; @@ -2059,27 +2200,20 @@ Void ssdDeinitTsk() #ifdef SS_DRVR_SUPPORT /* -* -* Fun: Initialize driver task table -* -* Desc: This function initializes MTSS-specific information -* in the driver task table. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitDrvr -( -void -) -#else -S16 ssdInitDrvr() -#endif + * + * Fun: Initialize driver task table + * + * Desc: This function initializes MTSS-specific information + * in the driver task table. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitDrvr(void) { S16 i; #ifndef L2_L3_SPLIT @@ -2119,7 +2253,7 @@ S16 ssdInitDrvr() } #endif - /*mt014.301 : 4GMX release related changes*/ + /*mt014.301 : 4GMX release related changes*/ #ifdef SS_4GMX_UCORE uarmDrvrInit(); #endif @@ -2137,37 +2271,30 @@ S16 ssdInitDrvr() /* -* -* Fun: Deinitialize driver information -* -* Desc: This function reverses the initialization performed in -* ssdInitDrvr(). -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void ssdDeinitDrvr -( -void -) -#else -Void ssdDeinitDrvr() -#endif + * + * Fun: Deinitialize driver information + * + * Desc: This function reverses the initialization performed in + * ssdInitDrvr(). + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +Void ssdDeinitDrvr(void) { - /* mt008.301: Terminate the Driver Task on exit */ - while(pthread_cancel(osCp.dep.isTskHdlrTID)); + /* mt008.301: Terminate the Driver Task on exit */ + while(pthread_cancel(osCp.dep.isTskHdlrTID)); #ifdef L2_L3_SPLIT - TL_Close(AppContext.hUAII); - if (clusterMode == RADIO_CLUSTER_MODE) - { + TL_Close(AppContext.hUAII); + if (clusterMode == RADIO_CLUSTER_MODE) + { TL_Close(AppContext.hUAII_second); - } + } #endif return; @@ -2176,31 +2303,24 @@ Void ssdDeinitDrvr() /* -* -* Fun: Initialize timer table -* -* Desc: This function initializes MTSS-specific information -* in the timer table. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitTmr -( -void -) -#else -S16 ssdInitTmr() -#endif + * + * Fun: Initialize timer table + * + * Desc: This function initializes MTSS-specific information + * in the timer table. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitTmr(void) { pthread_attr_t attr; struct sched_param param_sched; - /* mt010.21: addition */ + /* mt010.21: addition */ S32 i; #ifdef SS_MULTICORE_SUPPORT SsSTskEntry *sTsk; @@ -2212,7 +2332,7 @@ S16 ssdInitTmr() osCp.dep.tmrTqCp.tmrLen = SS_MAX_TMRS; - /* mt010.21: addition */ + /* mt010.21: addition */ osCp.dep.tmrTqCp.nxtEnt = 0; for (i=0; i< SS_MAX_TMRS; i++) { @@ -2249,15 +2369,15 @@ S16 ssdInitTmr() #endif if ((pthread_create(&osCp.dep.tmrHdlrTID, &attr, mtTmrHdlr, NULLP)) != 0) { - /* mt020.201 - Addition for destroying thread attribute object attr */ - pthread_attr_destroy(&attr); + /* mt020.201 - Addition for destroying thread attribute object attr */ + pthread_attr_destroy(&attr); - return RFAILED; + return RFAILED; } #ifdef SS_THR_REG_MAP threadCreated = ssCheckAndAddMemoryRegionMap(osCp.dep.tmrHdlrTID, - sTsk->region); + sTsk->region); } #endif /* SS_THR_REG_MAP */ #ifdef SS_MEM_WL_DEBUG @@ -2273,27 +2393,20 @@ S16 ssdInitTmr() /* -* -* Fun: Deinitialize timer table -* -* Desc: This function reverses the initialization performed in -* ssdInitTmr(). -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void ssdDeinitTmr -( -void -) -#else -Void ssdDeinitTmr() -#endif + * + * Fun: Deinitialize timer table + * + * Desc: This function reverses the initialization performed in + * ssdInitTmr(). + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +Void ssdDeinitTmr(void) { #ifdef SS_MULTICORE_SUPPORT SsSTskEntry *sTsk; @@ -2308,7 +2421,7 @@ Void ssdDeinitTmr() #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT008, (ErrVal) ret, - "Could not lock system task table"); + "Could not lock system task table"); #endif return; } @@ -2331,36 +2444,29 @@ Void ssdDeinitTmr() SUnlock(&osCp.sTskTblLock); #endif /* SS_MULTICORE_SUPPORT */ - /* mt008.301: Terminate the timer thread on exit */ - while(pthread_cancel(osCp.dep.tmrHdlrTID)); - return; + /* mt008.301: Terminate the timer thread on exit */ + while(pthread_cancel(osCp.dep.tmrHdlrTID)); + return; } /* -* -* Fun: ssdInitLog -* -* Desc: Pre-tst() initialization. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitLog -( -void -) -#else -S16 ssdInitLog() -#endif + * + * Fun: ssdInitLog + * + * Desc: Pre-tst() initialization. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitLog(void) { -/* mt027.201 - Modification to fix warnings with no STDIN and STDOUT */ + /* mt027.201 - Modification to fix warnings with no STDIN and STDOUT */ #ifdef CONAVL #ifndef CONRD S32 flags; @@ -2372,14 +2478,14 @@ S16 ssdInitLog() #endif /* CONRD */ #endif /* CONAVL */ -/* mt008.301: ssdInitFinal changed to ssdInitLog */ + /* mt008.301: ssdInitFinal changed to ssdInitLog */ #ifdef CONAVL osCp.dep.conInFp = (FILE *) stdin; osCp.dep.conOutFp = (FILE *) stdout; -/* added compile time flag CONRD: mt017.21 */ + /* added compile time flag CONRD: mt017.21 */ #ifndef CONRD #ifndef CONSTDIO @@ -2387,7 +2493,7 @@ S16 ssdInitLog() fd = fileno(osCp.dep.conInFp); if ((tcgetattr(fd, &tio)) != 0) { - printf("Error: disable canonical input processing\n"); + printf("\nError: disable canonical input processing\n"); return RFAILED; } @@ -2396,7 +2502,7 @@ S16 ssdInitLog() tio.c_cc[VTIME] = 0; if ((tcsetattr(fd, TCSANOW, &tio)) != 0) { - printf("Error: while tcsetattr() processing\n"); + printf("\nError: while tcsetattr() processing\n"); return RFAILED; } @@ -2409,7 +2515,7 @@ S16 ssdInitLog() flags &= ~O_NONBLOCK; if (fcntl(fd, F_SETFL, flags) == -1) { - printf("Error: while fcntl processing\n"); + printf("\nError: while fcntl processing\n"); return RFAILED; } @@ -2427,7 +2533,7 @@ S16 ssdInitLog() /* mt020.201 - Addition for destroying thread attribute object attr */ pthread_attr_destroy(&attr); - printf("Error: Logging Thread creation failed \n"); + printf("\nError: Logging Thread creation failed \n"); return RFAILED; } @@ -2443,34 +2549,27 @@ S16 ssdInitLog() /* -* -* Fun: ssdDeinitLog -* -* Desc: This function reverses the initialization performed in -* ssdInitLog(). -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ + * + * Fun: ssdDeinitLog + * + * Desc: This function reverses the initialization performed in + * ssdInitLog(). + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ /* mt008.301: ssdDeinitFinal changed to ssdDeinitLog */ -#ifdef ANSI -Void ssdDeinitLog -( -void -) -#else -Void ssdDeinitLog() -#endif +Void ssdDeinitLog(void) { -/* mt008.301: ssdDeinitFinal changed to ssdDeinitLog */ + /* mt008.301: ssdDeinitFinal changed to ssdDeinitLog */ #ifdef CONAVL #ifndef CONRD - /* mt008.301: Terminate the console reader on exit */ - while(pthread_cancel(osCp.dep.conHdlrTID)); + /* mt008.301: Terminate the console reader on exit */ + while(pthread_cancel(osCp.dep.conHdlrTID)); #endif /* CONRD */ #endif /* CONVAL */ @@ -2480,15 +2579,7 @@ Void ssdDeinitLog() #ifdef SS_WATCHDOG -#ifdef ANSI -S16 ssdInitWatchDog -( -uint16_t port -) -#else -S16 ssdInitWatchDog(port) -uint16_t port; -#endif +S16 ssdInitWatchDog(uint16_t port) { uint8_t idx; Txt prntBuf[PRNTSZE]; @@ -2579,7 +2670,7 @@ uint16_t port; #endif /* SS_WATCHDOG_IPV6 */ if(bind(osCp.wdCp.globWd.sock, (struct sockaddr *)&tmpaddr, sizeof(struct sockaddr)) != 0 -) + ) { sprintf(prntBuf,"ssdInitWatchDog: bind failed errno [%d]\n", errno); SPrint(prntBuf); @@ -2603,15 +2694,7 @@ uint16_t port; return ROK; } -#ifdef ANSI -S16 ssdInitWatchDgPst -( -Pst *pst -) -#else -S16 ssdInitWatchDgPst(pst) -Pst *pst; -#endif +S16 ssdInitWatchDgPst(Pst *pst) { pst->selector = SS_LOOSE_COUPLING; @@ -2631,25 +2714,14 @@ Pst *pst; } #ifdef SS_MULTIPLE_PROCS -#ifdef ANSI -S16 ssdWatchDgActvTmr -( -ProcId proc, -Ent ent, -Inst inst -) -#else -S16 ssdWatchDgActvTmr(proc, ent, inst) -#endif -#else -#ifdef ANSI -S16 ssdWatchDgActvTmr + S16 ssdWatchDgActvTmr ( -Void -) + ProcId proc, + Ent ent, + Inst inst + ) #else -S16 ssdWatchDgActvTmr() -#endif +S16 ssdWatchDgActvTmr(Void) #endif /* SS_MULTIPLE_PROCS */ { @@ -2658,19 +2730,13 @@ S16 ssdWatchDgActvTmr() return ROK; } -#ifdef ANSI -Void ssdWatchDgTmrEvt + Void ssdWatchDgTmrEvt ( -PTR cb, /* control block */ -S16 event /* timer number */ -) -#else -Void ssdWatchDgTmrEvt(cb, event) -PTR cb; /* control block */ -S16 event; /* timer number */ -#endif + PTR cb, /* control block */ + S16 event /* timer number */ + ) { -/* mt003.301 Fixed warings */ + /* mt003.301 Fixed warings */ #ifdef DEBUGP DateTime dt; #endif /* DEBUGP */ @@ -2683,54 +2749,47 @@ S16 event; /* timer number */ { case SS_TMR_HRTBT: #ifdef DEBUGP - SPrint("Timer Heartbeat Request Expired"); - SGetDateTime(&dt); - sprintf(prntBuf," Time: %02d:%02d:%02d\n",dt.hour,dt.min, dt.sec); - SPrint(prntBuf); -#endif - restartTmr=TRUE; - - SLock(&osCp.wdCp.wdLock); - for(i=0; i < osCp.wdCp.globWd.numNodes; i++) - { - if(osCp.wdCp.globWd.wdsta[i].status == 0) - { - sprintf(prntBuf, "Node [ %s ] Down. Calling user callback\n", inet_ntoa(osCp.wdCp.globWd.wdsta[i].addr)); - SPrint(prntBuf); - if(osCp.wdCp.globWd.callback != 0) - { - osCp.wdCp.globWd.callback(osCp.wdCp.globWd.data); - } - } - } - SUnlock(&osCp.wdCp.wdLock); - - if(!osCp.wdCp.globWd.watchdogStop) - { - ssdStartWatchDgTmr(NULLP, SS_TMR_HRTBT, osCp.wdCp.globWd.timeout); - ssdSndHrtBtMsg(restartTmr, SS_WD_HB_REQ); - } - break; + SPrint("Timer Heartbeat Request Expired"); + SGetDateTime(&dt); + sprintf(prntBuf," Time: %02d:%02d:%02d\n",dt.hour,dt.min, dt.sec); + SPrint(prntBuf); +#endif + restartTmr=TRUE; + + SLock(&osCp.wdCp.wdLock); + for(i=0; i < osCp.wdCp.globWd.numNodes; i++) + { + if(osCp.wdCp.globWd.wdsta[i].status == 0) + { + sprintf(prntBuf, "Node [ %s ] Down. Calling user callback\n", inet_ntoa(osCp.wdCp.globWd.wdsta[i].addr)); + SPrint(prntBuf); + if(osCp.wdCp.globWd.callback != 0) + { + osCp.wdCp.globWd.callback(osCp.wdCp.globWd.data); + } + } + } + SUnlock(&osCp.wdCp.wdLock); + + if(!osCp.wdCp.globWd.watchdogStop) + { + ssdStartWatchDgTmr(NULLP, SS_TMR_HRTBT, osCp.wdCp.globWd.timeout); + ssdSndHrtBtMsg(restartTmr, SS_WD_HB_REQ); + } + break; default: - break; + break; } } -#ifdef ANSI -Void ssdStartWatchDgTmr + Void ssdStartWatchDgTmr ( -void *cb, -S16 event, -uint16_t wait -) -#else -Void ssdStartWatchDgTmr(cb, event, wait) -void *cb; -S16 event; -uint16_t wait; -#endif + void *cb, + S16 event, + uint16_t wait + ) { CmTmrArg arg; int i; @@ -2740,7 +2799,7 @@ uint16_t wait; #endif - /* mt003.301 Modifications */ + /* mt003.301 Modifications */ #ifdef DEBUGP SGetDateTime(&dt); sprintf(prntBuf," Time: %02d:%02d:%02d\n",dt.hour,dt.min, dt.sec); @@ -2773,17 +2832,11 @@ uint16_t wait; return; } -#ifdef ANSI -Void ssdStopWatchDgTmr + Void ssdStopWatchDgTmr ( -void *cb, -S16 event -) -#else -Void ssdStopWatchDgTmr(cb, event) -void *cb; -S16 event; -#endif + void *cb, + S16 event + ) { CmTmrArg arg; #ifdef DEBUGP @@ -2792,7 +2845,7 @@ S16 event; int i; #endif - /* mt003.301 Modifications */ + /* mt003.301 Modifications */ #ifdef DEBUGP SGetDateTime(&dt); sprintf(prntBuf," Time: %02d:%02d:%02d\n",dt.hour,dt.min, dt.sec); @@ -2823,17 +2876,11 @@ S16 event; return; } -#ifdef ANSI -S16 ssdSndHrtBtMsg + S16 ssdSndHrtBtMsg ( -Bool restart, -uint32_t type -) -#else -S16 ssdSndHrtBtMsg(restart, type) -Bool restart; -uint32_t type; -#endif + Bool restart, + uint32_t type + ) { S16 ret = ROK; #ifdef DEBUGP @@ -2861,7 +2908,7 @@ uint32_t type; { if(osCp.wdCp.globWd.wdsta[n].addr.s_addr == 0) { - continue; + continue; } /* Identify the destination node */ @@ -2880,16 +2927,16 @@ uint32_t type; if(err == -1) { #ifdef DEBUGP - sprintf(prntBuf,"ssdSndHrtBtMsg: HB to node [%s:%d] failed status[%d]\n", - inet_ntoa(tmpaddr.sin_addr), tmpaddr.sin_port, errno); - SPrint(prntBuf); + sprintf(prntBuf,"ssdSndHrtBtMsg: HB to node [%s:%d] failed status[%d]\n", + inet_ntoa(tmpaddr.sin_addr), tmpaddr.sin_port, errno); + SPrint(prntBuf); #endif /* DEBUGP */ } else { #ifdef DEBUGP - sprintf(prntBuf,"ssdSndHrtBtMsg: HB to node [%s:%d] sent[%d]\n", inet_ntoa(tmpaddr.sin_addr), tmpaddr.sin_port, err); - SPrint(prntBuf); + sprintf(prntBuf,"ssdSndHrtBtMsg: HB to node [%s:%d] sent[%d]\n", inet_ntoa(tmpaddr.sin_addr), tmpaddr.sin_port, err); + SPrint(prntBuf); #endif /* DEBUGP */ } } @@ -2905,26 +2952,19 @@ uint32_t type; /* mt022.201 - Modification to fix problem when NOCMDLINE is defined */ #ifndef NOCMDLINE /* -* -* Fun: mtGetOpts -* -* Desc: This function gets command line options. -* -* Ret: -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -static Void mtGetOpts -( -void -) -#else -static Void mtGetOpts() -#endif + * + * Fun: mtGetOpts + * + * Desc: This function gets command line options. + * + * Ret: + * + * Notes: + * + * File: mt_ss.c + * + */ +static Void mtGetOpts(void) { S32 argc; S8 **argv; @@ -2934,7 +2974,7 @@ static Void mtGetOpts() FILE *memOpt; /* memory options file pointer */ Txt pBuf[128]; uint8_t i; -/* mt007.301 : Fix related to file based mem config on 64 bit machine */ + /* mt007.301 : Fix related to file based mem config on 64 bit machine */ PTR numReg; PTR numBkts; PTR bktSz = NULLP; @@ -2978,282 +3018,282 @@ static Void mtGetOpts() switch (ret) { #ifndef NOFILESYS -/* mt001.301 : Additions */ + /* mt001.301 : Additions */ #ifdef SS_MEM_LEAK_STS - case 'm': - cmMemOpenMemLkFile(msOptArg); - break; -#endif - case 'o': - osCp.dep.fileOutFp = fopen(msOptArg, "w"); - break; - case 'f': - fileBasedMemCfg = TRUE; - memOpt = fopen(msOptArg, "r"); - - /* if file does not exist or could not be opened then use the - * default memory configuration as defined in mt_ss.h - */ - if (memOpt == (FILE *) NULLP) - { - sprintf(pBuf, "\nMTSS: Memory configuration file: %s could not\ - be opened, using default mem configuration\n", msOptArg); - SPrint(pBuf); - break; - } - i = 0; - while (fgets((Txt *)line, 256, memOpt) != NULLP) - { - if(line[0] == '#' || line[0] < '0' || line[0] > '9') /* Comment line or non numeric character, so skip it and read next line */ - continue; - if(error == TRUE) - break; - switch (i) - { - case 0: /*** INPUT: Number of regions ***/ - sscanf(line, "%ld", (long *) &numReg); - mtMemoCfg.numRegions = numReg; - if(mtMemoCfg.numRegions > SS_MAX_REGS) - { - printf("\n No. of regions are > SS_MAX_REGS:%d \n",SS_MAX_REGS); - error = TRUE; - break; - } - i++; - break; - case 1: /*** INPUT: Number of buckets and number of Pools ***/ - sscanf(line, "%ld %ld", (long *) &numBkts, (long *) &numPools); - if(numBkts > MT_MAX_BKTS) - { - printf("\n No. of buckets are > MT_MAX_BKTS :%d \n",MT_MAX_BKTS); - error = TRUE; - break; - } - if(numPools > SS_MAX_POOLS_PER_REG) - { - printf("\n No. of pools are > SS_MAX_POOLS_PER_REG:%d \n",SS_MAX_POOLS_PER_REG); - error = TRUE; - break; - } - /* - * Delay updation from local variable to global - * structure of number of regions and heap data to - * counter error conditions present above. - */ - for(idx = 0; idx < cfgNumRegs; idx++) - { - mtMemoCfg.region[idx].numBkts = numBkts; - cfgRegInfo[idx].region = idx; - cfgRegInfo[idx].numPools = numPools; - /* - * Initialize the pool info as static type with size zero - */ - for(poolIdx = 0; poolIdx < numPools; poolIdx++) - { - cfgRegInfo[idx].pools[poolIdx].type = SS_POOL_STATIC; - cfgRegInfo[idx].pools[poolIdx].size = 0; - } - } - i++; - break; - case 2: /*** INPUT: Bucket Id and size of the bucket ***/ - if(bktUpdtCnt < numBkts) /* more set of bucket can be added */ - { - sscanf(line, "%ld %ld",(long *)&bktIdx, (long *) &bktSz); - } - if(bktIdx >= numBkts) - { - printf("\n Invalid Bucket Id, may be >= the No. of buckets:%ld\n",numBkts); - error = TRUE; - break; - - } - mtBktInfo[bktIdx].blkSize = bktSz; - bktUpdtCnt++; - if(bktUpdtCnt == numBkts) - { - i++; /*done reading bkt info, start reading individual region info*/ - bktUpdtCnt = 0; - } - break; - case 3: /*** INPUT: Region Id (ranges from 0 to numRegions-1) **/ - sscanf(line,"%ld",(long *) ®Id); - if(regId >= mtMemoCfg.numRegions) - { - printf("\n Invalid Region Id, may be >= the No. of regions:%d\n",mtMemoCfg.numRegions); + case 'm': + cmMemOpenMemLkFile(msOptArg); + break; +#endif + case 'o': + osCp.dep.fileOutFp = fopen(msOptArg, "w"); + break; + case 'f': + fileBasedMemCfg = TRUE; + memOpt = fopen(msOptArg, "r"); + + /* if file does not exist or could not be opened then use the + * default memory configuration as defined in mt_ss.h + */ + if (memOpt == (FILE *) NULLP) + { + sprintf(pBuf, "\nMTSS: Memory configuration file: %s could not\ + be opened, using default mem configuration\n", msOptArg); + SPrint(pBuf); + break; + } + i = 0; + while (fgets((Txt *)line, 256, memOpt) != NULLP) + { + if(line[0] == '#' || line[0] < '0' || line[0] > '9') /* Comment line or non numeric character, so skip it and read next line */ + continue; + if(error == TRUE) + break; + switch (i) + { + case 0: /*** INPUT: Number of regions ***/ + sscanf(line, "%ld", (long *) &numReg); + mtMemoCfg.numRegions = numReg; + if(mtMemoCfg.numRegions > SS_MAX_REGS) + { + printf("\n No. of regions are > SS_MAX_REGS:%d \n",SS_MAX_REGS); + error = TRUE; + break; + } + i++; + break; + case 1: /*** INPUT: Number of buckets and number of Pools ***/ + sscanf(line, "%ld %ld", (long *) &numBkts, (long *) &numPools); + if(numBkts > MT_MAX_BKTS) + { + printf("\n No. of buckets are > MT_MAX_BKTS :%d \n",MT_MAX_BKTS); + error = TRUE; + break; + } + if(numPools > SS_MAX_POOLS_PER_REG) + { + printf("\n No. of pools are > SS_MAX_POOLS_PER_REG:%d \n",SS_MAX_POOLS_PER_REG); + error = TRUE; + break; + } + /* + * Delay updation from local variable to global + * structure of number of regions and heap data to + * counter error conditions present above. + */ + for(idx = 0; idx < cfgNumRegs; idx++) + { + mtMemoCfg.region[idx].numBkts = numBkts; + cfgRegInfo[idx].region = idx; + cfgRegInfo[idx].numPools = numPools; + /* + * Initialize the pool info as static type with size zero + */ + for(poolIdx = 0; poolIdx < numPools; poolIdx++) + { + cfgRegInfo[idx].pools[poolIdx].type = SS_POOL_STATIC; + cfgRegInfo[idx].pools[poolIdx].size = 0; + } + } + i++; + break; + case 2: /*** INPUT: Bucket Id and size of the bucket ***/ + if(bktUpdtCnt < numBkts) /* more set of bucket can be added */ + { + sscanf(line, "%ld %ld",(long *)&bktIdx, (long *) &bktSz); + } + if(bktIdx >= numBkts) + { + printf("\n Invalid Bucket Id, may be >= the No. of buckets:%ld\n",numBkts); + error = TRUE; + break; + + } + mtBktInfo[bktIdx].blkSize = bktSz; + bktUpdtCnt++; + if(bktUpdtCnt == numBkts) + { + i++; /*done reading bkt info, start reading individual region info*/ + bktUpdtCnt = 0; + } + break; + case 3: /*** INPUT: Region Id (ranges from 0 to numRegions-1) **/ + sscanf(line,"%ld",(long *) ®Id); + if(regId >= mtMemoCfg.numRegions) + { + printf("\n Invalid Region Id, may be >= the No. of regions:%d\n",mtMemoCfg.numRegions); #ifndef XEON_SPECIFIC_CHANGES - error = TRUE; + error = TRUE; #endif - break; - } - mtMemoCfg.region[regId].regionId = regId; - i++; - break; - case 4: /*** INPUT: BktId (ranges from 0 to numBkts-1), No. of blks ***/ - if(bktUpdtCnt < numBkts) - { - sscanf(line, "%ld %ld",(long *)&bktIdx, (long *)&bktNum); - if(bktIdx >= numBkts) - { - printf("\n Invalid Bucket Id, may be >= the No. of buckets:%ld\n",numBkts); - error = TRUE; - break; - - } - if(bktIdx < MT_MAX_BKTS) - { - mtMemoCfg.region[regId].bkt[bktIdx].blkSize = mtBktInfo[bktIdx].blkSize; - mtMemoCfg.region[regId].bkt[bktIdx].numBlks = bktNum; - cfgRegInfo[regId].pools[bktIdx].type = SS_POOL_DYNAMIC; - cfgRegInfo[regId].pools[bktIdx].size = mtBktInfo[bktIdx].blkSize - (sizeof(SsMblk)+sizeof(SsDblk)); - } - bktUpdtCnt++; - if(bktUpdtCnt == numBkts) - { - i++; - bktUpdtCnt = 0; - } - } - break; - case 5: /* INPUT: Heapsize ***/ - sscanf(line, "%ld", (long *) &heapSz); - mtMemoCfg.region[regId].heapsize = heapSz; - regUpdtCnt++; - if(regUpdtCnt != mtMemoCfg.numRegions) - { - i = 3; - } - else - { - i++; - } - break; + break; + } + mtMemoCfg.region[regId].regionId = regId; + i++; + break; + case 4: /*** INPUT: BktId (ranges from 0 to numBkts-1), No. of blks ***/ + if(bktUpdtCnt < numBkts) + { + sscanf(line, "%ld %ld",(long *)&bktIdx, (long *)&bktNum); + if(bktIdx >= numBkts) + { + printf("\n Invalid Bucket Id, may be >= the No. of buckets:%ld\n",numBkts); + error = TRUE; + break; + + } + if(bktIdx < MT_MAX_BKTS) + { + mtMemoCfg.region[regId].bkt[bktIdx].blkSize = mtBktInfo[bktIdx].blkSize; + mtMemoCfg.region[regId].bkt[bktIdx].numBlks = bktNum; + cfgRegInfo[regId].pools[bktIdx].type = SS_POOL_DYNAMIC; + cfgRegInfo[regId].pools[bktIdx].size = mtBktInfo[bktIdx].blkSize - (sizeof(SsMblk)+sizeof(SsDblk)); + } + bktUpdtCnt++; + if(bktUpdtCnt == numBkts) + { + i++; + bktUpdtCnt = 0; + } + } + break; + case 5: /* INPUT: Heapsize ***/ + sscanf(line, "%ld", (long *) &heapSz); + mtMemoCfg.region[regId].heapsize = heapSz; + regUpdtCnt++; + if(regUpdtCnt != mtMemoCfg.numRegions) + { + i = 3; + } + else + { + i++; + } + break; #ifdef SS_LOCKLESS_MEMORY - case 6: - sscanf(line, "%ld", (long *) &numBkts); - mtGlobMemoCfg.numBkts = numBkts; + case 6: + sscanf(line, "%ld", (long *) &numBkts); + mtGlobMemoCfg.numBkts = numBkts; #ifndef XEON_SPECIFIC_CHANGES - mtDynMemoCfg.numRegions = mtMemoCfg.numRegions; + mtDynMemoCfg.numRegions = mtMemoCfg.numRegions; #endif #ifdef XEON_SPECIFIC_CHANGES - CM_LOG_DEBUG(CM_LOG_ID_MT, "numRegions = %d numBkts = %d\n", - mtDynMemoCfg.numRegions, mtGlobMemoCfg.numBkts); - for(idx = 0; idx < mtDynMemoCfg.numRegions; idx++) + CM_LOG_DEBUG(CM_LOG_ID_MT, "numRegions = %d numBkts = %d\n", + mtDynMemoCfg.numRegions, mtGlobMemoCfg.numBkts); + for(idx = 0; idx < mtDynMemoCfg.numRegions; idx++) #else - for(idx = 0; idx < mtMemoCfg.numRegions; idx++) + for(idx = 0; idx < mtMemoCfg.numRegions; idx++) #endif - { - mtDynMemoCfg.region[idx].regionId = idx; - mtDynMemoCfg.region[idx].numBkts = numBkts; - } - - bktUpdtCnt = 0; - i++; - break; - - case 7: - if(bktUpdtCnt < numBkts) - { - sscanf(line, "%ld %ld %ld %ld %ld %ld", (long *) &bktIdx, - (long *) &bktSz, (long *) &bktNum, - (long *) &bktSetSize, (long *) &bktRelThr, - (long *) &bktAqurThr); - /* Klock work fix ccpu00148484 */ - if(bktIdx < SS_MAX_POOLS_PER_REG) - { - mtGlobMemoCfg.bkt[bktIdx].blkSize = bktSz; - mtGlobMemoCfg.bkt[bktIdx].numBlks = bktNum; - mtGlobMemoCfg.bkt[bktIdx].bucketSetSize = bktSetSize; + { + mtDynMemoCfg.region[idx].regionId = idx; + mtDynMemoCfg.region[idx].numBkts = numBkts; + } + + bktUpdtCnt = 0; + i++; + break; + + case 7: + if(bktUpdtCnt < numBkts) + { + sscanf(line, "%ld %ld %ld %ld %ld %ld", (long *) &bktIdx, + (long *) &bktSz, (long *) &bktNum, + (long *) &bktSetSize, (long *) &bktRelThr, + (long *) &bktAqurThr); + /* Klock work fix ccpu00148484 */ + if(bktIdx < SS_MAX_POOLS_PER_REG) + { + mtGlobMemoCfg.bkt[bktIdx].blkSize = bktSz; + mtGlobMemoCfg.bkt[bktIdx].numBlks = bktNum; + mtGlobMemoCfg.bkt[bktIdx].bucketSetSize = bktSetSize; #ifdef XEON_SPECIFIC_CHANGES - CM_LOG_DEBUG(CM_LOG_ID_MT, "Pool [%d] blkSize %d numBlks %d bucketSetSize %d\n", - bktUpdtCnt, mtGlobMemoCfg.bkt[bktIdx].blkSize, - mtGlobMemoCfg.bkt[bktIdx].numBlks, mtGlobMemoCfg.bkt[bktIdx].bucketSetSize); + CM_LOG_DEBUG(CM_LOG_ID_MT, "Pool [%d] blkSize %d numBlks %d bucketSetSize %d\n", + bktUpdtCnt, mtGlobMemoCfg.bkt[bktIdx].blkSize, + mtGlobMemoCfg.bkt[bktIdx].numBlks, mtGlobMemoCfg.bkt[bktIdx].bucketSetSize); - if(bktIdx >= SS_MAX_POOLS_PER_REG) - { - printf("\nNo. of Buckets/pools are > SS_MAX_POOLS_PER_REG:%d\n",SS_MAX_POOLS_PER_REG); - error = TRUE; - break; - } + if(bktIdx >= SS_MAX_POOLS_PER_REG) + { + printf("\nNo. of Buckets/pools are > SS_MAX_POOLS_PER_REG:%d\n",SS_MAX_POOLS_PER_REG); + error = TRUE; + break; + } #endif - for(idx = 0; idx < mtMemoCfg.numRegions; idx++) - { - mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetRelThreshold = bktRelThr; - mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetAcquireThreshold = bktAqurThr; + for(idx = 0; idx < mtMemoCfg.numRegions; idx++) + { + mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetRelThreshold = bktRelThr; + mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetAcquireThreshold = bktAqurThr; #ifdef XEON_SPECIFIC_CHANGES - CM_LOG_DEBUG(CM_LOG_ID_MT, "Pool [%d] blkSetRelThreshold %d blkSetAcquireThreshold %d\n", - bktUpdtCnt, mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetRelThreshold, - mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetAcquireThreshold); + CM_LOG_DEBUG(CM_LOG_ID_MT, "Pool [%d] blkSetRelThreshold %d blkSetAcquireThreshold %d\n", + bktUpdtCnt, mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetRelThreshold, + mtDynMemoCfg.region[idx].bkt[bktIdx].blkSetAcquireThreshold); #endif - } - } - bktUpdtCnt++; - } + } + } + bktUpdtCnt++; + } #ifdef XEON_SPECIFIC_CHANGES - if(bktUpdtCnt == numBkts) - { - i=8; - } - break; - - case 8: /* INPUT: Global Heapsize ***/ - sscanf(line, "%ld", (long *) &heapSz); - mtGlobMemoCfg.heapSize = heapSz; - CM_LOG_DEBUG(CM_LOG_ID_MT, "Global Heap size = %d\n", mtGlobMemoCfg.heapSize); + if(bktUpdtCnt == numBkts) + { + i=8; + } + break; + + case 8: /* INPUT: Global Heapsize ***/ + sscanf(line, "%ld", (long *) &heapSz); + mtGlobMemoCfg.heapSize = heapSz; + CM_LOG_DEBUG(CM_LOG_ID_MT, "Global Heap size = %d\n", mtGlobMemoCfg.heapSize); #endif - break; + break; #endif - } - } - if(error == TRUE) - { - memConfigured = FALSE; - } - else - { - memConfigured = TRUE; - } - fclose (memOpt); - break; + } + } + if(error == TRUE) + { + memConfigured = FALSE; + } + else + { + memConfigured = TRUE; + } + fclose (memOpt); + break; #endif - case 's': -/* mt028.201: modification: multiple procs support related changes */ + case 's': + /* mt028.201: modification: multiple procs support related changes */ #ifndef SS_MULTIPLE_PROCS #ifdef ENB_RELAY - osCp.procId = PID_STK((ProcId) strtol(msOptArg, NULLP, 0)); + osCp.procId = PID_STK((ProcId) strtol(msOptArg, NULLP, 0)); #else - osCp.procId = (ProcId) strtol(msOptArg, NULLP, 0); + osCp.procId = (ProcId) strtol(msOptArg, NULLP, 0); #endif #else /* SS_MULTIPLE_PROCS */ - { - ProcId procId; + { + ProcId procId; #ifdef ENB_RELAY - procId = PID_STK((ProcId) strtol(msOptArg, NULLP, 0)); + procId = PID_STK((ProcId) strtol(msOptArg, NULLP, 0)); #else - procId = (ProcId) strtol(msOptArg, NULLP, 0); + procId = (ProcId) strtol(msOptArg, NULLP, 0); #endif - SAddProcIdLst(1, &procId); - } + SAddProcIdLst(1, &procId); + } #endif /* SS_MULTIPLE_PROCS */ - break; + break; - case 'c': - osCp.configFilePath = msOptArg; - break; + case 'c': + osCp.configFilePath = msOptArg; + break; - case '?': - /* fall through */ + case '?': + /* fall through */ - default: - break; + default: + break; } } @@ -3266,54 +3306,47 @@ static Void mtGetOpts() /* -* -* Fun: SGetOpt -* -* Desc: Get options from command line -* -* Ret: option - success -* '?' - fail -* EOF - end of options -* -* Notes: Handles command lines like the following -* -* if opts = "abc:d" -* then command line should look like this... -* -a foo -b foo1 -c -d foo -* -* code usage: -* -* while ((ret = SGetOpt(msArgc, msArgv, "ls")) != EOF ) -* { -* switch(ret) -* { -* case 'l': -* nloops = atoi(msArgv[msOptInd]); -* break; -* case 's': -* state1 = atoi(msArgv[msOptInd]); -* case '?': -* default: -* break; -* } -* } -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetOpt + * + * Fun: SGetOpt + * + * Desc: Get options from command line + * + * Ret: option - success + * '?' - fail + * EOF - end of options + * + * Notes: Handles command lines like the following + * + * if opts = "abc:d" + * then command line should look like this... + * -a foo -b foo1 -c -d foo + * + * code usage: + * + * while ((ret = SGetOpt(msArgc, msArgv, "ls")) != EOF ) + * { + * switch(ret) + * { + * case 'l': + * nloops = atoi(msArgv[msOptInd]); + * break; + * case 's': + * state1 = atoi(msArgv[msOptInd]); + * case '?': + * default: + * break; + * } + * } + * + * File: mt_ss.c + * + */ + S16 SGetOpt ( -int argc, /* argument count */ -char **argv, /* argument value */ -char *opts /* options */ -) -#else -S16 SGetOpt(argc, argv, opts) -int argc; /* argument count */ -char **argv; /* argument value */ -char *opts; /* options */ -#endif + int argc, /* argument count */ + char **argv, /* argument value */ + char *opts /* options */ + ) { /* mt020.201 - Removed for no command line */ #ifndef NOCMDLINE @@ -3335,23 +3368,23 @@ char *opts; /* options */ sp = 1; if (sp == 1) { - /*mt013.301 : Changes as per coding standards*/ + /*mt013.301 : Changes as per coding standards*/ if (msOptInd >= (S16) argc || argv[msOptInd][0] == '\0') { - return (EOF); + return (EOF); } else { - if (!strcmp(argv[msOptInd], "--")) - { - msOptInd++; - return (EOF); - } - else if (argv[msOptInd][0] != '-') - { - msOptInd++; - return ('?'); - } + if (!strcmp(argv[msOptInd], "--")) + { + msOptInd++; + return (EOF); + } + else if (argv[msOptInd][0] != '-') + { + msOptInd++; + return ('?'); + } } } @@ -3360,8 +3393,8 @@ char *opts; /* options */ { if (argv[msOptInd][++sp] == '\0') { - msOptInd++; - sp = 1; + msOptInd++; + sp = 1; } return ('?'); @@ -3372,22 +3405,22 @@ char *opts; /* options */ if (argv[msOptInd][sp+1] != '\0') msOptArg = &argv[msOptInd++][sp+1]; else { - if (++msOptInd >= (S16) argc) - { - sp = 1; - return ('?'); - } - else msOptArg = argv[msOptInd++]; + if (++msOptInd >= (S16) argc) + { + sp = 1; + return ('?'); + } + else msOptArg = argv[msOptInd++]; - sp = 1; + sp = 1; } } else { if (argv[msOptInd][++sp] == '\0') { - sp = 1; - msOptInd++; + sp = 1; + msOptInd++; } msOptArg = NULLP; @@ -3401,28 +3434,21 @@ char *opts; /* options */ /* -* -* Fun: ssdStart -* -* Desc: This function starts system services execution; the -* permanent tasks are started and the system enters a -* ready state. -* -* Ret: Void -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void ssdStart -( -void -) -#else -Void ssdStart() -#endif + * + * Fun: ssdStart + * + * Desc: This function starts system services execution; the + * permanent tasks are started and the system enters a + * ready state. + * + * Ret: Void + * + * Notes: + * + * File: mt_ss.c + * + */ +Void ssdStart(void) { S16 i; @@ -3441,33 +3467,28 @@ Void ssdStart() /* -* indirect interface functions to system services service user -*/ + * indirect interface functions to system services service user + */ /* -* -* Fun: ssdAttachTTsk -* -* Desc: This function sends the initial tick message to a TAPA -* task if the task is a permanent task. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdAttachTTsk + * + * Fun: ssdAttachTTsk + * + * Desc: This function sends the initial tick message to a TAPA + * task if the task is a permanent task. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 ssdAttachTTsk ( -SsTTskEntry *tTsk /* pointer to TAPA task entry */ -) -#else -S16 ssdAttachTTsk(tTsk) -SsTTskEntry *tTsk; /* pointer to TAPA task entry */ -#endif + SsTTskEntry *tTsk /* pointer to TAPA task entry */ + ) { Buffer *mBuf; SsMsgInfo *mInfo; @@ -3482,16 +3503,16 @@ SsTTskEntry *tTsk; /* pointer to TAPA task entry */ if (ret != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT001, ret, "SGetMsg() failed"); + MTLOGERROR(ERRCLS_DEBUG, EMT001, ret, "SGetMsg() failed"); #endif - return RFAILED; + return RFAILED; } mInfo = (SsMsgInfo *)mBuf->b_rptr; mInfo->eventInfo.event = SS_EVNT_PERMTICK; /* set up post structure */ -/* mt028.201: modification: multiple procs support related changes */ + /* mt028.201: modification: multiple procs support related changes */ #ifndef SS_MULTIPLE_PROCS mInfo->pst.dstProcId = SFndProcId(); mInfo->pst.srcProcId = SFndProcId(); @@ -3511,17 +3532,17 @@ SsTTskEntry *tTsk; /* pointer to TAPA task entry */ mInfo->pst.srcInst = tTsk->inst; ret = ssDmndQPutLast(&tTsk->sTsk->dQ, mBuf, - (tTsk->tskPrior * SS_MAX_MSG_PRI) + PRIOR3); + (tTsk->tskPrior * SS_MAX_MSG_PRI) + PRIOR3); if (ret != ROK) { - SPutMsg(mBuf); + SPutMsg(mBuf); #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT002, ret, - "Could not write to demand queue"); + MTLOGERROR(ERRCLS_DEBUG, EMT002, ret, + "Could not write to demand queue"); #endif - return RFAILED; + return RFAILED; } } @@ -3531,27 +3552,22 @@ SsTTskEntry *tTsk; /* pointer to TAPA task entry */ /* -* -* Fun: ssdDetachTTsk -* -* Desc: Does nothing. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdDetachTTsk + * + * Fun: ssdDetachTTsk + * + * Desc: Does nothing. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 ssdDetachTTsk ( -SsTTskEntry *tTsk /* pointer to TAPA task entry */ -) -#else -S16 ssdDetachTTsk(tTsk) -SsTTskEntry *tTsk; /* pointer to TAPA task entry */ -#endif + SsTTskEntry *tTsk /* pointer to TAPA task entry */ + ) { return ROK; @@ -3559,28 +3575,23 @@ SsTTskEntry *tTsk; /* pointer to TAPA task entry */ /* -* -* Fun: ssdCreateSTsk -* -* Desc: This function creates a system task. A thread is started -* on the system task handler function defined later. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdCreateSTsk + * + * Fun: ssdCreateSTsk + * + * Desc: This function creates a system task. A thread is started + * on the system task handler function defined later. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 ssdCreateSTsk ( -SsSTskEntry *sTsk /* pointer to system task entry */ -) -#else -S16 ssdCreateSTsk(sTsk) -SsSTskEntry *sTsk; /* pointer to system task entry */ -#endif + SsSTskEntry *sTsk /* pointer to system task entry */ + ) { S16 ret; pthread_attr_t attr; @@ -3593,23 +3604,23 @@ SsSTskEntry *sTsk; /* pointer to system task entry */ #ifdef SS_SINGLE_THREADED -/* mt001.301 : Additions */ + /* mt001.301 : Additions */ #ifndef SS_WATCHDOG #ifdef SS_MULTICORE_SUPPORT if (osCp.numSTsks > 1) #else - if (osCp.numSTsks > 0) + if (osCp.numSTsks > 0) #endif /* SS_MULTICORE_SUPPORT */ #else #ifdef SS_MULTICORE_SUPPORT - if (osCp.numSTsks > 3) + if (osCp.numSTsks > 3) #else - if (osCp.numSTsks > 2) + if (osCp.numSTsks > 2) #endif /* SS_MULTICORE_SUPPORT */ #endif /* SS_WATCHDOG */ - { - return ROK; - } + { + return ROK; + } #endif @@ -3624,11 +3635,11 @@ SsSTskEntry *sTsk; /* pointer to system task entry */ pthread_attr_init(&attr); ssdSetPthreadAttr(sTsk->tskPrior, &attr); - printf("Creating thread here %s %d\n", __FILE__, __LINE__); + printf("\nCreating thread here %s %d\n", __FILE__, __LINE__); #ifdef TENB_T2K3K_SPECIFIC_CHANGES if (sTsk->tskPrior == 0) { - printf("Creating RT thread #######################\n"); + printf("\nCreating RT thread #######################\n"); #ifdef SS_THR_REG_MAP /* When the thread is created, we check for the memory mapping table if * threadId can be placed in thread memory map table. If it is not able to place @@ -3639,21 +3650,21 @@ SsSTskEntry *sTsk; /* pointer to system task entry */ while(threadCreated == FALSE) { #endif - ret = pthread_create(&sTsk->dep.tId, &attr, mtTskHdlr, (Ptr)sTsk); - if (ret != 0) - { - DU_LOG("\nDU APP : Failed to create thread. Cause[%d]",ret); - pthread_attr_destroy(&attr); + ret = pthread_create(&sTsk->dep.tId, &attr, mtTskHdlr, (Ptr)sTsk); + if (ret != 0) + { + DU_LOG("\nDU APP : Failed to create thread. Cause[%d]",ret); + pthread_attr_destroy(&attr); #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT004, ERRZERO, "Could not create thread"); + MTLOGERROR(ERRCLS_DEBUG, EMT004, ERRZERO, "Could not create thread"); #endif - return RFAILED; - } + return RFAILED; + } #ifdef SS_THR_REG_MAP - threadCreated = ssCheckAndAddMemoryRegionMap(sTsk->dep.tId, - sTsk->region); + threadCreated = ssCheckAndAddMemoryRegionMap(sTsk->dep.tId, + sTsk->region); } #endif } @@ -3670,32 +3681,32 @@ SsSTskEntry *sTsk; /* pointer to system task entry */ while(threadCreated == FALSE) { #endif - ret = pthread_create(&sTsk->dep.tId, &attr, mtTskHdlr, (Ptr)sTsk); - if (ret != 0) - { + ret = pthread_create(&sTsk->dep.tId, &attr, mtTskHdlr, (Ptr)sTsk); + if (ret != 0) + { - /* mt020.201 - Addition for destroying thread attribute object attr */ - pthread_attr_destroy(&attr); + /* mt020.201 - Addition for destroying thread attribute object attr */ + pthread_attr_destroy(&attr); #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT004, ERRZERO, "Could not create thread"); + MTLOGERROR(ERRCLS_DEBUG, EMT004, ERRZERO, "Could not create thread"); #endif - return RFAILED; - } + return RFAILED; + } #ifdef SS_THR_REG_MAP - threadCreated = ssCheckAndAddMemoryRegionMap(sTsk->dep.tId, - sTsk->region); + threadCreated = ssCheckAndAddMemoryRegionMap(sTsk->dep.tId, + sTsk->region); } #endif } -/*mt013.301 :Added SS_AFFINITY_SUPPORT */ + /*mt013.301 :Added SS_AFFINITY_SUPPORT */ #if defined(SS_MULTICORE_SUPPORT) ||defined(SS_AFFINITY_SUPPORT) { - static uint32_t stLwpId = 3; - sTsk->dep.lwpId = ++stLwpId; + static uint32_t stLwpId = 3; + sTsk->dep.lwpId = ++stLwpId; } #endif /* SS_MULTICORE_SUPPORT || SS_AFFINITY_SUPPORT */ @@ -3706,21 +3717,13 @@ SsSTskEntry *sTsk; /* pointer to system task entry */ } -#ifdef ANSI -int SCreatePThread + int SCreatePThread ( -pthread_t* tid, -pthread_attr_t* attr, -void *(*start_routine) (void *), -void* arg -) -#else -int SCreatePThread(tid, attr, start_routine, arg) -pthread_t* tid; -pthread_attr_t* attr; -void *(*start_routine) (void *); -void* arg; -#endif + pthread_t* tid, + pthread_attr_t* attr, + void *(*start_routine) (void *), + void* arg + ) { int retVal = 0; #ifdef SS_THR_REG_MAP @@ -3735,9 +3738,9 @@ void* arg; } threadArg->argument = arg; threadArg->start_routine = start_routine; - - printf("Creating thread here %s %d\n", __FILE__, __LINE__); + + printf("\nCreating thread here %s %d\n", __FILE__, __LINE__); { #ifdef SS_THR_REG_MAP /* When the thread is created, we check for the memory mapping table if @@ -3749,14 +3752,14 @@ void* arg; while(threadCreated == FALSE) { #endif - /*pthreadCreateHdlr */ - if (((retVal = pthread_create(tid, attr, pthreadCreateHdlr, threadArg))) != 0) - { + /*pthreadCreateHdlr */ + if (((retVal = pthread_create(tid, attr, pthreadCreateHdlr, threadArg))) != 0) + { - return (retVal); - } + return (retVal); + } #ifdef SS_THR_REG_MAP - threadCreated = ssCheckAndAddMemoryRegionMap(*tid, SS_MAX_REGS - 1); + threadCreated = ssCheckAndAddMemoryRegionMap(*tid, SS_MAX_REGS - 1); } #endif } @@ -3766,31 +3769,25 @@ void* arg; /* -* -* Fun: Set Pthread Attributes -* -* Desc: This function is used to set various explicit -* pthread attributes like, priority scheduling,etc -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ - -#ifdef ANSI -static S16 ssdSetPthreadAttr + * + * Fun: Set Pthread Attributes + * + * Desc: This function is used to set various explicit + * pthread attributes like, priority scheduling,etc + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ + + static S16 ssdSetPthreadAttr ( -S32 tskPrior, -pthread_attr_t *attr -) -#else -static S16 ssdSetPthreadAttr(sTsk, attr) -S32 tskPrior, -pthread_attr_t *attr -#endif + S32 tskPrior, + pthread_attr_t *attr + ) { struct sched_param param; @@ -3807,18 +3804,18 @@ pthread_attr_t *attr /* TODO:: This can be avoided by reducing the priority * of iccserv thread in l1_master.sh*/ #ifdef L2_L3_SPLIT - if (clusterMode == RADIO_CLUSTER_MODE) - { - if(tskPrior == PRIOR1) - {/* DL RLC */ - param.sched_priority = 91; - } - } + if (clusterMode == RADIO_CLUSTER_MODE) + { + if(tskPrior == PRIOR1) + {/* DL RLC */ + param.sched_priority = 91; + } + } #endif #endif - printf("Set priority %u\n", param.sched_priority); + printf("\nSet priority %u\n", param.sched_priority); /* Set Scheduler to explicit, without this non of the below pthread attr works */ @@ -3843,32 +3840,26 @@ pthread_attr_t *attr #if defined(SS_MULTICORE_SUPPORT) ||defined(SS_AFFINITY_SUPPORT) /* -* -* Fun: Get the current core/cpu affinity for a thread/lwp -* -* Desc: This function is used to get the current processor/core -* affinity for a a system task (thread/lwp). It sets the -* affinity based on the mode supplied by the caller. -* -* Ret: ROK - ok -* RFAILED - failed, general (optional) -* -* Notes: -* -* File: ss_task.c -* -*/ -#ifdef ANSI -S16 ssdGetAffinity + * + * Fun: Get the current core/cpu affinity for a thread/lwp + * + * Desc: This function is used to get the current processor/core + * affinity for a a system task (thread/lwp). It sets the + * affinity based on the mode supplied by the caller. + * + * Ret: ROK - ok + * RFAILED - failed, general (optional) + * + * Notes: + * + * File: ss_task.c + * + */ + S16 ssdGetAffinity ( -SSTskId *tskId, /* filled in with system task ID */ -uint32_t *coreId /* the core/processor id to which the affinity is set */ -) -#else -S16 ssdGetAffinity(tskId, coreId) -SSTskId *tskId; /* filled in with system task ID */ -uint32_t *coreId; /* the core/processor id to which the affinity is set */ -#endif + SSTskId *tskId, /* filled in with system task ID */ + uint32_t *coreId /* the core/processor id to which the affinity is set */ + ) { uint32_t tskInd; @@ -3889,16 +3880,16 @@ uint32_t *coreId; /* the core/processor id to which the affin { if (osCp.sTskTbl[tskInd].tskId == *tskId) { - tId = osCp.sTskTbl[tskInd].dep.tId; - break; + tId = osCp.sTskTbl[tskInd].dep.tId; + break; } /* end if */ } /* end for */ /* if tskId is not found in the tskTbl */ if (tskInd == SS_MAX_STSKS) { - MTLOGERROR(ERRCLS_DEBUG, EMT036, ERRZERO, "Invalid system task Id\n"); - return RFAILED; + MTLOGERROR(ERRCLS_DEBUG, EMT036, ERRZERO, "Invalid system task Id\n"); + return RFAILED; } @@ -3906,21 +3897,21 @@ uint32_t *coreId; /* the core/processor id to which the affin CPU_ZERO( &cpuSet); /* set thread affinity for linux */ - if (pthread_getaffinity_np(tId, sizeof(cpuSet), &cpuSet) < 0) - { + if (pthread_getaffinity_np(tId, sizeof(cpuSet), &cpuSet) < 0) + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT037, ERRZERO, "Could not get thread affinity\n"); + MTLOGERROR(ERRCLS_DEBUG, EMT037, ERRZERO, "Could not get thread affinity\n"); #endif - return RFAILED; - } /* end if pthread_setaffinity fails */ + return RFAILED; + } /* end if pthread_setaffinity fails */ for (cpuInd = 0; cpuInd ent; inst = tTsk->inst; - /* We check the sTsk element; if it is not NULLP, the - * task is attached. So we have to detach it before - * deregistering the task. - */ + /* We check the sTsk element; if it is not NULLP, the + * task is attached. So we have to detach it before + * deregistering the task. + */ ret = SLock(&osCp.sTskTblLock); if (ret != ROK) { - MTLOGERROR(ERRCLS_DEBUG, EMTXXX, ERRZERO, "Could not lock system task table"); - return RFAILED; + MTLOGERROR(ERRCLS_DEBUG, EMTXXX, ERRZERO, "Could not lock system task table"); + return RFAILED; } - SS_ACQUIRE_ALL_SEMA(&osCp.tTskTblSem, ret); + SS_ACQUIRE_ALL_SEMA(&osCp.tTskTblSem, ret); if (ret != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) @@ -4598,8 +4518,8 @@ SsIdx idx; if ( SUnlock(&osCp.sTskTblLock) != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMTXXX, ERRZERO, "Could not Unlock system task table"); - return RFAILED; + MTLOGERROR(ERRCLS_DEBUG, EMTXXX, ERRZERO, "Could not Unlock system task table"); + return RFAILED; #endif } @@ -4612,14 +4532,14 @@ SsIdx idx; { #ifndef USE_MEMCAL (Void)(*(tTsk->initTsk))(proc, ent, inst, - DFLT_REGION, - NRM_TERM, - &(osCp.tTskTbl[idx].xxCb)); + DFLT_REGION, + NRM_TERM, + &(osCp.tTskTbl[idx].xxCb)); #else (Void)(*(tTsk->initTsk))(proc, ent, inst, - SS_STATIC_REGION, - NRM_TERM, - &(osCp.tTskTbl[idx].xxCb)); + SS_STATIC_REGION, + NRM_TERM, + &(osCp.tTskTbl[idx].xxCb)); #endif /* USE_MEMCAL */ } #endif /* SS_MULTIPLE_PROCS */ @@ -4633,48 +4553,48 @@ SsIdx idx; for (n = 0; n < SS_MAX_TTSKS; n++) { - if (sTsk->tTsks[n] == idx) - { - sTsk->tTsks[n] = SS_INVALID_IDX; - sTsk->numTTsks--; - break; - } + if (sTsk->tTsks[n] == idx) + { + sTsk->tTsks[n] = SS_INVALID_IDX; + sTsk->numTTsks--; + break; + } } - /* call the implementation to detach the task */ - ssdDetachTTsk(tTsk); - /* 100178 */ - sTsk->dep.ent = ENTNC; - sTsk->dep.inst = INSTNC; + /* call the implementation to detach the task */ + ssdDetachTTsk(tTsk); + /* 100178 */ + sTsk->dep.ent = ENTNC; + sTsk->dep.inst = INSTNC; } - /* Now we empty the entry for this task and update the table - * information - */ + /* Now we empty the entry for this task and update the table + * information + */ #ifdef SS_MULTIPLE_PROCS - osCp.tTskIds[procIdx][ent][inst] = SS_TSKNC; + osCp.tTskIds[procIdx][ent][inst] = SS_TSKNC; #else /* SS_MULTIPLE_PROCS */ - osCp.tTskIds[ent][inst] = SS_TSKNC; + osCp.tTskIds[ent][inst] = SS_TSKNC; #endif /* SS_MULTIPLE_PROCS */ - tTsk->used = FALSE; + tTsk->used = FALSE; #ifdef SS_MULTIPLE_PROCS - tTsk->proc = PROCNC; + tTsk->proc = PROCNC; #endif /* SS_MULTIPLE_PROCS */ - tTsk->ent = ENTNC; - tTsk->inst = INSTNC; - tTsk->tskType = TTUND; - tTsk->initTsk = NULLP; - tTsk->actvTsk = NULLP; - tTsk->sTsk = NULLP; + tTsk->ent = ENTNC; + tTsk->inst = INSTNC; + tTsk->tskType = TTUND; + tTsk->initTsk = NULLP; + tTsk->actvTsk = NULLP; + tTsk->sTsk = NULLP; - tTsk->nxt = osCp.nxtTTskEntry; - osCp.nxtTTskEntry = idx; - osCp.numTTsks--; + tTsk->nxt = osCp.nxtTTskEntry; + osCp.nxtTTskEntry = idx; + osCp.numTTsks--; #ifdef SS_MULTIPLE_PROCS - /* mark the control block for this task as invalid */ - osCp.tTskTbl[idx].xxCb = NULLP; + /* mark the control block for this task as invalid */ + osCp.tTskTbl[idx].xxCb = NULLP; #endif SS_RELEASE_ALL_SEMA(&osCp.tTskTblSem); @@ -4683,9 +4603,9 @@ SsIdx idx; #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMTXXX, ERRZERO, "Could not Unlock system task table"); #endif - return RFAILED; + return RFAILED; } - return ROK; + return ROK; } //#ifndef SPLIT_RLC_DL_TASK @@ -4694,24 +4614,19 @@ SsIdx idx; Void ysMtTskHdlr(Void); Void ysMtPollPhyMsg(uint8_t region); Void ysMtRcvPhyMsg(Void); -#ifdef ANSI -Void *mtTskHdlrT2kL2 + Void *mtTskHdlrT2kL2 ( -Ptr tskPtr /* pointer to task entry */ -) -#else -Void *mtTskHdlrT2kL2(tskPtr) -Ptr tskPtr; /* pointer to task entry */ -#endif + Ptr tskPtr /* pointer to task entry */ + ) { S16 ret; /* wait for SS to come up */ /* It is required to block on this semaphore before starting actual processing of - the thread becasue the creator of this thread might want to cance it without - doing any processing. When this semaphore is released, means the creator gives - the go ahead for actual processing and we should never come back to this point */ + the thread becasue the creator of this thread might want to cance it without + doing any processing. When this semaphore is released, means the creator gives + the go ahead for actual processing and we should never come back to this point */ while ((ret = sem_wait(&osCp.dep.ssStarted) != ROK) && (errno == EINTR)) continue; @@ -4722,23 +4637,18 @@ Ptr tskPtr; /* pointer to task entry */ while(1) { ysMtPollPhyMsg(0); /* blocks, waiting for messages for L2 - * (processes L1 msgs) */ - } + * (processes L1 msgs) */ + } - return (NULLP); + return (NULLP); } #else Void ysMtTskHdlr(Void); Void YsPhyRecvMsg(); -#ifdef ANSI -Void *mtTskHdlrT2kL2 + Void *mtTskHdlrT2kL2 ( -Ptr tskPtr /* pointer to task entry */ -) -#else -Void *mtTskHdlrT2kL2(tskPtr) -Ptr tskPtr; /* pointer to task entry */ -#endif + Ptr tskPtr /* pointer to task entry */ + ) { S16 ret; SsSTskEntry *sTsk; @@ -4748,9 +4658,9 @@ Ptr tskPtr; /* pointer to task entry */ /* wait for SS to come up */ /* It is required to block on this semaphore before starting actual processing of - the thread becasue the creator of this thread might want to cance it without - doing any processing. When this semaphore is released, means the creator gives - the go ahead for actual processing and we should never come back to this point */ + the thread becasue the creator of this thread might want to cance it without + doing any processing. When this semaphore is released, means the creator gives + the go ahead for actual processing and we should never come back to this point */ while ((ret = sem_wait(&osCp.dep.ssStarted) != ROK) && (errno == EINTR)) continue; @@ -4766,23 +4676,17 @@ Ptr tskPtr; /* pointer to task entry */ YsPhyRecvMsg(); #else ysMtTskHdlr(); /* blocks, waiting for messages for L2 - * (processes L1 msgs) */ + * (processes L1 msgs) */ #endif /* get a message from the demand queue */ /* RT Processing */ -#ifdef RLC_MAC_DAT_REQ_RBUF - rgDlDatReqBatchProc(); -#endif ret = mtTskHdlMsg(sTsk); if (ret != ROK) { - /* exit the for loop here */ - break; + /* exit the for loop here */ + break; } -#if defined(SPLIT_RLC_DL_TASK) && defined(RLC_MAC_STA_RSP_RBUF) - rgBatchProc(); -#endif } return (NULLP); @@ -4790,15 +4694,7 @@ Ptr tskPtr; /* pointer to task entry */ #endif /* TENB_T2K3K_SPECIFIC_CHANGES */ #endif -#ifdef ANSI -void *pthreadCreateHdlr -( -void * arg -) -#else -void *pthreadCreateHdlr(pthreadCreateArg) -void *arg; -#endif +void *pthreadCreateHdlr(void * arg) { S16 ret; SPThreadCreateArg* pthreadCreateArg = (SPThreadCreateArg*)arg; @@ -4811,35 +4707,30 @@ void *arg; } /* -* -* Fun: Task handler -* -* Desc: This is the system task handler function. It blocks on -* the system task's demand queue. On receiving a message, -* it identifies the target TAPA task, verifies that the -* TAPA task belongs to this system task and if so, calls -* the activation function of that TAPA task with the -* received message. The task activation function or the -* timer activation function may be called. -* -* Ret: (thread function) -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void *mtTskHdlr + * + * Fun: Task handler + * + * Desc: This is the system task handler function. It blocks on + * the system task's demand queue. On receiving a message, + * it identifies the target TAPA task, verifies that the + * TAPA task belongs to this system task and if so, calls + * the activation function of that TAPA task with the + * received message. The task activation function or the + * timer activation function may be called. + * + * Ret: (thread function) + * + * Notes: + * + * File: mt_ss.c + * + */ + Void *mtTskHdlr ( -Ptr tskPtr /* pointer to task entry */ -) -#else -Void *mtTskHdlr(tskPtr) -Ptr tskPtr; /* pointer to task entry */ -#endif + Ptr tskPtr /* pointer to task entry */ + ) { - S16 ret; + S16 ret = ROK; SsSTskEntry *sTsk; /* get out the system task entry from the parameter */ @@ -4854,13 +4745,8 @@ Ptr tskPtr; /* pointer to task entry */ #ifdef XEON_SPECIFIC_CHANGES printf("\n**********MT Task Handler********\n"); #endif - while (1) - { -#ifndef ODU_TEST_STUB -#ifdef INTEL_WLS - LwrMacRecvPhyMsg(); -#endif -#endif + while (1) + { /* Wait for a message from the demand queue */ #ifdef SS_CDMNDQ_SUPPORT ret = ssCDmndQWait(&sTsk->dQ); @@ -4868,12 +4754,12 @@ Ptr tskPtr; /* pointer to task entry */ ret = ssDmndQWait(&sTsk->dQ); #endif if (ret != ROK) - continue; + continue; ret = mtTskHdlMsg(sTsk); if (ret != ROK) { - break; + break; } } @@ -4882,45 +4768,40 @@ Ptr tskPtr; /* pointer to task entry */ /* -* -* Fun: Task handler -* -* Desc: This is the system task handler function. It blocks on -* the system task's demand queue. On receiving a message, -* it identifies the target TAPA task, verifies that the -* TAPA task belongs to this system task and if so, calls -* the activation function of that TAPA task with the -* received message. The task activation function or the -* timer activation function may be called. -* -* Ret: (thread function) -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 mtTskHdlMsg + * + * Fun: Task handler + * + * Desc: This is the system task handler function. It blocks on + * the system task's demand queue. On receiving a message, + * it identifies the target TAPA task, verifies that the + * TAPA task belongs to this system task and if so, calls + * the activation function of that TAPA task with the + * received message. The task activation function or the + * timer activation function may be called. + * + * Ret: (thread function) + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 mtTskHdlMsg ( -SsSTskEntry *sTsk -) -#else -S16 mtTskHdlMsg(sTsk) -SsSTskEntry *sTsk -#endif + SsSTskEntry *sTsk + ) { - S16 i; - S16 ret; - SsIdx idx; - SsTTskEntry *tTsk; - Buffer *mBuf; + S16 i =0; + S16 ret =0; + SsIdx idx =0; + SsTTskEntry *tTsk=NULLP; + Buffer *mBuf=NULLP; #ifdef SS_PERF - Buffer *mBuf2; + Buffer *mBuf2=NULLP; #endif - SsMsgInfo *mInfo; + SsMsgInfo *mInfo=NULLP; Pst nPst; -/* mt028.201: modification: multiple procs support related changes */ + /* mt028.201: modification: multiple procs support related changes */ #ifndef SS_MULTIPLE_PROCS #ifdef SS_MT_TMR PAIFTMRS16 tmrActvFnMt = NULLP; @@ -4928,12 +4809,12 @@ SsSTskEntry *sTsk /* mt015.301 Initialized the timer activation functions with NULLP */ PFS16 tmrActvFn = NULLP; #else - PAIFTMRS16 tmrActvFn; - uint16_t procIdIdx; + PAIFTMRS16 tmrActvFn =NULLP; + uint16_t procIdIdx =0; #endif /* SS_MULTIPLE_PROCS */ - /* mt003.301 Modifications */ + /* mt003.301 Modifications */ #ifdef SS_THREAD_PROFILE - EpcTime et1,et2; + EpcTime et1,et2; #endif /* SS_THREAD_PROFILE */ @@ -4951,13 +4832,13 @@ SsSTskEntry *sTsk #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT007, (ErrVal) ret, - "Could not lock system task entry"); + "Could not lock system task entry"); #endif SPutMsg(mBuf); return ROK; } -/* mt034.201 */ + /* mt034.201 */ #ifdef SS_PERF do { @@ -4968,325 +4849,325 @@ SsSTskEntry *sTsk #ifdef SS_MEM_WL_DEBUG mtTskBuffer1 = mBuf2; if(mBuf2) - mtTskBuffer2 = mBuf2->b_next; + mtTskBuffer2 = mBuf2->b_next; if(mInfo == 0x5050505) { - stopBtInfo = TRUE; - SGlobMemInfoShow(); - cmAnalyseBtInfo((PTR) mBuf,4); - SGlobMemInfoShow(); - printf("\n In trouble .... \n"); + stopBtInfo = TRUE; + SGlobMemInfoShow(); + cmAnalyseBtInfo((PTR) mBuf,4); + SGlobMemInfoShow(); + printf("\n In trouble .... \n"); } else if (mInfo == 0x2020202) { - stopBtInfo = TRUE; - cmAnalyseBtInfo((PTR) mBuf,1); - printf("\n In trouble .... \n"); + stopBtInfo = TRUE; + cmAnalyseBtInfo((PTR) mBuf,1); + printf("\n In trouble .... \n"); } #endif /* SS_MEM_WL_DEBUG */ switch (mInfo->eventInfo.event) { - /* this is a termination event, we die */ - case SS_EVNT_TERM: - /* release the message */ - SPutMsg(mBuf); - - /* Unlock the system task entry and lock the system - * task table to clean our entry up. - */ - SUnlock(&sTsk->lock); - - ret = SLock(&osCp.sTskTblLock); - if (ret != ROK) - { - -#if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT008, (ErrVal) ret, - "Could not lock system task table"); -#endif - /* what to do here? */ - return ROK; - } + /* this is a termination event, we die */ + case SS_EVNT_TERM: + /* release the message */ + SPutMsg(mBuf); - /* clean up the system task entry */ - sTsk->used = FALSE; - sTsk->tskPrior = 0; - /* mt003.301 Modifications - SDeRegTTsk */ - /* sTsk->numTTsks = 0; */ - SDestroyLock(&sTsk->lock); - ssDestroyDmndQ(&sTsk->dQ); + /* Unlock the system task entry and lock the system + * task table to clean our entry up. + */ + SUnlock(&sTsk->lock); - /* lock for current executing TAPA task ID */ + ret = SLock(&osCp.sTskTblLock); + if (ret != ROK) + { - /* make this entry available in the system task table */ - sTsk->nxt = osCp.nxtSTskEntry; - for (i = 0; i < SS_MAX_STSKS; i++) - { - if (sTsk == &osCp.sTskTbl[i]) - { - osCp.nxtSTskEntry = i; - break; - } - } +#if (ERRCLASS & ERRCLS_DEBUG) + MTLOGERROR(ERRCLS_DEBUG, EMT008, (ErrVal) ret, + "Could not lock system task table"); +#endif + /* what to do here? */ + return ROK; + } + + /* clean up the system task entry */ + sTsk->used = FALSE; + sTsk->tskPrior = 0; + /* mt003.301 Modifications - SDeRegTTsk */ + /* sTsk->numTTsks = 0; */ + SDestroyLock(&sTsk->lock); + ssDestroyDmndQ(&sTsk->dQ); + + /* lock for current executing TAPA task ID */ + + /* make this entry available in the system task table */ + sTsk->nxt = osCp.nxtSTskEntry; + for (i = 0; i < SS_MAX_STSKS; i++) + { + if (sTsk == &osCp.sTskTbl[i]) + { + osCp.nxtSTskEntry = i; + break; + } + } - osCp.numSTsks--; + osCp.numSTsks--; - /* unlock the system task table */ - SUnlock(&osCp.sTskTblLock); + /* unlock the system task table */ + SUnlock(&osCp.sTskTblLock); - return RFAILED; + return RFAILED; - /* this is a data message or a permanent task keep-alive message */ - case SS_EVNT_DATA: - case SS_EVNT_PERMTICK: - /* message to a task. find the destination task */ -/* mt028.201: modification: multiple procs support related changes */ + /* this is a data message or a permanent task keep-alive message */ + case SS_EVNT_DATA: + case SS_EVNT_PERMTICK: + /* message to a task. find the destination task */ + /* mt028.201: modification: multiple procs support related changes */ #ifdef SS_MULTIPLE_PROCS - procIdIdx = SGetProcIdIdx(mInfo->pst.dstProcId); + procIdIdx = SGetProcIdIdx(mInfo->pst.dstProcId); - if (procIdIdx == SS_INV_PROCID_IDX) - { - SPutMsg(mBuf); - break; - } + if (procIdIdx == SS_INV_PROCID_IDX) + { + SPutMsg(mBuf); + break; + } - idx = osCp.tTskIds[procIdIdx][mInfo->pst.dstEnt][mInfo->pst.dstInst]; + idx = osCp.tTskIds[procIdIdx][mInfo->pst.dstEnt][mInfo->pst.dstInst]; #else /* SS_MULTIPLE_PROCS */ - idx = osCp.tTskIds[mInfo->pst.dstEnt][mInfo->pst.dstInst]; + idx = osCp.tTskIds[mInfo->pst.dstEnt][mInfo->pst.dstInst]; #endif /* SS_MULTIPLE_PROCS */ - /* verify that it hasn't been deregistered */ - if (idx == SS_TSKNC) - { - SPutMsg(mBuf); - break; - } - - /* verify that this system task is still running it */ - tTsk = &osCp.tTskTbl[idx]; - if (tTsk->sTsk != sTsk) - { - SPutMsg(mBuf); - break; - } - - /* set the current executing TAPA task ID */ - sTsk->dep.ent = mInfo->pst.dstEnt; - sTsk->dep.inst = mInfo->pst.dstInst; - - /* copy the Pst structure into a local duplicate */ - for (i = 0; i < (S16) sizeof(Pst); i++) - *(((uint8_t *)(&nPst)) + i) = *(((uint8_t *)&mInfo->pst) + i); - - /* Give the message to the task activation function. If - * its a normal data message, we pass it, if this is a - * keep-alive message for a permanent task then we pass - * NULLP in place of the message to the task activation - * function. - */ - if (mInfo->eventInfo.event == SS_EVNT_DATA) - { + /* verify that it hasn't been deregistered */ + if (idx == SS_TSKNC) + { + SPutMsg(mBuf); + break; + } + + /* verify that this system task is still running it */ + tTsk = &osCp.tTskTbl[idx]; + if (tTsk->sTsk != sTsk) + { + SPutMsg(mBuf); + break; + } + + /* set the current executing TAPA task ID */ + sTsk->dep.ent = mInfo->pst.dstEnt; + sTsk->dep.inst = mInfo->pst.dstInst; + + /* copy the Pst structure into a local duplicate */ + for (i = 0; i < (S16) sizeof(Pst); i++) + *(((uint8_t *)(&nPst)) + i) = *(((uint8_t *)&mInfo->pst) + i); + + /* Give the message to the task activation function. If + * its a normal data message, we pass it, if this is a + * keep-alive message for a permanent task then we pass + * NULLP in place of the message to the task activation + * function. + */ + if (mInfo->eventInfo.event == SS_EVNT_DATA) + { #ifndef RGL_SPECIFIC_CHANGES #ifdef SS_TSKLOG_ENABLE - uint32_t t = MacGetTick(); + uint32_t t = MacGetTick(); #endif #endif - /* mt003.301 Modifications */ + /* mt003.301 Modifications */ #if SS_THREAD_PROFILE - tTsk->curEvent = nPst.event; - SGetEpcTime(&et1); + tTsk->curEvent = nPst.event; + SGetEpcTime(&et1); #endif /* SS_THREAD_PROFILE */ - tTsk->actvTsk(&nPst, mBuf); + tTsk->actvTsk(&nPst, mBuf); #ifndef RGL_SPECIFIC_CHANGES #ifdef SS_TSKLOG_ENABLE - SStopTask(t,PID_SSI_TSK); + SStopTask(t,PID_SSI_TSK); #endif #endif #if SS_THREAD_PROFILE - SGetEpcTime(&et2); - tTsk->curEvtTime = (uint32_t)(et2 - et1); - tTsk->totTime += (uint64_t)tTsk->curEvtTime; + SGetEpcTime(&et2); + tTsk->curEvtTime = (uint32_t)(et2 - et1); + tTsk->totTime += (uint64_t)tTsk->curEvtTime; #endif /* SS_THREAD_PROFILE */ - } - else - { + } + else + { #if (ERRCLASS & ERRCLS_DEBUG) - /* this message should only come to a permanent task */ - if (tTsk->tskType != SS_TSK_PERMANENT) - { - MTLOGERROR(ERRCLS_DEBUG, EMT009, ERRZERO, "Logic failure"); - break; - } -#endif - tTsk->actvTsk(&nPst, NULLP); - - /* We need to re-send this message back to ourselves so - * the permanent task continues to run. - */ - /* Check if this task got deregistered or detached - * by the activation function; if so, there's nothing - * more to do here, otherwise go ahead. - */ - ret = ROK; - if (tTsk->used == TRUE && tTsk->sTsk != NULLP) - { - ret = ssDmndQPutLast(&tTsk->sTsk->dQ, mBuf, - ((tTsk->tskPrior) * SS_MAX_MSG_PRI) + - mInfo->pst.prior); - } - - /* failure here is a real problem */ - if (ret != ROK) - { + /* this message should only come to a permanent task */ + if (tTsk->tskType != SS_TSK_PERMANENT) + { + MTLOGERROR(ERRCLS_DEBUG, EMT009, ERRZERO, "Logic failure"); + break; + } +#endif + tTsk->actvTsk(&nPst, NULLP); + + /* We need to re-send this message back to ourselves so + * the permanent task continues to run. + */ + /* Check if this task got deregistered or detached + * by the activation function; if so, there's nothing + * more to do here, otherwise go ahead. + */ + ret = ROK; + if (tTsk->used == TRUE && tTsk->sTsk != NULLP) + { + ret = ssDmndQPutLast(&tTsk->sTsk->dQ, mBuf, + ((tTsk->tskPrior) * SS_MAX_MSG_PRI) + + mInfo->pst.prior); + } + + /* failure here is a real problem */ + if (ret != ROK) + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT010, ERRZERO, - "Could not write to demand queue"); + MTLOGERROR(ERRCLS_DEBUG, EMT010, ERRZERO, + "Could not write to demand queue"); #endif - SPutMsg(mBuf); - } - } + SPutMsg(mBuf); + } + } - /* unset the current executing TAPA task ID */ - sTsk->dep.ent = ENTNC; - sTsk->dep.inst = INSTNC; - break; + /* unset the current executing TAPA task ID */ + sTsk->dep.ent = ENTNC; + sTsk->dep.inst = INSTNC; + break; - case SS_EVNT_TIMER: - /* timer event. find the timer entry */ - idx = mInfo->eventInfo.u.tmr.tmrIdx; + case SS_EVNT_TIMER: + /* timer event. find the timer entry */ + idx = mInfo->eventInfo.u.tmr.tmrIdx; - /* lock the timer table, coz we're going to peek in it */ - ret = SLock(&osCp.tmrTblLock); - if (ret != ROK) - { + /* lock the timer table, coz we're going to peek in it */ + ret = SLock(&osCp.tmrTblLock); + if (ret != ROK) + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT011, (ErrVal) ret, - "Could not lock timer table"); -#endif - SPutMsg(mBuf); - break; - } - - /* Verify that this timer entry is still around and that it - * belongs to our task. - */ - if (osCp.tmrTbl[idx].used == FALSE -/* mt028.201: modification: multiple procs support related changes */ + MTLOGERROR(ERRCLS_DEBUG, EMT011, (ErrVal) ret, + "Could not lock timer table"); +#endif + SPutMsg(mBuf); + break; + } + + /* Verify that this timer entry is still around and that it + * belongs to our task. + */ + if (osCp.tmrTbl[idx].used == FALSE + /* mt028.201: modification: multiple procs support related changes */ #ifdef SS_MULTIPLE_PROCS - || osCp.tmrTbl[idx].ownerProc != mInfo->pst.dstProcId + || osCp.tmrTbl[idx].ownerProc != mInfo->pst.dstProcId #endif /* SS_MULTIPLE_PROCS */ - || osCp.tmrTbl[idx].ownerEnt != mInfo->pst.dstEnt - || osCp.tmrTbl[idx].ownerInst != mInfo->pst.dstInst) - { - SUnlock(&osCp.tmrTblLock); - SPutMsg(mBuf); - break; - } - - /* mt005.21: addition */ - /* set the current executing TAPA task ID */ - sTsk->dep.ent = mInfo->pst.dstEnt; - sTsk->dep.inst = mInfo->pst.dstInst; + || osCp.tmrTbl[idx].ownerEnt != mInfo->pst.dstEnt + || osCp.tmrTbl[idx].ownerInst != mInfo->pst.dstInst) + { + SUnlock(&osCp.tmrTblLock); + SPutMsg(mBuf); + break; + } + + /* mt005.21: addition */ + /* set the current executing TAPA task ID */ + sTsk->dep.ent = mInfo->pst.dstEnt; + sTsk->dep.inst = mInfo->pst.dstInst; #ifndef SS_MULTIPLE_PROCS #ifdef SS_MT_TMR - /*mt006.301 Adding Initializing the tmrActvFnMt*/ - tmrActvFnMt = NULLP; - if (osCp.tmrTbl[idx].ssTmrActvFn.mtFlag == TRUE) - { - tmrActvFnMt = osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFnMt; - } - else + /*mt006.301 Adding Initializing the tmrActvFnMt*/ + tmrActvFnMt = NULLP; + if (osCp.tmrTbl[idx].ssTmrActvFn.mtFlag == TRUE) + { + tmrActvFnMt = osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFnMt; + } + else #endif #endif - { - tmrActvFn = osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn; - } + { + tmrActvFn = osCp.tmrTbl[idx].ssTmrActvFn.actvFnc.tmrActvFn; + } - /* unlock the timer table */ - SUnlock(&osCp.tmrTblLock); + /* unlock the timer table */ + SUnlock(&osCp.tmrTblLock); - /* activate the timer function */ -/* mt028.201: modification: multiple procs support related changes */ + /* activate the timer function */ + /* mt028.201: modification: multiple procs support related changes */ #ifndef SS_MULTIPLE_PROCS #ifdef SS_MT_TMR - if (tmrActvFnMt) - { - tmrActvFnMt(osCp.tmrTbl[idx].ownerEnt, - osCp.tmrTbl[idx].ownerInst); - } - else -#endif - { - tmrActvFn(); - } -#else - tmrActvFn(osCp.tmrTbl[idx].ownerProc, osCp.tmrTbl[idx].ownerEnt, - osCp.tmrTbl[idx].ownerInst); + if (tmrActvFnMt) + { + tmrActvFnMt(osCp.tmrTbl[idx].ownerEnt, + osCp.tmrTbl[idx].ownerInst); + } + else +#endif + { + tmrActvFn(); + } +#else + tmrActvFn(osCp.tmrTbl[idx].ownerProc, osCp.tmrTbl[idx].ownerEnt, + osCp.tmrTbl[idx].ownerInst); #endif /* SS_MULTIPLE_PROCS */ - /*mt005.21: addition */ - /* unset the current executing TAPA task ID */ - sTsk->dep.ent = ENTNC; - sTsk->dep.inst = INSTNC; + /*mt005.21: addition */ + /* unset the current executing TAPA task ID */ + sTsk->dep.ent = ENTNC; + sTsk->dep.inst = INSTNC; - /* return the message buffer */ - SPutMsg(mBuf); - break; - /* - * mt003.301 - SDeRegTTsk fix - */ - case SS_EVNT_TTSK_TERM: + /* return the message buffer */ + SPutMsg(mBuf); + break; + /* + * mt003.301 - SDeRegTTsk fix + */ + case SS_EVNT_TTSK_TERM: #ifdef SS_MULTIPLE_PROCS - procIdIdx = SGetProcIdIdx(mInfo->pst.dstProcId); + procIdIdx = SGetProcIdIdx(mInfo->pst.dstProcId); - if (procIdIdx == SS_INV_PROCID_IDX) - { - SPutMsg(mBuf); - break; - } + if (procIdIdx == SS_INV_PROCID_IDX) + { + SPutMsg(mBuf); + break; + } - idx = osCp.tTskIds[procIdIdx][mInfo->pst.dstEnt][mInfo->pst.dstInst]; + idx = osCp.tTskIds[procIdIdx][mInfo->pst.dstEnt][mInfo->pst.dstInst]; #else /* SS_MULTIPLE_PROCS */ - idx = osCp.tTskIds[mInfo->pst.dstEnt][mInfo->pst.dstInst]; + idx = osCp.tTskIds[mInfo->pst.dstEnt][mInfo->pst.dstInst]; #endif /* SS_MULTIPLE_PROCS */ - /* verify that it hasn't been deregistered */ - if (idx == SS_TSKNC) - { - SPutMsg(mBuf); - break; - } - - /* verify that this system task is still running it */ - tTsk = &osCp.tTskTbl[idx]; - if (tTsk->sTsk != sTsk) - { - SPutMsg(mBuf); - break; - } + /* verify that it hasn't been deregistered */ + if (idx == SS_TSKNC) + { + SPutMsg(mBuf); + break; + } + + /* verify that this system task is still running it */ + tTsk = &osCp.tTskTbl[idx]; + if (tTsk->sTsk != sTsk) + { + SPutMsg(mBuf); + break; + } #ifdef SS_MULTIPLE_PROCS - ssdProcTTskTerm(procIdIdx, tTsk, idx); + ssdProcTTskTerm(procIdIdx, tTsk, idx); #else - ssdProcTTskTerm(tTsk, idx); + ssdProcTTskTerm(tTsk, idx); #endif - SPutMsg(mBuf); - break; + SPutMsg(mBuf); + break; - default: + default: #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT012, (ErrVal) ret, - "Illegal event"); + MTLOGERROR(ERRCLS_DEBUG, EMT012, (ErrVal) ret, + "Illegal event"); #endif - break; + break; } #ifdef SS_PERF - mBuf = mBuf2; + mBuf = mBuf2; } while (mBuf != NULLP); #endif @@ -5304,15 +5185,9 @@ SsSTskEntry *sTsk Bool g_usettitmr; /* -* Fun: mtTmrHdlrPublic -*/ -#ifdef ANSI -Void mtTmrHdlrPublic -( -) -#else + * Fun: mtTmrHdlrPublic + */ Void mtTmrHdlrPublic() -#endif { if (SLock(&osCp.tmrTblLock) != ROK) { @@ -5328,35 +5203,29 @@ Void mtTmrHdlrPublic() /* -* -* Fun: mtTmrHdlr -* -* Desc: The timer handler thread function. Counts time -* and invokes the common timer function on each -* tick. -* -* Ret: (thread function) -* -* Notes: -* -* File: mt_ss.c -* -*/ + * + * Fun: mtTmrHdlr + * + * Desc: The timer handler thread function. Counts time + * and invokes the common timer function on each + * tick. + * + * Ret: (thread function) + * + * Notes: + * + * File: mt_ss.c + * + */ /*mt041.201 Modified SSI tick handling in mtTmrHdlr() */ -#ifdef ANSI -static Void *mtTmrHdlr + static Void *mtTmrHdlr ( -void *parm /* unused */ -) -#else - /* mt009.21: addition */ -static Void *mtTmrHdlr(parm) -void *parm; /* unused */ -#endif + void *parm /* unused */ + ) { -/*mt004.301-addede new region*/ -/* mt010.301 Removed SS_FAP portion and - * enabled oroginal code in function mtTmrHdlr */ + /*mt004.301-addede new region*/ + /* mt010.301 Removed SS_FAP portion and + * enabled oroginal code in function mtTmrHdlr */ struct timespec ts; uint32_t time_int; @@ -5399,8 +5268,8 @@ void *parm; /* unused */ if (gettimeofday(&tv1, NULL) == -1) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT014, (ErrVal) errno, - "Error in clock_gettime"); + MTLOGERROR(ERRCLS_DEBUG, EMT014, (ErrVal) errno, + "Error in clock_gettime"); #endif } @@ -5408,82 +5277,82 @@ void *parm; /* unused */ for (; ;) { #if 1 - if (g_usettitmr) - { + if (g_usettitmr) + { #ifndef STUB_TTI_HANDLING_5GTF - printf("Returning from mtTmrHdlr()\n"); - return NULL; + printf("\nReturning from mtTmrHdlr()\n"); + return NULL; #endif - } + } #endif - /* mt039.201 changes for nanosleep */ + /* mt039.201 changes for nanosleep */ /* sleep for MT_TICK_CNT milli seconds */ ts.tv_nsec = (MT_TICK_CNT - err_in_usec) * 1000; while ((ret = nanosleep (&ts, &tsN) != ROK) && (errno == EINTR)) { - ts.tv_nsec = tsN.tv_nsec; - tsN.tv_nsec = 0; - continue; + ts.tv_nsec = tsN.tv_nsec; + tsN.tv_nsec = 0; + continue; } if (gettimeofday(&tv2,NULL) == -1) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT015, (ErrVal) errno, - "Error in clock_gettime"); + MTLOGERROR(ERRCLS_DEBUG, EMT015, (ErrVal) errno, + "Error in clock_gettime"); #endif } - /*mt013.301 : changed check while calculating timer to fix - * diffrence between MTSS time and real unix time - */ - if ((tv2.tv_sec == tv1.tv_sec)&&(tv2.tv_usec > tv1.tv_usec)) - { - time_int = (tv2.tv_usec - tv1.tv_usec); - } - else if (tv2.tv_sec > tv1.tv_sec) - { - time_int = ((tv2.tv_sec - tv1.tv_sec)*1000000) + (tv2.tv_usec - tv1.tv_usec); - } - else /* ts2 < ts1, this will not happen in normal scenario */ - { - /* to make sure cnt = 1 */ - err_in_usec = 0; - time_int = MT_TICK_CNT; - } - - oldTicks = osCp.dep.sysTicks; - osCp.dep.sysTicks += (time_int/(MT_TICK_CNT - err_in_usec)); - err_in_usec = (time_int % (MT_TICK_CNT - err_in_usec)); - newTicks = osCp.dep.sysTicks; - tv1.tv_usec = tv2.tv_usec; - tv1.tv_sec = tv2.tv_sec; - - cnt = newTicks - oldTicks; - - while(err_in_usec >= MT_TICK_CNT) - { - cnt++; - err_in_usec -= MT_TICK_CNT; - } - if( cnt >= MT_MAX_TICK_CNT_VAL) - cnt = MT_MIN_TICK_CNT_VAL; - /* call the common timer tick handler */ - for (i = 0; i < cnt; i++) - { - /* mt008.301: cmPrcTmr is guarded with a lock */ - /* lock the timer table */ - if (SLock(&osCp.tmrTblLock) != ROK) - { + /*mt013.301 : changed check while calculating timer to fix + * diffrence between MTSS time and real unix time + */ + if ((tv2.tv_sec == tv1.tv_sec)&&(tv2.tv_usec > tv1.tv_usec)) + { + time_int = (tv2.tv_usec - tv1.tv_usec); + } + else if (tv2.tv_sec > tv1.tv_sec) + { + time_int = ((tv2.tv_sec - tv1.tv_sec)*1000000) + (tv2.tv_usec - tv1.tv_usec); + } + else /* ts2 < ts1, this will not happen in normal scenario */ + { + /* to make sure cnt = 1 */ + err_in_usec = 0; + time_int = MT_TICK_CNT; + } + + oldTicks = osCp.dep.sysTicks; + osCp.dep.sysTicks += (time_int/(MT_TICK_CNT - err_in_usec)); + err_in_usec = (time_int % (MT_TICK_CNT - err_in_usec)); + newTicks = osCp.dep.sysTicks; + tv1.tv_usec = tv2.tv_usec; + tv1.tv_sec = tv2.tv_sec; + + cnt = newTicks - oldTicks; + + while(err_in_usec >= MT_TICK_CNT) + { + cnt++; + err_in_usec -= MT_TICK_CNT; + } + if( cnt >= MT_MAX_TICK_CNT_VAL) + cnt = MT_MIN_TICK_CNT_VAL; + /* call the common timer tick handler */ + for (i = 0; i < cnt; i++) + { + /* mt008.301: cmPrcTmr is guarded with a lock */ + /* lock the timer table */ + if (SLock(&osCp.tmrTblLock) != ROK) + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT016, ERRZERO, "Could not lock timer table"); + MTLOGERROR(ERRCLS_DEBUG, EMT016, ERRZERO, "Could not lock timer table"); #endif - continue; - } - cmPrcTmr(&osCp.dep.tmrTqCp, osCp.dep.tmrTq, mtTimeout); - /* unlock the timer table */ - SUnlock(&osCp.tmrTblLock); - } + continue; + } + cmPrcTmr(&osCp.dep.tmrTqCp, osCp.dep.tmrTq, mtTimeout); + /* unlock the timer table */ + SUnlock(&osCp.tmrTblLock); + } } /* mt009.21: addition */ @@ -5493,30 +5362,24 @@ void *parm; /* unused */ /* -* -* Fun: mtTimeout -* -* Desc: Process timer event. Called from the common timer -* code when a timeout occurs. -* -* Ret: Void -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void mtTimeout + * + * Fun: mtTimeout + * + * Desc: Process timer event. Called from the common timer + * code when a timeout occurs. + * + * Ret: Void + * + * Notes: + * + * File: mt_ss.c + * + */ + Void mtTimeout ( -PTR tCb, /* control block */ -S16 evnt /* event */ -) -#else -Void mtTimeout(tCb, evnt) -PTR tCb; /* control block */ -S16 evnt; /* event */ -#endif + PTR tCb, /* control block */ + S16 evnt /* event */ + ) { Buffer *mBuf; SsMsgInfo *mInfo; @@ -5527,7 +5390,7 @@ S16 evnt; /* event */ #ifndef TENB_RTLIN_CHANGES S16 ret; #endif -/* mt028.201: modification: multiple procs support related changes */ + /* mt028.201: modification: multiple procs support related changes */ #ifdef SS_MULTIPLE_PROCS uint16_t procIdIdx; #endif /* SS_MULTIPLE_PROCS */ @@ -5549,7 +5412,7 @@ S16 evnt; /* event */ return; } -/* mt008.301 Deletion: tmrTbl Lock is moved to mtTmrHdlr */ + /* mt008.301 Deletion: tmrTbl Lock is moved to mtTmrHdlr */ /* Hmmmm, the timer might have been deleted while we've been @@ -5568,19 +5431,19 @@ S16 evnt; /* event */ if (SGetMsg(SS_DFLT_REGION, SS_DFLT_POOL, &mBuf) != ROK) #else #ifdef RGL_SPECIFIC_CHANGES - if (SGetMsg((SS_DFLT_REGION), SS_DFLT_POOL, &mBuf) != ROK) + if (SGetMsg((SS_DFLT_REGION), SS_DFLT_POOL, &mBuf) != ROK) #else - if (SGetMsg((osCp.sTskTbl[0].region), SS_DFLT_POOL, &mBuf) != ROK) + if (SGetMsg((osCp.sTskTbl[0].region), SS_DFLT_POOL, &mBuf) != ROK) #endif #endif - { + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT017, ERRZERO, "Could not get message"); + MTLOGERROR(ERRCLS_DEBUG, EMT017, ERRZERO, "Could not get message"); #endif - return; - } + return; + } mInfo = (SsMsgInfo *)mBuf->b_rptr; mInfo->eventInfo.event = SS_EVNT_TIMER; @@ -5590,7 +5453,7 @@ S16 evnt; /* event */ mInfo->pst.dstInst = tEnt->ownerInst; mInfo->pst.srcEnt = tEnt->ownerEnt; mInfo->pst.srcInst = tEnt->ownerInst; -/* mt028.201: modification: multiple procs support related changes */ + /* mt028.201: modification: multiple procs support related changes */ #ifndef SS_MULTIPLE_PROCS mInfo->pst.dstProcId = SFndProcId(); mInfo->pst.srcProcId = SFndProcId(); @@ -5626,7 +5489,7 @@ S16 evnt; /* event */ /* find the owner TAPA task */ -/* mt028.201: modification: multiple procs support related changes */ + /* mt028.201: modification: multiple procs support related changes */ #ifdef SS_MULTIPLE_PROCS procIdIdx = SGetProcIdIdx(tEnt->ownerProc); idx = osCp.tTskIds[procIdIdx][tEnt->ownerEnt][tEnt->ownerInst]; @@ -5655,7 +5518,7 @@ S16 evnt; /* event */ } /* Klock work fix ccpu00148484 */ /* write the timer message to the queue of the destination task */ - /* mt008.301 : check sTsk before putting into it's DQ */ + /* mt008.301 : check sTsk before putting into it's DQ */ if (tTsk->sTsk == NULLP) { #ifndef TENB_RTLIN_CHANGES @@ -5665,7 +5528,7 @@ S16 evnt; /* event */ #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT019, ERRZERO, - "Could not write to demand queue"); + "Could not write to demand queue"); #endif return; @@ -5675,7 +5538,7 @@ S16 evnt; /* event */ mInfo->region = tTsk->sTsk->region; #endif /* SS_LOCKLESS_MEMORY */ if (ssDmndQPutLast(&tTsk->sTsk->dQ, mBuf, - (tTsk->tskPrior * SS_MAX_MSG_PRI) + PRIOR0) != ROK) + (tTsk->tskPrior * SS_MAX_MSG_PRI) + PRIOR0) != ROK) { #ifndef TENB_RTLIN_CHANGES SS_RELEASE_SEMA(&osCp.tTskTblSem); @@ -5684,17 +5547,17 @@ S16 evnt; /* event */ #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT019, ERRZERO, - "Could not write to demand queue"); + "Could not write to demand queue"); #endif return; } -/* Fix for ccpu00130657 */ + /* Fix for ccpu00130657 */ #ifdef TENB_T2K3K_SPECIFIC_CHANGES if (tTsk->sTsk->tskPrior == PRIOR0) { #ifdef INTEL_WLS - WLS_WakeUp(mtGetWlsHdl()); + WLS_WakeUp(mtGetWlsHdl()); #else tlPost(NULLP); #endif @@ -5729,29 +5592,23 @@ S16 evnt; /* event */ #ifdef CONAVL /* -* -* Fun: mtConHdlr -* -* Desc: This thread reads the console and hands over any -* data read to a user function. -* -* Ret: (thread function) -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -static Void *mtConHdlr + * + * Fun: mtConHdlr + * + * Desc: This thread reads the console and hands over any + * data read to a user function. + * + * Ret: (thread function) + * + * Notes: + * + * File: mt_ss.c + * + */ + static Void *mtConHdlr ( -Ptr parm /* unused */ -) -#else - /* mt009.21: addition */ -static Void *mtConHdlr(parm) -Ptr parm; /* unused */ -#endif + Ptr parm /* unused */ + ) { int fd; Data data; @@ -5777,7 +5634,7 @@ Ptr parm; /* unused */ { if ((read(fd, &data, 1)) != 1) { - continue; + continue; } @@ -5793,34 +5650,28 @@ Ptr parm; /* unused */ #ifndef L2_L3_SPLIT #ifdef SS_DRVR_SUPPORT /* -* -* Fun: Interrupt service task handler -* -* Desc: This is the interrupt service task handler. It blocks -* on a pipe from which it reads an isFlag structure. The -* structure indicates which interrupt service task is to -* be executed. The thread identifies the task, calls the -* isTsk function and sends itself a message to repeat -* this operation until it receives a message to cease. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI - /* mt009.21: addition */ -static Void *mtIsTskHdlr + * + * Fun: Interrupt service task handler + * + * Desc: This is the interrupt service task handler. It blocks + * on a pipe from which it reads an isFlag structure. The + * structure indicates which interrupt service task is to + * be executed. The thread identifies the task, calls the + * isTsk function and sends itself a message to repeat + * this operation until it receives a message to cease. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +/* mt009.21: addition */ + static Void *mtIsTskHdlr ( -Ptr tskPtr /* pointer to task entry */ -) -#else - /* mt009.21: addition */ -static Void *mtIsTskHdlr(tskPtr) -Ptr tskPtr; /* pointer to task entry */ -#endif + Ptr tskPtr /* pointer to task entry */ + ) { #if (ERRCLASS & ERRCLS_DEBUG) int ret; @@ -5831,69 +5682,69 @@ Ptr tskPtr; /* pointer to task entry */ { if (read(osCp.dep.isFildes[0], &isFlag, sizeof(isFlag)) != sizeof(isFlag)) { - continue; + continue; } switch (isFlag.action) { - case MT_IS_SET: - osCp.drvrTskTbl[isFlag.id].dep.flag = TRUE; + case MT_IS_SET: + osCp.drvrTskTbl[isFlag.id].dep.flag = TRUE; - /* call the interrupt service task activation function */ - osCp.drvrTskTbl[isFlag.id].isTsk(isFlag.id); + /* call the interrupt service task activation function */ + osCp.drvrTskTbl[isFlag.id].isTsk(isFlag.id); - /* send self a message to keep doing this */ - isFlag.action = MT_IS_RESET; + /* send self a message to keep doing this */ + isFlag.action = MT_IS_RESET; #if (ERRCLASS & ERRCLS_DEBUG) - ret = write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); - if (ret != sizeof(isFlag)) - { - MTLOGERROR(ERRCLS_DEBUG, EMT020, ERRZERO, - "write() to pipe failed"); - } + ret = write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); + if (ret != sizeof(isFlag)) + { + MTLOGERROR(ERRCLS_DEBUG, EMT020, ERRZERO, + "write() to pipe failed"); + } #else - write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); + write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); #endif - break; + break; - case MT_IS_UNSET: - osCp.drvrTskTbl[isFlag.id].dep.flag = FALSE; - break; + case MT_IS_UNSET: + osCp.drvrTskTbl[isFlag.id].dep.flag = FALSE; + break; - case MT_IS_RESET: - if (osCp.drvrTskTbl[isFlag.id].dep.flag) - { - /* call the interrupt service task activation function */ - osCp.drvrTskTbl[isFlag.id].isTsk(isFlag.id); + case MT_IS_RESET: + if (osCp.drvrTskTbl[isFlag.id].dep.flag) + { + /* call the interrupt service task activation function */ + osCp.drvrTskTbl[isFlag.id].isTsk(isFlag.id); #if (ERRCLASS & ERRCLS_DEBUG) - /* send self a message to do this again */ - ret = write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); - - if (ret != sizeof(isFlag)) - { - MTLOGERROR(ERRCLS_DEBUG, EMT021, ERRZERO, - "write() to pipe failed"); - } + /* send self a message to do this again */ + ret = write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); + + if (ret != sizeof(isFlag)) + { + MTLOGERROR(ERRCLS_DEBUG, EMT021, ERRZERO, + "write() to pipe failed"); + } #else - write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); + write(osCp.dep.isFildes[1], &isFlag, sizeof(isFlag)); #endif - } - break; + } + break; - default: - /* where did THIS come from?? */ - break; + default: + /* where did THIS come from?? */ + break; } } - /* mt009.21: addition */ - return ( (Void *) NULLP); + /* mt009.21: addition */ + return ( (Void *) NULLP); /* not reached */ } @@ -5903,27 +5754,19 @@ Ptr tskPtr; /* pointer to task entry */ /*mt010.301 Fix for core when run with -o option and when killed with SIGINT*/ /* -* -* Fun: mtIntSigHndlr -* -* Desc: Exit function, shuts down. -* -* Ret: Void -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void mtIntSigHndlr -( -int arg -) -#else -Void mtIntSigHndlr(arg) -int arg; -#endif + * + * Fun: mtIntSigHndlr + * + * Desc: Exit function, shuts down. + * + * Ret: Void + * + * Notes: + * + * File: mt_ss.c + * + */ +Void mtIntSigHndlr(int arg) { osCp.dep.sigEvnt=TRUE; @@ -5939,26 +5782,19 @@ int arg; /*mt010.301 Fix for core when run with -o option and when killed with SIGINT*/ /* -* -* Fun: mtExitClnup -* -* Desc: function, shuts down. -* -* Ret: Void -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void mtExitClnup -( -void -) -#else -Void mtExitClnup() -#endif + * + * Fun: mtExitClnup + * + * Desc: function, shuts down. + * + * Ret: Void + * + * Notes: + * + * File: mt_ss.c + * + */ +Void mtExitClnup(void) { Ticks ticks; S8 buf[128]; @@ -5997,36 +5833,30 @@ Ticks SGetTtiCount(Void) } /* -* -* Fun: SDisplay -* -* Desc: This function displays a string to a given output -* channel. -* -* Ret: ROK - ok -* -* Notes: Buffer should be null terminated. -* -* channel 0 is reserved for backwards compatibility -* with SPrint -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SDisplay + * + * Fun: SDisplay + * + * Desc: This function displays a string to a given output + * channel. + * + * Ret: ROK - ok + * + * Notes: Buffer should be null terminated. + * + * channel 0 is reserved for backwards compatibility + * with SPrint + * + * File: mt_ss.c + * + */ + S16 SDisplay ( -S16 chan, /* channel */ -Txt *buf /* buffer */ -) -#else -S16 SDisplay(chan, buf) -S16 chan; /* channel */ -Txt *buf; /* buffer */ -#endif + S16 chan, /* channel */ + Txt *buf /* buffer */ + ) { -/* mt020.201 - Fixed typo */ + /* mt020.201 - Fixed typo */ #if (ERRCLASS & ERRCLS_INT_PAR) if (buf == NULLP) { @@ -6042,15 +5872,15 @@ Txt *buf; /* buffer */ #endif #endif - /* mt012.301 :FIX for LOG RELATED ISSUE */ + /* mt012.301 :FIX for LOG RELATED ISSUE */ #ifdef CONAVL if(chan==1) { - printf("%s",buf); + printf("%s",buf); } else { - if (osCp.dep.conOutFp) fwrite(buf, strlen(buf), 1, osCp.dep.conOutFp); + if (osCp.dep.conOutFp) fwrite(buf, strlen(buf), 1, osCp.dep.conOutFp); } #endif @@ -6071,26 +5901,19 @@ Txt *buf; /* buffer */ /*mt010.301 */ /* -* -* Fun: SFini -* -* Desc: function, shuts down. -* -* Ret: Void -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SFini -( -void -) -#else -S16 SFini() -#endif + * + * Fun: SFini + * + * Desc: function, shuts down. + * + * Ret: Void + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 SFini(void) { /* mt030.201 added under compilet time flag SS_LINUX and SLES9_PLUS @@ -6104,7 +5927,7 @@ S16 SFini() pause(); if(osCp.dep.sigEvnt==TRUE) { - mtExitClnup(); + mtExitClnup(); } } @@ -6114,28 +5937,23 @@ S16 SFini() } /* -* -* Fun: Set date and time -* -* Desc: This function is used to set the calendar -* date and time. -* -* Ret: ROK - ok -* -* Notes: Unimplemented -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SSetDateTime + * + * Fun: Set date and time + * + * Desc: This function is used to set the calendar + * date and time. + * + * Ret: ROK - ok + * + * Notes: Unimplemented + * + * File: mt_ss.c + * + */ + S16 SSetDateTime ( -REG1 DateTime *dt /* date and time */ -) -#else -S16 SSetDateTime(dt) -REG1 DateTime *dt; /* date and time */ -#endif + REG1 DateTime *dt /* date and time */ + ) { UNUSED(dt); @@ -6146,30 +5964,25 @@ REG1 DateTime *dt; /* date and time */ /* -* -* Fun: Get date and time -* -* Desc: This function is used to determine the calendar -* date and time. This information may be used for -* some management functions. -* -* Ret: ROK - ok -* RFAILED - error -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetDateTime + * + * Fun: Get date and time + * + * Desc: This function is used to determine the calendar + * date and time. This information may be used for + * some management functions. + * + * Ret: ROK - ok + * RFAILED - error + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 SGetDateTime ( -REG1 DateTime *dt /* date and time */ -) -#else -S16 SGetDateTime(dt) -REG1 DateTime *dt; /* date and time */ -#endif + REG1 DateTime *dt /* date and time */ + ) { /*-- mt035.201 : SSI enhancements for micro second in datetime struct --*/ /* time_t tt; --*/ @@ -6192,15 +6005,15 @@ REG1 DateTime *dt; /* date and time */ #endif -/*-- mt035.201 --*/ + /*-- mt035.201 --*/ /*-- - time(&tt); - localtime_r(&tt, &tme); - --*/ + time(&tt); + localtime_r(&tt, &tme); + --*/ #ifndef SS_LINUX - clock_gettime(CLOCK_REALTIME, &ptime); + clock_gettime(CLOCK_REALTIME, &ptime); #else - gettimeofday(&ptime, NULL); + gettimeofday(&ptime, NULL); #endif localtime_r(&ptime.tv_sec, &tme); @@ -6224,36 +6037,31 @@ REG1 DateTime *dt; /* date and time */ } /* -* Get time from epoch in milliseconds -* -* Fun: Get time from epoch in milliseconds -* -* Desc: This function is used to get the time from epoch in milli seconds. -* This information may be used for calculating a layer's activation function -* execution time used for thread profiling. -* -* Ret: ROK - ok -* RFAILED - error -* -* Notes: -* -* File: mt_ss.c -*/ + * Get time from epoch in milliseconds + * + * Fun: Get time from epoch in milliseconds + * + * Desc: This function is used to get the time from epoch in milli seconds. + * This information may be used for calculating a layer's activation function + * execution time used for thread profiling. + * + * Ret: ROK - ok + * RFAILED - error + * + * Notes: + * + * File: mt_ss.c + */ /* mt003.301 Modifications */ -#ifdef ANSI -S16 SGetEpcTime + S16 SGetEpcTime ( -EpcTime *et /* date and time */ -) -#else -S16 SGetEpcTime(et) -EpcTime *et; /* date and time */ -#endif + EpcTime *et /* date and time */ + ) { -/* mt003.301 Modifications */ -static uint64_t now; - uint64_t to_sec = 1000000; - uint64_t to_nsec = 1000; + /* mt003.301 Modifications */ + static uint64_t now; + uint64_t to_sec = 1000000; + uint64_t to_nsec = 1000; #ifndef SS_LINUX struct timespec ptime; #else @@ -6271,20 +6079,20 @@ static uint64_t now; #ifndef SS_LINUX - clock_gettime(CLOCK_REALTIME, &ptime); + clock_gettime(CLOCK_REALTIME, &ptime); #else - gettimeofday(&ptime, NULL); + gettimeofday(&ptime, NULL); #endif /* SS_LINUX */ - now = (ptime.tv_sec * to_sec); + now = (ptime.tv_sec * to_sec); #ifndef SS_LINUX now += (ptime.tv_nsec / to_nsec); #else /* SS_LINUX */ - now += (ptime.tv_usec); + now += (ptime.tv_usec); #endif /* SS_LINUX */ - now = (now / to_nsec); + now = (now / to_nsec); *et = now; @@ -6294,27 +6102,22 @@ static uint64_t now; /* -* -* Fun: Get system time -* -* Desc: This function is used to determine the system time. -* -* Ret: ROK - ok -* -* Notes: osCp.dep.sysTicks is updated by the timer thread. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetSysTime + * + * Fun: Get system time + * + * Desc: This function is used to determine the system time. + * + * Ret: ROK - ok + * + * Notes: osCp.dep.sysTicks is updated by the timer thread. + * + * File: mt_ss.c + * + */ + S16 SGetSysTime ( -Ticks *sysTime /* system time */ -) -#else -S16 SGetSysTime(sysTime) -Ticks *sysTime; /* system time */ -#endif + Ticks *sysTime /* system time */ + ) { @@ -6335,37 +6138,30 @@ Ticks *sysTime; /* system time */ /* mt021.201 - Addition of SGetRefTime function */ /* -* -* Fun: Get referenced time -* -* Desc: This function is used to determine the time in seconds -* and microseconds from a reference time. The reference -* time is expressed in seconds from UTC EPOC, January 1, -* 1970. -* -* Ret: ROK - ok -* RFAILED - fail -* -* Notes: Macros are defined for reference times: -* SS_REFTIME_01_01_1970 -* SS_REFTIME_01_01_2002 -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetRefTime + * + * Fun: Get referenced time + * + * Desc: This function is used to determine the time in seconds + * and microseconds from a reference time. The reference + * time is expressed in seconds from UTC EPOC, January 1, + * 1970. + * + * Ret: ROK - ok + * RFAILED - fail + * + * Notes: Macros are defined for reference times: + * SS_REFTIME_01_01_1970 + * SS_REFTIME_01_01_2002 + * + * File: mt_ss.c + * + */ + S16 SGetRefTime ( -uint32_t refTime, /* reference time */ -uint32_t *sec, -uint32_t *usec -) -#else -S16 SGetRefTime(refTime, sec, usec) -uint32_t refTime; /* reference time */ -uint32_t *sec; -uint32_t *usec; -#endif + uint32_t refTime, /* reference time */ + uint32_t *sec, + uint32_t *usec + ) { #ifndef SS_LINUX @@ -6376,9 +6172,9 @@ uint32_t *usec; #ifndef SS_LINUX - clock_gettime(CLOCK_REALTIME, &ptime); + clock_gettime(CLOCK_REALTIME, &ptime); #else - gettimeofday(&ptime, NULL); + gettimeofday(&ptime, NULL); #endif #if (ERRCLASS & ERRCLS_INT_PAR) @@ -6402,42 +6198,37 @@ uint32_t *usec; *usec = ptime.tv_usec; #endif - return ROK; + return ROK; } /* -* -* Fun: Get Random Number -* -* Desc: Invoked by layer when a pseudorandom number is required. -* -* Ret: ROK - ok -* -* Notes: Suggested approach uses shuffled Linear Congruential -* Operators as described in Byte magazine October -* 1984; "Generating and Testing Pseudorandom Numbers" -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SRandom + * + * Fun: Get Random Number + * + * Desc: Invoked by layer when a pseudorandom number is required. + * + * Ret: ROK - ok + * + * Notes: Suggested approach uses shuffled Linear Congruential + * Operators as described in Byte magazine October + * 1984; "Generating and Testing Pseudorandom Numbers" + * + * File: mt_ss.c + * + */ + S16 SRandom ( -Random *value /* random number */ -) -#else -S16 SRandom(value) -Random *value; /* random number */ -#endif + Random *value /* random number */ + ) { #if (ERRCLASS & ERRCLS_INT_PAR) if (value == NULLP) { - /* mt011.21: addition */ + /* mt011.21: addition */ MTLOGERROR(ERRCLS_INT_PAR, EMT028, (ErrVal)0 , "Null pointer"); return RFAILED; } @@ -6452,26 +6243,19 @@ Random *value; /* random number */ /* -* -* Fun: Exit Task -* -* Desc: This function exits from a task. -* -* Ret: ROK - ok -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SExitTsk -( -void -) -#else -S16 SExitTsk() -#endif + * + * Fun: Exit Task + * + * Desc: This function exits from a task. + * + * Ret: ROK - ok + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ +S16 SExitTsk(void) { @@ -6480,26 +6264,19 @@ S16 SExitTsk() /* -* -* Fun: Exit Interrupt -* -* Desc: This function exits from an interrupt. -* -* Ret: ROK - ok -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SExitInt -( -void -) -#else -S16 SExitInt() -#endif + * + * Fun: Exit Interrupt + * + * Desc: This function exits from an interrupt. + * + * Ret: ROK - ok + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ +S16 SExitInt(void) { @@ -6508,30 +6285,23 @@ S16 SExitInt() /* -* -* Fun: Hold Interrupt -* -* Desc: This function prohibits interrupts from being enabled until -* release interrupt. This function should be called when -* interrupts are disabled and prior to any call to system -* services either by entry to an interrupt service routine or -* by explicit call to disable interrupt. -* -* Ret: ROK - ok -* -* Notes: Currently does nothing -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SHoldInt -( -void -) -#else -S16 SHoldInt() -#endif + * + * Fun: Hold Interrupt + * + * Desc: This function prohibits interrupts from being enabled until + * release interrupt. This function should be called when + * interrupts are disabled and prior to any call to system + * services either by entry to an interrupt service routine or + * by explicit call to disable interrupt. + * + * Ret: ROK - ok + * + * Notes: Currently does nothing + * + * File: mt_ss.c + * + */ +S16 SHoldInt(void) { @@ -6540,26 +6310,19 @@ S16 SHoldInt() /* -* -* Fun: Release Interrupt -* -* Desc: This function allows interrupts to be enabled. -* -* Ret: ROK - ok -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SRelInt -( -void -) -#else -S16 SRelInt() -#endif + * + * Fun: Release Interrupt + * + * Desc: This function allows interrupts to be enabled. + * + * Ret: ROK - ok + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ +S16 SRelInt(void) { @@ -6568,27 +6331,20 @@ S16 SRelInt() /* -* -* Fun: SEnbInt -* -* Desc: Enable interrupts -* -* Ret: ROK on success -* RFAILED on error -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -inline S16 SEnbInt -( -void -) -#else -inline S16 SEnbInt() -#endif + * + * Fun: SEnbInt + * + * Desc: Enable interrupts + * + * Ret: ROK on success + * RFAILED on error + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ +inline S16 SEnbInt(void) { @@ -6597,27 +6353,20 @@ inline S16 SEnbInt() /* -* -* Fun: SDisInt -* -* Desc: Disable interrupts -* -* Ret: ROK on success -* RFAILED on error -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -inline S16 SDisInt -( -void -) -#else -inline S16 SDisInt() -#endif + * + * Fun: SDisInt + * + * Desc: Disable interrupts + * + * Ret: ROK on success + * RFAILED on error + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ +inline S16 SDisInt(void) { @@ -6626,30 +6375,24 @@ inline S16 SDisInt() /* -* -* Fun: Get Vector -* -* Desc: This function gets the function address stored at the -* specified interrupt vector. -* -* Ret: ROK - ok -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetVect + * + * Fun: Get Vector + * + * Desc: This function gets the function address stored at the + * specified interrupt vector. + * + * Ret: ROK - ok + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ + S16 SGetVect ( -VectNmb vectNmb, /* vector number */ -PIF *vectFnct /* vector function */ -) -#else -S16 SGetVect(vectNmb, vectFnct) -VectNmb vectNmb; /* vector number */ -PIF *vectFnct; /* vector function */ -#endif + VectNmb vectNmb, /* vector number */ + PIF *vectFnct /* vector function */ + ) { @@ -6662,30 +6405,24 @@ PIF *vectFnct; /* vector function */ /* -* -* Fun: Put Vector -* -* Desc: This function installs the specified function at the -* specified interrupt vector. -* -* Ret: ROK - ok -* -* Notes: Currently does nothing. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SPutVect + * + * Fun: Put Vector + * + * Desc: This function installs the specified function at the + * specified interrupt vector. + * + * Ret: ROK - ok + * + * Notes: Currently does nothing. + * + * File: mt_ss.c + * + */ + S16 SPutVect ( -VectNmb vectNmb, /* vector number */ -PIF vectFnct /* vector function */ -) -#else -S16 SPutVect(vectNmb, vectFnct) -VectNmb vectNmb; /* vector number */ -PIF vectFnct; /* vector function */ -#endif + VectNmb vectNmb, /* vector number */ + PIF vectFnct /* vector function */ + ) { @@ -6700,31 +6437,25 @@ PIF vectFnct; /* vector function */ #ifndef SS_MULTIPLE_PROCS /* -* -* Fun: SGetEntInst -* -* Desc: This function gets the current entity and instance. -* -* Ret: ROK - ok -* RFAILED - failed, general (optional) -* -* Notes: This function may be called by the OS or Layer 1 -* hardware drivers. -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetEntInst + * + * Fun: SGetEntInst + * + * Desc: This function gets the current entity and instance. + * + * Ret: ROK - ok + * RFAILED - failed, general (optional) + * + * Notes: This function may be called by the OS or Layer 1 + * hardware drivers. + * + * File: mt_ss.c + * + */ + S16 SGetEntInst ( -Ent *ent, /* entity */ -Inst *inst /* instance */ -) -#else -S16 SGetEntInst(ent, inst) -Ent *ent; /* entity */ -Inst *inst; /* instance */ -#endif + Ent *ent, /* entity */ + Inst *inst /* instance */ + ) { S16 i; S16 ret; @@ -6759,14 +6490,14 @@ Inst *inst; /* instance */ { if (pthread_equal(osCp.sTskTbl[i].dep.tId, tId)) { - sTsk = &osCp.sTskTbl[i]; - break; + sTsk = &osCp.sTskTbl[i]; + break; } } if (sTsk != NULLP) { - *ent = sTsk->dep.ent; - *inst = sTsk->dep.inst; + *ent = sTsk->dep.ent; + *inst = sTsk->dep.inst; } SUnlock(&osCp.sTskTblLock); @@ -6776,29 +6507,23 @@ Inst *inst; /* instance */ /* -* -* Fun: SSetEntInst -* -* Desc: This function sets the current entity and instance. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SSetEntInst + * + * Fun: SSetEntInst + * + * Desc: This function sets the current entity and instance. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 SSetEntInst ( -Ent ent, /* entity */ -Inst inst /* instance */ -) -#else -S16 SSetEntInst(ent, inst) -Ent ent; /* entity */ -Inst inst; /* instance */ -#endif + Ent ent, /* entity */ + Inst inst /* instance */ + ) { S16 i; S16 ret; @@ -6833,14 +6558,14 @@ Inst inst; /* instance */ { if (pthread_equal(osCp.sTskTbl[i].dep.tId, tId)) { - sTsk = &osCp.sTskTbl[i]; - break; + sTsk = &osCp.sTskTbl[i]; + break; } } if (sTsk != NULLP) { - sTsk->dep.ent = ent; - sTsk->dep.inst = inst; + sTsk->dep.ent = ent; + sTsk->dep.inst = inst; } SUnlock(&osCp.sTskTblLock); @@ -6853,30 +6578,24 @@ Inst inst; /* instance */ #ifdef SS_DRVR_SUPPORT /* -* -* Fun: SSetIntPend -* -* Desc: Set interrupt pending flag -* -* Ret: ROK on success -* RFAILED on error -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -inline S16 SSetIntPend + * + * Fun: SSetIntPend + * + * Desc: Set interrupt pending flag + * + * Ret: ROK on success + * RFAILED on error + * + * Notes: + * + * File: mt_ss.c + * + */ + inline S16 SSetIntPend ( -uint16_t id, /* driver task identifier */ -Bool flag /* flag */ -) -#else -inline S16 SSetIntPend(id, flag) -uint16_t id; /* driver task identifier */ -Bool flag; /* flag */ -#endif + uint16_t id, /* driver task identifier */ + Bool flag /* flag */ + ) { MtIsFlag isFlag; @@ -6908,32 +6627,25 @@ Bool flag; /* flag */ #ifdef SS_LOCKLESS_MEMORY /* -* -* Fun: SGlobMemInfoShow -* -* Desc: This function displays the memory usage information -* for the destined region. It will show the usage of -* each configured bucket and the heap for the specified region. -* -* Ret: ROK OK -* RFAILED Region not registered -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGlobMemInfoShow -( -Void -) -#else -S16 SGlobMemInfoShow() -#endif + * + * Fun: SGlobMemInfoShow + * + * Desc: This function displays the memory usage information + * for the destined region. It will show the usage of + * each configured bucket and the heap for the specified region. + * + * Ret: ROK OK + * RFAILED Region not registered + * + * File: mt_ss.c + * + */ +S16 SGlobMemInfoShow(Void) { uint16_t idx; Txt prntBuf[100]; CmMmGlobRegCb *globReg; - + globReg = osCp.globRegCb; @@ -6947,20 +6659,20 @@ S16 SGlobMemInfoShow() SDisplay(0, prntBuf); sprintf(prntBuf, "====================================================\n"); SDisplay(0, prntBuf); - + for (idx = 0; idx < globReg->numBkts; idx++) { #ifdef XEON_SPECIFIC_CHANGES sprintf(prntBuf, "%2u %12lu %12lu %8lu %9lu\n", - idx, globReg->bktTbl[idx].size, globReg->bktTbl[idx].bucketSetSize, globReg->bktTbl[idx].listValidBktSet.count, globReg->bktTbl[idx].listFreeBktSet.count); + idx, globReg->bktTbl[idx].size, globReg->bktTbl[idx].bucketSetSize, globReg->bktTbl[idx].listValidBktSet.count, globReg->bktTbl[idx].listFreeBktSet.count); #else #ifndef ALIGN_64BIT sprintf(prntBuf, "%2u %12lu %8lu %9lu\n", - idx, globReg->bktTbl[idx].bucketSetSize, globReg->bktTbl[idx].listValidBktSet.count, globReg->bktTbl[idx].listFreeBktSet.count); + idx, globReg->bktTbl[idx].bucketSetSize, globReg->bktTbl[idx].listValidBktSet.count, globReg->bktTbl[idx].listFreeBktSet.count); #else sprintf(prntBuf, "%2u %12u %8u %9u\n", - idx, globReg->bktTbl[idx].bucketSetSize, globReg->bktTbl[idx].listValidBktSet.count, globReg->bktTbl[idx].listFreeBktSet.count); + idx, globReg->bktTbl[idx].bucketSetSize, globReg->bktTbl[idx].listValidBktSet.count, globReg->bktTbl[idx].listFreeBktSet.count); #endif #endif SDisplay(0, prntBuf); @@ -6974,65 +6686,59 @@ S16 SGlobMemInfoShow() #endif /* SS_LOCKLESS_MEMORY */ /* -Bool IsMemoryThresholdHit(Region reg, Pool pool) -{ - if((mtCMMRegCb[reg]->bktTbl[pool].numAlloc * 100 )/mtCMMRegCb[reg]->bktTbl[pool].numBlks > 70) - { - MSPD_DBG("Threshold reached reg(%d) pool(%d) numAllc(%d) numBlks(%d)\n", - reg, - pool, - mtCMMRegCb[reg]->bktTbl[pool].numAlloc, - mtCMMRegCb[reg]->bktTbl[pool].numBlks); - return (TRUE); - } - return (FALSE); -} -*/ + Bool IsMemoryThresholdHit(Region reg, Pool pool) + { + if((mtCMMRegCb[reg]->bktTbl[pool].numAlloc * 100 )/mtCMMRegCb[reg]->bktTbl[pool].numBlks > 70) + { + MSPD_DBG("Threshold reached reg(%d) pool(%d) numAllc(%d) numBlks(%d)\n", + reg, + pool, + mtCMMRegCb[reg]->bktTbl[pool].numAlloc, + mtCMMRegCb[reg]->bktTbl[pool].numBlks); + return (TRUE); + } + return (FALSE); + } + */ /* mt022.201 - Addition of SRegInfoShow function */ /* -* -* Fun: SRegInfoShow -* -* Desc: This function displays the memory usage information -* for the destined region. It will show the usage of -* each configured bucket and the heap for the specified region. -* -* Ret: ROK OK -* RFAILED Region not registered -* -* Notes: A Sample Output from the function -* Bucket Memory: region 1 -* ==================================================== -* Bucket Number of Blks configured Size Allocated -* ==================================================== -* 0 1 16 1 -* 1 1 32 0 -* 2 1 80 0 -* 3 1 256 0 -* 4 1 320 0 -* -* --------------- -* Heap Memory: region 1 -* Heap Size: 0 -* Heap Allocated: 0 -* Heap Segmented blocks: 0 -* -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SRegInfoShow + * + * Fun: SRegInfoShow + * + * Desc: This function displays the memory usage information + * for the destined region. It will show the usage of + * each configured bucket and the heap for the specified region. + * + * Ret: ROK OK + * RFAILED Region not registered + * + * Notes: A Sample Output from the function + * Bucket Memory: region 1 + * ==================================================== + * Bucket Number of Blks configured Size Allocated + * ==================================================== + * 0 1 16 1 + * 1 1 32 0 + * 2 1 80 0 + * 3 1 256 0 + * 4 1 320 0 + * + * --------------- + * Heap Memory: region 1 + * Heap Size: 0 + * Heap Allocated: 0 + * Heap Segmented blocks: 0 + * + * + * File: mt_ss.c + * + */ + S16 SRegInfoShow ( -Region region, -uint32_t *availmem -) -#else -S16 SRegInfoShow(region, availmem) -Region region; -uint32_t *availmem; -#endif + Region region, + uint32_t *availmem + ) { uint16_t idx; Txt prntBuf[100]; @@ -7065,60 +6771,60 @@ uint32_t *availmem; #ifdef TENB_T2K3K_SPECIFIC_CHANGES #ifdef ALIGN_64BIT sprintf((char *)prntBuf, "%2u %8u %5u %8u %8u\n", - idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, - mtCMMRegCb[region]->bktTbl[idx].size, - mtCMMRegCb[region]->bktTbl[idx].numAlloc, - mtCMMRegCb[region]->bktTbl[idx].maxAlloc); + idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, + mtCMMRegCb[region]->bktTbl[idx].size, + mtCMMRegCb[region]->bktTbl[idx].numAlloc, + mtCMMRegCb[region]->bktTbl[idx].maxAlloc); #else sprintf((char *)prntBuf, "%2u %8lu %5lu %8lu %8lu\n", - idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, - mtCMMRegCb[region]->bktTbl[idx].size, - mtCMMRegCb[region]->bktTbl[idx].numAlloc, - mtCMMRegCb[region]->bktTbl[idx].maxAlloc); + idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, + mtCMMRegCb[region]->bktTbl[idx].size, + mtCMMRegCb[region]->bktTbl[idx].numAlloc, + mtCMMRegCb[region]->bktTbl[idx].maxAlloc); #endif #else -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "%2u %8u %5u %8u\n", - idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, - mtCMMRegCb[region]->bktTbl[idx].size, - mtCMMRegCb[region]->bktTbl[idx].numAlloc); + idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, + mtCMMRegCb[region]->bktTbl[idx].size, + mtCMMRegCb[region]->bktTbl[idx].numAlloc); #else sprintf(prntBuf, "%2u %8lu %5lu %8lu\n", - idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, - mtCMMRegCb[region]->bktTbl[idx].size, - mtCMMRegCb[region]->bktTbl[idx].numAlloc); + idx, mtCMMRegCb[region]->bktTbl[idx].numBlks, + mtCMMRegCb[region]->bktTbl[idx].size, + mtCMMRegCb[region]->bktTbl[idx].numAlloc); #endif #endif /* not TENB_RTLIN_CHANGES */ SDisplay(0, prntBuf); *availmem = *availmem + (mtCMMRegCb[region]->bktTbl[idx].size * \ - (mtCMMRegCb[region]->bktTbl[idx].numBlks - \ - mtCMMRegCb[region]->bktTbl[idx].numAlloc)); + (mtCMMRegCb[region]->bktTbl[idx].numBlks - \ + mtCMMRegCb[region]->bktTbl[idx].numAlloc)); } sprintf(prntBuf, "\n---------------\n"); SDisplay(0, prntBuf); sprintf(prntBuf, "Heap Memory: region %d\n", region); SDisplay(0, prntBuf); -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "Heap Size: %u\n", mtCMMRegCb[region]->heapSize); #else sprintf(prntBuf, "Heap Size: %lu\n", mtCMMRegCb[region]->heapSize); #endif SDisplay(0, prntBuf); -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "Heap Allocated: %u\n", - (mtCMMRegCb[region]->heapSize - mtCMMRegCb[region]->heapCb.avlSize)); + (mtCMMRegCb[region]->heapSize - mtCMMRegCb[region]->heapCb.avlSize)); #else sprintf(prntBuf, "Heap Allocated: %lu\n", - (mtCMMRegCb[region]->heapSize - mtCMMRegCb[region]->heapCb.avlSize)); + (mtCMMRegCb[region]->heapSize - mtCMMRegCb[region]->heapCb.avlSize)); #endif SDisplay(0, prntBuf); *availmem = *availmem + mtCMMRegCb[region]->heapCb.avlSize; #if (ERRCLASS & ERRCLS_DEBUG) sprintf(prntBuf, "Heap Segmented blocks: %d\n", - mtCMMRegCb[region]->heapCb.numFragBlk); + mtCMMRegCb[region]->heapCb.numFragBlk); SDisplay(0, prntBuf); #endif @@ -7131,17 +6837,11 @@ uint32_t SMemMaxThreshold[SSI_MAX_REG_THRESHOLD][SSI_MAX_BKT_THRESHOLD] = {{0}}; uint32_t SMemMidThreshold[SSI_MAX_REG_THRESHOLD][SSI_MAX_BKT_THRESHOLD] = {{0}}; uint32_t SMemLowThreshold[SSI_MAX_REG_THRESHOLD][SSI_MAX_BKT_THRESHOLD] = {{0}}; -#ifdef ANSI -static Void SInitMemThreshold + static Void SInitMemThreshold ( -Region region, -uint8_t maxBkt -) -#else -static Void SInitMemThreshold(region, maxBkt) -Region region; -uint8_t maxBkt; -#endif + Region region, + uint8_t maxBkt + ) { uint8_t idx = 0; for (idx = 0; (idx < maxBkt && idx < mtCMMRegCb[region]->numBkts); idx++) @@ -7149,21 +6849,15 @@ uint8_t maxBkt; SMemMaxThreshold[region][idx] = (mtCMMRegCb[region]->bktTbl[idx].numBlks*95)/100; SMemMidThreshold[region][idx] = (mtCMMRegCb[region]->bktTbl[idx].numBlks*85)/100; SMemLowThreshold[region][idx] = (mtCMMRegCb[region]->bktTbl[idx].numBlks*80)/100; - printf("REGION:%d, BKT:%d max:%d mid:%d low:%d\n", region, idx, SMemMaxThreshold[region][idx], SMemMidThreshold[region][idx], SMemLowThreshold[region][idx]); + printf("\nREGION:%d, BKT:%d max:%d mid:%d low:%d\n", region, idx, SMemMaxThreshold[region][idx], SMemMidThreshold[region][idx], SMemLowThreshold[region][idx]); } } -#ifdef ANSI -S16 SRegReachedMemThreshold + S16 SRegReachedMemThreshold ( -Region region, -uint8_t maxBkt -) -#else -S16 SRegReachedMemThreshold(region, maxBkt) -Region region; -uint8_t maxBkt; -#endif + Region region, + uint8_t maxBkt + ) { uint8_t idx = 0; uint8_t memStatus = 3; @@ -7178,16 +6872,16 @@ uint8_t maxBkt; { if(mtCMMRegCb[region]->bktTbl[idx].numAlloc >= SMemMaxThreshold[region][idx]) { - memStatus = 0; - break; + memStatus = 0; + break; } else if((mtCMMRegCb[region]->bktTbl[idx].numAlloc >= SMemMidThreshold[region][idx]) && (memStatus >1)) { - memStatus = 1; + memStatus = 1; } else if((mtCMMRegCb[region]->bktTbl[idx].numAlloc >= SMemLowThreshold[region][idx]) && (memStatus >2)) { - memStatus = 2; + memStatus = 2; } } return (memStatus); @@ -7195,32 +6889,26 @@ uint8_t maxBkt; #endif /* mt033.201 - addition of API to return the memory statistical data */ /* -* -* Fun: SGetRegInfo -* -* Desc: This function returns the memory usage information -* for the destined region. It will return the usage of -* each configured bucket and the heap for the specified region. -* -* Ret: ROK OK -* RFAILED Region not registered -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SGetRegInfo + * + * Fun: SGetRegInfo + * + * Desc: This function returns the memory usage information + * for the destined region. It will return the usage of + * each configured bucket and the heap for the specified region. + * + * Ret: ROK OK + * RFAILED Region not registered + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 SGetRegInfo ( -Region region, -SsMemDbgInfo *dbgInfo -) -#else -S16 SGetRegInfo(region, dbgInfo) -Region region; -SsMemDbgInfo *dbgInfo; -#endif + Region region, + SsMemDbgInfo *dbgInfo + ) { uint32_t idx; @@ -7247,8 +6935,8 @@ SsMemDbgInfo *dbgInfo; dbgInfo->bktDbgTbl[idx].numAlloc = mtCMMRegCb[region]->bktTbl[idx].numAlloc; dbgInfo->availmem += (mtCMMRegCb[region]->bktTbl[idx].size * \ - (mtCMMRegCb[region]->bktTbl[idx].numBlks - \ - mtCMMRegCb[region]->bktTbl[idx].numAlloc)); + (mtCMMRegCb[region]->bktTbl[idx].numBlks - \ + mtCMMRegCb[region]->bktTbl[idx].numAlloc)); } dbgInfo->region = region; @@ -7256,7 +6944,7 @@ SsMemDbgInfo *dbgInfo; dbgInfo->heapSize = mtCMMRegCb[region]->heapSize; dbgInfo->heapAlloc = (mtCMMRegCb[region]->heapSize - \ - mtCMMRegCb[region]->heapCb.avlSize); + mtCMMRegCb[region]->heapCb.avlSize); dbgInfo->availmem += mtCMMRegCb[region]->heapCb.avlSize; @@ -7267,17 +6955,11 @@ SsMemDbgInfo *dbgInfo; return ROK; } -#ifdef ANSI -S16 SGetRegPoolInfo + S16 SGetRegPoolInfo ( -uint8_t *numRegion, -uint8_t *numPool -) -#else -S16 SGetRegPoolInfo(numRegion, numPool) -uint8_t *numRegion; -uint8_t *numPool; -#endif + uint8_t *numRegion, + uint8_t *numPool + ) { /* Send number of Region available */ *numRegion = mtMemoCfg.numRegions; @@ -7299,28 +6981,22 @@ uint8_t *numPool; * for the destined region. It will show the total memory * used for static and dynamic memory if typeFlag is * SS_MEM_BKT_ALLOC_PROFILE. It will show the number of -* memory block allocated for a particular size if typeFlag -* is SS_MEM_BLK_SIZE_PROFILE from the hash list by -* calling SRegPrintMemStats. -* -* Ret: ROK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SPrintRegMemStatusInfo + * memory block allocated for a particular size if typeFlag + * is SS_MEM_BLK_SIZE_PROFILE from the hash list by + * calling SRegPrintMemStats. + * + * Ret: ROK + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 SPrintRegMemStatusInfo ( -Region region, -uint8_t typeFlag -) -#else -S16 SPrintRegMemStatusInfo(region, typeFlag) -Region region; -uint8_t typeFlag; -#endif + Region region, + uint8_t typeFlag + ) { Txt prntBuf[150]; uint32_t idx; @@ -7353,23 +7029,23 @@ uint8_t typeFlag; SDisplay(0, prntBuf); for (idx = 0; idx < mtCMMRegCb[region]->numBkts; idx++) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, "%2u %8u %8u\n", idx, - mtCMMRegCb[region]->bktTbl[idx].staticMemUsed, - mtCMMRegCb[region]->bktTbl[idx].dynamicMemUsed); -#else - sprintf(prntBuf, "%2lu %8lu %8lu\n", idx, - mtCMMRegCb[region]->bktTbl[idx].staticMemUsed, - mtCMMRegCb[region]->bktTbl[idx].dynamicMemUsed); -#endif - SDisplay(0, prntBuf); - /* update the total count */ - statMemSize += mtCMMRegCb[region]->bktTbl[idx].staticMemUsed; - dynMemSize += mtCMMRegCb[region]->bktTbl[idx].dynamicMemUsed; + sprintf(prntBuf, "%2u %8u %8u\n", idx, + mtCMMRegCb[region]->bktTbl[idx].staticMemUsed, + mtCMMRegCb[region]->bktTbl[idx].dynamicMemUsed); +#else + sprintf(prntBuf, "%2lu %8lu %8lu\n", idx, + mtCMMRegCb[region]->bktTbl[idx].staticMemUsed, + mtCMMRegCb[region]->bktTbl[idx].dynamicMemUsed); +#endif + SDisplay(0, prntBuf); + /* update the total count */ + statMemSize += mtCMMRegCb[region]->bktTbl[idx].staticMemUsed; + dynMemSize += mtCMMRegCb[region]->bktTbl[idx].dynamicMemUsed; } /* from buckets */ -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "Total Static Memory allocated from buckets: %u\n", statMemSize); SDisplay(0, prntBuf); @@ -7384,13 +7060,13 @@ uint8_t typeFlag; /* from heap */ sprintf(prntBuf, "\n\nAllocated Memory profile from Heap of region: %d \n", region); SDisplay(0, prntBuf); -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "STATIC MEMORY: %u DYNAMIC MEMORY:%u \n", - mtCMMRegCb[region]->heapCb.staticHeapMemUsed, mtCMMRegCb[region]->heapCb.dynamicHeapMemUsed); + mtCMMRegCb[region]->heapCb.staticHeapMemUsed, mtCMMRegCb[region]->heapCb.dynamicHeapMemUsed); #else sprintf(prntBuf, "STATIC MEMORY: %lu DYNAMIC MEMORY:%lu \n", - mtCMMRegCb[region]->heapCb.staticHeapMemUsed, mtCMMRegCb[region]->heapCb.dynamicHeapMemUsed); + mtCMMRegCb[region]->heapCb.staticHeapMemUsed, mtCMMRegCb[region]->heapCb.dynamicHeapMemUsed); #endif SDisplay(0, prntBuf); } @@ -7410,29 +7086,21 @@ uint8_t typeFlag; } /* -* -* Fun: SPrintRegMemStats -* -* Desc: This function displays the memory usage information for -* the destined region. It will show the number of memory -* block allocated for a particular size from the hash list. -* -* Ret: ROK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -static S16 SPrintRegMemStats -( -Region region -) -#else -static S16 SPrintRegMemStats(region) -Region region; -#endif + * + * Fun: SPrintRegMemStats + * + * Desc: This function displays the memory usage information for + * the destined region. It will show the number of memory + * block allocated for a particular size from the hash list. + * + * Ret: ROK + * + * Notes: + * + * File: mt_ss.c + * + */ +static S16 SPrintRegMemStats(Region region) { CmMmHashListCp *hashListCp; Txt prntBuf[150]; @@ -7445,7 +7113,7 @@ Region region; sprintf(prntBuf, "\n\nSize Vs. NumAttempts and Alloc/Dealloc profile of region %d\n", region); SDisplay(0, prntBuf); sprintf(prntBuf, "Maximum Entries: %u Current Entries: %u\n", - hashListCp->numOfbins, hashListCp->numOfEntries); + hashListCp->numOfbins, hashListCp->numOfEntries); SDisplay(0, prntBuf); sprintf(prntBuf, "===================================\n"); SDisplay(0, prntBuf); @@ -7455,20 +7123,20 @@ Region region; SDisplay(0, prntBuf); for (idx = 0, cntEnt=0; (cntEnt < hashListCp->numOfEntries) && - (idx < CMM_STAT_HASH_TBL_LEN); idx++) + (idx < CMM_STAT_HASH_TBL_LEN); idx++) { if (hashListCp->hashList[idx].numAttempts) { - cntEnt++; -/*mt009.301 Fixed 64BIT compilation warnings*/ + cntEnt++; + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, "%8u %8u\n", hashListCp->hashList[idx].size, - hashListCp->hashList[idx].numAttempts); + sprintf(prntBuf, "%8u %8u\n", hashListCp->hashList[idx].size, + hashListCp->hashList[idx].numAttempts); #else - sprintf(prntBuf, "%8lu %8lu\n", hashListCp->hashList[idx].size, - hashListCp->hashList[idx].numAttempts); + sprintf(prntBuf, "%8lu %8lu\n", hashListCp->hashList[idx].size, + hashListCp->hashList[idx].numAttempts); #endif - SDisplay(0, prntBuf); + SDisplay(0, prntBuf); } } @@ -7484,29 +7152,29 @@ Region region; /* Print the statistics of total number of alloc/de-alloc attempts in each bucket of this region */ for (idx = 0; idx < mtCMMRegCb[region]->numBkts; idx++) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "%4u %8u %8u\n", idx, - mtCMMRegCb[region]->bktTbl[idx].numAllocAttempts, - mtCMMRegCb[region]->bktTbl[idx].numDeallocAttempts); + mtCMMRegCb[region]->bktTbl[idx].numAllocAttempts, + mtCMMRegCb[region]->bktTbl[idx].numDeallocAttempts); #else sprintf(prntBuf, "%4lu %8lu %8lu\n", idx, - mtCMMRegCb[region]->bktTbl[idx].numAllocAttempts, - mtCMMRegCb[region]->bktTbl[idx].numDeallocAttempts); + mtCMMRegCb[region]->bktTbl[idx].numAllocAttempts, + mtCMMRegCb[region]->bktTbl[idx].numDeallocAttempts); #endif SDisplay(0, prntBuf); } sprintf(prntBuf, "\nAllocation/De-allocation profile in Heap\n"); SDisplay(0, prntBuf); -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "Num of Alloc Attempts: %u Num of De-alloc Attempts: %u\n", - mtCMMRegCb[region]->heapCb.numAllocAttempts, - mtCMMRegCb[region]->heapCb.numDeallocAttempts); + mtCMMRegCb[region]->heapCb.numAllocAttempts, + mtCMMRegCb[region]->heapCb.numDeallocAttempts); #else sprintf(prntBuf, "Num of Alloc Attempts: %lu Num of De-alloc Attempts: %lu\n", - mtCMMRegCb[region]->heapCb.numAllocAttempts, - mtCMMRegCb[region]->heapCb.numDeallocAttempts); + mtCMMRegCb[region]->heapCb.numAllocAttempts, + mtCMMRegCb[region]->heapCb.numDeallocAttempts); #endif SDisplay(0, prntBuf); sprintf(prntBuf, "\n"); @@ -7516,33 +7184,26 @@ Region region; } /* -* -* Fun: SRegMemErrHdlr -* -* Desc: This function handles the errors returned from the memory -* related functions. Customers are suggested to modify this -* API according to their specific requirement. -* -* Ret: ROK OK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -Void SRegMemErrHdlr + * + * Fun: SRegMemErrHdlr + * + * Desc: This function handles the errors returned from the memory + * related functions. Customers are suggested to modify this + * API according to their specific requirement. + * + * Ret: ROK OK + * + * Notes: + * + * File: mt_ss.c + * + */ + Void SRegMemErrHdlr ( -Region region, -Data *ptr, -S16 errCode -) -#else -Void SRegMemErrHdlr(region, ptr, errCode) -Region region; -Data *ptr; -S16 errCode; -#endif + Region region, + Data *ptr, + S16 errCode + ) { Txt prntBuf[150]; @@ -7562,30 +7223,25 @@ S16 errCode; } /* -* -* Fun: SPrintRegMemProfile -* -* Desc: This function displays the memory profile information -* for the destined region. This function prints for: -* 1) each memory bucket-Block address, size, size for which it is allocated, free/allocated, static/dynamic -* 2) heap - memory block address, size, requested size, free/allocated, static/dynamic -* -* Ret: ROK OK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 SPrintRegMemProfile + * + * Fun: SPrintRegMemProfile + * + * Desc: This function displays the memory profile information + * for the destined region. This function prints for: + * 1) each memory bucket-Block address, size, size for which it is allocated, free/allocated, static/dynamic + * 2) heap - memory block address, size, requested size, free/allocated, static/dynamic + * + * Ret: ROK OK + * + * Notes: + * + * File: mt_ss.c + * + */ + S16 SPrintRegMemProfile ( -Region region -) -#else -S16 SPrintRegMemProfile(region) -Region region; -#endif + Region region + ) { CmMmHeapCb *heapCb; CmMmRegCb *regCb; @@ -7620,13 +7276,13 @@ Region region; for (idx = 0; idx < regCb->numBkts; idx++) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "\nBucket number:%4u of Size:%u Num of Blocks: %u\n", - idx, regCb->bktTbl[idx].size, regCb->bktTbl[idx].numBlks); + idx, regCb->bktTbl[idx].size, regCb->bktTbl[idx].numBlks); #else sprintf(prntBuf, "\nBucket number:%4lu of Size:%lu Num of Blocks: %lu\n", - idx, regCb->bktTbl[idx].size, regCb->bktTbl[idx].numBlks); + idx, regCb->bktTbl[idx].size, regCb->bktTbl[idx].numBlks); #endif SDisplay(0, prntBuf); @@ -7640,60 +7296,60 @@ Region region; offsetToNxtBlk = regCb->bktTbl[idx].size + sizeof(CmMmBlkHdr); for (blkCnt=0, curBktBlk = (CmMmBlkHdr *)(regCb->bktTbl[idx].bktStartPtr); - ((curBktBlk) && (blkCnt < regCb->bktTbl[idx].numBlks)); - curBktBlk = (CmMmBlkHdr *)((Data *)curBktBlk + offsetToNxtBlk), blkCnt++) + ((curBktBlk) && (blkCnt < regCb->bktTbl[idx].numBlks)); + curBktBlk = (CmMmBlkHdr *)((Data *)curBktBlk + offsetToNxtBlk), blkCnt++) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, "%6u %8p", blkCnt, (void *)curBktBlk); + sprintf(prntBuf, "%6u %8p", blkCnt, (void *)curBktBlk); #else - sprintf(prntBuf, "%6lu %8p", blkCnt, (void *)curBktBlk); + sprintf(prntBuf, "%6lu %8p", blkCnt, (void *)curBktBlk); #endif - SDisplay(0, prntBuf); - /* check if it is a sane block, elxe jump to next block */ - if (cmMmRegIsBlkSane(curBktBlk) != ROK) - { - sprintf(prntBuf, " Trampled \n"); - SDisplay(0, prntBuf); + SDisplay(0, prntBuf); + /* check if it is a sane block, elxe jump to next block */ + if (cmMmRegIsBlkSane(curBktBlk) != ROK) + { + sprintf(prntBuf, " Trampled \n"); + SDisplay(0, prntBuf); - continue; - } + continue; + } - if (CMM_IS_STATIC(curBktBlk->memFlags)) - { -/*mt009.301 Fixed 64BIT compilation warnings*/ + if (CMM_IS_STATIC(curBktBlk->memFlags)) + { + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, " Allocated Static %8u\n", curBktBlk->requestedSize); + sprintf(prntBuf, " Allocated Static %8u\n", curBktBlk->requestedSize); #else - sprintf(prntBuf, " Allocated Static %8lu\n", curBktBlk->requestedSize); + sprintf(prntBuf, " Allocated Static %8lu\n", curBktBlk->requestedSize); #endif - SDisplay(0, prntBuf); - } - else if (CMM_IS_DYNAMIC(curBktBlk->memFlags)) - { -/*mt009.301 Fixed 64BIT compilation warnings*/ + SDisplay(0, prntBuf); + } + else if (CMM_IS_DYNAMIC(curBktBlk->memFlags)) + { + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, " Allocated Dynamic %8u\n", curBktBlk->requestedSize); + sprintf(prntBuf, " Allocated Dynamic %8u\n", curBktBlk->requestedSize); #else - sprintf(prntBuf, " Allocated Dynamic %8lu\n", curBktBlk->requestedSize); + sprintf(prntBuf, " Allocated Dynamic %8lu\n", curBktBlk->requestedSize); #endif - SDisplay(0, prntBuf); - } - else if (CMM_IS_FREE(curBktBlk->memFlags)) - { -/*mt009.301 Fixed 64BIT compilation warnings*/ + SDisplay(0, prntBuf); + } + else if (CMM_IS_FREE(curBktBlk->memFlags)) + { + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, " Free %8u\n", curBktBlk->requestedSize); + sprintf(prntBuf, " Free %8u\n", curBktBlk->requestedSize); #else - sprintf(prntBuf, " Free %8lu\n", curBktBlk->requestedSize); + sprintf(prntBuf, " Free %8lu\n", curBktBlk->requestedSize); #endif - SDisplay(0, prntBuf); - } - else - { - sprintf(prntBuf, " Trampled \n"); - SDisplay(0, prntBuf); - } + SDisplay(0, prntBuf); + } + else + { + sprintf(prntBuf, " Trampled \n"); + SDisplay(0, prntBuf); + } } } @@ -7716,9 +7372,9 @@ Region region; /* traverse the entire heap to output the heap profile */ hdrSize = sizeof(CmHEntry); for (blkCnt=0, curHBlk = (CmHEntry *)heapCb->vStart; - ((curHBlk) && (curHBlk < (CmHEntry *)heapCb->vEnd)); blkCnt++) + ((curHBlk) && (curHBlk < (CmHEntry *)heapCb->vEnd)); blkCnt++) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, "%6u %8p", blkCnt, (void *)curHBlk); #else @@ -7729,22 +7385,22 @@ Region region; /* check if it is a sane block, elxe jump to next block */ if (cmMmRegIsBlkSane((CmMmBlkHdr *)curHBlk) != ROK) { - sprintf(prntBuf, " Trampled \n"); - SDisplay(0, prntBuf); - - sprintf(prntBuf, "Trampled block encountered: Stopping heap profile\n"); - SDisplay(0, prntBuf); - - /* - * To go to next block in the heap we do not have any offset value - * other than curHBlk->size. As the block is already trampled - * we cannot rely on this size. So it is better to stop here unless there - * exists any other mechanism(?) to know the offset to next block. - */ - return ROK; + sprintf(prntBuf, " Trampled \n"); + SDisplay(0, prntBuf); + + sprintf(prntBuf, "Trampled block encountered: Stopping heap profile\n"); + SDisplay(0, prntBuf); + + /* + * To go to next block in the heap we do not have any offset value + * other than curHBlk->size. As the block is already trampled + * we cannot rely on this size. So it is better to stop here unless there + * exists any other mechanism(?) to know the offset to next block. + */ + return ROK; } -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(prntBuf, " %8u", curHBlk->size); #else @@ -7754,38 +7410,38 @@ Region region; if (CMM_IS_STATIC(curHBlk->memFlags)) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, " Allocated Static %8u\n", curHBlk->requestedSize); + sprintf(prntBuf, " Allocated Static %8u\n", curHBlk->requestedSize); #else - sprintf(prntBuf, " Allocated Static %8lu\n", curHBlk->requestedSize); + sprintf(prntBuf, " Allocated Static %8lu\n", curHBlk->requestedSize); #endif - SDisplay(0, prntBuf); + SDisplay(0, prntBuf); } else if (CMM_IS_DYNAMIC(curHBlk->memFlags)) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, " Allocated Dynamic %8u\n", curHBlk->requestedSize); + sprintf(prntBuf, " Allocated Dynamic %8u\n", curHBlk->requestedSize); #else - sprintf(prntBuf, " Allocated Dynamic %8lu\n", curHBlk->requestedSize); + sprintf(prntBuf, " Allocated Dynamic %8lu\n", curHBlk->requestedSize); #endif - SDisplay(0, prntBuf); + SDisplay(0, prntBuf); } else if (CMM_IS_FREE(curHBlk->memFlags)) { -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT - sprintf(prntBuf, " Free %8u\n", curHBlk->requestedSize); + sprintf(prntBuf, " Free %8u\n", curHBlk->requestedSize); #else - sprintf(prntBuf, " Free %8lu\n", curHBlk->requestedSize); + sprintf(prntBuf, " Free %8lu\n", curHBlk->requestedSize); #endif - SDisplay(0, prntBuf); + SDisplay(0, prntBuf); } else { - sprintf(prntBuf, " Trampled \n"); - SDisplay(0, prntBuf); + sprintf(prntBuf, " Trampled \n"); + SDisplay(0, prntBuf); } /* goto next block in the heap */ curHBlk = (CmHEntry *)((Data *)curHBlk + hdrSize + curHBlk->size); @@ -7798,28 +7454,23 @@ Region region; /*-- mt035.201 : Added new API for timestamp --*/ /*-- -* -* Fun: Get TimeStamp -* -* Desc: This function is used to Get TimeStamp in micro seconds -* -* Ret: ROK - ok -* RFAILED - error -* -* Notes: -* -* File: mt_ss.c -* ---*/ -#ifdef ANSI -S16 SGetTimeStamp + * + * Fun: Get TimeStamp + * + * Desc: This function is used to Get TimeStamp in micro seconds + * + * Ret: ROK - ok + * RFAILED - error + * + * Notes: + * + * File: mt_ss.c + * + --*/ + S16 SGetTimeStamp ( -S8 *ts -) -#else -S16 SGetTimeStamp(ts) -S8 *ts; -#endif + S8 *ts + ) { #ifndef SS_LINUX @@ -7834,9 +7485,9 @@ S8 *ts; #ifndef SS_LINUX - clock_gettime(CLOCK_REALTIME, &ptime); + clock_gettime(CLOCK_REALTIME, &ptime); #else - gettimeofday(&ptime, NULL); + gettimeofday(&ptime, NULL); #endif /* Obtain the time of day, and convert it to a tm struct. --*/ @@ -7844,8 +7495,8 @@ S8 *ts; /* Klock work fix ccpu00148484 */ if(ptm != NULLP) { - /* Format the date and time, down to a single second. --*/ - strftime (time_string, sizeof (time_string), "%a %b %d %Y %H:%M:%S", ptm); + /* Format the date and time, down to a single second. --*/ + strftime (time_string, sizeof (time_string), "%a %b %d %Y %H:%M:%S", ptm); } /* Compute microseconds. --*/ @@ -7857,7 +7508,7 @@ S8 *ts; /* Print the formatted time, in seconds, followed by a decimal point and the microseconds. --*/ -/*mt009.301 Fixed 64BIT compilation warnings*/ + /*mt009.301 Fixed 64BIT compilation warnings*/ #ifdef ALIGN_64BIT sprintf(ts, "%s.%03d", time_string, microseconds); #else @@ -7869,26 +7520,19 @@ S8 *ts; } /*-- mt037.201 : Added new API for SGetSystemTsk --*/ /* -* -* Fun: Get SGetSystemTsk -* -* Desc: This function is used to Get sytem task id -* -* Ret: task id -* -* Notes: -* -* File: mt_ss.c -* ---*/ -#ifdef ANSI -uint32_t SGetSystemTsk -( -Void -) -#else -uint32_t SGetSystemTsk() -#endif + * + * Fun: Get SGetSystemTsk + * + * Desc: This function is used to Get sytem task id + * + * Ret: task id + * + * Notes: + * + * File: mt_ss.c + * + --*/ +uint32_t SGetSystemTsk(Void) { return (pthread_self()); @@ -7897,24 +7541,20 @@ uint32_t SGetSystemTsk() #ifdef SS_MULTICORE_SUPPORT /* -* -* Fun: Add Timer thread into system task table -* -* Desc: This function is used to add the system task -* associated with Timer thread. -* -* Ret: None -* -* Notes: -* -* File: mt_ss.c -* ---*/ -#ifdef ANSI + * + * Fun: Add Timer thread into system task table + * + * Desc: This function is used to add the system task + * associated with Timer thread. + * + * Ret: None + * + * Notes: + * + * File: mt_ss.c + * + --*/ static SsSTskEntry* ssdAddTmrSTsk(Void) -#else -static SsSTskEntry* ssdAddTmrSTsk() -#endif { SsSTskEntry *sTsk; S16 ret; @@ -7927,7 +7567,7 @@ static SsSTskEntry* ssdAddTmrSTsk() #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT039, (ErrVal) ret, - "Could not lock system task table"); + "Could not lock system task table"); #endif return (sTsk); @@ -7940,9 +7580,9 @@ static SsSTskEntry* ssdAddTmrSTsk() if ( SUnlock(&osCp.sTskTblLock) != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT040, ERRZERO, - "Could not give the Semaphore"); - return (sTsk); + MTLOGERROR(ERRCLS_DEBUG, EMT040, ERRZERO, + "Could not give the Semaphore"); + return (sTsk); #endif } @@ -7967,15 +7607,15 @@ static SsSTskEntry* ssdAddTmrSTsk() if ( SUnlock(&osCp.sTskTblLock) != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT042, ERRZERO, - "Could not give the Semaphore"); - return (NULLP); + MTLOGERROR(ERRCLS_DEBUG, EMT042, ERRZERO, + "Could not give the Semaphore"); + return (NULLP); #endif } #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT043, (ErrVal) ret, - "Could not initialize demand queue"); + "Could not initialize demand queue"); #endif return (NULLP); @@ -7989,15 +7629,15 @@ static SsSTskEntry* ssdAddTmrSTsk() if ( SUnlock(&osCp.sTskTblLock) != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT044, ERRZERO, - "Could not give the Semaphore"); - return (NULLP); + MTLOGERROR(ERRCLS_DEBUG, EMT044, ERRZERO, + "Could not give the Semaphore"); + return (NULLP); #endif } #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT045, (ErrVal) ret, - "Could not initialize system task entry lock"); + "Could not initialize system task entry lock"); #endif return (NULLP); @@ -8013,14 +7653,14 @@ static SsSTskEntry* ssdAddTmrSTsk() /* unlock the system task table */ - if ( SUnlock(&osCp.sTskTblLock) != ROK) - { + if ( SUnlock(&osCp.sTskTblLock) != ROK) + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT046, ERRZERO, - "Could not give the Semaphore"); - return (NULLP); + MTLOGERROR(ERRCLS_DEBUG, EMT046, ERRZERO, + "Could not give the Semaphore"); + return (NULLP); #endif - } + } return (sTsk); } @@ -8028,33 +7668,23 @@ static SsSTskEntry* ssdAddTmrSTsk() /* mt003.301 Readwrite lock and recursive mutex additions */ #ifdef SS_LOCK_SUPPORT /* -* -* Fun: ssdInitLockNew -* -* Desc: This function is used to initialise lock/mutex -* -* Ret: ROK OK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdInitLockNew -( -SLockInfo *lockId, -uint8_t lockType -) -#else -S16 ssdInitLockNew(lockId, lockType) -SLockInfo *lockId; -uint8_t lockType; -#endif + * + * Fun: ssdInitLockNew + * + * Desc: This function is used to initialise lock/mutex + * + * Ret: ROK OK + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdInitLockNew(SLockInfo *lockId,uint8_t lockType) { #ifdef SS_REC_LOCK_SUPPORT - pthread_mutexattr_t attr; + pthread_mutexattr_t attr; #endif /* SS_REC_LOCK_SUPPORT */ Txt prntBuf[PRNTSZE]; S16 retVal = ROK; @@ -8064,83 +7694,73 @@ uint8_t lockType; { #ifdef SS_RDWR_LOCK_SUPPORT case SRDWRLOCK : - { - if((retVal = pthread_rwlock_init((&(lockId->l.rdWrLockId)), NULLP)) != ROK) - { - sprintf(prntBuf, "\n\n ssdInitLockNew(): Initialization of read write lock failed,Error# retVal %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_init((&(lockId->l.rdWrLockId)), NULLP)) != ROK) + { + sprintf(prntBuf, "\n\n ssdInitLockNew(): Initialization of read write lock failed,Error# retVal %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_RDWR_LOCK_SUPPORT */ #ifdef SS_REC_LOCK_SUPPORT - case SMUTEXRECUR: - { - retVal = pthread_mutexattr_init(&attr); - - if(retVal != 0) - { - sprintf(prntBuf,"\n ssdInitLockNew(): mutexattr init failed,Error# %d \n",retVal); - SPrint(prntBuf); - return RFAILED; - } + case SMUTEXRECUR: + { + retVal = pthread_mutexattr_init(&attr); + + if(retVal != 0) + { + sprintf(prntBuf,"\n ssdInitLockNew(): mutexattr init failed,Error# %d \n",retVal); + SPrint(prntBuf); + return RFAILED; + } #ifdef SS_LINUX - retVal = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); -#else - retVal = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); -#endif - if(retVal != 0) - { - sprintf(prntBuf,"\n ssdInitLockNew(): mutexattr settype failed,Error# %d \n",retVal); - pthread_mutexattr_destroy(&attr); - SPrint(prntBuf); - return RFAILED; - } - retVal = pthread_mutex_init((pthread_mutex_t *)&(lockId->l.recurLock), &attr); - if(retVal != 0) - { - sprintf(prntBuf,"\n ssdInitLockNew(): mutex init failed,Error# %d \n",retVal); - pthread_mutexattr_destroy(&attr); - SPrint(prntBuf); - return RFAILED; - } - break; - } + retVal = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); +#else + retVal = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); +#endif + if(retVal != 0) + { + sprintf(prntBuf,"\n ssdInitLockNew(): mutexattr settype failed,Error# %d \n",retVal); + pthread_mutexattr_destroy(&attr); + SPrint(prntBuf); + return RFAILED; + } + retVal = pthread_mutex_init((pthread_mutex_t *)&(lockId->l.recurLock), &attr); + if(retVal != 0) + { + sprintf(prntBuf,"\n ssdInitLockNew(): mutex init failed,Error# %d \n",retVal); + pthread_mutexattr_destroy(&attr); + SPrint(prntBuf); + return RFAILED; + } + break; + } #endif /* SS_REC_LOCK_SUPPORT */ default : - { - sprintf(prntBuf, "\n\n ssdInitLockNew(): Invalid lock type %d\n", lockType); - SDisplay(0, prntBuf); - return RFAILED; - } + { + sprintf(prntBuf, "\n\n ssdInitLockNew(): Invalid lock type %d\n", lockType); + SDisplay(0, prntBuf); + return RFAILED; + } } return ROK; } /* -* -* Fun: ssdLockNew -* -* Desc: This function is used to aquire the read write lock -* -* Ret: ROK OK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdLockNew -( -SLockInfo *lockId, -uint8_t lockType -) -#else -S16 ssdLockNew(lockId, lockType) -SLockInfo *lockId; -uint8_t lockType; -#endif + * + * Fun: ssdLockNew + * + * Desc: This function is used to aquire the read write lock + * + * Ret: ROK OK + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdLockNew(SLockInfo *lockId,uint8_t lockType) { Txt prntBuf[PRNTSZE]; @@ -8151,64 +7771,64 @@ uint8_t lockType; { #ifdef SS_RDWR_LOCK_SUPPORT case SRDLOCK : - { - if((retVal = pthread_rwlock_rdlock(&(lockId->l.rdWrLockId))) != ROK) - { - sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the read lock,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_rdlock(&(lockId->l.rdWrLockId))) != ROK) + { + sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the read lock,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } case SWRLOCK : - { - if((retVal = pthread_rwlock_wrlock(&(lockId->l.rdWrLockId))) != ROK) - { - sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the write lock,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_wrlock(&(lockId->l.rdWrLockId))) != ROK) + { + sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the write lock,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } case STRYRDLOCK : - { - if((retVal = pthread_rwlock_tryrdlock(&(lockId->l.rdWrLockId))) != ROK) - { - sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the read lock,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_tryrdlock(&(lockId->l.rdWrLockId))) != ROK) + { + sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the read lock,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } case STRYWRLOCK: - { - if((retVal = pthread_rwlock_trywrlock(&(lockId->l.rdWrLockId))) != ROK) - { - sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the read lock,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_trywrlock(&(lockId->l.rdWrLockId))) != ROK) + { + sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the read lock,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_RDWR_LOCK_SUPPORT */ #ifdef SS_REC_LOCK_SUPPORT - case SMUTEXRECUR: - { - if((retVal = pthread_mutex_lock(&(lockId->l.recurLock)) != ROK)) - { - sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the recursive mutex,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + case SMUTEXRECUR: + { + if((retVal = pthread_mutex_lock(&(lockId->l.recurLock)) != ROK)) + { + sprintf(prntBuf, "\n\n ssdLockNew(): Failed to aquire the recursive mutex,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_REC_LOCK_SUPPORT */ default : - { - sprintf(prntBuf, "\n\n ssdLockNew(): Invalid lock type %d\n", lockType); - SDisplay(0, prntBuf); - return RFAILED; - } + { + sprintf(prntBuf, "\n\n ssdLockNew(): Invalid lock type %d\n", lockType); + SDisplay(0, prntBuf); + return RFAILED; + } } return ROK; @@ -8216,29 +7836,19 @@ uint8_t lockType; /* -* -* Fun: ssdUnlockNew -* -* Desc: This function is used to Unlock the read write lock -* -* Ret: ROK OK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdUnlockNew -( -SLockInfo *lockId, -uint8_t lockType -) -#else -S16 ssdUnlockNew(lockId, lockType) -SLockInfo *lockId; -uint8_t lockType; -#endif + * + * Fun: ssdUnlockNew + * + * Desc: This function is used to Unlock the read write lock + * + * Ret: ROK OK + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdUnlockNew(SLockInfo *lockId,uint8_t lockType) { Txt prntBuf[PRNTSZE]; @@ -8249,62 +7859,52 @@ uint8_t lockType; { #ifdef SS_RDWR_LOCK_SUPPORT case SRDWRLOCK : - { - if((retVal = pthread_rwlock_unlock(&(lockId->l.rdWrLockId))) != ROK) - { - sprintf(prntBuf, "\n\n ssdUnLockNew(): Failed to unlock the lock,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_unlock(&(lockId->l.rdWrLockId))) != ROK) + { + sprintf(prntBuf, "\n\n ssdUnLockNew(): Failed to unlock the lock,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_RDWR_LOCK_SUPPORT */ #ifdef SS_REC_LOCK_SUPPORT - case SMUTEXRECUR: - { - if((retVal = pthread_mutex_unlock(&(lockId->l.recurLock)) != ROK)) - { - sprintf(prntBuf, "\n\n ssdUnLockNew(): Failed to aquire the recursive mutex,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + case SMUTEXRECUR: + { + if((retVal = pthread_mutex_unlock(&(lockId->l.recurLock)) != ROK)) + { + sprintf(prntBuf, "\n\n ssdUnLockNew(): Failed to aquire the recursive mutex,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_REC_LOCK_SUPPORT */ default : - { - sprintf(prntBuf, "\n\n ssdUnlockNew(): Invalid lock type %d\n", lockType); - SDisplay(0, prntBuf); - return RFAILED; - } + { + sprintf(prntBuf, "\n\n ssdUnlockNew(): Invalid lock type %d\n", lockType); + SDisplay(0, prntBuf); + return RFAILED; + } } return ROK; } /* -* -* Fun: ssdDestroyLockNew -* -* Desc: This function is used to destroy the read write lock -* -* Ret: ROK OK -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdDestroyLockNew -( -SLockInfo *lockId, -uint8_t lockType -) -#else -S16 ssdDestroyLockNew(lockId, lockType) -SLockInfo *lockId; -uint8_t lockType; -#endif + * + * Fun: ssdDestroyLockNew + * + * Desc: This function is used to destroy the read write lock + * + * Ret: ROK OK + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdDestroyLockNew(SLockInfo *lockId,uint8_t lockType) { Txt prntBuf[PRNTSZE]; S16 retVal = ROK; @@ -8314,34 +7914,34 @@ uint8_t lockType; { #ifdef SS_RDWR_LOCK_SUPPORT case SRDWRLOCK : - { - if((retVal = pthread_rwlock_destroy(&(lockId->l.rdWrLockId))) != ROK) - { - sprintf(prntBuf, "\n\n ssdDestroyLockNew(): Failed to destroy the lock,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + { + if((retVal = pthread_rwlock_destroy(&(lockId->l.rdWrLockId))) != ROK) + { + sprintf(prntBuf, "\n\n ssdDestroyLockNew(): Failed to destroy the lock,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_RDWR_LOCK_SUPPORT */ #ifdef SS_REC_LOCK_SUPPORT - case SMUTEXRECUR: - { - if((retVal = pthread_mutex_destroy(&(lockId->l.recurLock)) != ROK)) - { - sprintf(prntBuf, "\n\n ssdDestroyLockNew(): Failed to destroy the mutex,Error# %d\n", retVal); - SDisplay(0, prntBuf); - return RFAILED; - } - break; - } + case SMUTEXRECUR: + { + if((retVal = pthread_mutex_destroy(&(lockId->l.recurLock)) != ROK)) + { + sprintf(prntBuf, "\n\n ssdDestroyLockNew(): Failed to destroy the mutex,Error# %d\n", retVal); + SDisplay(0, prntBuf); + return RFAILED; + } + break; + } #endif /* SS_REC_LOCK_SUPPORT */ default : - { - sprintf(prntBuf, "\n\n ssdDestroyLockNew(): Invalid lock type %d\n", lockType); - SDisplay(0, prntBuf); - return RFAILED; - } + { + sprintf(prntBuf, "\n\n ssdDestroyLockNew(): Invalid lock type %d\n", lockType); + SDisplay(0, prntBuf); + return RFAILED; + } } return ROK; } @@ -8367,36 +7967,29 @@ uint8_t lockType; * File: * **/ -#ifdef ANSI -S16 ssInitRcvWork -( - void - ) -#else -S16 ssInitRcvWork() -#endif +S16 ssInitRcvWork(void) { - pthread_attr_t attr; - pthread_t thread; + pthread_attr_t attr; + pthread_t thread; - /* set the required attributes */ - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, (size_t)MT_ISTASK_STACK); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + /* set the required attributes */ + pthread_attr_init(&attr); + pthread_attr_setstacksize(&attr, (size_t)MT_ISTASK_STACK); + pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - /* Create a new thread to receive the work queue messages */ - if ((pthread_create(&thread, &attr, workRcvTsk, NULLP)) != 0) - { - pthread_attr_destroy(&attr); + /* Create a new thread to receive the work queue messages */ + if ((pthread_create(&thread, &attr, workRcvTsk, NULLP)) != 0) + { + pthread_attr_destroy(&attr); - return RFAILED; - } + return RFAILED; + } - pthread_attr_destroy(&attr); + pthread_attr_destroy(&attr); - return ROK; + return ROK; }/* ssInitRcvWork */ @@ -8419,96 +8012,88 @@ S16 ssInitRcvWork() * **/ -#ifdef ANSI -static void *workRcvTsk -( - Ptr ptr - ) -#else -static void *workRcvTsk (ptr) - Ptr ptr; -#endif +static void *workRcvTsk(Ptr ptr) { - cvmx_wqe_t *workPtr; - Buffer *mBuf, *rcvdBuf; - SsMsgInfo *minfoPtr; - S16 ret; - struct timespec ts; - Pst pst; - + cvmx_wqe_t *workPtr; + Buffer *mBuf, *rcvdBuf; + SsMsgInfo *minfoPtr; + S16 ret; + struct timespec ts; + Pst pst; - for (;;) - { - /* get the work if its avilable */ - workPtr = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT); - if ( workPtr == NULLP ) - { - /* If there is no work then sleep for 10 usec */ - ts.tv_sec = 0; - ts.tv_nsec = 500000; + for (;;) + { + /* get the work if its avilable */ + workPtr = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT); - nanosleep(&ts, NULLP); - continue; - } + if ( workPtr == NULLP ) + { + /* If there is no work then sleep for 10 usec */ + ts.tv_sec = 0; + ts.tv_nsec = 500000; - switch(workPtr->tag) - { - /* Switch over according to the tag value */ - case SS_CVMX_MBUF_TAG: - - rcvdBuf = (Buffer*)workPtr->packet_ptr.ptr; - - /* Convert the physical address to Pointers */ - ret = SConvPhyPtr(&rcvdBuf); - if (ret != ROK) - { - /* mt011.301: Cavium 32 bit changes */ - cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); - continue; - } - - /* Copy the buffer to this region */ - ret = SCpyFpaMsg(rcvdBuf, SS_DFLT_REGION, SS_DFLT_POOL, &mBuf); - if( ret != ROK ) - { - /* mt011.301: Cavium 32 bit changes */ - cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); - continue; - } - - /* mt011.301: Cavium 32 bit changes */ - cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); - - minfoPtr = (SsMsgInfo*)mBuf->b_rptr; - - /* Get the post strucutre and Post the message */ - if ( minfoPtr != NULLP) - { - SMemCpy( &pst, &minfoPtr->pst, sizeof(Pst)); - - (Void)SPstTsk(&pst, mBuf); - } - /* Free the buffer allocated if it cannot be sent */ - else - { - SPutMsg(mBuf); - } - break; + nanosleep(&ts, NULLP); + continue; + } - default: - { - /* Invalid tag value, drop the work */ - /* mt011.301: Cavium 32 bit changes */ - cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); - continue; - } - break; - } + switch(workPtr->tag) + { + /* Switch over according to the tag value */ + case SS_CVMX_MBUF_TAG: + + rcvdBuf = (Buffer*)workPtr->packet_ptr.ptr; + + /* Convert the physical address to Pointers */ + ret = SConvPhyPtr(&rcvdBuf); + if (ret != ROK) + { + /* mt011.301: Cavium 32 bit changes */ + cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); + continue; + } + + /* Copy the buffer to this region */ + ret = SCpyFpaMsg(rcvdBuf, SS_DFLT_REGION, SS_DFLT_POOL, &mBuf); + if( ret != ROK ) + { + /* mt011.301: Cavium 32 bit changes */ + cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); + continue; + } + + /* mt011.301: Cavium 32 bit changes */ + cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); + + minfoPtr = (SsMsgInfo*)mBuf->b_rptr; + + /* Get the post strucutre and Post the message */ + if ( minfoPtr != NULLP) + { + SMemCpy( &pst, &minfoPtr->pst, sizeof(Pst)); + + (Void)SPstTsk(&pst, mBuf); + } + /* Free the buffer allocated if it cannot be sent */ + else + { + SPutMsg(mBuf); + } + break; + + default: + { + /* Invalid tag value, drop the work */ + /* mt011.301: Cavium 32 bit changes */ + cvmx_fpa_free(workPtr, SS_CVMX_WQE_POOL, 0); + continue; + } + break; + } - } + } } /* workRcvTsk */ #endif /* SS_SEUM_CAVIUM */ @@ -8548,7 +8133,7 @@ Void ssRegMainThread(Void) if(SS_INVALID_THREAD_REG_MAP != SS_GET_THREAD_MEM_REGION()) { - printf("not able to get different Id for main thread\n"); + printf("\nnot able to get different Id for main thread\n"); exit(1); } /* Here the default region is added as we dont have any region associated with @@ -8560,7 +8145,7 @@ Void ssRegMainThread(Void) #else SS_GET_THREAD_MEM_REGION() = #endif - DFLT_REGION; + DFLT_REGION; } /* @@ -8587,11 +8172,11 @@ Void ssRegMainThread(Void) * File: mt_ss.c * */ -S32 ssCheckAndAddMemoryRegionMap + S32 ssCheckAndAddMemoryRegionMap ( -pthread_t threadId, /* Thread Id of system task */ -Region region /* Region associated with thread */ -) + pthread_t threadId, /* Thread Id of system task */ + Region region /* Region associated with thread */ + ) { static uint32_t createdThreads; static pthread_t createdThreadIds[SS_MAX_THREAD_CREATE_RETRY]; @@ -8602,14 +8187,14 @@ Region region /* Region associated with thread */ * contains 0xFF, that mapping entry is free */ if(SS_INVALID_THREAD_REG_MAP != - osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)]) + osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)]) { /* Klock work fix ccpu00148484 */ if(!(createdThreads < SS_MAX_THREAD_CREATE_RETRY)) { - printf("failed in index = %ld\n", ((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)); - printf("Not able to get the different thread ID, exiting\n"); - exit(1); + printf("\nfailed in index = %ld\n", ((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)); + printf("\nNot able to get the different thread ID, exiting\n"); + exit(1); } createdThreadIds[createdThreads++] = threadId; return (FALSE); @@ -8619,14 +8204,14 @@ Region region /* Region associated with thread */ */ osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)] = region; #ifdef XEON_SPECIFIC_CHANGES - printf("ThreadId %ld, Thread Idx %d, Region %d\n", threadId, - ((threadId >> SS_MEM_THREAD_ID_SHIFT) % - SS_MAX_THREAD_REGION_MAP), region); + printf("\nThreadId %ld, Thread Idx %d, Region %d\n", threadId, + ((threadId >> SS_MEM_THREAD_ID_SHIFT) % + SS_MAX_THREAD_REGION_MAP), region); #endif for(indx = 0; indx < createdThreads; indx++) { #ifdef XEON_SPECIFIC_CHANGES - printf("Sending pthred Cancel to thread Id %d \n",createdThreadIds[indx]); + printf("\nSending pthred Cancel to thread Id %d \n",createdThreadIds[indx]); #endif pthread_cancel(createdThreadIds[indx]); } @@ -8660,10 +8245,10 @@ Region region /* Region associated with thread */ * File: mt_ss.c * */ -S32 ssCheckAndDelMemoryRegionMap + S32 ssCheckAndDelMemoryRegionMap ( -pthread_t threadId /* Thread Id of system task */ -) + pthread_t threadId /* Thread Id of system task */ + ) { @@ -8673,12 +8258,12 @@ pthread_t threadId /* Thread Id of system task */ * contains 0xFF, that mapping entry is free */ if(SS_INVALID_THREAD_REG_MAP == - osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)]) + osCp.threadMemoryRegionMap[((threadId >> SS_MEM_THREAD_ID_SHIFT) % SS_MAX_THREAD_REGION_MAP)]) { #ifndef ALIGN_64BIT - printf("Invalid Thread ID (%ld)\n", (uint32_t)threadId); + printf("\nInvalid Thread ID (%ld)\n", (uint32_t)threadId); #else - printf("Invalid Thread ID (%d)\n", (uint32_t)threadId); + printf("\nInvalid Thread ID (%d)\n", (uint32_t)threadId); #endif return RFAILED; } @@ -8695,29 +8280,23 @@ pthread_t threadId /* Thread Id of system task */ #endif #ifdef SS_TSKLOG_ENABLE /* -* -* Fun: SStartTask -* -* Desc: This function will return current time through input parameter. -* -* Ret: ROK - ok -* RFAILED - failed, general (optional) -* -* -* File: pt_ss.c -* -*/ -#ifdef ANSI -S16 SStartTask + * + * Fun: SStartTask + * + * Desc: This function will return current time through input parameter. + * + * Ret: ROK - ok + * RFAILED - failed, general (optional) + * + * + * File: pt_ss.c + * + */ + S16 SStartTask ( -volatile uint32_t *startTime, -uint32_t taskId -) -#else -S16 SStartTask(startTime, taskId) -volatile uint32_t *startTime; -uint32_t taskId; -#endif + volatile uint32_t *startTime, + uint32_t taskId + ) { #ifdef MSPD_MLOG_NEW *startTime = GetTIMETICK(); @@ -8726,31 +8305,25 @@ uint32_t taskId; } /* -* -* Fun: SStopTask -* -* Desc: This function will return current time through input parameter. -* and take the difference of start time provided as input parameter -* and current time. -* -* Ret: ROK - ok -* RFAILED - failed, general (optional) -* -* -* File: pt_ss.c -* -*/ -#ifdef ANSI -S16 SStopTask + * + * Fun: SStopTask + * + * Desc: This function will return current time through input parameter. + * and take the difference of start time provided as input parameter + * and current time. + * + * Ret: ROK - ok + * RFAILED - failed, general (optional) + * + * + * File: pt_ss.c + * + */ + S16 SStopTask ( -volatile uint32_t startTime, -uint32_t taskId -) -#else -S16 SStopTask(startTime, taskId) -volatile uint32_t startTime; -uint32_t taskId; -#endif + volatile uint32_t startTime, + uint32_t taskId + ) { /*uint32_t stopTime;*/ switch(taskId) @@ -8777,45 +8350,33 @@ uint32_t taskId; case PID_RECPREQ_PROC: #ifdef CA_PHY #ifndef LTE_TDD - MLogTask(0, taskId, RESOURCE_LARM, startTime, GetTIMETICK()); + MLogTask(0, taskId, RESOURCE_LARM, startTime, GetTIMETICK()); #else - MLogTask(taskId, RESOURCE_LARM, startTime, GetTIMETICK()); + MLogTask(taskId, RESOURCE_LARM, startTime, GetTIMETICK()); #endif #else - MLogTask(taskId, RESOURCE_LARM, startTime, GetTIMETICK()); + MLogTask(taskId, RESOURCE_LARM, startTime, GetTIMETICK()); #endif - break; + break; } return ROK; } #else -#ifdef ANSI -S16 SStartTask + S16 SStartTask ( -volatile uint32_t * startTime, -uint32_t taskId -) -#else -S16 SStartTask(startTime, taskId) -volatile uint32_t * startTime; -uint32_t taskId; -#endif + volatile uint32_t * startTime, + uint32_t taskId + ) { *startTime = 0; return ROK; } -#ifdef ANSI -S16 SStopTask + S16 SStopTask ( -volatile uint32_t startTime, -uint32_t taskId -) -#else -S16 SStopTask(startTime, taskId) -volatile uint32_t startTime; -uint32_t taskId; -#endif + volatile uint32_t startTime, + uint32_t taskId + ) { return ROK; } @@ -8823,24 +8384,18 @@ uint32_t taskId; #endif /*#ifdef SS_TSKLOG_ENABLE */ #ifdef TENB_T2K3K_SPECIFIC_CHANGES /** @details -* This primitive is used to calculate the CPU Utilization per Core -* for Intel T2200 -* -* @param [in] Void -* -* @return Void - function is always success -*/ -#ifdef ANSI -Void UpdateSocCpuInfo + * This primitive is used to calculate the CPU Utilization per Core + * for Intel T2200 + * + * @param [in] Void + * + * @return Void - function is always success + */ + Void UpdateSocCpuInfo ( -CmCpuStatsInfo *cpuInfo, -uint8_t idx -) -#else -Void UpdateSocCpuInfo(*cpuInfo, idx) -CmCpuStatsInfo *cpuInfo; -uint8_t idx; -#endif + CmCpuStatsInfo *cpuInfo, + uint8_t idx + ) { FILE *mipsFd; S8 mipsStr[MIPS_STRING_LEN]; @@ -8861,7 +8416,7 @@ uint8_t idx; /* Get the free mips available value from the file */ if(NULLP == fgets(mipsStr, 24, mipsFd)) { - printf("fgets to get the free mips available failed\n"); + printf("\nfgets to get the free mips available failed\n"); fclose(mipsFd); return; } @@ -8874,11 +8429,11 @@ uint8_t idx; { if(strPart != NULLP) { - l2FreeCpu = atoi(strPart); - l2CpuUsed = 100 - l2FreeCpu; - cpuInfo->cpuUtil[0].totCpuUtil += l2CpuUsed; - cpuInfo->cpuUtil[0].maxCpuUtil = GET_CPU_MAX((cpuInfo->cpuUtil[0].maxCpuUtil), l2CpuUsed); - cpuInfo->cpuUtil[0].numSamples++; + l2FreeCpu = atoi(strPart); + l2CpuUsed = 100 - l2FreeCpu; + cpuInfo->cpuUtil[0].totCpuUtil += l2CpuUsed; + cpuInfo->cpuUtil[0].maxCpuUtil = GET_CPU_MAX((cpuInfo->cpuUtil[0].maxCpuUtil), l2CpuUsed); + cpuInfo->cpuUtil[0].numSamples++; } } if(idx == CM_L3_CPU_UTIL) @@ -8886,11 +8441,11 @@ uint8_t idx; strPart = strtok(NULLP, " "); if(strPart != NULLP) { - l3FreeCpu = atoi(strPart); - l3CpuUsed = 100 - l3FreeCpu; - cpuInfo->cpuUtil[0].totCpuUtil += l3CpuUsed; - cpuInfo->cpuUtil[0].maxCpuUtil = GET_CPU_MAX((cpuInfo->cpuUtil[0].maxCpuUtil), l3CpuUsed); - cpuInfo->cpuUtil[0].numSamples++; + l3FreeCpu = atoi(strPart); + l3CpuUsed = 100 - l3FreeCpu; + cpuInfo->cpuUtil[0].totCpuUtil += l3CpuUsed; + cpuInfo->cpuUtil[0].maxCpuUtil = GET_CPU_MAX((cpuInfo->cpuUtil[0].maxCpuUtil), l3CpuUsed); + cpuInfo->cpuUtil[0].numSamples++; } } if(idx == CM_L2_CPU_UTIL) @@ -8908,27 +8463,22 @@ uint8_t idx; #endif /* TENB_T2K3K_SPECIFIC_CHANGES */ #ifdef SS_MULTICORE_SUPPORT /* -* -* Fun: Add Timer thread into system task table -* -* Desc: This function is used to add the system task -* associated with Timer thread. -* -* Ret: None -* -* Notes: -* -* File: mt_ss.c -* ---*/ -#ifdef ANSI + * + * Fun: Add Timer thread into system task table + * + * Desc: This function is used to add the system task + * associated with Timer thread. + * + * Ret: None + * + * Notes: + * + * File: mt_ss.c + * + --*/ static SsSTskEntry* ssdReAddTmrSTsk( -uint8_t idx -) -#else -static SsSTskEntry* ssdReAddTmrSTsk(idx) -uint8_t idx; -#endif + uint8_t idx + ) { SsSTskEntry *sTsk; S16 ret; @@ -8941,7 +8491,7 @@ uint8_t idx; #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT039, (ErrVal) ret, - "Could not lock system task table"); + "Could not lock system task table"); #endif return (sTsk); @@ -8967,15 +8517,15 @@ uint8_t idx; if ( SUnlock(&osCp.sTskTblLock) != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT042, ERRZERO, - "Could not give the Semaphore"); - return (NULLP); + MTLOGERROR(ERRCLS_DEBUG, EMT042, ERRZERO, + "Could not give the Semaphore"); + return (NULLP); #endif } #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT043, (ErrVal) ret, - "Could not initialize demand queue"); + "Could not initialize demand queue"); #endif return (NULLP); @@ -8989,15 +8539,15 @@ uint8_t idx; if ( SUnlock(&osCp.sTskTblLock) != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT044, ERRZERO, - "Could not give the Semaphore"); - return (NULLP); + MTLOGERROR(ERRCLS_DEBUG, EMT044, ERRZERO, + "Could not give the Semaphore"); + return (NULLP); #endif } #if (ERRCLASS & ERRCLS_DEBUG) MTLOGERROR(ERRCLS_DEBUG, EMT045, (ErrVal) ret, - "Could not initialize system task entry lock"); + "Could not initialize system task entry lock"); #endif return (NULLP); @@ -9011,14 +8561,14 @@ uint8_t idx; /* unlock the system task table */ - if ( SUnlock(&osCp.sTskTblLock) != ROK) - { + if ( SUnlock(&osCp.sTskTblLock) != ROK) + { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT046, ERRZERO, - "Could not give the Semaphore"); - return (NULLP); + MTLOGERROR(ERRCLS_DEBUG, EMT046, ERRZERO, + "Could not give the Semaphore"); + return (NULLP); #endif - } + } return (sTsk); } @@ -9026,27 +8576,20 @@ uint8_t idx; /* -* -* Fun: Initialize timer table -* -* Desc: This function initializes MTSS-specific information -* in the timer table. -* -* Ret: ROK - ok -* -* Notes: -* -* File: mt_ss.c -* -*/ -#ifdef ANSI -S16 ssdReInitTmr -( -void -) -#else -S16 ssdReInitTmr() -#endif + * + * Fun: Initialize timer table + * + * Desc: This function initializes MTSS-specific information + * in the timer table. + * + * Ret: ROK - ok + * + * Notes: + * + * File: mt_ss.c + * + */ +S16 ssdReInitTmr(void) { pthread_attr_t attr; struct sched_param param_sched; @@ -9066,15 +8609,15 @@ S16 ssdReInitTmr() if(ret != ROK) { #if (ERRCLASS & ERRCLS_DEBUG) - MTLOGERROR(ERRCLS_DEBUG, EMT046, ERRZERO, - "Could not give the Semaphore"); + MTLOGERROR(ERRCLS_DEBUG, EMT046, ERRZERO, + "Could not give the Semaphore"); #endif - return RFAILED; + return RFAILED; } #endif osCp.dep.tmrTqCp.tmrLen = SS_MAX_TMRS; - /* mt010.21: addition */ + /* mt010.21: addition */ #ifdef SS_MULTICORE_SUPPORT sTsk = ssdReAddTmrSTsk(0); @@ -9107,15 +8650,15 @@ S16 ssdReInitTmr() #endif if ((pthread_create(&osCp.dep.tmrHdlrTID, &attr, mtTmrHdlr, NULLP)) != 0) { - /* mt020.201 - Addition for destroying thread attribute object attr */ - pthread_attr_destroy(&attr); + /* mt020.201 - Addition for destroying thread attribute object attr */ + pthread_attr_destroy(&attr); - return RFAILED; + return RFAILED; } #ifdef SS_THR_REG_MAP threadCreated = ssCheckAndAddMemoryRegionMap(osCp.dep.tmrHdlrTID, - sTsk->region); + sTsk->region); } #endif /* SS_THR_REG_MAP */ #ifdef SS_MEM_WL_DEBUG @@ -9129,5 +8672,5 @@ S16 ssdReInitTmr() } /********************************************************************** - End of file -**********************************************************************/ + End of file + **********************************************************************/