summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/identcpu.c14
-rw-r--r--sys/amd64/amd64/initcpu.c4
-rw-r--r--sys/amd64/amd64/msi.c4
-rw-r--r--sys/amd64/include/specialreg.h4
-rw-r--r--sys/i386/cpufreq/hwpstate.c10
-rw-r--r--sys/i386/i386/identcpu.c18
-rw-r--r--sys/i386/i386/msi.c4
-rw-r--r--sys/i386/i386/pmap.c4
-rw-r--r--sys/i386/include/specialreg.h4
-rw-r--r--sys/i386/xen/pmap.c2
10 files changed, 31 insertions, 37 deletions
diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c
index 2c1b804..766977d 100644
--- a/sys/amd64/amd64/identcpu.c
+++ b/sys/amd64/amd64/identcpu.c
@@ -371,21 +371,21 @@ printcpuinfo(void)
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
- AMD64_CPU_FAMILY(cpu_id) >= 0x10 ||
+ CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
cpu_id == 0x60fb2)
tsc_is_invariant = 1;
break;
case CPU_VENDOR_INTEL:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
- (AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
- AMD64_CPU_MODEL(cpu_id) >= 0xe) ||
- (AMD64_CPU_FAMILY(cpu_id) == 0xf &&
- AMD64_CPU_MODEL(cpu_id) >= 0x3))
+ (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xe) ||
+ (CPUID_TO_FAMILY(cpu_id) == 0xf &&
+ CPUID_TO_MODEL(cpu_id) >= 0x3))
tsc_is_invariant = 1;
break;
case CPU_VENDOR_CENTAUR:
- if (AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
- AMD64_CPU_MODEL(cpu_id) >= 0xf &&
+ if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xf &&
(rdmsr(0x1203) & 0x100000000ULL) == 0)
tsc_is_invariant = 1;
break;
diff --git a/sys/amd64/amd64/initcpu.c b/sys/amd64/amd64/initcpu.c
index c293c1a..4376dd0 100644
--- a/sys/amd64/amd64/initcpu.c
+++ b/sys/amd64/amd64/initcpu.c
@@ -154,8 +154,8 @@ initializecpu(void)
pg_nx = PG_NX;
}
if (cpu_vendor_id == CPU_VENDOR_CENTAUR &&
- AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
- AMD64_CPU_MODEL(cpu_id) >= 0xf)
+ CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xf)
init_via();
/*
diff --git a/sys/amd64/amd64/msi.c b/sys/amd64/amd64/msi.c
index 736b692..91a8cbb 100644
--- a/sys/amd64/amd64/msi.c
+++ b/sys/amd64/amd64/msi.c
@@ -275,8 +275,8 @@ msi_init(void)
case CPU_VENDOR_AMD:
break;
case CPU_VENDOR_CENTAUR:
- if (AMD64_CPU_FAMILY(cpu_id) == 0x6 &&
- AMD64_CPU_MODEL(cpu_id) >= 0xf)
+ if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xf)
break;
/* FALLTHROUGH */
default:
diff --git a/sys/amd64/include/specialreg.h b/sys/amd64/include/specialreg.h
index 88ff734..d1f0c89 100644
--- a/sys/amd64/include/specialreg.h
+++ b/sys/amd64/include/specialreg.h
@@ -168,10 +168,10 @@
#define CPUID_FAMILY 0x00000f00
#define CPUID_EXT_MODEL 0x000f0000
#define CPUID_EXT_FAMILY 0x0ff00000
-#define AMD64_CPU_MODEL(id) \
+#define CPUID_TO_MODEL(id) \
((((id) & CPUID_MODEL) >> 4) | \
(((id) & CPUID_EXT_MODEL) >> 12))
-#define AMD64_CPU_FAMILY(id) \
+#define CPUID_TO_FAMILY(id) \
((((id) & CPUID_FAMILY) >> 8) + \
(((id) & CPUID_EXT_FAMILY) >> 20))
diff --git a/sys/i386/cpufreq/hwpstate.c b/sys/i386/cpufreq/hwpstate.c
index f46080d..3790b76 100644
--- a/sys/i386/cpufreq/hwpstate.c
+++ b/sys/i386/cpufreq/hwpstate.c
@@ -83,12 +83,6 @@ __FBSDID("$FreeBSD$");
#define AMD_10H_11H_CUR_DID(msr) (((msr) >> 6) & 0x07)
#define AMD_10H_11H_CUR_FID(msr) ((msr) & 0x3F)
-#if defined(__amd64__)
-#define CPU_FAMILY(id) AMD64_CPU_FAMILY(id)
-#elif defined(__i386__)
-#define CPU_FAMILY(id) I386_CPU_FAMILY(id)
-#endif
-
#define HWPSTATE_DEBUG(dev, msg...) \
do{ \
if(hwpstate_verbose) \
@@ -302,7 +296,7 @@ hwpstate_identify(driver_t *driver, device_t parent)
if (device_find_child(parent, "hwpstate", -1) != NULL)
return;
- if (cpu_vendor_id != CPU_VENDOR_AMD || CPU_FAMILY(cpu_id) < 0x10)
+ if (cpu_vendor_id != CPU_VENDOR_AMD || CPUID_TO_FAMILY(cpu_id) < 0x10)
return;
/*
@@ -405,7 +399,7 @@ hwpstate_get_info_from_msr(device_t dev)
uint64_t msr;
int family, i, fid, did;
- family = CPU_FAMILY(cpu_id);
+ family = CPUID_TO_FAMILY(cpu_id);
sc = device_get_softc(dev);
/* Get pstate count */
msr = rdmsr(MSR_AMD_10H_11H_LIMIT);
diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c
index af0da5b..66c5fed 100644
--- a/sys/i386/i386/identcpu.c
+++ b/sys/i386/i386/identcpu.c
@@ -858,21 +858,21 @@ printcpuinfo(void)
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
- I386_CPU_FAMILY(cpu_id) >= 0x10 ||
+ CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
cpu_id == 0x60fb2)
tsc_is_invariant = 1;
break;
case CPU_VENDOR_INTEL:
if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
- (I386_CPU_FAMILY(cpu_id) == 0x6 &&
- I386_CPU_MODEL(cpu_id) >= 0xe) ||
- (I386_CPU_FAMILY(cpu_id) == 0xf &&
- I386_CPU_MODEL(cpu_id) >= 0x3))
+ (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xe) ||
+ (CPUID_TO_FAMILY(cpu_id) == 0xf &&
+ CPUID_TO_MODEL(cpu_id) >= 0x3))
tsc_is_invariant = 1;
break;
case CPU_VENDOR_CENTAUR:
- if (I386_CPU_FAMILY(cpu_id) == 0x6 &&
- I386_CPU_MODEL(cpu_id) >= 0xf &&
+ if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xf &&
(rdmsr(0x1203) & 0x100000000ULL) == 0)
tsc_is_invariant = 1;
break;
@@ -1106,8 +1106,8 @@ finishidentcpu(void)
* XXX This is only done on the BSP package.
*/
if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4 &&
- ((I386_CPU_FAMILY(cpu_id) == 0xf && I386_CPU_MODEL(cpu_id) >= 0x3) ||
- (I386_CPU_FAMILY(cpu_id) == 0x6 && I386_CPU_MODEL(cpu_id) >= 0xe))) {
+ ((CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x3) ||
+ (CPUID_TO_FAMILY(cpu_id) == 0x6 && CPUID_TO_MODEL(cpu_id) >= 0xe))) {
uint64_t msr;
msr = rdmsr(MSR_IA32_MISC_ENABLE);
if ((msr & 0x400000ULL) != 0) {
diff --git a/sys/i386/i386/msi.c b/sys/i386/i386/msi.c
index 6a0a0c9..91a8cbb 100644
--- a/sys/i386/i386/msi.c
+++ b/sys/i386/i386/msi.c
@@ -275,8 +275,8 @@ msi_init(void)
case CPU_VENDOR_AMD:
break;
case CPU_VENDOR_CENTAUR:
- if (I386_CPU_FAMILY(cpu_id) == 0x6 &&
- I386_CPU_MODEL(cpu_id) >= 0xf)
+ if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xf)
break;
/* FALLTHROUGH */
default:
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 9b832ae..f3b4d99 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -501,8 +501,8 @@ pmap_init_pat(void)
*/
if (!pat_tested) {
if (cpu_vendor_id != CPU_VENDOR_INTEL ||
- (I386_CPU_FAMILY(cpu_id) == 6 &&
- I386_CPU_MODEL(cpu_id) >= 0xe)) {
+ (CPUID_TO_FAMILY(cpu_id) == 6 &&
+ CPUID_TO_MODEL(cpu_id) >= 0xe)) {
pat_works = 1;
sysenv = getenv("smbios.system.product");
if (sysenv != NULL) {
diff --git a/sys/i386/include/specialreg.h b/sys/i386/include/specialreg.h
index aeda4c4..c203059 100644
--- a/sys/i386/include/specialreg.h
+++ b/sys/i386/include/specialreg.h
@@ -165,11 +165,11 @@
#define CPUID_FAMILY 0x00000f00
#define CPUID_EXT_MODEL 0x000f0000
#define CPUID_EXT_FAMILY 0x0ff00000
-#define I386_CPU_MODEL(id) \
+#define CPUID_TO_MODEL(id) \
((((id) & CPUID_MODEL) >> 4) | \
((((id) & CPUID_FAMILY) >= 0x600) ? \
(((id) & CPUID_EXT_MODEL) >> 12) : 0))
-#define I386_CPU_FAMILY(id) \
+#define CPUID_TO_FAMILY(id) \
((((id) & CPUID_FAMILY) >> 8) + \
((((id) & CPUID_FAMILY) == 0xf00) ? \
(((id) & CPUID_EXT_FAMILY) >> 20) : 0))
diff --git a/sys/i386/xen/pmap.c b/sys/i386/xen/pmap.c
index 122318c..1d9c9c1 100644
--- a/sys/i386/xen/pmap.c
+++ b/sys/i386/xen/pmap.c
@@ -517,7 +517,7 @@ pmap_init_pat(void)
return;
if (cpu_vendor_id != CPU_VENDOR_INTEL ||
- (I386_CPU_FAMILY(cpu_id) == 6 && I386_CPU_MODEL(cpu_id) >= 0xe)) {
+ (CPUID_TO_FAMILY(cpu_id) == 6 && CPUID_TO_MODEL(cpu_id) >= 0xe)) {
/*
* Leave the indices 0-3 at the default of WB, WT, UC, and UC-.
* Program 4 and 5 as WP and WC.
OpenPOWER on IntegriCloud