Can you try the following diff ?

The identifycpu diff caused a problem on acpi resume but it was fixed,
this reverts the whole thing.

Index: identcpu.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/identcpu.c,v
retrieving revision 1.36
retrieving revision 1.34
diff -d -u -p -r1.36 -r1.34
--- identcpu.c  22 Apr 2012 19:36:09 -0000      1.36
+++ identcpu.c  8 Jan 2012 14:39:26 -0000       1.34
@@ -1,4 +1,4 @@
-/*     $OpenBSD: identcpu.c,v 1.36 2012/04/22 19:36:09 haesbaert Exp $ */
+/*     $OpenBSD: identcpu.c,v 1.34 2012/01/08 14:39:26 haesbaert Exp $ */
 /*     $NetBSD: identcpu.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $        */
 
 /*
@@ -302,31 +302,27 @@ identifycpu(struct cpu_info *ci)
        u_int64_t last_tsc;
        u_int32_t dummy, val, pnfeatset;
        u_int32_t brand[12];
-       char mycpu_model[48];
+       u_int32_t vendor[4];
        int i, max;
        char *brandstr_from, *brandstr_to;
        int skipspace;
 
        CPUID(1, ci->ci_signature, val, dummy, ci->ci_feature_flags);
        CPUID(0x80000000, pnfeatset, dummy, dummy, dummy);
-       if (pnfeatset >= 0x80000001) {
-               u_int32_t ecx;
-
+       if (pnfeatset >= 0x80000001)
                CPUID(0x80000001, dummy, dummy,
-                   ecx, ci->ci_feature_eflags);
-               if (ci->ci_flags & CPUF_PRIMARY)
-                       ecpu_ecxfeature = ecx;
-               /* Let cpu_fature be the common bits */
-               cpu_feature &= ci->ci_feature_flags;
-       }
+                   ecpu_ecxfeature, ci->ci_feature_eflags);
 
+       vendor[3] = 0;
+       CPUID(0, dummy, vendor[0], vendor[2], vendor[1]);       /* yup, 0 2 1 */
        CPUID(0x80000002, brand[0], brand[1], brand[2], brand[3]);
        CPUID(0x80000003, brand[4], brand[5], brand[6], brand[7]);
        CPUID(0x80000004, brand[8], brand[9], brand[10], brand[11]);
-       strlcpy(mycpu_model, (char *)brand, sizeof(mycpu_model));
 
