1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
#ifndef __ARM_SETUP_H_
#define __ARM_SETUP_H_
#include <public/version.h>
#include <asm/p2m.h>
#include <xen/device_tree.h>
#define MIN_FDT_ALIGN 8
#define MAX_FDT_SIZE SZ_2M
#define NR_MEM_BANKS 256
#define MAX_MODULES 32 /* Current maximum useful modules */
typedef enum {
BOOTMOD_XEN,
BOOTMOD_FDT,
BOOTMOD_KERNEL,
BOOTMOD_RAMDISK,
BOOTMOD_XSM,
BOOTMOD_GUEST_DTB,
BOOTMOD_UNKNOWN
} bootmodule_kind;
enum membank_type {
/*
* The MEMBANK_DEFAULT type refers to either reserved memory for the
* device/firmware (when the bank is in 'reserved_mem') or any RAM (when
* the bank is in 'mem').
*/
MEMBANK_DEFAULT,
/*
* The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memory
* bank is bound to a static Xen domain. It is only valid when the bank
* is in reserved_mem.
*/
MEMBANK_STATIC_DOMAIN,
/*
* The MEMBANK_STATIC_HEAP type is used to indicate whether the memory
* bank is reserved as static heap. It is only valid when the bank is
* in reserved_mem.
*/
MEMBANK_STATIC_HEAP,
};
/* Indicates the maximum number of characters(\0 included) for shm_id */
#define MAX_SHM_ID_LENGTH 16
struct membank {
paddr_t start;
paddr_t size;
enum membank_type type;
#ifdef CONFIG_STATIC_SHM
char shm_id[MAX_SHM_ID_LENGTH];
unsigned int nr_shm_borrowers;
#endif
};
struct meminfo {
unsigned int nr_banks;
struct membank bank[NR_MEM_BANKS];
};
/*
* The domU flag is set for kernels and ramdisks of "xen,domain" nodes.
* The purpose of the domU flag is to avoid getting confused in
* kernel_probe, where we try to guess which is the dom0 kernel and
* initrd to be compatible with all versions of the multiboot spec.
*/
#define BOOTMOD_MAX_CMDLINE 1024
struct bootmodule {
bootmodule_kind kind;
bool domU;
paddr_t start;
paddr_t size;
};
/* DT_MAX_NAME is the node name max length according the DT spec */
#define DT_MAX_NAME 41
struct bootcmdline {
bootmodule_kind kind;
bool domU;
paddr_t start;
char dt_name[DT_MAX_NAME];
char cmdline[BOOTMOD_MAX_CMDLINE];
};
struct bootmodules {
int nr_mods;
struct bootmodule module[MAX_MODULES];
};
struct bootcmdlines {
unsigned int nr_mods;
struct bootcmdline cmdline[MAX_MODULES];
};
struct bootinfo {
struct meminfo mem;
/* The reserved regions are only used when booting using Device-Tree */
struct meminfo reserved_mem;
struct bootmodules modules;
struct bootcmdlines cmdlines;
#ifdef CONFIG_ACPI
struct meminfo acpi;
#endif
bool static_heap;
};
struct map_range_data
{
struct domain *d;
p2m_type_t p2mt;
/* Set if mapping of the memory ranges must be skipped. */
bool skip_mapping;
};
extern struct bootinfo bootinfo;
extern domid_t max_init_domid;
void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
size_t estimate_efi_size(unsigned int mem_nr_banks);
void acpi_create_efi_system_table(struct domain *d,
struct membank tbl_add[]);
void acpi_create_efi_mmap_table(struct domain *d,
const struct meminfo *mem,
struct membank tbl_add[]);
int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
void create_domUs(void);
void create_dom0(void);
void alloc_static_evtchn(void);
void discard_initial_modules(void);
void fw_unreserved_regions(paddr_t s, paddr_t e,
void (*cb)(paddr_t, paddr_t), unsigned int first);
size_t boot_fdt_info(const void *fdt, paddr_t paddr);
const char *boot_fdt_cmdline(const void *fdt);
bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
struct bootmodule *add_boot_module(bootmodule_kind kind,
paddr_t start, paddr_t size, bool domU);
struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind,
paddr_t start);
void add_boot_cmdline(const char *name, const char *cmdline,
bootmodule_kind kind, paddr_t start, bool domU);
struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind);
struct bootcmdline * boot_cmdline_find_by_name(const char *name);
const char *boot_module_kind_as_string(bootmodule_kind kind);
extern uint32_t hyp_traps_vector[];
void init_traps(void);
void device_tree_get_reg(const __be32 **cell, u32 address_cells,
u32 size_cells, u64 *start, u64 *size);
u32 device_tree_get_u32(const void *fdt, int node,
const char *prop_name, u32 dflt);
int map_range_to_domain(const struct dt_device_node *dev,
u64 addr, u64 len, void *data);
extern DEFINE_BOOT_PAGE_TABLE(boot_pgtable);
#ifdef CONFIG_ARM_64
extern DEFINE_BOOT_PAGE_TABLE(boot_first_id);
#endif
extern DEFINE_BOOT_PAGE_TABLE(boot_second_id);
extern DEFINE_BOOT_PAGE_TABLE(boot_third_id);
/* Find where Xen will be residing at runtime and return a PT entry */
lpae_t pte_of_xenaddr(vaddr_t);
extern const char __ro_after_init_start[], __ro_after_init_end[];
struct init_info
{
/* Pointer to the stack, used by head.S when entering in C */
unsigned char *stack;
/* Logical CPU ID, used by start_secondary */
unsigned int cpuid;
};
#endif
/*
* Local variables:
* mode: C
* c-file-style: "BSD"
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
|