Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp700/hp700 Drop CPU detection by features and pani...



details:   https://anonhg.NetBSD.org/src/rev/0e2089948511
branches:  trunk
changeset: 326031:0e2089948511
user:      skrll <skrll%NetBSD.org@localhost>
date:      Thu Jan 16 13:07:07 2014 +0000

description:
Drop CPU detection by features and panic if a CPU isn't detected via
PDC_MODEL_CPUID or cpu_model_cpuid.

diffstat:

 sys/arch/hp700/hp700/machdep.c |  35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diffs (76 lines):

diff -r 7917f4a4e570 -r 0e2089948511 sys/arch/hp700/hp700/machdep.c
--- a/sys/arch/hp700/hp700/machdep.c    Thu Jan 16 11:43:49 2014 +0000
+++ b/sys/arch/hp700/hp700/machdep.c    Thu Jan 16 13:07:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.116 2013/10/19 13:16:30 skrll Exp $      */
+/*     $NetBSD: machdep.c,v 1.117 2014/01/16 13:07:07 skrll Exp $      */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.116 2013/10/19 13:16:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.117 2014/01/16 13:07:07 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -685,9 +685,13 @@
        error = pdcproc_model_cpuid(&pdc_cpuid);
        if (error < 0) {
                DPRINTF(("WARNING: PDC_MODEL_CPUID error %d. "
-                   "Using cpu_modelno based cpu_type.\n", error));
+                   "Using cpu_modelno (%#x) based cpu_type.\n", error, cpu_modelno));
 
                cpu_type = cpu_model_cpuid(cpu_modelno);
+               if (cpu_type == hpc_unknown) {
+                       printf("WARNING: Unknown cpu_type for cpu_modelno %x\n",
+                          cpu_modelno);
+               }
        } else {
                DPRINTF(("%s: cpuid.version  = %x\n", __func__,
                    pdc_cpuid.version));
@@ -774,26 +778,33 @@
                pmap_hptsize = 0;
        }
 
+       bool cpu_found = false;
        if (cpu_version) {
-               for (i = 0, p = cpu_types; i < __arraycount(cpu_types);
-                    i++, p++) {
-                       if (p->hci_cpuversion == cpu_version)
-                               break;
-               }
-       } else if (cpu_type != hpc_unknown) {
+               DPRINTF(("%s: looking for cpu_version %x\n", __func__,
+                   cpu_version));
                for (i = 0, p = cpu_types; i < __arraycount(cpu_types);
                     i++, p++) {
-                       if (p->hci_cputype == cpu_type)
+                       if (p->hci_cpuversion == cpu_version) {
+                               cpu_found = true;
                                break;
+                       }
                }
-       } else {
+       } else if (cpu_type != hpc_unknown) {
+               DPRINTF(("%s: looking for cpu_type %d\n", __func__,
+                   cpu_type));
                for (i = 0, p = cpu_types; i < __arraycount(cpu_types);
                     i++, p++) {
-                       if (p->hci_features == cpu_features)
+                       if (p->hci_cputype == cpu_type) {
+                               cpu_found = true;
                                break;
+                       }
                }
        }
 
+       if (!cpu_found) {
+               panic("CPU detection failed. Please report the problem.");
+       }
+
        hppa_cpu_info = p;
 
        if (hppa_cpu_info->hci_chip_name == NULL)



Home | Main Index | Thread Index | Old Index