First Support on Ginger and OMAP TI
[linux-ginger.git] / arch / x86 / include / asm / vmi.h
blob61e08c0a290785c5527d9faf607c0c2ab2e384e2
1 /*
2 * VMI interface definition
4 * Copyright (C) 2005, VMware, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Maintained by: Zachary Amsden zach@vmware.com
24 #include <linux/types.h>
27 *---------------------------------------------------------------------
29 * VMI Option ROM API
31 *---------------------------------------------------------------------
33 #define VMI_SIGNATURE 0x696d5663 /* "cVmi" */
35 #define PCI_VENDOR_ID_VMWARE 0x15AD
36 #define PCI_DEVICE_ID_VMWARE_VMI 0x0801
39 * We use two version numbers for compatibility, with the major
40 * number signifying interface breakages, and the minor number
41 * interface extensions.
43 #define VMI_API_REV_MAJOR 3
44 #define VMI_API_REV_MINOR 0
46 #define VMI_CALL_CPUID 0
47 #define VMI_CALL_WRMSR 1
48 #define VMI_CALL_RDMSR 2
49 #define VMI_CALL_SetGDT 3
50 #define VMI_CALL_SetLDT 4
51 #define VMI_CALL_SetIDT 5
52 #define VMI_CALL_SetTR 6
53 #define VMI_CALL_GetGDT 7
54 #define VMI_CALL_GetLDT 8
55 #define VMI_CALL_GetIDT 9
56 #define VMI_CALL_GetTR 10
57 #define VMI_CALL_WriteGDTEntry 11
58 #define VMI_CALL_WriteLDTEntry 12
59 #define VMI_CALL_WriteIDTEntry 13
60 #define VMI_CALL_UpdateKernelStack 14
61 #define VMI_CALL_SetCR0 15
62 #define VMI_CALL_SetCR2 16
63 #define VMI_CALL_SetCR3 17
64 #define VMI_CALL_SetCR4 18
65 #define VMI_CALL_GetCR0 19
66 #define VMI_CALL_GetCR2 20
67 #define VMI_CALL_GetCR3 21
68 #define VMI_CALL_GetCR4 22
69 #define VMI_CALL_WBINVD 23
70 #define VMI_CALL_SetDR 24
71 #define VMI_CALL_GetDR 25
72 #define VMI_CALL_RDPMC 26
73 #define VMI_CALL_RDTSC 27
74 #define VMI_CALL_CLTS 28
75 #define VMI_CALL_EnableInterrupts 29
76 #define VMI_CALL_DisableInterrupts 30
77 #define VMI_CALL_GetInterruptMask 31
78 #define VMI_CALL_SetInterruptMask 32
79 #define VMI_CALL_IRET 33
80 #define VMI_CALL_SYSEXIT 34
81 #define VMI_CALL_Halt 35
82 #define VMI_CALL_Reboot 36
83 #define VMI_CALL_Shutdown 37
84 #define VMI_CALL_SetPxE 38
85 #define VMI_CALL_SetPxELong 39
86 #define VMI_CALL_UpdatePxE 40
87 #define VMI_CALL_UpdatePxELong 41
88 #define VMI_CALL_MachineToPhysical 42
89 #define VMI_CALL_PhysicalToMachine 43
90 #define VMI_CALL_AllocatePage 44
91 #define VMI_CALL_ReleasePage 45
92 #define VMI_CALL_InvalPage 46
93 #define VMI_CALL_FlushTLB 47
94 #define VMI_CALL_SetLinearMapping 48
96 #define VMI_CALL_SetIOPLMask 61
97 #define VMI_CALL_SetInitialAPState 62
98 #define VMI_CALL_APICWrite 63
99 #define VMI_CALL_APICRead 64
100 #define VMI_CALL_IODelay 65
101 #define VMI_CALL_SetLazyMode 73
104 *---------------------------------------------------------------------
106 * MMU operation flags
108 *---------------------------------------------------------------------
111 /* Flags used by VMI_{Allocate|Release}Page call */
112 #define VMI_PAGE_PAE 0x10 /* Allocate PAE shadow */
113 #define VMI_PAGE_CLONE 0x20 /* Clone from another shadow */
114 #define VMI_PAGE_ZEROED 0x40 /* Page is pre-zeroed */
117 /* Flags shared by Allocate|Release Page and PTE updates */
118 #define VMI_PAGE_PT 0x01
119 #define VMI_PAGE_PD 0x02
120 #define VMI_PAGE_PDP 0x04
121 #define VMI_PAGE_PML4 0x08
123 #define VMI_PAGE_NORMAL 0x00 /* for debugging */
125 /* Flags used by PTE updates */
126 #define VMI_PAGE_CURRENT_AS 0x10 /* implies VMI_PAGE_VA_MASK is valid */
127 #define VMI_PAGE_DEFER 0x20 /* may queue update until TLB inval */
128 #define VMI_PAGE_VA_MASK 0xfffff000
130 #ifdef CONFIG_X86_PAE
131 #define VMI_PAGE_L1 (VMI_PAGE_PT | VMI_PAGE_PAE | VMI_PAGE_ZEROED)
132 #define VMI_PAGE_L2 (VMI_PAGE_PD | VMI_PAGE_PAE | VMI_PAGE_ZEROED)
133 #else
134 #define VMI_PAGE_L1 (VMI_PAGE_PT | VMI_PAGE_ZEROED)
135 #define VMI_PAGE_L2 (VMI_PAGE_PD | VMI_PAGE_ZEROED)
136 #endif
138 /* Flags used by VMI_FlushTLB call */
139 #define VMI_FLUSH_TLB 0x01
140 #define VMI_FLUSH_GLOBAL 0x02
143 *---------------------------------------------------------------------
145 * VMI relocation definitions for ROM call get_reloc
147 *---------------------------------------------------------------------
150 /* VMI Relocation types */
151 #define VMI_RELOCATION_NONE 0
152 #define VMI_RELOCATION_CALL_REL 1
153 #define VMI_RELOCATION_JUMP_REL 2
154 #define VMI_RELOCATION_NOP 3
156 #ifndef __ASSEMBLY__
157 struct vmi_relocation_info {
158 unsigned char *eip;
159 unsigned char type;
160 unsigned char reserved[3];
162 #endif
166 *---------------------------------------------------------------------
168 * Generic ROM structures and definitions
170 *---------------------------------------------------------------------
173 #ifndef __ASSEMBLY__
175 struct vrom_header {
176 u16 rom_signature; /* option ROM signature */
177 u8 rom_length; /* ROM length in 512 byte chunks */
178 u8 rom_entry[4]; /* 16-bit code entry point */
179 u8 rom_pad0; /* 4-byte align pad */
180 u32 vrom_signature; /* VROM identification signature */
181 u8 api_version_min;/* Minor version of API */
182 u8 api_version_maj;/* Major version of API */
183 u8 jump_slots; /* Number of jump slots */
184 u8 reserved1; /* Reserved for expansion */
185 u32 virtual_top; /* Hypervisor virtual address start */
186 u16 reserved2; /* Reserved for expansion */
187 u16 license_offs; /* Offset to License string */
188 u16 pci_header_offs;/* Offset to PCI OPROM header */
189 u16 pnp_header_offs;/* Offset to PnP OPROM header */
190 u32 rom_pad3; /* PnP reserverd / VMI reserved */
191 u8 reserved[96]; /* Reserved for headers */
192 char vmi_init[8]; /* VMI_Init jump point */
193 char get_reloc[8]; /* VMI_GetRelocationInfo jump point */
194 } __attribute__((packed));
196 struct pnp_header {
197 char sig[4];
198 char rev;
199 char size;
200 short next;
201 short res;
202 long devID;
203 unsigned short manufacturer_offset;
204 unsigned short product_offset;
205 } __attribute__((packed));
207 struct pci_header {
208 char sig[4];
209 short vendorID;
210 short deviceID;
211 short vpdData;
212 short size;
213 char rev;
214 char class;
215 char subclass;
216 char interface;
217 short chunks;
218 char rom_version_min;
219 char rom_version_maj;
220 char codetype;
221 char lastRom;
222 short reserved;
223 } __attribute__((packed));
225 /* Function prototypes for bootstrapping */
226 #ifdef CONFIG_VMI
227 extern void vmi_init(void);
228 extern void vmi_activate(void);
229 extern void vmi_bringup(void);
230 #else
231 static inline void vmi_init(void) {}
232 static inline void vmi_activate(void) {}
233 static inline void vmi_bringup(void) {}
234 #endif
236 /* State needed to start an application processor in an SMP system. */
237 struct vmi_ap_state {
238 u32 cr0;
239 u32 cr2;
240 u32 cr3;
241 u32 cr4;
243 u64 efer;
245 u32 eip;
246 u32 eflags;
247 u32 eax;
248 u32 ebx;
249 u32 ecx;
250 u32 edx;
251 u32 esp;
252 u32 ebp;
253 u32 esi;
254 u32 edi;
255 u16 cs;
256 u16 ss;
257 u16 ds;
258 u16 es;
259 u16 fs;
260 u16 gs;
261 u16 ldtr;
263 u16 gdtr_limit;
264 u32 gdtr_base;
265 u32 idtr_base;
266 u16 idtr_limit;
269 #endif