Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame] | 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 |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
The Android Open Source Project | 7984f7a | 2008-12-17 18:04:47 -0800 | [diff] [blame] | 19 | /** |
| 20 | * Supported cpu type. Always add new CPU types at the very end. |
| 21 | */ |
Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame] | 22 | typedef 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 */ |
The Android Open Source Project | 7984f7a | 2008-12-17 18:04:47 -0800 | [diff] [blame] | 46 | CPU_PPC64_POWER5p, /**< ppc64 Power5+ family */ |
Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame] | 47 | CPU_PPC64_970, /**< ppc64 970 family */ |
The Android Open Source Project | 7984f7a | 2008-12-17 18:04:47 -0800 | [diff] [blame] | 48 | CPU_MIPS_20K, /**< MIPS 20K */ |
Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame] | 49 | CPU_MIPS_24K, /**< MIPS 24K */ |
The Android Open Source Project | 7984f7a | 2008-12-17 18:04:47 -0800 | [diff] [blame] | 50 | CPU_MIPS_25K, /**< MIPS 25K */ |
| 51 | CPU_MIPS_34K, /**< MIPS 34K */ |
| 52 | CPU_MIPS_5K, /**< MIPS 5K */ |
Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame] | 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 */ |
The Android Open Source Project | 7984f7a | 2008-12-17 18:04:47 -0800 | [diff] [blame] | 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 */ |
Upstream | cc2ee17 | 1970-01-12 13:46:40 +0000 | [diff] [blame] | 75 | MAX_CPU_TYPE |
| 76 | } op_cpu; |
| 77 | |
| 78 | /** |
| 79 | * get the CPU type from the kernel |
| 80 | * |
| 81 | * returns CPU_NO_GOOD if the CPU could not be identified. |
| 82 | * This function can not work if the module is not loaded |
| 83 | */ |
| 84 | op_cpu op_get_cpu_type(void); |
| 85 | |
| 86 | /** |
| 87 | * get the cpu number based on string |
| 88 | * @param cpu_string with either the cpu type identifier or cpu type number |
| 89 | * |
| 90 | * The function returns CPU_NO_GOOD if no matching string was found. |
| 91 | */ |
| 92 | op_cpu op_get_cpu_number(char const * cpu_string); |
| 93 | |
| 94 | /** |
| 95 | * get the cpu string. |
| 96 | * @param cpu_type the cpu type identifier |
| 97 | * |
| 98 | * The function always return a valid char const * the core cpu denomination |
| 99 | * or "invalid cpu type" if cpu_type is not valid. |
| 100 | */ |
| 101 | char const * op_get_cpu_type_str(op_cpu cpu_type); |
| 102 | |
| 103 | /** |
| 104 | * op_get_cpu_name - get the cpu name |
| 105 | * @param cpu_type the cpu identifier name |
| 106 | * |
| 107 | * The function always return a valid char const * |
| 108 | * Return the OProfile CPU name, e.g. "i386/pii" |
| 109 | */ |
| 110 | char const * op_get_cpu_name(op_cpu cpu_type); |
| 111 | |
| 112 | /** |
| 113 | * compute the number of counters available |
| 114 | * @param cpu_type numeric processor type |
| 115 | * |
| 116 | * returns 0 if the CPU could not be identified |
| 117 | */ |
| 118 | int op_get_nr_counters(op_cpu cpu_type); |
| 119 | |
| 120 | typedef enum { |
| 121 | OP_INTERFACE_NO_GOOD = -1, |
| 122 | OP_INTERFACE_24, |
| 123 | OP_INTERFACE_26 |
| 124 | } op_interface; |
| 125 | |
| 126 | /** |
| 127 | * get the INTERFACE used to communicate between daemon and the kernel |
| 128 | * |
| 129 | * returns OP_INTERFACE_NO_GOOD if the INTERFACE could not be identified. |
| 130 | * This function will identify the interface as OP_INTERFACE_NO_GOOD if |
| 131 | * the module is not loaded. |
| 132 | */ |
| 133 | op_interface op_get_interface(void); |
| 134 | |
| 135 | #ifdef __cplusplus |
| 136 | } |
| 137 | #endif |
| 138 | |
| 139 | #endif /* OP_CPU_TYPE_H */ |