Add generic printout of extended CPUID feature flags on Intel processors.
authorThomas E. Spanjaard <tgen@dragonflybsd.org>
Wed, 27 Dec 2006 17:20:28 +0000 (17:20 +0000)
committerThomas E. Spanjaard <tgen@dragonflybsd.org>
Wed, 27 Dec 2006 17:20:28 +0000 (17:20 +0000)
Obtained-from: FreeBSD.
XXX-regarding: cpu_feature and cpu_feature2 flags are defined in
sys/systm.h, which really isn't the right place.

sys/cpu/i386/include/specialreg.h
sys/platform/pc32/i386/est.c
sys/platform/pc32/i386/identcpu.c
sys/platform/pc32/i386/locore.s
sys/sys/systm.h

index 5fe5b96..f154022 100644 (file)
@@ -32,7 +32,7 @@
  *
  *     from: @(#)specialreg.h  7.1 (Berkeley) 5/9/91
  * $FreeBSD: src/sys/i386/include/specialreg.h,v 1.19.2.3 2003/01/22 17:24:28 jhb Exp $
- * $DragonFly: src/sys/cpu/i386/include/specialreg.h,v 1.6 2006/11/07 06:43:22 dillon Exp $
+ * $DragonFly: src/sys/cpu/i386/include/specialreg.h,v 1.7 2006/12/27 17:20:28 tgen Exp $
  */
 
 #ifndef _CPU_SPECIALREG_H_
 #define        CPUID_B30       0x40000000
 #define        CPUID_PBE       0x80000000
 
+#define        CPUID2_SSE3     0x00000001
+#define        CPUID2_MON      0x00000008
+#define        CPUID2_DS_CPL   0x00000010
+#define        CPUID2_EST      0x00000080
+#define        CPUID2_TM2      0x00000100
+#define        CPUID2_CNTXID   0x00000400
+#define        CPUID2_CX16     0x00002000
+
 /*
  * CPUID instruction 1 ebx info
  */
index 75ff91a..1fb0dfd 100644 (file)
@@ -85,7 +85,7 @@
  *   ACPI objects: _PCT is MSR location, _PSS is freq/voltage, _PPC is caps.
  *
  * $NetBSD: est.c,v 1.24 2006/03/15 22:56:38 dogcow Exp $
- * $DragonFly: src/sys/platform/pc32/i386/est.c,v 1.4 2006/12/23 00:27:03 swildner Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/est.c,v 1.5 2006/12/27 17:20:28 tgen Exp $
  */
 
 #include <sys/param.h>
@@ -578,14 +578,6 @@ est_init(void)
        int                     err;
        size_t                  i;
 
-#ifndef CPUID2_EST
-       int                     regs[4];
-
-#define cpu_feature2   regs[2]
-#define CPUID2_EST     0x00000080
-
-       do_cpuid(1, regs);
-#endif
        if ((cpu_feature2 & CPUID2_EST) == 0) {
                kprintf("Enhanced SpeedStep unsupported on this hardware.\n");
                return(EOPNOTSUPP);
index e5d2c12..e9f22eb 100644 (file)
@@ -39,7 +39,7 @@
  *
  *     from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp
  * $FreeBSD: src/sys/i386/i386/identcpu.c,v 1.80.2.15 2003/04/11 17:06:41 jhb Exp $
- * $DragonFly: src/sys/platform/pc32/i386/identcpu.c,v 1.15 2006/12/23 00:27:03 swildner Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/identcpu.c,v 1.16 2006/12/27 17:20:28 tgen Exp $
  */
 
 #include "opt_cpu.h"
@@ -688,6 +688,44 @@ printcpuinfo(void)
                        "\040PBE"       /* Pending Break Enable */
                        );
 
+                       if (cpu_feature2 != 0) {
+                               printf("\n  Features2=0x%b", cpu_feature2,
+                               "\020"
+                               "\001SSE3"      /* SSE3 */
+                               "\002<b1>"
+                               "\003RSVD2"     /* "Reserved" bit 2 */
+                               "\004MON"       /* MONITOR/MWAIT Instructions */
+                               "\005DS_CPL"    /* CPL Qualified Debug Store */
+                               "\006VMX"       /* Virtual Machine Extensions */
+                               "\007<b6>"
+                               "\010EST"       /* Enhanced SpeedStep */
+                               "\011TM2"       /* Thermal Monitor 2 */
+                               "\012<b9>"
+                               "\013CNTX-ID"   /* L1 context ID available */
+                               "\014<b11>"
+                               "\015<b12>"
+                               "\016CX16"      /* CMPXCHG16B Instruction */
+                               "\017XTPR"      /* Send Task Priority Messages*/
+                               "\020<b15>"
+                               "\021<b16>"
+                               "\022<b17>"
+                               "\023<b18>"
+                               "\024<b19>"
+                               "\025<b20>"
+                               "\026<b21>"
+                               "\027<b22>"
+                               "\030<b23>"
+                               "\031<b24>"
+                               "\032<b25>"
+                               "\033<b26>"
+                               "\034<b27>"
+                               "\035<b28>"
+                               "\036<b29>"
+                               "\037<b30>"
+                               "\040<b31>"
+                               );
+                       }
+
                        /*
                         * If this CPU supports hyperthreading then mention
                         * the number of logical CPU's it contains.
index 961248f..8c7207b 100644 (file)
@@ -35,7 +35,7 @@
  *
  *     from: @(#)locore.s      7.3 (Berkeley) 5/13/91
  * $FreeBSD: src/sys/i386/i386/locore.s,v 1.132.2.10 2003/02/03 20:54:49 jhb Exp $
- * $DragonFly: src/sys/platform/pc32/i386/locore.s,v 1.11 2005/11/07 20:05:51 dillon Exp $
+ * $DragonFly: src/sys/platform/pc32/i386/locore.s,v 1.12 2006/12/27 17:20:28 tgen Exp $
  *
  *             originally from: locore.s, by William F. Jolitz
  *
        .globl  boothowto,bootdev
 
        .globl  cpu,cpu_vendor,cpu_id,bootinfo
-       .globl  cpu_high, cpu_feature, cpu_procinfo
+       .globl  cpu_high, cpu_feature, cpu_feature2, cpu_procinfo
 
 cpu:           .long   0                       /* are we 386, 386sx, or 486 */
 cpu_id:                .long   0                       /* stepping ID */
 cpu_high:      .long   0                       /* highest arg to CPUID */
 cpu_feature:   .long   0                       /* features */
+cpu_feature2:  .long   0                       /* additional features */
 cpu_procinfo:  .long   0                       /* brand index / HTT info */
 cpu_vendor:    .space  20                      /* CPU origin code */
 bootinfo:      .space  BOOTINFO_SIZE           /* bootinfo buffer space */
@@ -623,6 +624,7 @@ trycpuid:   /* Use the `cpuid' instruction. */
        movl    %eax,R(cpu_id)                  # store cpu_id
        movl    %ebx,R(cpu_procinfo)            # store cpu_procinfo
        movl    %edx,R(cpu_feature)             # store cpu_feature
+       movl    %ecx,R(cpu_feature2)            # store cpu_feature2
        rorl    $8,%eax                         # extract family type
        andl    $15,%eax
        cmpl    $5,%eax
index 6eb004a..bfc3e9b 100644 (file)
@@ -37,7 +37,7 @@
  *
  *     @(#)systm.h     8.7 (Berkeley) 3/29/95
  * $FreeBSD: src/sys/sys/systm.h,v 1.111.2.18 2002/12/17 18:04:02 sam Exp $
- * $DragonFly: src/sys/sys/systm.h,v 1.55 2006/12/26 20:43:53 dillon Exp $
+ * $DragonFly: src/sys/sys/systm.h,v 1.56 2006/12/27 17:20:28 tgen Exp $
  */
 
 #ifndef _SYS_SYSTM_H_
@@ -90,7 +90,10 @@ extern int ncpus2_shift;     /* log base 2 of ncpus2 */
 extern int ncpus2_mask;                /* ncpus2 - 1 */
 extern int clocks_running;     /* timing/timeout subsystem is operational */
 
+/* XXX TGEN these don't belong here, they're MD on i386/amd64 */
 extern u_int cpu_feature;      /* CPUID_* features */
+extern u_int cpu_feature2;     /* CPUID2_* features */
+
 extern int nfs_diskless_valid; /* NFS diskless params were obtained */
 extern vm_paddr_t Maxmem;      /* Highest physical memory address in system */