1 /*
2  * Copyright (C) 2012      Citrix Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation; version 2.1 only. with the special
7  * exception on linking described in file LICENSE.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  */
14 
15 #ifndef LIBXL_ARCH_H
16 #define LIBXL_ARCH_H
17 
18 /* fill the arch specific configuration for the domain */
19 _hidden
20 int libxl__arch_domain_prepare_config(libxl__gc *gc,
21                                       libxl_domain_config *d_config,
22                                       struct xen_domctl_createdomain *config);
23 
24 /* save the arch specific configuration for the domain */
25 _hidden
26 int libxl__arch_domain_save_config(libxl__gc *gc,
27                                    libxl_domain_config *d_config,
28                                    libxl__domain_build_state *state,
29                                    const struct xen_domctl_createdomain *config);
30 
31 /* arch specific internal domain creation function */
32 _hidden
33 int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
34                uint32_t domid);
35 
36 /* setup arch specific hardware description, i.e. DTB on ARM */
37 _hidden
38 int libxl__arch_domain_init_hw_description(libxl__gc *gc,
39                                            libxl_domain_build_info *info,
40                                            libxl__domain_build_state *state,
41                                            struct xc_dom_image *dom);
42 /* finalize arch specific hardware description. */
43 _hidden
44 int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
45                                       uint32_t domid,
46                                       libxl_domain_config *d_config,
47                                       struct xc_dom_image *dom);
48 
49 /* perform any pending hardware initialization */
50 _hidden
51 int libxl__arch_build_dom_finish(libxl__gc *gc,
52                                  libxl_domain_build_info *info,
53                                  struct xc_dom_image *dom,
54                                  libxl__domain_build_state *state);
55 
56 /* build vNUMA vmemrange with arch specific information */
57 _hidden
58 int libxl__arch_vnuma_build_vmemrange(libxl__gc *gc,
59                                       uint32_t domid,
60                                       libxl_domain_build_info *b_info,
61                                       libxl__domain_build_state *state);
62 
63 /* arch specific irq map function */
64 _hidden
65 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
66 
67 _hidden
68 void libxl__arch_domain_create_info_setdefault(libxl__gc *gc,
69                                                libxl_domain_create_info *c_info);
70 
71 _hidden
72 void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
73                                               libxl_domain_build_info *b_info);
74 
75 _hidden
76 int libxl__arch_passthrough_mode_setdefault(libxl__gc *gc,
77                                      uint32_t domid /* for logging, only */,
78                                             libxl_domain_config *d_config,
79                                             const libxl_physinfo *physinfo);
80 
81 _hidden
82 int libxl__arch_extra_memory(libxl__gc *gc,
83                              const libxl_domain_build_info *info,
84                              uint64_t *out);
85 
86 #if defined(__i386__) || defined(__x86_64__)
87 
88 #define LAPIC_BASE_ADDRESS  0xfee00000
89 #define ACPI_INFO_PHYSICAL_ADDRESS 0xfc000000
90 
91 int libxl__dom_load_acpi(libxl__gc *gc,
92                          const libxl_domain_build_info *b_info,
93                          struct xc_dom_image *dom);
94 #endif
95 
96 #endif
97