fix vcpu after recent cpubus changes.

This commit is contained in:
yamt 2007-03-06 12:35:39 +00:00
parent a36286ca6a
commit dedaf26748
3 changed files with 63 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.9 2007/03/05 23:26:40 dogcow Exp $ */
/* $NetBSD: cpu.c,v 1.10 2007/03/06 12:35:39 yamt Exp $ */
/* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */
/*-
@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2007/03/05 23:26:40 dogcow Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 2007/03/06 12:35:39 yamt Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -106,6 +106,10 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2007/03/05 23:26:40 dogcow Exp $");
#include <machine/tlog.h>
#include <machine/pio.h>
#ifdef XEN3
#include <machine/vcpuvar.h>
#endif
#if NLAPIC > 0
#include <machine/apicvar.h>
#include <machine/i82489reg.h>
@ -300,7 +304,11 @@ vcpu_match(parent, match, aux)
struct cfdata *match;
void *aux;
{
return 1;
struct vcpu_attach_args *vcaa = aux;
if (strcmp(vcaa->vcaa_name, match->cf_name) == 0)
return 1;
return 0;
}
void
@ -308,7 +316,9 @@ vcpu_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
cpu_attach_common(parent, self, aux);
struct vcpu_attach_args *vcaa = aux;
cpu_attach_common(parent, self, &vcaa->vcaa_caa);
}
#endif

View File

@ -0,0 +1,39 @@
/* $NetBSD: vcpuvar.h,v 1.1 2007/03/06 12:35:39 yamt Exp $ */
/*-
* Copyright (c)2007 YAMAMOTO Takashi,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _XEN_VCPUVAR_H_
#define _XEN_VCPUVAR_H_
#include <x86/cpuvar.h>
struct vcpu_attach_args {
const char *vcaa_name;
struct cpu_attach_args vcaa_caa;
};
#endif /* _XEN_VCPUVAR_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: hypervisor.c,v 1.30 2007/03/05 23:26:40 dogcow Exp $ */
/* $NetBSD: hypervisor.c,v 1.31 2007/03/06 12:35:39 yamt Exp $ */
/*
* Copyright (c) 2005 Manuel Bouyer.
@ -63,7 +63,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.30 2007/03/05 23:26:40 dogcow Exp $");
__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.31 2007/03/06 12:35:39 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -105,7 +105,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.30 2007/03/05 23:26:40 dogcow Exp $
#endif /* DOM0OPS || XEN3 */
#ifdef XEN3
#include <machine/granttables.h>
#include <machine/cpuvar.h>
#include <machine/vcpuvar.h>
#endif
#if NPCI > 0
#include <dev/pci/pcivar.h>
@ -180,7 +180,7 @@ union hypervisor_attach_cookie {
#endif
#endif /* NPCI */
#ifdef XEN3
struct cpu_attach_args hac_caa;
struct vcpu_attach_args hac_vcaa;
#endif
};
@ -249,11 +249,12 @@ hypervisor_attach(parent, self, aux)
#ifdef XEN3
xengnt_init();
memset(&hac.hac_caa, 0, sizeof(hac.hac_caa));
hac.hac_caa.cpu_number = 0;
hac.hac_caa.cpu_role = CPU_ROLE_SP;
hac.hac_caa.cpu_func = 0;
config_found_ia(self, "xendevbus", &hac.hac_caa, hypervisor_print);
memset(&hac.hac_vcaa, 0, sizeof(hac.hac_vcaa));
hac.hac_vcaa.vcaa_name = "vcpu";
hac.hac_vcaa.vcaa_caa.cpu_number = 0;
hac.hac_vcaa.vcaa_caa.cpu_role = CPU_ROLE_SP;
hac.hac_vcaa.vcaa_caa.cpu_func = 0;
config_found_ia(self, "xendevbus", &hac.hac_vcaa, hypervisor_print);
#endif
init_events();