Module Name:    src
Committed By:   skrll
Date:           Thu Jan 16 13:07:07 UTC 2014

Modified Files:
        src/sys/arch/hp700/hp700: machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/hp700/hp700/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp700/hp700/machdep.c
diff -u src/sys/arch/hp700/hp700/machdep.c:1.116 src/sys/arch/hp700/hp700/machdep.c:1.117
--- src/sys/arch/hp700/hp700/machdep.c:1.116	Sat Oct 19 13:16:30 2013
+++ src/sys/arch/hp700/hp700/machdep.c	Thu Jan 16 13:07:07 2014
@@ -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 @@ cpuid(void)
 	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 @@ cpuid(void)
 		pmap_hptsize = 0;
 	}
 
+	bool cpu_found = false;
 	if (cpu_version) {
+		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_cpuversion == cpu_version)
+			if (p->hci_cpuversion == cpu_version) {
+				cpu_found = true;
 				break;
+			}
 		}
 	} 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_cputype == cpu_type)
-				break;
-		}
-	} else {
-		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)

Reply via email to