op_cpu_type.h revision 84862f9f1c18e2906bd17871ed0970751de7eeae
1/**
2 * @file op_cpu_type.h
3 * CPU type determination
4 *
5 * @remark Copyright 2002 OProfile authors
6 * @remark Read the file COPYING
7 *
8 * @author John Levon
9 * @author Philippe Elie
10 */
11
12#ifndef OP_CPU_TYPE_H
13#define OP_CPU_TYPE_H
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19/**
20 * Supported cpu type.  Always add new CPU types at the very end.
21 */
22typedef enum {
23	CPU_NO_GOOD = -1, /**< unsupported CPU type */
24	CPU_PPRO, /**< Pentium Pro */
25	CPU_PII, /**< Pentium II series */
26	CPU_PIII, /**< Pentium III series */
27	CPU_ATHLON, /**< AMD P6 series */
28	CPU_TIMER_INT, /**< CPU using the timer interrupt */
29	CPU_RTC, /**< other CPU to use the RTC */
30	CPU_P4,  /**< Pentium 4 / Xeon series */
31	CPU_IA64, /**< Generic IA64 */
32	CPU_IA64_1, /**< IA64 Merced */
33	CPU_IA64_2, /**< IA64 McKinley */
34	CPU_HAMMER, /**< AMD Hammer family */
35	CPU_P4_HT2, /**< Pentium 4 / Xeon series with 2 hyper-threads */
36	CPU_AXP_EV4, /**< Alpha EV4 family */
37	CPU_AXP_EV5, /**< Alpha EV5 family */
38	CPU_AXP_PCA56, /**< Alpha PCA56 family */
39	CPU_AXP_EV6, /**< Alpha EV6 family */
40	CPU_AXP_EV67, /**< Alpha EV67 family */
41	CPU_P6_MOBILE, /**< Pentium M series */
42	CPU_ARM_XSCALE1, /**< ARM XScale 1 */
43	CPU_ARM_XSCALE2, /**< ARM XScale 2 */
44	CPU_PPC64_POWER4, /**< ppc64 POWER4 family */
45	CPU_PPC64_POWER5, /**< ppc64 POWER5 family */
46	CPU_PPC64_POWER5p, /**< ppc64 Power5+ family */
47	CPU_PPC64_970, /**< ppc64 970 family */
48	CPU_MIPS_20K, /**< MIPS 20K */
49	CPU_MIPS_24K, /**< MIPS 24K */
50	CPU_MIPS_25K, /**< MIPS 25K */
51	CPU_MIPS_34K, /**< MIPS 34K */
52	CPU_MIPS_5K, /**< MIPS 5K */
53	CPU_MIPS_R10000, /**< MIPS R10000 */
54	CPU_MIPS_R12000, /**< MIPS R12000 */
55	CPU_MIPS_RM7000, /**< QED  RM7000 */
56	CPU_MIPS_RM9000, /**< PMC-Sierra RM9000 */
57	CPU_MIPS_SB1, /**< Broadcom SB1 */
58	CPU_MIPS_VR5432, /**< NEC VR5432 */
59	CPU_MIPS_VR5500, /**< MIPS VR5500, VR5532 and VR7701 */
60	CPU_PPC_E500,	/**< e500 */
61	CPU_PPC_E500_2,	/**< e500v2 */
62	CPU_CORE, /**< Core Solo / Duo series */
63	CPU_PPC_7450, /**< PowerPC G4 */
64	CPU_CORE_2, /**< Intel Core 2 */
65	CPU_PPC64_POWER6, /**< ppc64 POWER6 family */
66	CPU_PPC64_970MP, /**< ppc64 970MP */
67	CPU_PPC64_CELL, /**< ppc64 Cell Broadband Engine*/
68	CPU_FAMILY10, /**< AMD family 10 */
69 	CPU_PPC64_PA6T, /**< ppc64 PA6T */
70	CPU_ARM_MPCORE, /**< ARM MPCore */
71	CPU_ARM_V6, /**< ARM V6 */
72	CPU_PPC64_POWER5pp,  /**< ppc64 Power5++ family */
73	CPU_PPC_E300, /**< e300 */
74	CPU_AVR32, /**< AVR32 */
75	CPU_ARM_V7, /**< ARM V7 */
76 	CPU_ARCH_PERFMON, /**< Intel architectural perfmon */
77	CPU_FAMILY11H, /**< AMD family 11h */
78	CPU_PPC64_POWER7, /**< ppc64 POWER7 family */
79	CPU_PPC64_IBM_COMPAT_V1, /**< IBM PPC64 processor compat mode version 1 */
80   	CPU_CORE_I7, /* Intel Core i7, Nehalem */
81   	CPU_ATOM, /* First generation Intel Atom */
82	MAX_CPU_TYPE
83} op_cpu;
84
85/**
86 * get the CPU type from the kernel
87 *
88 * returns CPU_NO_GOOD if the CPU could not be identified.
89 * This function can not work if the module is not loaded
90 */
91op_cpu op_get_cpu_type(void);
92
93/**
94 * get the cpu number based on string
95 * @param cpu_string with either the cpu type identifier or cpu type number
96 *
97 * The function returns CPU_NO_GOOD if no matching string was found.
98 */
99op_cpu op_get_cpu_number(char const * cpu_string);
100
101/**
102 * get the cpu string.
103 * @param cpu_type the cpu type identifier
104 *
105 * The function always return a valid char const * the core cpu denomination
106 * or "invalid cpu type" if cpu_type is not valid.
107 */
108char const * op_get_cpu_type_str(op_cpu cpu_type);
109
110/**
111 * op_get_cpu_name - get the cpu name
112 * @param cpu_type  the cpu identifier name
113 *
114 * The function always return a valid char const *
115 * Return the OProfile CPU name, e.g. "i386/pii"
116 */
117char const * op_get_cpu_name(op_cpu cpu_type);
118
119/**
120 * compute the number of counters available
121 * @param cpu_type numeric processor type
122 *
123 * returns 0 if the CPU could not be identified
124 */
125int op_get_nr_counters(op_cpu cpu_type);
126
127typedef enum {
128	OP_INTERFACE_NO_GOOD = -1,
129	OP_INTERFACE_24,
130	OP_INTERFACE_26
131} op_interface;
132
133/**
134 * get the INTERFACE used to communicate between daemon and the kernel
135 *
136 * returns OP_INTERFACE_NO_GOOD if the INTERFACE could not be identified.
137 * This function will identify the interface as OP_INTERFACE_NO_GOOD if
138 * the module is not loaded.
139 */
140op_interface op_get_interface(void);
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* OP_CPU_TYPE_H */
147