103b705cfSriastradh/* 203b705cfSriastradh * Copyright (c) 2013 Intel Corporation 303b705cfSriastradh * 403b705cfSriastradh * Permission is hereby granted, free of charge, to any person obtaining a 503b705cfSriastradh * copy of this software and associated documentation files (the "Software"), 603b705cfSriastradh * to deal in the Software without restriction, including without limitation 703b705cfSriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense, 803b705cfSriastradh * and/or sell copies of the Software, and to permit persons to whom the 903b705cfSriastradh * Software is furnished to do so, subject to the following conditions: 1003b705cfSriastradh * 1103b705cfSriastradh * The above copyright notice and this permission notice (including the next 1203b705cfSriastradh * paragraph) shall be included in all copies or substantial portions of the 1303b705cfSriastradh * Software. 1403b705cfSriastradh * 1503b705cfSriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1603b705cfSriastradh * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1703b705cfSriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1803b705cfSriastradh * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 1903b705cfSriastradh * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 2003b705cfSriastradh * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 2103b705cfSriastradh * SOFTWARE. 2203b705cfSriastradh * 2303b705cfSriastradh * Authors: 2403b705cfSriastradh * Chris Wilson <chris@chris-wilson.co.uk> 2503b705cfSriastradh * 2603b705cfSriastradh */ 2703b705cfSriastradh 2803b705cfSriastradh/* Small wrapper around compiler specific implementation details of cpuid */ 2903b705cfSriastradh 3003b705cfSriastradh#ifndef SNA_CPUID_H 3103b705cfSriastradh#define SNA_CPUID_H 3203b705cfSriastradh 3342542f5fSchristos#ifdef HAVE_CPUID_H 3403b705cfSriastradh#include <cpuid.h> 3503b705cfSriastradh#else 3603b705cfSriastradh#define __get_cpuid_max(x, y) 0 3742542f5fSchristos#define __cpuid(level, a, b, c, d) a = b = c = d = 0 3842542f5fSchristos#define __cpuid_count(level, count, a, b, c, d) a = b = c = d = 0 3903b705cfSriastradh#endif 4003b705cfSriastradh 4103b705cfSriastradh#define BASIC_CPUID 0x0 4203b705cfSriastradh#define EXTENDED_CPUID 0x80000000 4303b705cfSriastradh 4403b705cfSriastradh#ifndef bit_MMX 4503b705cfSriastradh#define bit_MMX (1 << 23) 4603b705cfSriastradh#endif 4703b705cfSriastradh 4803b705cfSriastradh#ifndef bit_SSE 4903b705cfSriastradh#define bit_SSE (1 << 25) 5003b705cfSriastradh#endif 5103b705cfSriastradh 5203b705cfSriastradh#ifndef bit_SSE2 5303b705cfSriastradh#define bit_SSE2 (1 << 26) 5403b705cfSriastradh#endif 5503b705cfSriastradh 5603b705cfSriastradh#ifndef bit_SSE3 5703b705cfSriastradh#define bit_SSE3 (1 << 0) 5803b705cfSriastradh#endif 5903b705cfSriastradh 6003b705cfSriastradh#ifndef bit_SSSE3 6103b705cfSriastradh#define bit_SSSE3 (1 << 9) 6203b705cfSriastradh#endif 6303b705cfSriastradh 6403b705cfSriastradh#ifndef bit_SSE4_1 6503b705cfSriastradh#define bit_SSE4_1 (1 << 19) 6603b705cfSriastradh#endif 6703b705cfSriastradh 6803b705cfSriastradh#ifndef bit_SSE4_2 6903b705cfSriastradh#define bit_SSE4_2 (1 << 20) 7003b705cfSriastradh#endif 7103b705cfSriastradh 7203b705cfSriastradh#ifndef bit_OSXSAVE 7303b705cfSriastradh#define bit_OSXSAVE (1 << 27) 7403b705cfSriastradh#endif 7503b705cfSriastradh 7603b705cfSriastradh#ifndef bit_AVX 7703b705cfSriastradh#define bit_AVX (1 << 28) 7803b705cfSriastradh#endif 7903b705cfSriastradh 8003b705cfSriastradh#ifndef bit_AVX2 8103b705cfSriastradh#define bit_AVX2 (1<<5) 8203b705cfSriastradh#endif 8303b705cfSriastradh 8403b705cfSriastradh#endif /* SNA_CPUID_H */ 85