]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ppc/hw_perfmon_mmcr.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / ppc / hw_perfmon_mmcr.h
CommitLineData
55e303ae
A
1/*
2 * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
3 *
8ad349bb 4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
55e303ae 5 *
8ad349bb
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
55e303ae
A
29 */
30
31#ifndef _HW_PERFMON_MMCR_H_
32#define _HW_PERFMON_MMCR_H_
33
34#ifndef __ppc__
35#error This file is only useful on PowerPC.
36#endif
37
38typedef struct {
39 uint32_t disable_counters_always : 1; /* 0: disable counters */
40 uint32_t disable_counters_supervisor : 1; /* 1: disable counters (supervisor) */
41 uint32_t disable_counters_user : 1; /* 2: disable counters (user) */
42 uint32_t disable_counters_marked : 1; /* 3: disable counters (marked bit == 1) */
43 uint32_t disable_counters_unmarked : 1; /* 4: disable counters (marked bit == 0) */
44 uint32_t enable_pmi : 1; /* 5: performance monitor interrupt enable */
45 uint32_t on_pmi_stop_counting : 1; /* 6: disable counters (pmi) */
46 uint32_t timebase_bit_selector : 2; /* 7-8: TBL bit for TB events */
47 uint32_t enable_timebase_pmi : 1; /* 9: enable pmi on TBL bit transition */
48 uint32_t threshold_value : 6; /* 10-15: threshold value */
49 uint32_t enable_pmi_on_pmc1 : 1; /* 16: enable pmi on pmc1 overflow */
50 uint32_t enable_pmi_on_pmcn : 1; /* 17: enable pmi on any pmc except pmc1 overflow */
51 uint32_t enable_pmi_trigger : 1; /* 18: enable triggering of pmcn by pmc1 overflow */
52 uint32_t pmc1_event : 7; /* 19-25: pmc1 event select */
53 uint32_t pmc2_event : 6; /* 26-31: pmc2 event select */
54} ppc32_mmcr0_bits_t;
55
56typedef union {
57 uint32_t value;
58 ppc32_mmcr0_bits_t field;
59} ppc32_mmcr0_reg_t;
60
61typedef struct {
62 uint32_t pmc3_event : 5;
63 uint32_t pmc4_event : 5;
64 uint32_t pmc5_event : 5;
65 uint32_t pmc6_event : 6;
66 uint32_t /*reserved*/ : 11;
67} ppc32_mmcr1_bits_t;
68
69typedef union {
70 uint32_t value;
71 ppc32_mmcr1_bits_t field;
72} ppc32_mmcr1_reg_t;
73
74typedef struct {
75 uint32_t threshold_multiplier : 1;
76 uint32_t /*reserved*/ : 31;
77} ppc32_mmcr2_bits_t;
78
79typedef union {
80 uint32_t value;
81 ppc32_mmcr2_bits_t field;
82} ppc32_mmcr2_reg_t;
83
84typedef struct {
85 uint32_t /* reserved */ : 32; /* 0-31: reserved */
86 uint32_t disable_counters_always : 1; /* 32: disable counters */
87 uint32_t disable_counters_supervisor : 1; /* 33: disable counters (supervisor) */
88 uint32_t disable_counters_user : 1; /* 34: disable counters (user) */
89 uint32_t disable_counters_marked : 1; /* 35: disable counters (marked bit == 1) */
90 uint32_t disable_counters_unmarked : 1; /* 36: disable counters (marked bit == 0) */
91 uint32_t enable_pmi : 1; /* 37: performance monitor interrupt enable */
92 uint32_t on_pmi_stop_counting : 1; /* 38: disable counters (pmi) */
93 uint32_t timebase_bit_selector : 2; /* 39-40: TBL bit for timebase events */
94 uint32_t enable_timebase_pmi : 1; /* 41: enable pmi on TBL bit transition */
95 uint32_t threshold_value : 6; /* 42-47: threshold value */
96 uint32_t enable_pmi_on_pmc1 : 1; /* 48: enable pmi on pmc1 overflow */
97 uint32_t enable_pmi_on_pmcn : 1; /* 49: enable pmi on any pmc except pmc1 overflow */
98 uint32_t enable_pmi_trigger : 1; /* 50: enable triggering of pmcn by pmc1 overflow */
99 uint32_t pmc1_event : 5; /* 51-55: pmc1 event select */
100 uint32_t perfmon_event_occurred : 1; /* 56: performance monitor event has occurred */
101 uint32_t /* reserved */ : 1; /* 57: reserved */
102 uint32_t pmc2_event : 5; /* 58-62: pmc2 event select */
103 uint32_t disable_counters_hypervisor : 1; /* 63: disable counters (hypervisor) */
104} ppc64_mmcr0_bits_t;
105
106typedef union {
107 uint64_t value;
108 ppc64_mmcr0_bits_t field;
109} ppc64_mmcr0_reg_t;
110
111typedef struct {
112 uint32_t ttm0_select : 2; /* 0-1: FPU/ISU/IFU/VMX unit select */
113 uint32_t /* reserved */ : 1; /* 2: reserved */
114 uint32_t ttm1_select : 2; /* 3-4: IDU/ISU/ISU unit select */
115 uint32_t /* reserved */ : 1; /* 5: reserved */
116 uint32_t ttm2_select : 2; /* 6-7: IFU/LSU0 unit select */
117 uint32_t /* reserved */ : 1; /* 8: reserved */
118 uint32_t ttm3_select : 2; /* 9-10: LSU1 select */
119 uint32_t /* reserved */ : 1; /* 11: reserved */
120 uint32_t lane0_select : 2; /* 12-13: Byte lane 0 unit select (TD_CP_DBG0SEL) */
121 uint32_t lane1_select : 2; /* 14-15: Byte lane 1 unit select (TD_CP_DBG1SEL) */
122 uint32_t lane2_select : 2; /* 16-17: Byte lane 2 unit select (TD_CP_DBG2SEL) */
123 uint32_t lane3_select : 2; /* 18-19: Byte lane 3 unit select (TD_CP_DBG3SEL) */
124 uint32_t /* reserved */ : 4; /* 20-23: reserved */
125 uint32_t pmc1_adder_lane_select : 1; /* 24: PMC1 Event Adder Lane Select (PMC1_ADDER_SELECT) */
126 uint32_t pmc2_adder_lane_select : 1; /* 25: PMC2 Event Adder Lane Select (PMC2_ADDER_SELECT) */
127 uint32_t pmc6_adder_lane_select : 1; /* 26: PMC6 Event Adder Lane Select (PMC6_ADDER_SELECT) */
128 uint32_t pmc5_adder_lane_select : 1; /* 27: PMC5 Event Adder Lane Select (PMC5_ADDER_SELECT) */
129 uint32_t pmc8_adder_lane_select : 1; /* 28: PMC8 Event Adder Lane Select (PMC8_ADDER_SELECT) */
130 uint32_t pmc7_adder_lane_select : 1; /* 29: PMC7 Event Adder Lane Select (PMC7_ADDER_SELECT) */
131 uint32_t pmc3_adder_lane_select : 1; /* 30: PMC3 Event Adder Lane Select (PMC3_ADDER_SELECT) */
132 uint32_t pmc4_adder_lane_select : 1; /* 31: PMC4 Event Adder Lane Select (PMC4_ADDER_SELECT) */
133 uint32_t pmc3_event : 5; /* 32-36: pmc3 event select */
134 uint32_t pmc4_event : 5; /* 37-41: pmc4 event select */
135 uint32_t pmc5_event : 5; /* 42-46: pmc5 event select */
136 uint32_t pmc6_event : 5; /* 47-51: pmc6 event select */
137 uint32_t pmc7_event : 5; /* 52-56: pmc7 event select */
138 uint32_t pmc8_event : 5; /* 57-61: pmc8 event select */
139 uint32_t speculative_event : 2; /* 62-63: SPeCulative count event SELector */
140} ppc64_mmcr1_bits_t;
141
142typedef union {
143 uint64_t value;
144 ppc64_mmcr1_bits_t field;
145} ppc64_mmcr1_reg_t;
146
147typedef struct {
148 uint32_t /* reserved */ : 32; /* 0-31: reserved */
149 uint32_t siar_sdar_same_instruction : 1; /* 32: SIAR and SDAR are from same instruction */
150 uint32_t disable_counters_pmc1_pmc4 : 1; /* 33: disable counters PMC1-PMC4 */
151 uint32_t disable_counters_pmc5_pmc8 : 1; /* 34: disable counters PMC5-PMC8 */
152 uint32_t problem_state_siar : 1; /* 35: MSR[PR] bit when SIAR set */
153 uint32_t hypervisor_state_siar : 1; /* 36: MSR[HV] bit when SIAR set */
154 uint32_t /* reserved */ : 3; /* 37-39: reserved */
155 uint32_t threshold_start_event : 3; /* 40-42: threshold start event */
156 uint32_t threshold_end_event : 3; /* 43-45: threshold end event */
157 uint32_t /* reserved */ : 3; /* 46-48: reserved */
158 uint32_t imr_select : 1; /* 49: imr select */
159 uint32_t imr_mark : 2; /* 50-51: imr mark */
160 uint32_t imr_mask : 4; /* 52-55: imr mask */
161 uint32_t imr_match : 4; /* 56-59: imr match */
162 uint32_t disable_counters_tags_inactive : 1; /* 60: disable counters in tags inactive mode */
163 uint32_t disable_counters_tags_active : 1; /* 61: disable counters in tags active mode */
164 uint32_t disable_counters_wait_state : 1; /* 62: freeze counters in wait state (CNTL[31]=0) */
165 uint32_t sample_enable : 1; /* 63: sampling enabled */
166} ppc64_mmcra_bits_t;
167
168typedef union {
169 uint64_t value;
170 ppc64_mmcra_bits_t field;
171} ppc64_mmcra_reg_t;
172
173/* PPC_PERFMON_FUNC_* values are taken apart to fill in the appropriate configuration bitfields: */
174typedef struct {
175 uint32_t /* reserved */ : 22;
176 uint32_t SPECSEL : 2;
177 uint32_t TD_CP_DBGxSEL : 2;
178 uint32_t TTM3SEL : 2;
179 uint32_t TTM1SEL : 2;
180 uint32_t TTM0SEL : 2;
181} ppc_func_bits_t;
182
183typedef union {
184 uint32_t value;
185 ppc_func_bits_t field;
186} ppc_func_unit_t;
187
188#endif /* _HW_PERFMON_MMCR_H_ */