kusano 2b45e8
/*********************************************************************/
kusano 2b45e8
/* Copyright 2009, 2010 The University of Texas at Austin.           */
kusano 2b45e8
/* All rights reserved.                                              */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/* Redistribution and use in source and binary forms, with or        */
kusano 2b45e8
/* without modification, are permitted provided that the following   */
kusano 2b45e8
/* conditions are met:                                               */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*   1. Redistributions of source code must retain the above         */
kusano 2b45e8
/*      copyright notice, this list of conditions and the following  */
kusano 2b45e8
/*      disclaimer.                                                  */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*   2. Redistributions in binary form must reproduce the above      */
kusano 2b45e8
/*      copyright notice, this list of conditions and the following  */
kusano 2b45e8
/*      disclaimer in the documentation and/or other materials       */
kusano 2b45e8
/*      provided with the distribution.                              */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
kusano 2b45e8
/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
kusano 2b45e8
/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
kusano 2b45e8
/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
kusano 2b45e8
/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
kusano 2b45e8
/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
kusano 2b45e8
/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
kusano 2b45e8
/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
kusano 2b45e8
/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
kusano 2b45e8
/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
kusano 2b45e8
/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
kusano 2b45e8
/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
kusano 2b45e8
/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
kusano 2b45e8
/*    POSSIBILITY OF SUCH DAMAGE.                                    */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/* The views and conclusions contained in the software and           */
kusano 2b45e8
/* documentation are those of the authors and should not be          */
kusano 2b45e8
/* interpreted as representing official policies, either expressed   */
kusano 2b45e8
/* or implied, of The University of Texas at Austin.                 */
kusano 2b45e8
/*********************************************************************/
kusano 2b45e8
kusano 2b45e8
#ifndef CPUID_H
kusano 2b45e8
#define CPUID_H
kusano 2b45e8
kusano 2b45e8
#define VENDOR_INTEL      1
kusano 2b45e8
#define VENDOR_UMC        2
kusano 2b45e8
#define VENDOR_AMD        3
kusano 2b45e8
#define VENDOR_CYRIX      4
kusano 2b45e8
#define VENDOR_NEXGEN     5
kusano 2b45e8
#define VENDOR_CENTAUR    6
kusano 2b45e8
#define VENDOR_RISE       7
kusano 2b45e8
#define VENDOR_SIS	  8
kusano 2b45e8
#define VENDOR_TRANSMETA  9
kusano 2b45e8
#define VENDOR_NSC	 10
kusano 2b45e8
#define VENDOR_UNKNOWN   99
kusano 2b45e8
kusano 2b45e8
#define BITMASK(a, b, c) ((((a) >> (b)) & (c)))
kusano 2b45e8
kusano 2b45e8
#define FAMILY_80486  4
kusano 2b45e8
#define FAMILY_P5     5
kusano 2b45e8
#define FAMILY_P6     6
kusano 2b45e8
#define FAMILY_PM     7
kusano 2b45e8
#define FAMILY_IA64   8
kusano 2b45e8
kusano 2b45e8
#if defined(__i386__) || defined(__x86_64__)
kusano 2b45e8
#define GET_EXFAMILY  1
kusano 2b45e8
#define GET_EXMODEL   2
kusano 2b45e8
#define GET_TYPE      3
kusano 2b45e8
#define GET_FAMILY    4
kusano 2b45e8
#define GET_MODEL     5
kusano 2b45e8
#define GET_APICID    6
kusano 2b45e8
#define GET_LCOUNT    7
kusano 2b45e8
#define GET_CHUNKS    8
kusano 2b45e8
#define GET_STEPPING  9
kusano 2b45e8
#define GET_BLANDID  10
kusano 2b45e8
#define GET_FEATURE  11
kusano 2b45e8
#define GET_NUMSHARE 12
kusano 2b45e8
#define GET_NUMCORES 13
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef __ia64__
kusano 2b45e8
#define GET_ARCHREV   1
kusano 2b45e8
#define GET_FAMILY    2
kusano 2b45e8
#define GET_MODEL     3
kusano 2b45e8
#define GET_REVISION  4
kusano 2b45e8
#define GET_NUMBER    5
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#define CORE_UNKNOWN     0
kusano 2b45e8
#define CORE_80486       1
kusano 2b45e8
#define CORE_P5          2
kusano 2b45e8
#define CORE_P6          3
kusano 2b45e8
#define CORE_KATMAI      4
kusano 2b45e8
#define CORE_COPPERMINE  5
kusano 2b45e8
#define CORE_NORTHWOOD   6
kusano 2b45e8
#define CORE_PRESCOTT    7
kusano 2b45e8
#define CORE_BANIAS      8
kusano 2b45e8
#define CORE_ATHLON      9
kusano 2b45e8
#define CORE_OPTERON    10
kusano 2b45e8
#define CORE_BARCELONA  11
kusano 2b45e8
#define CORE_VIAC3      12
kusano 2b45e8
#define CORE_YONAH	13
kusano 2b45e8
#define CORE_CORE2	14
kusano 2b45e8
#define CORE_PENRYN	15
kusano 2b45e8
#define CORE_DUNNINGTON	16
kusano 2b45e8
#define CORE_NEHALEM	17
kusano 2b45e8
#define CORE_ATOM	18
kusano 2b45e8
#define CORE_NANO	19
kusano 2b45e8
kusano 2b45e8
#define HAVE_SSE      (1 <<  0)
kusano 2b45e8
#define HAVE_SSE2     (1 <<  1)
kusano 2b45e8
#define HAVE_SSE3     (1 <<  2)
kusano 2b45e8
#define HAVE_SSSE3    (1 <<  3)
kusano 2b45e8
#define HAVE_SSE4_1   (1 <<  4)
kusano 2b45e8
#define HAVE_SSE4_2   (1 <<  5)
kusano 2b45e8
#define HAVE_SSE4A    (1 <<  6)
kusano 2b45e8
#define HAVE_SSE5     (1 <<  7)
kusano 2b45e8
#define HAVE_MMX      (1 <<  8)
kusano 2b45e8
#define HAVE_3DNOW    (1 <<  9)
kusano 2b45e8
#define HAVE_3DNOWEX  (1 << 10)
kusano 2b45e8
#define HAVE_CMOV     (1 << 11)
kusano 2b45e8
#define HAVE_PSE      (1 << 12)
kusano 2b45e8
#define HAVE_CFLUSH   (1 << 13)
kusano 2b45e8
#define HAVE_HIT      (1 << 14)
kusano 2b45e8
#define HAVE_MISALIGNSSE (1 << 15)
kusano 2b45e8
#define HAVE_128BITFPU   (1 << 16)
kusano 2b45e8
#define HAVE_FASTMOVU    (1 << 17)
kusano 2b45e8
kusano 2b45e8
#define CACHE_INFO_L1_I     1
kusano 2b45e8
#define CACHE_INFO_L1_D     2
kusano 2b45e8
#define CACHE_INFO_L2       3
kusano 2b45e8
#define CACHE_INFO_L3       4
kusano 2b45e8
#define CACHE_INFO_L1_ITB   5
kusano 2b45e8
#define CACHE_INFO_L1_DTB   6
kusano 2b45e8
#define CACHE_INFO_L1_LITB  7
kusano 2b45e8
#define CACHE_INFO_L1_LDTB  8
kusano 2b45e8
#define CACHE_INFO_L2_ITB   9
kusano 2b45e8
#define CACHE_INFO_L2_DTB  10
kusano 2b45e8
#define CACHE_INFO_L2_LITB 11
kusano 2b45e8
#define CACHE_INFO_L2_LDTB 12
kusano 2b45e8
kusano 2b45e8
typedef struct {
kusano 2b45e8
  int size;
kusano 2b45e8
  int associative;
kusano 2b45e8
  int linesize;
kusano 2b45e8
  int shared;
kusano 2b45e8
} cache_info_t;
kusano 2b45e8
kusano 2b45e8
#define CPUTYPE_UNKNOWN			 0
kusano 2b45e8
#define CPUTYPE_INTEL_UNKNOWN		 1
kusano 2b45e8
#define CPUTYPE_UMC_UNKNOWN		 2
kusano 2b45e8
#define CPUTYPE_AMD_UNKNOWN		 3
kusano 2b45e8
#define CPUTYPE_CYRIX_UNKNOWN		 4
kusano 2b45e8
#define CPUTYPE_NEXGEN_UNKNOWN		 5
kusano 2b45e8
#define CPUTYPE_CENTAUR_UNKNOWN		 6
kusano 2b45e8
#define CPUTYPE_RISE_UNKNOWN		 7
kusano 2b45e8
#define CPUTYPE_SIS_UNKNOWN		 8
kusano 2b45e8
#define CPUTYPE_TRANSMETA_UNKNOWN	 9
kusano 2b45e8
#define CPUTYPE_NSC_UNKNOWN		10
kusano 2b45e8
kusano 2b45e8
#define CPUTYPE_80386			11
kusano 2b45e8
#define CPUTYPE_80486			12
kusano 2b45e8
#define CPUTYPE_PENTIUM			13
kusano 2b45e8
#define CPUTYPE_PENTIUM2		14
kusano 2b45e8
#define CPUTYPE_PENTIUM3		15
kusano 2b45e8
#define CPUTYPE_PENTIUMM		16
kusano 2b45e8
#define CPUTYPE_PENTIUM4		17
kusano 2b45e8
#define CPUTYPE_CORE2			18
kusano 2b45e8
#define CPUTYPE_PENRYN			19
kusano 2b45e8
#define CPUTYPE_DUNNINGTON		20
kusano 2b45e8
#define CPUTYPE_NEHALEM			21
kusano 2b45e8
#define CPUTYPE_ATOM			22
kusano 2b45e8
#define CPUTYPE_ITANIUM			23
kusano 2b45e8
#define CPUTYPE_ITANIUM2		24
kusano 2b45e8
#define CPUTYPE_AMD5X86			25
kusano 2b45e8
#define CPUTYPE_AMDK6			26
kusano 2b45e8
#define CPUTYPE_ATHLON			27
kusano 2b45e8
#define CPUTYPE_DURON			28
kusano 2b45e8
#define CPUTYPE_OPTERON			29
kusano 2b45e8
#define CPUTYPE_BARCELONA		30
kusano 2b45e8
#define CPUTYPE_SHANGHAI		31
kusano 2b45e8
#define CPUTYPE_ISTANBUL		32
kusano 2b45e8
#define CPUTYPE_CYRIX5X86		33
kusano 2b45e8
#define CPUTYPE_CYRIXM1			34
kusano 2b45e8
#define CPUTYPE_CYRIXM2			35
kusano 2b45e8
#define CPUTYPE_NEXGENNX586		36
kusano 2b45e8
#define CPUTYPE_CENTAURC6		37
kusano 2b45e8
#define CPUTYPE_RISEMP6			38
kusano 2b45e8
#define CPUTYPE_SYS55X			39
kusano 2b45e8
#define CPUTYPE_CRUSOETM3X		40
kusano 2b45e8
#define CPUTYPE_NSGEODE			41
kusano 2b45e8
#define CPUTYPE_VIAC3			42
kusano 2b45e8
#define CPUTYPE_NANO			43
kusano 2b45e8
#endif