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
This commit is contained in:
mrg 2010-02-01 05:00:59 +00:00
parent ba65e91001
commit c3dff9108b
2 changed files with 10 additions and 5 deletions

View File

@ -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 @@ SPARC64_SETPR_DEF(cwp, int) /* setcwp() */
/* 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)
{

View File

@ -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 @@ sparc64_ipi_halt_thiscpu(void *arg)
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 @@ sparc64_send_ipi(int upaid, ipifunc_t func, uint64_t arg1, uint64_t arg2)
* 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))