[ARM] integrator: fix build warnings and errors
[linux-2.6] / include / asm-x86 / vmi.h
1 /*
2  * VMI interface definition
3  *
4  * Copyright (C) 2005, VMware, Inc.
5  *
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.
10  *
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.
16  *
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.
20  *
21  * Maintained by: Zachary Amsden zach@vmware.com
22  *
23  */
24 #include <linux/types.h>
25
26 /*
27  *---------------------------------------------------------------------
28  *
29  *  VMI Option ROM API
30  *
31  *---------------------------------------------------------------------
32  */
33 #define VMI_SIGNATURE 0x696d5663   /* "cVmi" */
34
35 #define PCI_VENDOR_ID_VMWARE            0x15AD
36 #define PCI_DEVICE_ID_VMWARE_VMI        0x0801
37
38 /*
39  * We use two version numbers for compatibility, with the major
40  * number signifying interface breakages, and the minor number
41  * interface extensions.
42  */
43 #define VMI_API_REV_MAJOR       3
44 #define VMI_API_REV_MINOR       0
45
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
95
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
102
103 /*
104  *---------------------------------------------------------------------
105  *
106  * MMU operation flags
107  *
108  *---------------------------------------------------------------------
109  */
110
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 */
115
116
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
122
123 #define VMI_PAGE_NORMAL          0x00 /* for debugging */
124
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
129
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
137
138 /* Flags used by VMI_FlushTLB call */
139 #define VMI_FLUSH_TLB            0x01
140 #define VMI_FLUSH_GLOBAL         0x02
141
142 /*
143  *---------------------------------------------------------------------
144  *
145  *  VMI relocation definitions for ROM call get_reloc
146  *
147  *---------------------------------------------------------------------
148  */
149
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
155
156 #ifndef __ASSEMBLY__
157 struct vmi_relocation_info {
158         unsigned char           *eip;
159         unsigned char           type;
160         unsigned char           reserved[3];
161 };
162 #endif
163
164
165 /*
166  *---------------------------------------------------------------------
167  *
168  *  Generic ROM structures and definitions
169  *
170  *---------------------------------------------------------------------
171  */
172
173 #ifndef __ASSEMBLY__
174
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));
195
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));
206
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));
224
225 /* Function prototypes for bootstrapping */
226 extern void vmi_init(void);
227 extern void vmi_bringup(void);
228 extern void vmi_apply_boot_page_allocations(void);
229
230 /* State needed to start an application processor in an SMP system. */
231 struct vmi_ap_state {
232         u32 cr0;
233         u32 cr2;
234         u32 cr3;
235         u32 cr4;
236
237         u64 efer;
238
239         u32 eip;
240         u32 eflags;
241         u32 eax;
242         u32 ebx;
243         u32 ecx;
244         u32 edx;
245         u32 esp;
246         u32 ebp;
247         u32 esi;
248         u32 edi;
249         u16 cs;
250         u16 ss;
251         u16 ds;
252         u16 es;
253         u16 fs;
254         u16 gs;
255         u16 ldtr;
256
257         u16 gdtr_limit;
258         u32 gdtr_base;
259         u32 idtr_base;
260         u16 idtr_limit;
261 };
262
263 #endif