summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/include
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2024-04-03 02:01:22 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2024-04-03 02:01:22 +0000
commit7aa9791fe062d1b2a5c9b93c8f6675a8cbd33f7c (patch)
tree2b28362f63340bfb2fd8f4b8893cfcab4ac50804 /sys/arch/amd64/include
parentfc6017e0de122eabb8fa29e57fd793623b2a579f (diff)
Add ci_cpuid_level and ci_vendor holding the per-CPU basic cpuid
level and a numeric mapping of the cpu vendor, both from CPUID(0). Convert the general use of strcmp(cpu_vendor) to simple numeric tests of ci_vendor. Track the minimum of all ci_cpuid_level in the cpuid_level global and continue to use that for what we vmm exposes. AMD testing help matthieu@ krw@ ok miod@ deraadt@ cheloha@
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r--sys/arch/amd64/include/cpu.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 3eea95d5614..84a86b229da 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.163 2024/02/25 19:15:50 cheloha Exp $ */
+/* $OpenBSD: cpu.h,v 1.164 2024/04/03 02:01:21 guenther Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -91,6 +91,13 @@ union vmm_cpu_cap {
struct svm vcc_svm;
};
+enum cpu_vendor {
+ CPUV_UNKNOWN,
+ CPUV_AMD,
+ CPUV_INTEL,
+ CPUV_VIA,
+};
+
/*
* Locks used to protect struct members in this file:
* I immutable after creation
@@ -154,6 +161,8 @@ struct cpu_info {
volatile u_int ci_flags; /* [a] */
u_int32_t ci_ipis; /* [a] */
+ enum cpu_vendor ci_vendor; /* [I] mapped from cpuid(0) */
+ u_int32_t ci_cpuid_level; /* [I] cpuid(0).eax */
u_int32_t ci_feature_flags; /* [I] */
u_int32_t ci_feature_eflags; /* [I] */
u_int32_t ci_feature_sefflags_ebx;/* [I] */
@@ -403,6 +412,7 @@ extern int cpuspeed;
/* machdep.c */
void dumpconf(void);
+void cpu_set_vendor(struct cpu_info *, int _level, const char *_vendor);
void cpu_reset(void);
void x86_64_proc0_tss_ldt_init(void);
void cpu_proc_fork(struct proc *, struct proc *);