Module Name: src Committed By: jruoho Date: Thu Feb 24 04:42:55 UTC 2011
Modified Files: src/sys/arch/amd64/conf: XEN3_DOM0 src/sys/arch/i386/conf: XEN3_DOM0 src/sys/arch/xen/conf: files.xen src/sys/arch/xen/x86: cpu.c Log Message: Add cpufeaturebus and est(4) for Xen. To generate a diff of this commit: cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/conf/XEN3_DOM0 cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/conf/XEN3_DOM0 cvs rdiff -u -r1.111 -r1.112 src/sys/arch/xen/conf/files.xen cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/x86/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/conf/XEN3_DOM0 diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.62 src/sys/arch/amd64/conf/XEN3_DOM0:1.63 --- src/sys/arch/amd64/conf/XEN3_DOM0:1.62 Wed Feb 23 11:43:21 2011 +++ src/sys/arch/amd64/conf/XEN3_DOM0 Thu Feb 24 04:42:54 2011 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOM0,v 1.62 2011/02/23 11:43:21 jruoho Exp $ +# $NetBSD: XEN3_DOM0,v 1.63 2011/02/24 04:42:54 jruoho Exp $ include "arch/amd64/conf/std.xen" @@ -23,6 +23,9 @@ # AMD PowerNow! and Cool`n'Quiet technology options POWERNOW_K8 +# CPU features +est0 at cpu0 # Intel Enhanced SpeedStep (non-ACPI) + #options MTRR # memory-type range register syscall support #options CONSDEVNAME="\"xencons\"" Index: src/sys/arch/i386/conf/XEN3_DOM0 diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.43 src/sys/arch/i386/conf/XEN3_DOM0:1.44 --- src/sys/arch/i386/conf/XEN3_DOM0:1.43 Thu Feb 17 22:00:36 2011 +++ src/sys/arch/i386/conf/XEN3_DOM0 Thu Feb 24 04:42:54 2011 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOM0,v 1.43 2011/02/17 22:00:36 jym Exp $ +# $NetBSD: XEN3_DOM0,v 1.44 2011/02/24 04:42:54 jruoho Exp $ # # XEN3_0: Xen 3.0 domain0 kernel @@ -40,6 +40,9 @@ # AMD PowerNow! and Cool`n'Quiet technology options POWERNOW_K8 +# CPU features +est0 at cpu0 # Intel Enhanced SpeedStep (non-ACPI) + #options MTRR # memory-type range register syscall support #options CONSDEVNAME="\"xencons\"" Index: src/sys/arch/xen/conf/files.xen diff -u src/sys/arch/xen/conf/files.xen:1.111 src/sys/arch/xen/conf/files.xen:1.112 --- src/sys/arch/xen/conf/files.xen:1.111 Wed Feb 23 11:43:23 2011 +++ src/sys/arch/xen/conf/files.xen Thu Feb 24 04:42:54 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.xen,v 1.111 2011/02/23 11:43:23 jruoho Exp $ +# $NetBSD: files.xen,v 1.112 2011/02/24 04:42:54 jruoho Exp $ # NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp # NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp @@ -161,6 +161,7 @@ # xen specific mainbus attributes define cpubus { [apid = -1] } +define cpufeaturebus {} define ioapicbus { [apid = -1] } define apmbus {} define pnpbiosbus {} @@ -284,9 +285,9 @@ attach ipmi at ipmibus file arch/x86/x86/ipmi.c ipmi needs-flag -# CPUS - -device cpu +# CPUs +# +device cpu: cpufeaturebus attach cpu at cpubus device vcpu @@ -294,6 +295,13 @@ file arch/xen/x86/cpu.c cpu | vcpu +# CPU features +# +device est +attach est at cpufeaturebus +file arch/x86/x86/est.c est +file arch/x86/x86/intel_busclock.c est + # # Compatibility modules # Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.52 src/sys/arch/xen/x86/cpu.c:1.53 --- src/sys/arch/xen/x86/cpu.c:1.52 Sun Nov 14 13:43:04 2010 +++ src/sys/arch/xen/x86/cpu.c Thu Feb 24 04:42:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.52 2010/11/14 13:43:04 bouyer Exp $ */ +/* $NetBSD: cpu.c,v 1.53 2011/02/24 04:42:55 jruoho Exp $ */ /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp */ /*- @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.52 2010/11/14 13:43:04 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.53 2011/02/24 04:42:55 jruoho Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -115,11 +115,13 @@ #error cpu_info contains 32bit bitmasks #endif -int cpu_match(device_t, cfdata_t, void *); -void cpu_attach(device_t, device_t, void *); -int vcpu_match(device_t, cfdata_t, void *); -void vcpu_attach(device_t, device_t, void *); -void cpu_attach_common(device_t, device_t, void *); +int cpu_match(device_t, cfdata_t, void *); +void cpu_attach(device_t, device_t, void *); +int cpu_rescan(device_t, const char *, const int *); +void cpu_childdetached(device_t, device_t); +int vcpu_match(device_t, cfdata_t, void *); +void vcpu_attach(device_t, device_t, void *); +void cpu_attach_common(device_t, device_t, void *); void cpu_offline_md(void); struct cpu_softc { @@ -133,8 +135,9 @@ const struct cpu_functions mp_cpu_funcs = { mp_cpu_start, NULL, mp_cpu_start_cleanup }; -CFATTACH_DECL_NEW(cpu, sizeof(struct cpu_softc), - cpu_match, cpu_attach, NULL, NULL); +CFATTACH_DECL2_NEW(cpu, sizeof(struct cpu_softc), + cpu_match, cpu_attach, NULL, NULL, cpu_rescan, cpu_childdetached); + CFATTACH_DECL_NEW(vcpu, sizeof(struct cpu_softc), vcpu_match, vcpu_attach, NULL, NULL); @@ -271,6 +274,38 @@ } int +cpu_rescan(device_t self, const char *ifattr, const int *locators) +{ + struct cpu_softc *sc = device_private(self); + struct cpufeature_attach_args cfaa; + struct cpu_info *ci = sc->sc_info; + + memset(&cfaa, 0, sizeof(cfaa)); + cfaa.ci = ci; + + if (ifattr_match(ifattr, "cpufeaturebus")) { + + if (ci->ci_frequency == NULL) { + cfaa.name = "est"; + ci->ci_frequency = config_found_ia(self, + "cpufeaturebus", &cfaa, NULL); + } + } + + return 0; +} + +void +cpu_childdetached(device_t self, device_t child) +{ + struct cpu_softc *sc = device_private(self); + struct cpu_info *ci = sc->sc_info; + + if (ci->ci_frequency == child) + ci->ci_frequency = NULL; +} + +int vcpu_match(device_t parent, cfdata_t match, void *aux) { struct vcpu_attach_args *vcaa = aux;