source: trunk/packages/xen-common/xen-common/xen/include/asm-ia64/dom_fw.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 8.2 KB
Line 
1/*
2 * Xen domain firmware emulation
3 *
4 * Copyright (C) 2004 Hewlett-Packard Co
5 *      Dan Magenheimer (dan.magenheimer@hp.com)
6 */
7
8#include <linux/efi.h>
9
10/* Portion of guest physical memory space reserved for PAL/SAL/EFI/ACPI
11   data and code.  */
12#define FW_BASE_PADDR           0x0000UL
13#define FW_END_PADDR            0x3000UL
14
15/* This is used to determined the portion of a domain's metaphysical memory
16   space reserved for the hypercall patch table. */
17/* Map:
18   Index           Addr
19   0x0000-0x000f   0x0000-0x00ff  : unused
20   0x0010-0x001f   0x0100-0x01ff  : EFI
21   0x0080-0x008f   0x0800-0x08ff  : PAL/SAL
22   0x0090-0x009f   0x0900-0x09ff  : FPSWA
23*/
24#define FW_HYPERCALL_BASE_PADDR 0x0000UL
25#define FW_HYPERCALL_END_PADDR  0X1000UL
26#define FW_HYPERCALL_PADDR(index) (FW_HYPERCALL_BASE_PADDR + (16UL * index))
27
28/* Base and end guest physical address of ACPI tables.  */
29#define FW_ACPI_BASE_PADDR      0x1000UL
30#define FW_ACPI_END_PADDR       0x2000UL
31
32/* Base and end guest physical address of EFI and SAL (non-ACPI) tables.  */
33#define FW_TABLES_BASE_PADDR    0x2000UL
34#define FW_TABLES_END_PADDR     0x3000UL
35
36
37/* Hypercalls number have a low part and a high part.
38   The high part is the class (xen/pal/sal/efi).  */
39#define FW_HYPERCALL_NUM_MASK_HIGH      ~0xffUL
40#define FW_HYPERCALL_NUM_MASK_LOW        0xffUL
41
42/* Xen hypercalls are 0-63.  */
43#define FW_HYPERCALL_XEN                0x0000UL
44
45/* Define some faster and lighter hypercalls.
46   See definitions in arch-ia64.h */
47#define FW_HYPERCALL_XEN_FAST           0x0200UL
48
49/*
50 * PAL can be called in physical or virtual mode simply by
51 * branching to pal_entry_point, which is found in one of the
52 * SAL system table entrypoint descriptors (type=0).  Parameters
53 * may be passed in r28-r31 (static) or r32-r35 (stacked); which
54 * convention is used depends on which procedure is being called.
55 * r28 contains the PAL index, the indicator of which PAL procedure
56 * is to be called: Index=0 is reserved, 1-255 indicates static
57 * parameters, 256-511 indicates stacked parameters.  512-1023
58 * are implementation-specific and 1024+ are reserved.
59 * rp=b0 indicates the return point.
60 *
61 * A single hypercall is used for all PAL calls.
62 * The hypercall stub is pal_call_stub (xenasm.S).  Its size is 2 bundles.
63 */
64
65#define FW_HYPERCALL_PAL_CALL_INDEX     0x80UL
66#define FW_HYPERCALL_PAL_CALL_PADDR     FW_HYPERCALL_PADDR(FW_HYPERCALL_PAL_CALL_INDEX)
67#define FW_HYPERCALL_PAL_CALL           0x1000UL
68
69/*
70 * SAL consists of a table of descriptors, one of which (type=0)
71 * contains a sal_entry_point which provides access to a number of
72 * functions.  Parameters are passed in r33-r39; r32 contains the
73 * index of the SAL function being called. At entry, r1=gp contains
74 * a global pointer which may be needed by the function.  rp=b0
75 * indicates the return point.  SAL may not be re-entrant; an
76 * OS must ensure it is called by one processor at a time.
77 *
78 * A single hypercall is used for all SAL calls.
79 */
80
81#define FW_HYPERCALL_SAL_CALL_INDEX     0x82UL
82#define FW_HYPERCALL_SAL_CALL_PADDR     FW_HYPERCALL_PADDR(FW_HYPERCALL_SAL_CALL_INDEX)
83#define FW_HYPERCALL_SAL_CALL           0x1100UL
84
85/* SAL return point.  */
86#define FW_HYPERCALL_SAL_RETURN_INDEX   0x84UL
87#define FW_HYPERCALL_SAL_RETURN_PADDR   FW_HYPERCALL_PADDR(FW_HYPERCALL_SAL_RETURN_INDEX)
88#define FW_HYPERCALL_SAL_RETURN         0x1200UL
89
90/*
91 * EFI is accessed via the EFI system table, which contains:
92 * - a header which contains version info
93 * - console information (stdin,stdout,stderr)
94 * as well as pointers to:
95 * - the EFI configuration table, which contains GUID/pointer pairs,
96 *   one of which is a pointer to the SAL system table; another is
97 *   a pointer to the ACPI table
98 * - the runtime services table, which contains a header followed by
99 *   a list of (11) unique "runtime" entry points.  EFI runtime entry
100 *   points are real function descriptors so contain both a (physical)
101 *   address and a global pointer.  They are entered (at first) in
102 *   physical mode, though it is possible (optionally... requests can
103 *   be ignored and calls still must be OK) to call one entry point
104 *   which switches the others so they are capable of being called in
105 *   virtual mode.  Parameters are passed in stacked registers, and
106 *   rp=b0 indicates the return point.
107 * - the boot services table, which contains bootloader-related
108 *   entry points (ADD MORE HERE LATER)
109 *
110 * Each runtime (and boot) entry point requires a unique hypercall.
111 */
112
113/* these are indexes into the runtime services table */
114#define FW_HYPERCALL_EFI_GET_TIME_INDEX                 0x10UL
115#define FW_HYPERCALL_EFI_SET_TIME_INDEX                 0x11UL
116#define FW_HYPERCALL_EFI_GET_WAKEUP_TIME_INDEX          0x12UL
117#define FW_HYPERCALL_EFI_SET_WAKEUP_TIME_INDEX          0x13UL
118#define FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP_INDEX  0x14UL
119#define FW_HYPERCALL_EFI_GET_VARIABLE_INDEX             0x15UL
120#define FW_HYPERCALL_EFI_GET_NEXT_VARIABLE_INDEX        0x16UL
121#define FW_HYPERCALL_EFI_SET_VARIABLE_INDEX             0x17UL
122#define FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT_INDEX 0x18UL
123#define FW_HYPERCALL_EFI_RESET_SYSTEM_INDEX             0x19UL
124
125/* these are hypercall numbers */
126#define FW_HYPERCALL_EFI_CALL                           0x300UL
127#define FW_HYPERCALL_EFI_GET_TIME                       0x300UL
128#define FW_HYPERCALL_EFI_SET_TIME                       0x301UL
129#define FW_HYPERCALL_EFI_GET_WAKEUP_TIME                0x302UL
130#define FW_HYPERCALL_EFI_SET_WAKEUP_TIME                0x303UL
131#define FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP        0x304UL
132#define FW_HYPERCALL_EFI_GET_VARIABLE                   0x305UL
133#define FW_HYPERCALL_EFI_GET_NEXT_VARIABLE              0x306UL
134#define FW_HYPERCALL_EFI_SET_VARIABLE                   0x307UL
135#define FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT       0x308UL
136#define FW_HYPERCALL_EFI_RESET_SYSTEM                   0x309UL
137
138/* these are the physical addresses of the pseudo-entry points that
139 * contain the hypercalls */
140#define FW_HYPERCALL_EFI_GET_TIME_PADDR                 FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_GET_TIME_INDEX)
141#define FW_HYPERCALL_EFI_SET_TIME_PADDR                 FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_SET_TIME_INDEX)
142#define FW_HYPERCALL_EFI_GET_WAKEUP_TIME_PADDR          FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_GET_WAKEUP_TIME_INDEX)
143#define FW_HYPERCALL_EFI_SET_WAKEUP_TIME_PADDR          FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_SET_WAKEUP_TIME_INDEX)
144#define FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP_PADDR  FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_SET_VIRTUAL_ADDRESS_MAP_INDEX)
145#define FW_HYPERCALL_EFI_GET_VARIABLE_PADDR             FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_GET_VARIABLE_INDEX)
146#define FW_HYPERCALL_EFI_GET_NEXT_VARIABLE_PADDR        FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_GET_NEXT_VARIABLE_INDEX)
147#define FW_HYPERCALL_EFI_SET_VARIABLE_PADDR             FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_SET_VARIABLE_INDEX)
148#define FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT_PADDR FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_GET_NEXT_HIGH_MONO_COUNT_INDEX)
149#define FW_HYPERCALL_EFI_RESET_SYSTEM_PADDR             FW_HYPERCALL_PADDR(FW_HYPERCALL_EFI_RESET_SYSTEM_INDEX)
150
151/*
152 * This is a hypercall number for IPI.
153 * A pseudo-entry-point is not presented to IPI hypercall. This hypercall number
154 * is used in xen_send_ipi of linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S.
155 */
156#define FW_HYPERCALL_IPI                                0x400UL
157
158/*
159 * This is a hypercall number for FPSWA.
160 * FPSWA hypercall uses 2 bundles for a pseudo-entry-point and a hypercall-patch.
161 */
162#define FW_HYPERCALL_FPSWA_ENTRY_INDEX                  0x90UL
163#define FW_HYPERCALL_FPSWA_PATCH_INDEX                  0x91UL
164#define FW_HYPERCALL_FPSWA_ENTRY_PADDR                  FW_HYPERCALL_PADDR(FW_HYPERCALL_FPSWA_ENTRY_INDEX)
165#define FW_HYPERCALL_FPSWA_PATCH_PADDR                  FW_HYPERCALL_PADDR(FW_HYPERCALL_FPSWA_PATCH_INDEX)
166#define FW_HYPERCALL_FPSWA                              0x500UL
167
168/* Set the shared_info base virtual address.  */
169#define FW_HYPERCALL_SET_SHARED_INFO_VA                 0x600UL
170
171/* Hypercalls index bellow _FIRST_ARCH are reserved by Xen, while those above
172   are for the architecture.
173   Note: this limit was defined by Xen/ia64 (and not by Xen).
174     This can be renumbered safely.
175*/
176#define FW_HYPERCALL_FIRST_ARCH         0x300UL
177
178/* Interrupt vector used for os boot rendez vous.  */
179#define XEN_SAL_BOOT_RENDEZ_VEC 0xF3
180
181#define EFI_MEMDESC_VERSION             1
182
183/* Additionnal OEM SAL.  */
184#define SAL_XEN_SAL_RETURN      0x02000000
185
186extern struct ia64_pal_retval xen_pal_emulator(u64, u64, u64, u64);
187extern struct sal_ret_values sal_emulator (long index, unsigned long in1, unsigned long in2, unsigned long in3, unsigned long in4, unsigned long in5, unsigned long in6, unsigned long in7);
188extern struct ia64_pal_retval pal_emulator_static (unsigned long);
189extern efi_status_t efi_emulator (struct pt_regs *regs, unsigned long *fault);
190
191extern void dom_fw_setup (struct domain *, unsigned long bp_mpa, unsigned long maxmem);
Note: See TracBrowser for help on using the repository browser.