X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Fgeneric-2.6%2Ffiles%2Fcrypto%2Focf%2Fkirkwood%2FmvHal%2Fmv_hal%2Fcpu%2FmvCpuL2Cntrs.c;fp=target%2Flinux%2Fgeneric-2.6%2Ffiles%2Fcrypto%2Focf%2Fkirkwood%2FmvHal%2Fmv_hal%2Fcpu%2FmvCpuL2Cntrs.c;h=0000000000000000000000000000000000000000;hb=da1bb88a2b900f0392b731ec47c5e1bff956fd8f;hp=033386224ffde52a463522ebc3f277113af5df97;hpb=6117c04c9416b295347fb45c37e430f01df1d0d9;p=openwrt%2Fstaging%2Fwigyori.git diff --git a/target/linux/generic-2.6/files/crypto/ocf/kirkwood/mvHal/mv_hal/cpu/mvCpuL2Cntrs.c b/target/linux/generic-2.6/files/crypto/ocf/kirkwood/mvHal/mv_hal/cpu/mvCpuL2Cntrs.c deleted file mode 100644 index 033386224f..0000000000 --- a/target/linux/generic-2.6/files/crypto/ocf/kirkwood/mvHal/mv_hal/cpu/mvCpuL2Cntrs.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "mvOs.h" -#include "mvCpuL2Cntrs.h" - - - -MV_CPU_L2_CNTRS_ENTRY mvCpuL2CntrsTbl[MV_CPU_L2_CNTRS_NUM]; - -MV_CPU_L2_CNTRS_EVENT* mvCpuL2CntrsEventTbl[128]; - -void mvCpuL2CntrsReset(void) -{ - MV_U32 reg = 0; - - MV_ASM ("mcr p15, 6, %0, c15, c13, 0" : : "r" (reg)); - MV_ASM ("mcr p15, 6, %0, c15, c13, 1" : : "r" (reg)); - MV_ASM ("mcr p15, 6, %0, c15, c13, 2" : : "r" (reg)); - MV_ASM ("mcr p15, 6, %0, c15, c13, 3" : : "r" (reg)); -} - -static void mvCpuL2CntrConfig(int counter, int op) -{ - MV_U32 reg = (1 << op) | 0x1; /*enable*/ - - switch(counter) - { - case 0: - MV_ASM ("mcr p15, 6, %0, c15, c12, 0" : : "r" (reg)); - return; - - case 1: - MV_ASM ("mcr p15, 6, %0, c15, c12, 1" : : "r" (reg)); - return; - - default: - mvOsPrintf("mvCpuL2CntrConfig: bad counter number (%d)\n", counter); - } - return; -} - -void mvCpuL2CntrsEventClear(MV_CPU_L2_CNTRS_EVENT* pEvent) -{ - int i; - - for(i=0; icounters_sum[i] = 0; - } - pEvent->num_of_measurements = 0; -} - - -MV_CPU_L2_CNTRS_EVENT* mvCpuL2CntrsEventCreate(char* name, MV_U32 print_threshold) -{ - int i; - MV_CPU_L2_CNTRS_EVENT* event = mvOsMalloc(sizeof(MV_CPU_L2_CNTRS_EVENT)); - - if(event) - { - strncpy(event->name, name, sizeof(event->name)); - event->num_of_measurements = 0; - event->avg_sample_count = print_threshold; - for(i=0; icounters_before[i] = 0; - event->counters_after[i] = 0; - event->counters_sum[i] = 0; - } - } - return event; -} - -void mvCpuL2CntrsEventDelete(MV_CPU_L2_CNTRS_EVENT* event) -{ - if(event != NULL) - mvOsFree(event); -} - - -MV_STATUS mvCpuL2CntrsProgram(int counter, MV_CPU_L2_CNTRS_OPS op, - char* name, MV_U32 overhead) -{ - strncpy(mvCpuL2CntrsTbl[counter].name, name, sizeof(mvCpuL2CntrsTbl[counter].name)); - mvCpuL2CntrsTbl[counter].operation = op; - mvCpuL2CntrsTbl[counter].opIdx = op; - mvCpuL2CntrsTbl[counter].overhead = overhead; - mvCpuL2CntrConfig(counter, op); - mvOsPrintf("CPU L2 Counter %d: operation=%d, overhead=%d\n", - counter, op, overhead); - return MV_OK; -} - -void mvCpuL2CntrsShow(MV_CPU_L2_CNTRS_EVENT* pEvent) -{ - int i; - MV_U64 counters_avg; - - if(pEvent->num_of_measurements < pEvent->avg_sample_count) - return; - - mvOsPrintf("%16s: ", pEvent->name); - for(i=0; icounters_sum[i], - pEvent->num_of_measurements, NULL); - - if(counters_avg >= mvCpuL2CntrsTbl[i].overhead) - counters_avg -= mvCpuL2CntrsTbl[i].overhead; - else - counters_avg = 0; - - mvOsPrintf("%s=%5llu, ", mvCpuL2CntrsTbl[i].name, counters_avg); - } - mvOsPrintf("\n"); - mvCpuL2CntrsEventClear(pEvent); - mvCpuL2CntrsReset(); -} - -void mvCpuL2CntrsStatus(void) -{ - int i; - - for(i=0; i