Module Name:    src
Committed By:   skrll
Date:           Wed Nov 14 10:58:04 UTC 2018

Modified Files:
        src/sys/arch/hppa/hppa: fpu.c machdep.c

Log Message:
Some fixes for QEMU/hppa.

Don't call desidhash_l on pcxl2 as it doesn't support it.  QEMU emulates
this cpu and would trap on illegal instruction for the diag in desidhash_l

Allow a FPU to be missing... more fixes are likely here.

QEMU doesn't set C bit properly yet


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/hppa/hppa/fpu.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/hppa/hppa/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/hppa/hppa/fpu.c
diff -u src/sys/arch/hppa/hppa/fpu.c:1.24 src/sys/arch/hppa/hppa/fpu.c:1.25
--- src/sys/arch/hppa/hppa/fpu.c:1.24	Fri Apr  6 12:21:59 2012
+++ src/sys/arch/hppa/hppa/fpu.c	Wed Nov 14 10:58:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $	*/
+/*	$NetBSD: fpu.c,v 1.25 2018/11/14 10:58:04 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.25 2018/11/14 10:58:04 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -144,6 +144,12 @@ hppa_fpu_bootstrap(u_int ccr_enable)
 
 	/* See if we have a present and functioning hardware FPU. */
 	fpu_present = (ccr_enable & HPPA_FPUS) == HPPA_FPUS;
+	if (!fpu_present) {
+		fpu_csw = 0;
+		curcpu()->ci_fpu_state = 0;
+
+		return;
+	}
 
 	KASSERT(fpu_present);
 	/* Initialize the FPU and get its version. */

Index: src/sys/arch/hppa/hppa/machdep.c
diff -u src/sys/arch/hppa/hppa/machdep.c:1.8 src/sys/arch/hppa/hppa/machdep.c:1.9
--- src/sys/arch/hppa/hppa/machdep.c:1.8	Mon Sep  3 16:29:24 2018
+++ src/sys/arch/hppa/hppa/machdep.c	Wed Nov 14 10:58:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.8 2018/09/03 16:29:24 riastradh Exp $	*/
+/*	$NetBSD: machdep.c,v 1.9 2018/11/14 10:58:04 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.8 2018/09/03 16:29:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.9 2018/11/14 10:58:04 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -374,7 +374,7 @@ const struct hppa_cpu_info cpu_types[] =
 	{ "PA7300LC", "Velociraptor", "PCXL2",
 	  hpcxl2, HPPA_CPU_PCXL2,
 	  HPPA_FTRS_TLBU | HPPA_FTRS_BTLBU | HPPA_FTRS_HVT, "1.1e",
-	  desidhash_l, itlb_l, dtlb_l, itlbna_l, dtlbna_l, tlbd_l,
+	  NULL, itlb_l, dtlb_l, itlbna_l, dtlbna_l, tlbd_l,
 	  ibtlb_g, NULL, pbtlb_g, hpti_g },
 #endif
 #ifdef HP8000_CPU
@@ -809,9 +809,6 @@ cpuid(void)
 
 	if (hppa_cpu_info->hci_chip_name == NULL)
 		panic("bad model string for 0x%x", pdc_model.hwmodel);
-	else if (hppa_cpu_info->desidhash == NULL)
-		panic("no kernel support for %s",
-		    hppa_cpu_info->hci_chip_name);
 
 	/*
 	 * TODO: HPT on 7200 is not currently supported
@@ -825,7 +822,10 @@ cpuid(void)
 	cpu_hpt_init = hppa_cpu_info->hptinit;
 	cpu_desidhash = hppa_cpu_info->desidhash;
 
-	cpu_revision = (*cpu_desidhash)();
+	if (cpu_desidhash)
+		cpu_revision = (*cpu_desidhash)();
+	else
+		cpu_revision = 0;
 
 	/* force strong ordering for now */
 	if (hppa_cpu_ispa20_p())

Reply via email to