Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 add some macros to check cpu type:
details: https://anonhg.NetBSD.org/src/rev/8afea0cb15f0
branches: trunk
changeset: 751336:8afea0cb15f0
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Feb 01 05:00:59 2010 +0000
description:
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
diffstat:
sys/arch/sparc64/include/psl.h | 7 ++++++-
sys/arch/sparc64/sparc64/ipifuncs.c | 8 ++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r 8cd239937dd5 -r 8afea0cb15f0 sys/arch/sparc64/include/psl.h
--- a/sys/arch/sparc64/include/psl.h Mon Feb 01 03:43:27 2010 +0000
+++ b/sys/arch/sparc64/include/psl.h Mon Feb 01 05:00:59 2010 +0000
@@ -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)
{
diff -r 8cd239937dd5 -r 8afea0cb15f0 sys/arch/sparc64/sparc64/ipifuncs.c
--- a/sys/arch/sparc64/sparc64/ipifuncs.c Mon Feb 01 03:43:27 2010 +0000
+++ b/sys/arch/sparc64/sparc64/ipifuncs.c Mon Feb 01 05:00:59 2010 +0000
@@ -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))
Home |
Main Index |
Thread Index |
Old Index