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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
/******************************************************************************
*
* Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
* VA Linux Systems Japan K.K.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* Xen domain firmware emulation support
* Copyright (C) 2004 Hewlett-Packard Co.
* Dan Magenheimer (dan.magenheimer@hp.com)
*/
#ifdef __XEN__
#include <xen/sched.h>
#include <asm/dom_fw_utils.h>
#include <linux/sort.h>
#define xen_ia64_dom_fw_map(d, mpaddr) domain_mpa_to_imva((d), (mpaddr))
#define xen_ia64_dom_fw_unmap(d, vaddr) do { } while (0)
#else
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <xen/xen.h>
#include "xg_private.h"
#include "xc_dom.h"
#include "ia64/xc_dom_ia64_util.h"
#endif
#include <asm/dom_fw.h>
#include <asm/dom_fw_domu.h>
void efi_systable_init_domu(struct fw_tables *tables)
{
int i = 1;
printk(XENLOG_GUEST XENLOG_INFO "DomainU EFI build up:");
tables->efi_tables[i].guid = ACPI_20_TABLE_GUID;
tables->efi_tables[i].table = FW_ACPI_BASE_PADDR;
printk(" ACPI 2.0=0x%lx", tables->efi_tables[i].table);
i++;
printk("\n");
BUG_ON(i > NUM_EFI_SYS_TABLES);
}
int
complete_domu_memmap(domain_t * d,
struct fw_tables *tables,
unsigned long maxmem,
unsigned long memmap_info_pfn,
unsigned long memmap_info_num_pages)
{
efi_memory_desc_t *md;
int create_memmap = 0;
xen_ia64_memmap_info_t *memmap_info;
unsigned long memmap_info_size;
unsigned long paddr_start;
unsigned long paddr_end;
void *p;
void *memmap_start;
void *memmap_end;
if (memmap_info_pfn == 0 || memmap_info_num_pages == 0) {
/* old domain builder which doesn't setup
* memory map. create it for compatibility */
memmap_info_pfn = (maxmem >> PAGE_SHIFT) - 1;
memmap_info_num_pages = 1;
create_memmap = 1;
}
memmap_info_size = memmap_info_num_pages << PAGE_SHIFT;
paddr_start = memmap_info_pfn << PAGE_SHIFT;
/* 3 = start info page, xenstore page and console page */
paddr_end = paddr_start + memmap_info_size + 3 * PAGE_SIZE;
memmap_info = xen_ia64_dom_fw_map(d, paddr_start);
if (memmap_info->efi_memmap_size == 0) {
create_memmap = 1;
} else if (memmap_info->efi_memdesc_size != sizeof(md[0]) ||
memmap_info->efi_memdesc_version !=
EFI_MEMORY_DESCRIPTOR_VERSION) {
printk(XENLOG_WARNING
"%s: Warning: unknown memory map "
"memmap size %" PRIu64 " "
"memdesc size %" PRIu64 " "
"version %" PRIu32 "\n",
__func__,
memmap_info->efi_memmap_size,
memmap_info->efi_memdesc_size,
memmap_info->efi_memdesc_version);
|