Module Name:    src
Committed By:   skrll
Date:           Wed May 13 14:33:42 UTC 2009

Modified Files:
        src/sys/arch/hp700/hp700: machdep.c
        src/sys/arch/hp700/include: cpu.h

Log Message:
If the PDC_MODEL_CPUID call fails use cpu_hvers to work out cpu_type.

Fixes PR/41379.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/hp700/hp700/machdep.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/hp700/include/cpu.h

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.62 src/sys/arch/hp700/hp700/machdep.c:1.63
--- src/sys/arch/hp700/hp700/machdep.c:1.62	Sat May  9 11:39:30 2009
+++ src/sys/arch/hp700/hp700/machdep.c	Wed May 13 14:33:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.62 2009/05/09 11:39:30 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.63 2009/05/13 14:33:42 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.62 2009/05/09 11:39:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.63 2009/05/13 14:33:42 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -270,6 +270,7 @@
 static inline void fall(int, int, int, int, int);
 void dumpsys(void);
 void cpuid(void);
+enum hppa_cpu_type cpu_model_cpuid(int);
 
 /*
  * wide used hardware params
@@ -622,6 +623,7 @@
 	extern int kpsw;
 
 	/* may the scientific guessing begin */
+	cpu_type = hpc_unknown;
 	cpu_features = 0;
 	cpu_version = 0;
 
@@ -648,8 +650,10 @@
 	if ((error = pdc_call((iodcio_t)pdc, 0, PDC_MODEL, PDC_MODEL_CPUID,
 	   &pdc_cpuid, 0, 0, 0, 0)) < 0) {
 #ifdef DEBUG
-		printf("WARNING: PDC_MODEL_CPUID error %d\n", error);
+		printf("WARNING: PDC_MODEL_CPUID error %d. "
+		    "Using cpu_hvers based cpu_type.\n", error);
 #endif
+		cpu_type = cpu_model_cpuid(cpu_hvers);
 	} else {
 #ifdef DEBUG
 		printf("%s: cpuid.version  = %x\n", __func__,
@@ -752,7 +756,12 @@
 
 	if (cpu_version)
 		for (p = cpu_types; p->hci_chip_name; p++) {
-			if (p->hci_cpuid == cpu_version)
+			if (p->hci_cpuversion == cpu_version)
+				break;
+		}
+	else if (cpu_type != hpc_unknown)
+		for (p = cpu_types; p->hci_chip_name; p++) {
+			if (p->hci_cputype == cpu_type)
 				break;
 		}
 	else
@@ -802,6 +811,38 @@
 	hppa_fpu_bootstrap(pdc_coproc.ccr_enable);
 }
 
+enum hppa_cpu_type
+cpu_model_cpuid(int hvers)
+{
+	switch (hvers) {
+	/* no supported HP8xx/9xx models with pcx */
+	case HPPA_BOARD_HP720:
+	case HPPA_BOARD_HP750_66:
+	case HPPA_BOARD_HP730_66:
+	case HPPA_BOARD_HP710:
+	case HPPA_BOARD_HP705:
+		return hpcxs;
+
+	case HPPA_BOARD_HP735_99:
+	case HPPA_BOARD_HP755_99:
+	case HPPA_BOARD_HP755_125:
+	case HPPA_BOARD_HP735_130:
+	case HPPA_BOARD_HP715_50:
+	case HPPA_BOARD_HP715_33:
+	case HPPA_BOARD_HP715S_50:
+	case HPPA_BOARD_HP715S_33:
+	case HPPA_BOARD_HP715T_50:
+	case HPPA_BOARD_HP715T_33:
+	case HPPA_BOARD_HP715_75:
+	case HPPA_BOARD_HP715_99:
+	case HPPA_BOARD_HP725_50:
+	case HPPA_BOARD_HP725_75:
+	case HPPA_BOARD_HP725_99:
+		return hpcxt;
+	}
+	return hpc_unknown;
+}
+
 void
 cpu_startup(void)
 {

Index: src/sys/arch/hp700/include/cpu.h
diff -u src/sys/arch/hp700/include/cpu.h:1.32 src/sys/arch/hp700/include/cpu.h:1.33
--- src/sys/arch/hp700/include/cpu.h:1.32	Sat May  9 11:39:31 2009
+++ src/sys/arch/hp700/include/cpu.h	Wed May 13 14:33:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.32 2009/05/09 11:39:31 skrll Exp $	*/
+/*	$NetBSD: cpu.h,v 1.33 2009/05/13 14:33:42 skrll Exp $	*/
 
 /*	$OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $	*/
 
@@ -62,6 +62,7 @@
 
 /* types */
 enum hppa_cpu_type {
+	hpc_unknown,
 	hpcx,	/* PA7000 (x)		PA 1.0 */
 	hpcxs,	/* PA7000 (s)		PA 1.1a */
 	hpcxt,	/* PA7100 (t)		PA 1.1b */
@@ -89,7 +90,7 @@
 	/* The type and PA-RISC specification of the chip. */
 	const char hci_chip_type[8];
 	enum hppa_cpu_type hci_cputype;
-	int  hci_cpuid;
+	int  hci_cpuversion;
 	int  hci_features;		/* CPU types and features */
 #define	HPPA_FTRS_TLBU		0x00000001
 #define	HPPA_FTRS_BTLBU		0x00000002

Reply via email to