View | Details | Raw Unified | Return to bug 277200 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/x86/acpica/OsdEnvironment.c (+8 lines)
Lines 78-83 acpi_get_root_from_memory(void) Link Here
78
	return (0);
78
	return (0);
79
}
79
}
80
80
81
void
82
acpi_set_root(vm_paddr_t addr)
83
{
84
85
    KASSERT(acpi_root_phys == 0, ("ACPI root pointer already set"));
86
    acpi_root_phys = addr;
87
}
88
81
ACPI_PHYSICAL_ADDRESS
89
ACPI_PHYSICAL_ADDRESS
82
AcpiOsGetRootPointer(void)
90
AcpiOsGetRootPointer(void)
83
{
91
{
(-)b/sys/x86/include/acpica_machdep.h (+2 lines)
Lines 84-89 void madt_parse_interrupt_values(void *entry, Link Here
84
extern int madt_found_sci_override;
84
extern int madt_found_sci_override;
85
extern int (*apei_nmi)(void);
85
extern int (*apei_nmi)(void);
86
86
87
void	acpi_set_root(vm_paddr_t addr);
88
87
#endif /* _KERNEL */
89
#endif /* _KERNEL */
88
90
89
#endif /* __ACPICA_MACHDEP_H__ */
91
#endif /* __ACPICA_MACHDEP_H__ */
(-)b/sys/x86/xen/pv.c (-64 / +5 lines)
Lines 60-65 Link Here
60
60
61
#include <machine/_inttypes.h>
61
#include <machine/_inttypes.h>
62
#include <machine/intr_machdep.h>
62
#include <machine/intr_machdep.h>
63
#include <x86/acpica_machdep.h>
63
#include <x86/apicvar.h>
64
#include <x86/apicvar.h>
64
#include <x86/init.h>
65
#include <x86/init.h>
65
#include <machine/pc/bios.h>
66
#include <machine/pc/bios.h>
Lines 161-167 hammer_time_xen(vm_paddr_t start_info_paddr) Link Here
161
	struct hvm_modlist_entry *mod;
162
	struct hvm_modlist_entry *mod;
162
	struct xen_add_to_physmap xatp;
163
	struct xen_add_to_physmap xatp;
163
	uint64_t physfree;
164
	uint64_t physfree;
164
	char *kenv;
165
	int rc;
165
	int rc;
166
166
167
	if (isxen()) {
167
	if (isxen()) {
Lines 225-239 hammer_time_xen(vm_paddr_t start_info_paddr) Link Here
225
		physfree += PAGE_SIZE;
225
		physfree += PAGE_SIZE;
226
	}
226
	}
227
227
228
	/*
229
	 * Init a static kenv using a free page. The contents will be filled
230
	 * from the parse_preload_data hook.
231
	 */
232
	kenv = (void *)(physfree + KERNBASE);
233
	physfree += PAGE_SIZE;
234
	bzero_early(kenv, PAGE_SIZE);
235
	init_static_kenv(kenv, PAGE_SIZE);
236
237
	/* Set the hooks for early functions that diverge from bare metal */
228
	/* Set the hooks for early functions that diverge from bare metal */
238
	init_ops = xen_pvh_init_ops;
229
	init_ops = xen_pvh_init_ops;
239
	hvm_start_flags = start_info->flags;
230
	hvm_start_flags = start_info->flags;
Lines 244-295 hammer_time_xen(vm_paddr_t start_info_paddr) Link Here
244
235
245
/*-------------------------------- PV specific -------------------------------*/
236
/*-------------------------------- PV specific -------------------------------*/
246
237
247
/*
248
 * When booted as a PVH guest FreeBSD needs to avoid using the RSDP address
249
 * hint provided by the loader because it points to the native set of ACPI
250
 * tables instead of the ones crafted by Xen. The acpi.rsdp env variable is
251
 * removed from kenv if present, and a new acpi.rsdp is added to kenv that
252
 * points to the address of the Xen crafted RSDP.
253
 */
254
static bool reject_option(const char *option)
255
{
256
	static const char *reject[] = {
257
		"acpi.rsdp",
258
	};
259
	unsigned int i;
260
261
	for (i = 0; i < nitems(reject); i++)
262
		if (strncmp(option, reject[i], strlen(reject[i])) == 0)
263
			return (true);
264
265
	return (false);
266
}
267
268
static void
269
xen_pvh_set_env(char *env, bool (*filter)(const char *))
270
{
271
	char *option;
272
273
	if (env == NULL)
274
		return;
275
276
	option = env;
277
	while (*option != 0) {
278
		char *value;
279
280
		if (filter != NULL && filter(option)) {
281
			option += strlen(option) + 1;
282
			continue;
283
		}
284
285
		value = option;
286
		option = strsep(&value, "=");
287
		if (kern_setenv(option, value) != 0 && isxen())
288
			xc_printf("unable to add kenv %s=%s\n", option, value);
289
		option = value + strlen(value) + 1;
290
	}
291
}
292
293
#ifdef DDB
238
#ifdef DDB
294
/*
239
/*
295
 * The way Xen loads the symtab is different from the native boot loader,
240
 * The way Xen loads the symtab is different from the native boot loader,
Lines 414-420 xen_pvh_parse_preload_data(uint64_t modulep) Link Here
414
	vm_ooffset_t off;
359
	vm_ooffset_t off;
415
	vm_paddr_t metadata;
360
	vm_paddr_t metadata;
416
	char *envp;
361
	char *envp;
417
	char acpi_rsdp[19];
418
362
419
	TSENTER();
363
	TSENTER();
420
	if (start_info->modlist_paddr != 0) {
364
	if (start_info->modlist_paddr != 0) {
Lines 478-486 xen_pvh_parse_preload_data(uint64_t modulep) Link Here
478
422
479
		boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
423
		boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
480
		envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
424
		envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
481
		if (envp != NULL)
425
		if ( envp != NULL )
482
			envp += off;
426
		    envp += off;
483
		xen_pvh_set_env(envp, reject_option);
427
		init_static_kenv(envp, 0);
484
428
485
		if (MD_FETCH(kmdp, MODINFOMD_EFI_MAP, void *) != NULL)
429
		if (MD_FETCH(kmdp, MODINFOMD_EFI_MAP, void *) != NULL)
486
		    strlcpy(bootmethod, "UEFI", sizeof(bootmethod));
430
		    strlcpy(bootmethod, "UEFI", sizeof(bootmethod));
Lines 500-508 xen_pvh_parse_preload_data(uint64_t modulep) Link Here
500
444
501
	boothowto |= boot_env_to_howto();
445
	boothowto |= boot_env_to_howto();
502
446
503
	snprintf(acpi_rsdp, sizeof(acpi_rsdp), "%#" PRIx64,
447
	acpi_set_root(start_info->rsdp_paddr);
504
	    start_info->rsdp_paddr);
505
	kern_setenv("acpi.rsdp", acpi_rsdp);
506
448
507
#ifdef DDB
449
#ifdef DDB
508
	xen_pvh_parse_symtab();
450
	xen_pvh_parse_symtab();
509
- 

Return to bug 277200