更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
armv7_pmu_pri.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _ARMV7_PMU_PRI_H
33#define _ARMV7_PMU_PRI_H
34
35#include "los_typedef.h"
36
37#ifdef __cplusplus
38#if __cplusplus
39extern "C" {
40#endif /* __cplusplus */
41#endif /* __cplusplus */
42
43/* counters overflow flag status reg */
44#define ARMV7_FLAG_MASK 0xffffffff /* Mask for writable bits */
45#define ARMV7_OVERFLOWED_MASK ARMV7_FLAG_MASK /* Mask for pmu overflowed */
46
47/* pmnc config reg */
48#define ARMV7_PMNC_E (1U << 0) /* Enable all counters */
49#define ARMV7_PMNC_P (1U << 1) /* Reset all counters */
50#define ARMV7_PMNC_C (1U << 2) /* Cycle counter reset */
51#define ARMV7_PMNC_D (1U << 3) /* CCNT counts every 64th cpu cycle */
52#define ARMV7_PMNC_X (1U << 4) /* Export to ETM */
53#define ARMV7_PMNC_DP (1U << 5) /* Disable CCNT if non-invasive debug */
54#define ARMV7_PMNC_MASK 0x3f /* Mask for writable bits */
55
56/* pmxevtyper event selection reg */
57#define ARMV7_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */
58
59/* armv7 counters index */
60#define ARMV7_IDX_COUNTER0 1
61#define ARMV7_IDX_CYCLE_COUNTER 0
62#define ARMV7_IDX_MAX_COUNTER 9
63
64#define ARMV7_MAX_COUNTERS 32
65#define ARMV7_IDX_COUNTER_LAST (ARMV7_IDX_CYCLE_COUNTER + ARMV7_MAX_COUNTERS - 1)
66#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1)
67
68/* armv7 event counter index mapping */
69#define ARMV7_CNT2BIT(x) (1UL << (x))
70#define ARMV7_IDX2CNT(x) (((x) - ARMV7_IDX_COUNTER0) & ARMV7_COUNTER_MASK)
71
73 ARMV7_PERF_HW_CYCLES = 0xFF, /* cycles */
74 ARMV7_PERF_HW_INSTRUCTIONS = 0x08, /* instructions */
75 ARMV7_PERF_HW_DCACHES = 0x04, /* dcache */
76 ARMV7_PERF_HW_DCACHE_MISSES = 0x03, /* dcache-misses */
77 ARMV7_PERF_HW_ICACHES = 0x14, /* icache */
78 ARMV7_PERF_HW_ICACHE_MISSES = 0x01, /* icache-misses */
79 ARMV7_PERF_HW_BRANCHES = 0x0C, /* software change of pc */
80 ARMV7_PERF_HW_BRANCE_MISSES = 0x10, /* branch-misses */
81 ARMV7_PERF_HW_PRED_BRANCH = 0x12, /* predictable branches */
82 ARMV7_PERF_HW_NUM_CYC_IRQ = 0x50, /* number of cycles Irqs are interrupted */
83 ARMV7_PERF_HW_EXC_TAKEN = 0x09, /* exception_taken */
84 ARMV7_PERF_HW_DATA_READ = 0x06, /* data read */
85 ARMV7_PERF_HW_DATA_WRITE = 0x07, /* data write */
86 ARMV7_PERF_HW_STREX_PASSED = 0x80, /* strex passed */
87 ARMV7_PERF_HW_STREX_FAILED = 0x81, /* strex failed */
88 ARMV7_PERF_HW_LP_IN_TCM = 0x82, /* literal pool in TCM region */
89 ARMV7_PERF_HW_DMB_STALL = 0x90, /* DMB stall */
90 ARMV7_PERF_HW_ITCM_ACCESS = 0x91, /* ITCM access */
91 ARMV7_PERF_HW_DTCM_ACCESS = 0x92, /* DTCM access */
92 ARMV7_PERF_HW_DATA_EVICTION = 0x93, /* data eviction */
93 ARMV7_PERF_HW_SCU = 0x94, /* SCU coherency operation */
94 ARMV7_PERF_HW_INSCACHE_DEP_DW = 0x95, /* instruction cache dependent stall */
95 ARMV7_PERF_HW_DATA_CACHE_DEP_STALL = 0x96, /* data cache dependent stall */
96 ARMV7_PERF_HW_NOCACHE_NO_PER_DEP_STALL = 0x97, /* non-cacheable no peripheral dependent stall */
97 ARMV7_PERF_HW_NOCACHE_PER_DEP_STALL = 0x98, /* non-Cacheable peripheral dependent stall */
98 ARMV7_PERF_HW_DATA_CACHE_HP_DEP_STALL = 0x99, /* data cache high priority dependent stall */
99 ARMV7_PERF_HW_AXI_FAST_PERIPHERAL = 0x9A, /* Accesses_to_AXI_fast_peripheral_port(reads_and_writes) */
100};
101
102#ifdef __cplusplus
103#if __cplusplus
104}
105#endif /* __cplusplus */
106#endif /* __cplusplus */
107
108#endif /* _ARMV7_PMU_PRI_H */
PmuEventType
Definition: armv7_pmu_pri.h:72
@ ARMV7_PERF_HW_DATA_CACHE_DEP_STALL
Definition: armv7_pmu_pri.h:95
@ ARMV7_PERF_HW_BRANCHES
Definition: armv7_pmu_pri.h:79
@ ARMV7_PERF_HW_AXI_FAST_PERIPHERAL
Definition: armv7_pmu_pri.h:99
@ ARMV7_PERF_HW_DCACHE_MISSES
Definition: armv7_pmu_pri.h:76
@ ARMV7_PERF_HW_DMB_STALL
Definition: armv7_pmu_pri.h:89
@ ARMV7_PERF_HW_ICACHES
Definition: armv7_pmu_pri.h:77
@ ARMV7_PERF_HW_ITCM_ACCESS
Definition: armv7_pmu_pri.h:90
@ ARMV7_PERF_HW_NUM_CYC_IRQ
Definition: armv7_pmu_pri.h:82
@ ARMV7_PERF_HW_INSCACHE_DEP_DW
Definition: armv7_pmu_pri.h:94
@ ARMV7_PERF_HW_BRANCE_MISSES
Definition: armv7_pmu_pri.h:80
@ ARMV7_PERF_HW_LP_IN_TCM
Definition: armv7_pmu_pri.h:88
@ ARMV7_PERF_HW_INSTRUCTIONS
Definition: armv7_pmu_pri.h:74
@ ARMV7_PERF_HW_CYCLES
Definition: armv7_pmu_pri.h:73
@ ARMV7_PERF_HW_NOCACHE_NO_PER_DEP_STALL
Definition: armv7_pmu_pri.h:96
@ ARMV7_PERF_HW_DCACHES
Definition: armv7_pmu_pri.h:75
@ ARMV7_PERF_HW_EXC_TAKEN
Definition: armv7_pmu_pri.h:83
@ ARMV7_PERF_HW_ICACHE_MISSES
Definition: armv7_pmu_pri.h:78
@ ARMV7_PERF_HW_DTCM_ACCESS
Definition: armv7_pmu_pri.h:91
@ ARMV7_PERF_HW_PRED_BRANCH
Definition: armv7_pmu_pri.h:81
@ ARMV7_PERF_HW_DATA_CACHE_HP_DEP_STALL
Definition: armv7_pmu_pri.h:98
@ ARMV7_PERF_HW_STREX_FAILED
Definition: armv7_pmu_pri.h:87
@ ARMV7_PERF_HW_DATA_WRITE
Definition: armv7_pmu_pri.h:85
@ ARMV7_PERF_HW_DATA_READ
Definition: armv7_pmu_pri.h:84
@ ARMV7_PERF_HW_STREX_PASSED
Definition: armv7_pmu_pri.h:86
@ ARMV7_PERF_HW_NOCACHE_PER_DEP_STALL
Definition: armv7_pmu_pri.h:97
@ ARMV7_PERF_HW_DATA_EVICTION
Definition: armv7_pmu_pri.h:92
@ ARMV7_PERF_HW_SCU
Definition: armv7_pmu_pri.h:93