diff options
author | jkim <jkim@FreeBSD.org> | 2008-10-21 00:17:55 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2008-10-21 00:17:55 +0000 |
commit | d4d906ba8600be6372142965c16b1830772b3df9 (patch) | |
tree | 8c5ecd5cef4e0ddf5adf4fa080ca8e3b054df5f2 | |
parent | 2efd12327df3f4069b0213d17386ff2b3a4b850c (diff) | |
download | FreeBSD-src-d4d906ba8600be6372142965c16b1830772b3df9.zip FreeBSD-src-d4d906ba8600be6372142965c16b1830772b3df9.tar.gz |
Detect Advanced Power Management Information for AMD CPUs.
-rw-r--r-- | sys/amd64/amd64/identcpu.c | 4 | ||||
-rw-r--r-- | sys/amd64/amd64/initcpu.c | 1 | ||||
-rw-r--r-- | sys/amd64/include/md_var.h | 1 | ||||
-rw-r--r-- | sys/amd64/include/specialreg.h | 13 | ||||
-rw-r--r-- | sys/i386/i386/identcpu.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/initcpu.c | 1 | ||||
-rw-r--r-- | sys/i386/include/md_var.h | 1 | ||||
-rw-r--r-- | sys/i386/include/specialreg.h | 13 |
8 files changed, 38 insertions, 0 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index 6558a5b..30ab367 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -451,6 +451,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]; diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c index e6e94d6..bc5d10c 100644 --- a/sys/amd64/amd64/initcpu.c +++ b/sys/amd64/amd64/initcpu.c @@ -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 */ diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 348cb31..7f9d286 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -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; diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h index 4fd32ae..d5b7c55 100644 --- a/sys/amd64/include/specialreg.h +++ b/sys/amd64/include/specialreg.h @@ -161,6 +161,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 diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index 8f835bc..3358511 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -1089,6 +1089,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]; diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index 0c212e4..a3679d6 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -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 */ diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index 4f8b96d..af3ab7e 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -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; diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h index eb6e0b5..ec9de9f 100644 --- a/sys/i386/include/specialreg.h +++ b/sys/i386/include/specialreg.h @@ -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 |