-       /* Remove leading and duplicated spaces from mycpu_model */
-       brandstr_from = brandstr_to = mycpu_model;
+       strlcpy(cpu_model, (char *)brand, sizeof(cpu_model));
+
+       /* Remove leading and duplicated spaces from cpu_model */
+       brandstr_from = brandstr_to = cpu_model;
        skipspace = 1;
        while (*brandstr_from != '\0') {
                if (!skipspace || *brandstr_from != ' ') {
@@ -339,13 +335,8 @@ identifycpu(struct cpu_info *ci)
        }
        *brandstr_to = '\0';
 
-       if (mycpu_model[0] == 0)
-               strlcpy(mycpu_model, "Opteron or Athlon 64",
-                   sizeof(mycpu_model));
-
-       /* If primary cpu, fill in the global cpu_model used by sysctl */
-       if (ci->ci_flags & CPUF_PRIMARY)
-               strlcpy(cpu_model, mycpu_model, sizeof(cpu_model));
+       if (cpu_model[0] == 0)
+               strlcpy(cpu_model, "Opteron or Athlon 64", sizeof(cpu_model));
 
        ci->ci_family = (ci->ci_signature >> 8) & 0x0f;
        ci->ci_model = (ci->ci_signature >> 4) & 0x0f;
@@ -360,16 +351,13 @@ identifycpu(struct cpu_info *ci)
 
        amd_cpu_cacheinfo(ci);
 
-       printf("%s: %s", ci->ci_dev->dv_xname, mycpu_model);
+       printf("%s: %s", ci->ci_dev->dv_xname, cpu_model);
 
        if (ci->ci_tsc_freq != 0)
                printf(", %lu.%02lu MHz", (ci->ci_tsc_freq + 4999) / 1000000,
                    ((ci->ci_tsc_freq + 4999) / 10000) % 100);
-
-       if (ci->ci_flags & CPUF_PRIMARY) {
-               cpuspeed = (ci->ci_tsc_freq + 4999) / 1000000;
-               cpu_cpuspeed = cpu_amd64speed;
-       }
+       cpuspeed = (ci->ci_tsc_freq + 4999) / 1000000;
+       cpu_cpuspeed = cpu_amd64speed;
 
        printf("\n%s: ", ci->ci_dev->dv_xname);
 
@@ -395,25 +383,25 @@ identifycpu(struct cpu_info *ci)
        x86_print_cacheinfo(ci);
 
 #ifndef SMALL_KERNEL
-       if (ci->ci_flags & CPUF_PRIMARY) {
-               if (pnfeatset > 0x80000007) {
-                       CPUID(0x80000007, dummy, dummy, dummy, pnfeatset);
+       if (pnfeatset > 0x80000007) {
+               CPUID(0x80000007, dummy, dummy, dummy, pnfeatset);
 
-                       if (pnfeatset & 0x06) {
-                               if ((ci->ci_signature & 0xF00) == 0xf00)
-                                       setperf_setup = k8_powernow_init;
-                       }
-                       if (ci->ci_family >= 0x10)
-                               setperf_setup = k1x_init;
+               if (pnfeatset & 0x06) {
+                       if ((ci->ci_signature & 0xF00) == 0xf00)
+                               setperf_setup = k8_powernow_init;
                }
+               if (ci->ci_family >= 0x10)
+                       setperf_setup = k1x_init;
+       }
 
-               if (cpu_ecxfeature & CPUIDECX_EST)
-                       setperf_setup = est_init;
-
-               if (cpu_ecxfeature & CPUIDECX_AES)
-                       amd64_has_aesni = 1;
+       if (cpu_ecxfeature & CPUIDECX_EST) {
+               setperf_setup = est_init;
        }
-       if (!strncmp(mycpu_model, "Intel", 5)) {
+
+       if (cpu_ecxfeature & CPUIDECX_AES)
+               amd64_has_aesni = 1;
+
+       if (!strncmp(cpu_model, "Intel", 5)) {
                u_int32_t cflushsz;
 
                CPUID(0x01, dummy, cflushsz, dummy, dummy);
@@ -432,10 +420,13 @@ identifycpu(struct cpu_info *ci)
 
 #endif
 
-       if (!strcmp(cpu_vendor, "AuthenticAMD"))
+
+       /* AuthenticAMD:    h t u A                    i t n e */
+       if (vendor[0] == 0x68747541 && vendor[1] == 0x69746e65 &&
+           vendor[2] == 0x444d4163)    /* DMAc */
                amd64_errata(ci);
 
-       if (strncmp(mycpu_model, "VIA Nano processor", 18) == 0) {
+       if (strncmp(cpu_model, "VIA Nano processor", 18) == 0) {
                ci->cpu_setup = via_nano_setup;
 #ifndef SMALL_KERNEL
                strlcpy(ci->ci_sensordev.xname, ci->ci_dev->dv_xname,
@@ -446,4 +437,11 @@ identifycpu(struct cpu_info *ci)
                sensordev_install(&ci->ci_sensordev);
 #endif
        }
+}
+
+void
+cpu_probe_features(struct cpu_info *ci)
+{
+       ci->ci_feature_flags = cpu_feature;
+       ci->ci_signature = 0;
 }
Index: cpu.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v
retrieving revision 1.47
retrieving revision 1.45
diff -d -u -p -r1.47 -r1.45
--- cpu.c       4 Apr 2012 18:44:22 -0000       1.47
+++ cpu.c       25 Feb 2012 00:12:07 -0000      1.45
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpu.c,v 1.47 2012/04/04 18:44:22 mikeb Exp $  */
+/*     $OpenBSD: cpu.c,v 1.45 2012/02/25 00:12:07 haesbaert Exp $      */
 /* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
 
 /*-
@@ -333,6 +333,7 @@ cpu_attach(struct device *parent, struct
                cpu_start_secondary(ci);
                ncpus++;
                if (ci->ci_flags & CPUF_PRESENT) {
+                       identifycpu(ci);
                        ci->ci_next = cpu_info_list->ci_next;
                        cpu_info_list->ci_next = ci;
                }
@@ -445,18 +446,6 @@ cpu_start_secondary(struct cpu_info *ci)
 #endif
        }
 
-       if ((ci->ci_flags & CPUF_IDENTIFIED) == 0) {
-               atomic_setbits_int(&ci->ci_flags, CPUF_IDENTIFY);
-
-               /* wait for it to identify */
-               for (i = 100000; (ci->ci_flags & CPUF_IDENTIFY) && i > 0; i--)
-                       delay(10);
-
-               if (ci->ci_flags & CPUF_IDENTIFY)
-                       printf("%s: failed to identify\n",
-                           ci->ci_dev->dv_xname);
-       }
-
        CPU_START_CLEANUP(ci);
 }
 
@@ -495,6 +484,9 @@ cpu_hatch(void *v)
 
        cpu_init_msrs(ci);
 
+       cpu_probe_features(ci);
+       cpu_feature &= ci->ci_feature_flags;
+
 #ifdef DEBUG
        if (ci->ci_flags & CPUF_PRESENT)
                panic("%s: already running!?", ci->ci_dev->dv_xname);
@@ -504,22 +496,6 @@ cpu_hatch(void *v)
 
        lapic_enable();
        lapic_startclock();
-
-       if ((ci->ci_flags & CPUF_IDENTIFIED) == 0) {
-               /*
-                * We need to wait until we can identify, otherwise dmesg
-                * output will be messy.
-                */
-               while ((ci->ci_flags & CPUF_IDENTIFY) == 0)
-                       delay(10);
-
-               identifycpu(ci);
-
-               /* Signal we're done */
-               atomic_clearbits_int(&ci->ci_flags, CPUF_IDENTIFY);
-               /* Prevent identifycpu() from running again */
-               atomic_setbits_int(&ci->ci_flags, CPUF_IDENTIFIED);
-       }
 
        while ((ci->ci_flags & CPUF_GO) == 0)
                delay(10);
Index: cpu.h
Index: ../include/cpu.h
===================================================================
RCS file: /cvs/src/sys/arch/amd64/include/cpu.h,v
retrieving revision 1.72
retrieving revision 1.70
diff -d -u -p -r1.72 -r1.70
--- ../include/cpu.h    4 Apr 2012 18:44:22 -0000       1.72
+++ ../include/cpu.h    26 Dec 2011 23:07:04 -0000      1.70
@@ -1,4 +1,4 @@
-/*     $OpenBSD: cpu.h,v 1.72 2012/04/04 18:44:22 mikeb Exp $  */
+/*     $OpenBSD: cpu.h,v 1.70 2011/12/26 23:07:04 haesbaert Exp $      */
 /*     $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $     */
 
 /*-
@@ -135,9 +135,6 @@ struct cpu_info {
 #define CPUF_SP                0x0004          /* CPU is only processor */  
 #define CPUF_PRIMARY   0x0008          /* CPU is active primary processor */
 
-#define CPUF_IDENTIFY  0x0010          /* CPU may now identify */
-#define CPUF_IDENTIFIED        0x0020          /* CPU has been identified */
-
 #define CPUF_PRESENT   0x1000          /* CPU is present */
 #define CPUF_RUNNING   0x2000          /* CPU is running */
 #define CPUF_PAUSE     0x4000          /* CPU is paused in DDB */
@@ -267,6 +264,7 @@ extern int cpuspeed;
 /* identcpu.c */
 void   identifycpu(struct cpu_info *);
 int    cpu_amd64speed(int *);
+void cpu_probe_features(struct cpu_info *);
 
 /* machdep.c */
 void   dumpconf(void);

Reply via email to