Module Name: src
Committed By: mrg
Date: Mon Feb 1 05:00:59 UTC 2010
Modified Files:
src/sys/arch/sparc64/include: psl.h
src/sys/arch/sparc64/sparc64: ipifuncs.c
Log Message:
add some macros to check cpu type:
GETVER_CPU_IMPL()
CPU_IS_JALAPENO()
CPU_IS_USIII_UP()
and use them in a couple places to choose the right method/index
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/sparc64/include/psl.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/sparc64/sparc64/ipifuncs.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/sparc64/include/psl.h
diff -u src/sys/arch/sparc64/include/psl.h:1.45 src/sys/arch/sparc64/include/psl.h:1.46
--- src/sys/arch/sparc64/include/psl.h:1.45 Fri Jan 15 23:55:55 2010
+++ src/sys/arch/sparc64/include/psl.h Mon Feb 1 05:00:59 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: psl.h,v 1.45 2010/01/15 23:55:55 nakayama Exp $ */
+/* $NetBSD: psl.h,v 1.46 2010/02/01 05:00:59 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -315,6 +315,11 @@
/* Version Register (PR 31) */
SPARC64_GETPR64_DEF(ver) /* getver() */
+/* Some simple macros to check the cpu type. */
+#define GETVER_CPU_IMPL() ((getver() & VER_IMPL) >> VER_IMPL_SHIFT)
+#define CPU_IS_JALAPENO() (GETVER_CPU_IMPL() == IMPL_JALAPENO)
+#define CPU_IS_USIII_UP() (GETVER_CPU_IMPL() >= IMPL_CHEETAH)
+
static __inline int
intr_disable(void)
{
Index: src/sys/arch/sparc64/sparc64/ipifuncs.c
diff -u src/sys/arch/sparc64/sparc64/ipifuncs.c:1.27 src/sys/arch/sparc64/sparc64/ipifuncs.c:1.28
--- src/sys/arch/sparc64/sparc64/ipifuncs.c:1.27 Mon Feb 1 02:42:33 2010
+++ src/sys/arch/sparc64/sparc64/ipifuncs.c Mon Feb 1 05:00:59 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.27 2010/02/01 02:42:33 mrg Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.28 2010/02/01 05:00:59 mrg Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.27 2010/02/01 02:42:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.28 2010/02/01 05:00:59 mrg Exp $");
#include "opt_ddb.h"
@@ -78,7 +78,7 @@
printf("cpu%d: shutting down\n", cpu_number());
CPUSET_ADD(cpus_halted, cpu_number());
- if (((getver() & VER_IMPL) >> VER_IMPL_SHIFT) >= IMPL_CHEETAH) {
+ if (CPU_IS_USIII_UP()) {
/*
* prom_selfstop() doesn't seem to work on newer machines.
*/
@@ -201,7 +201,7 @@
* UltraSPARC-IIIi CPUs select the BUSY/NACK pair based on the
* lower two bits of the ITID.
*/
- if (((getver() & VER_IMPL) >> VER_IMPL_SHIFT) == IMPL_JALAPENO)
+ if (CPU_IS_JALAPENO())
shift = (upaid & 0x3) * 2;
if (ldxa(0, ASR_IDSR) & (IDSR_BUSY << shift))