Home | History | Annotate | Download | only in libop
      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 
     19 /**
     20  * Supported cpu type.  Always add new CPU types at the very end.
     21  */
     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 */
     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 Cortex-A8 */
     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 	CPU_MIPS_LOONGSON2, /* < loongson2 family */
     83 	CPU_NEHALEM, /* Intel Nehalem microarchitecture */
     84 	CPU_ARM_V7_CA9, /**< ARM Cortex-A9 */
     85 	CPU_MIPS_74K, /**< MIPS 74K */
     86 	CPU_MIPS_1004K, /**< MIPS 1004K */
     87 	CPU_FAMILY12H, /**< AMD family 12h */
     88 	CPU_FAMILY14H, /**< AMD family 14h */
     89 	CPU_FAMILY15H, /**< AMD family 15h */
     90 	CPU_WESTMERE, /* Intel Westmere microarchitecture */
     91 	MAX_CPU_TYPE
     92 } op_cpu;
     93 
     94 /**
     95  * the CPU lowest common denominator
     96  *
     97  * returns 1 if there are variations for the base cpu type;
     98  */
     99 int op_cpu_variations(op_cpu cpu_type);
    100 
    101 /**
    102  * get the CPU lowest common denominator
    103  *
    104  * returns cpu_type if cpu_type does not have a lowest common denominator.
    105  */
    106 op_cpu op_cpu_base_type(op_cpu cpu_type);
    107 
    108 /**
    109  * get the CPU type from the kernel
    110  *
    111  * returns CPU_NO_GOOD if the CPU could not be identified.
    112  * This function can not work if the module is not loaded
    113  */
    114 op_cpu op_get_cpu_type(void);
    115 
    116 /**
    117  * get the cpu number based on string
    118  * @param cpu_string with either the cpu type identifier or cpu type number
    119  *
    120  * The function returns CPU_NO_GOOD if no matching string was found.
    121  */
    122 op_cpu op_get_cpu_number(char const * cpu_string);
    123 
    124 /**
    125  * get the cpu string.
    126  * @param cpu_type the cpu type identifier
    127  *
    128  * The function always return a valid char const * the core cpu denomination
    129  * or "invalid cpu type" if cpu_type is not valid.
    130  */
    131 char const * op_get_cpu_type_str(op_cpu cpu_type);
    132 
    133 /**
    134  * op_get_cpu_name - get the cpu name
    135  * @param cpu_type  the cpu identifier name
    136  *
    137  * The function always return a valid char const *
    138  * Return the OProfile CPU name, e.g. "i386/pii"
    139  */
    140 char const * op_get_cpu_name(op_cpu cpu_type);
    141 
    142 /**
    143  * compute the number of counters available
    144  * @param cpu_type numeric processor type
    145  *
    146  * returns 0 if the CPU could not be identified
    147  */
    148 int op_get_nr_counters(op_cpu cpu_type);
    149 
    150 typedef enum {
    151 	OP_INTERFACE_NO_GOOD = -1,
    152 	OP_INTERFACE_24,
    153 	OP_INTERFACE_26
    154 } op_interface;
    155 
    156 /**
    157  * get the INTERFACE used to communicate between daemon and the kernel
    158  *
    159  * returns OP_INTERFACE_NO_GOOD if the INTERFACE could not be identified.
    160  * This function will identify the interface as OP_INTERFACE_NO_GOOD if
    161  * the module is not loaded.
    162  */
    163 op_interface op_get_interface(void);
    164 
    165 #ifdef __cplusplus
    166 }
    167 #endif
    168 
    169 #endif /* OP_CPU_TYPE_H */
    170