From owner-svn-src-all@FreeBSD.ORG Wed Jan 21 20:16:12 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9520810656DE; Wed, 21 Jan 2009 20:16:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 804398FC29; Wed, 21 Jan 2009 20:16:12 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0LKGCe8088957; Wed, 21 Jan 2009 20:16:12 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0LKGCHO088949; Wed, 21 Jan 2009 20:16:12 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200901212016.n0LKGCHO088949@svn.freebsd.org> From: Jung-uk Kim Date: Wed, 21 Jan 2009 20:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187565 - in stable/7/sys: . amd64/amd64 amd64/include contrib/pf dev/ath/ath_hal dev/cxgb i386/i386 i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2009 20:16:14 -0000 Author: jkim Date: Wed Jan 21 20:16:11 2009 New Revision: 187565 URL: http://svn.freebsd.org/changeset/base/187565 Log: MFC: Detect Advanced Power Management Information for AMD CPUs. Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/identcpu.c stable/7/sys/amd64/amd64/initcpu.c stable/7/sys/amd64/include/md_var.h stable/7/sys/amd64/include/specialreg.h stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/i386/i386/identcpu.c stable/7/sys/i386/i386/initcpu.c stable/7/sys/i386/include/md_var.h stable/7/sys/i386/include/specialreg.h Modified: stable/7/sys/amd64/amd64/identcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/identcpu.c Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/amd64/amd64/identcpu.c Wed Jan 21 20:16:11 2009 (r187565) @@ -447,6 +447,10 @@ identify_cpu(void) amd_feature = regs[3] & ~(cpu_feature & 0x0183f3ff); amd_feature2 = regs[2]; } + if (cpu_exthigh >= 0x80000007) { + do_cpuid(0x80000007, regs); + amd_pminfo = regs[3]; + } if (cpu_exthigh >= 0x80000008) { do_cpuid(0x80000008, regs); cpu_procinfo2 = regs[2]; Modified: stable/7/sys/amd64/amd64/initcpu.c ============================================================================== --- stable/7/sys/amd64/amd64/initcpu.c Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/amd64/amd64/initcpu.c Wed Jan 21 20:16:11 2009 (r187565) @@ -53,6 +53,7 @@ u_int cpu_feature; /* Feature flags */ u_int cpu_feature2; /* Feature flags */ u_int amd_feature; /* AMD feature flags */ u_int amd_feature2; /* AMD feature flags */ +u_int amd_pminfo; /* AMD advanced power management info */ u_int cpu_high; /* Highest arg to CPUID */ u_int cpu_exthigh; /* Highest arg to extended CPUID */ u_int cpu_id; /* Stepping ID */ Modified: stable/7/sys/amd64/include/md_var.h ============================================================================== --- stable/7/sys/amd64/include/md_var.h Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/amd64/include/md_var.h Wed Jan 21 20:16:11 2009 (r187565) @@ -44,6 +44,7 @@ extern u_int cpu_feature; extern u_int cpu_feature2; extern u_int amd_feature; extern u_int amd_feature2; +extern u_int amd_pminfo; extern u_int cpu_fxsr; extern u_int cpu_high; extern u_int cpu_id; Modified: stable/7/sys/amd64/include/specialreg.h ============================================================================== --- stable/7/sys/amd64/include/specialreg.h Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/amd64/include/specialreg.h Wed Jan 21 20:16:11 2009 (r187565) @@ -156,6 +156,19 @@ #define CPUID_LOCAL_APIC_ID 0xff000000 /* + * AMD extended function 8000_0007h edx info + */ +#define AMDPM_TS 0x00000001 +#define AMDPM_FID 0x00000002 +#define AMDPM_VID 0x00000004 +#define AMDPM_TTP 0x00000008 +#define AMDPM_TM 0x00000010 +#define AMDPM_STC 0x00000020 +#define AMDPM_100MHZ_STEPS 0x00000040 +#define AMDPM_HW_PSTATE 0x00000080 +#define AMDPM_TSC_INVARIANT 0x00000100 + +/* * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff Modified: stable/7/sys/i386/i386/identcpu.c ============================================================================== --- stable/7/sys/i386/i386/identcpu.c Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/i386/i386/identcpu.c Wed Jan 21 20:16:11 2009 (r187565) @@ -1088,6 +1088,10 @@ finishidentcpu(void) amd_feature = regs[3] & ~(cpu_feature & 0x0183f3ff); amd_feature2 = regs[2]; } + if (cpu_exthigh >= 0x80000007) { + do_cpuid(0x80000007, regs); + amd_pminfo = regs[3]; + } if (cpu_exthigh >= 0x80000008) { do_cpuid(0x80000008, regs); cpu_procinfo2 = regs[2]; Modified: stable/7/sys/i386/i386/initcpu.c ============================================================================== --- stable/7/sys/i386/i386/initcpu.c Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/i386/i386/initcpu.c Wed Jan 21 20:16:11 2009 (r187565) @@ -82,6 +82,7 @@ u_int cpu_feature = 0; /* Feature flags u_int cpu_feature2 = 0; /* Feature flags */ u_int amd_feature = 0; /* AMD feature flags */ u_int amd_feature2 = 0; /* AMD feature flags */ +u_int amd_pminfo = 0; /* AMD advanced power management info */ u_int via_feature_rng = 0; /* VIA RNG features */ u_int via_feature_xcrypt = 0; /* VIA ACE features */ u_int cpu_high = 0; /* Highest arg to CPUID */ Modified: stable/7/sys/i386/include/md_var.h ============================================================================== --- stable/7/sys/i386/include/md_var.h Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/i386/include/md_var.h Wed Jan 21 20:16:11 2009 (r187565) @@ -49,6 +49,7 @@ extern u_int cpu_feature; extern u_int cpu_feature2; extern u_int amd_feature; extern u_int amd_feature2; +extern u_int amd_pminfo; extern u_int via_feature_rng; extern u_int via_feature_xcrypt; extern u_int cpu_fxsr; Modified: stable/7/sys/i386/include/specialreg.h ============================================================================== --- stable/7/sys/i386/include/specialreg.h Wed Jan 21 20:08:17 2009 (r187564) +++ stable/7/sys/i386/include/specialreg.h Wed Jan 21 20:16:11 2009 (r187565) @@ -158,6 +158,19 @@ #define CPUID_LOCAL_APIC_ID 0xff000000 /* + * AMD extended function 8000_0007h edx info + */ +#define AMDPM_TS 0x00000001 +#define AMDPM_FID 0x00000002 +#define AMDPM_VID 0x00000004 +#define AMDPM_TTP 0x00000008 +#define AMDPM_TM 0x00000010 +#define AMDPM_STC 0x00000020 +#define AMDPM_100MHZ_STEPS 0x00000040 +#define AMDPM_HW_PSTATE 0x00000080 +#define AMDPM_TSC_INVARIANT 0x00000100 + +/* * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff