1221828Sgrehan/*-
2221828Sgrehan * Copyright (c) 2011 NetApp, Inc.
3221828Sgrehan * All rights reserved.
4221828Sgrehan *
5221828Sgrehan * Redistribution and use in source and binary forms, with or without
6221828Sgrehan * modification, are permitted provided that the following conditions
7221828Sgrehan * are met:
8221828Sgrehan * 1. Redistributions of source code must retain the above copyright
9221828Sgrehan *    notice, this list of conditions and the following disclaimer.
10221828Sgrehan * 2. Redistributions in binary form must reproduce the above copyright
11221828Sgrehan *    notice, this list of conditions and the following disclaimer in the
12221828Sgrehan *    documentation and/or other materials provided with the distribution.
13221828Sgrehan *
14221828Sgrehan * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15221828Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16221828Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17221828Sgrehan * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18221828Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19221828Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20221828Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21221828Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22221828Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23221828Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24221828Sgrehan * SUCH DAMAGE.
25221828Sgrehan *
26221828Sgrehan * $FreeBSD$
27221828Sgrehan */
28221828Sgrehan
29221828Sgrehan#ifndef _X86_H_
30221828Sgrehan#define	_X86_H_
31221828Sgrehan
32221828Sgrehan#define CPUID_0000_0000 (0x0)
33221828Sgrehan#define CPUID_0000_0001	(0x1)
34221828Sgrehan#define CPUID_0000_0002 (0x2)
35221828Sgrehan#define CPUID_0000_0003 (0x3)
36221828Sgrehan#define CPUID_0000_0004 (0x4)
37222105Sgrehan#define CPUID_0000_0006 (0x6)
38243325Sgrehan#define CPUID_0000_0007 (0x7)
39221828Sgrehan#define	CPUID_0000_000A	(0xA)
40221828Sgrehan#define	CPUID_0000_000B	(0xB)
41255287Sgrehan#define	CPUID_0000_000D	(0xD)
42221828Sgrehan#define CPUID_8000_0000	(0x80000000)
43221828Sgrehan#define CPUID_8000_0001	(0x80000001)
44221828Sgrehan#define CPUID_8000_0002	(0x80000002)
45221828Sgrehan#define CPUID_8000_0003	(0x80000003)
46221828Sgrehan#define CPUID_8000_0004	(0x80000004)
47221828Sgrehan#define CPUID_8000_0006	(0x80000006)
48221828Sgrehan#define CPUID_8000_0007	(0x80000007)
49221828Sgrehan#define CPUID_8000_0008	(0x80000008)
50221828Sgrehan
51221828Sgrehan/*
52221828Sgrehan * CPUID instruction Fn0000_0001:
53221828Sgrehan */
54221828Sgrehan#define CPUID_0000_0001_APICID_MASK			(0xff<<24)
55221828Sgrehan#define CPUID_0000_0001_APICID_SHIFT			24
56221828Sgrehan
57221828Sgrehan/*
58221828Sgrehan * CPUID instruction Fn0000_0001 ECX
59221828Sgrehan */
60221828Sgrehan#define CPUID_0000_0001_FEAT0_VMX	(1<<5)
61221828Sgrehan
62240941Sneelint x86_emulate_cpuid(struct vm *vm, int vcpu_id, uint32_t *eax, uint32_t *ebx,
63240941Sneel		      uint32_t *ecx, uint32_t *edx);
64221828Sgrehan
65221828Sgrehan#endif
66