summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-01-08 16:35:59 +0000
committerjhb <jhb@FreeBSD.org>2003-01-08 16:35:59 +0000
commit6873375d06f281732e2bd5e1a509b1bd8edec189 (patch)
tree5d8849d86e4f426b29289cc9c14e674387108b64 /sys/i386
parentae34f5ca68917e1117f28452f0ae251572d15040 (diff)
downloadFreeBSD-src-6873375d06f281732e2bd5e1a509b1bd8edec189.zip
FreeBSD-src-6873375d06f281732e2bd5e1a509b1bd8edec189.tar.gz
- Add a cpu_exthigh variable to hold the highest extended cpuid value
returned from cpuid 0x80000000. - Add a cpu_brand char array to hold the processor name returned by cpuid 0x80000002-0x80000004 on AMD, Intel, Transmeta, and possibly other CPUs. - Use cpuid to set cpu_exthigh and read the processor name if it is present in identify_cpu().
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/initcpu.c2
-rw-r--r--sys/i386/i386/locore.s24
-rw-r--r--sys/i386/include/md_var.h2
3 files changed, 28 insertions, 0 deletions
diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c
index 9f13eb6..581fd63 100644
--- a/sys/i386/i386/initcpu.c
+++ b/sys/i386/i386/initcpu.c
@@ -83,10 +83,12 @@ u_int cpu_id = 0; /* Stepping ID */
u_int cpu_feature = 0; /* Feature flags */
u_int cpu_high = 0; /* Highest arg to CPUID */
u_int cpuid_cpuinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */
+u_int cpu_exthigh = 0; /* Highest arg to extended CPUID */
#ifdef CPU_ENABLE_SSE
u_int cpu_fxsr = 0; /* SSE enabled */
#endif
char cpu_vendor[20] = ""; /* CPU Origin code */
+char cpu_brand[48] = ""; /* Brand name */
#ifdef I486_CPU
/*
diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s
index b9efaf6..58c008b 100644
--- a/sys/i386/i386/locore.s
+++ b/sys/i386/i386/locore.s
@@ -740,6 +740,30 @@ trycpuid: /* Use the `cpuid' instruction. */
/* Greater than Pentium...call it a Pentium Pro */
movl $CPU_686,R(cpu)
3:
+ /* Try to read extended CPUID information. */
+ movl $0x80000000,%eax # cpuid 80000000
+ cpuid
+ cmpl $0x80000000,%eax # is it a valid value?
+ jb 5f
+ movl %eax,R(cpu_exthigh) # highest extended capability
+ cmpl $0x80000004,%eax # does it have a brand name?
+ jb 5f
+
+ /* Read the brand name. */
+ leal R(cpu_brand),%edi
+ movl $0x80000002,%esi
+4:
+ movl %esi,%eax
+ cpuid
+ movl %eax,(%edi) # Store next 16 characters
+ movl %ebx,4(%edi) # of brand name
+ movl %ecx,8(%edi)
+ movl %edx,12(%edi)
+ incl %esi # Advance to next set of 16
+ addl $16,%edi
+ cmpl $0x80000004,%esi
+ jbe 4b
+5:
ret
diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h
index 71c58c3..1d0a03d 100644
--- a/sys/i386/include/md_var.h
+++ b/sys/i386/include/md_var.h
@@ -42,12 +42,14 @@ extern void (*bcopy_vector)(const void *from, void *to, size_t len);
extern int busdma_swi_pending;
extern int (*copyin_vector)(const void *udaddr, void *kaddr, size_t len);
extern int (*copyout_vector)(const void *kaddr, void *udaddr, size_t len);
+extern u_int cpu_exthigh;
extern u_int cpu_feature;
extern u_int cpu_high;
extern u_int cpuid_cpuinfo;
extern u_int cpu_id;
extern u_int cpu_fxsr;
extern char cpu_vendor[];
+extern char cpu_brand[];
extern u_int cyrix_did;
extern uint16_t *elan_mmcr;
extern char kstack[];
OpenPOWER on IntegriCloud