Merge multiple definitions of cntlzw() ("count leading zeros")

instruction-wrapper to <powerpc/cpu.h>.

OK by briggs@
This commit is contained in:
freza 2006-06-13 18:24:37 +00:00
parent ef6f10f99b
commit dc25af75d0
4 changed files with 19 additions and 45 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extintr.c,v 1.55 2005/12/24 22:45:35 perry Exp $ */
/* $NetBSD: extintr.c,v 1.56 2006/06/13 18:24:37 freza Exp $ */
/*-
* Copyright (c) 2000, 2001 Tsubai Masanari.
@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.55 2005/12/24 22:45:35 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.56 2006/06/13 18:24:37 freza Exp $");
#include "opt_multiprocessor.h"
@ -87,6 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.55 2005/12/24 22:45:35 perry Exp $");
#include <uvm/uvm_extern.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/intr.h>
#include <machine/psl.h>
#include <machine/pio.h>
@ -103,7 +104,6 @@ __KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.55 2005/12/24 22:45:35 perry Exp $");
void intr_calculatemasks __P((void));
int fakeintr __P((void *));
static inline int cntlzw __P((int));
static inline uint32_t gc_read_irq __P((void));
static inline int mapirq __P((int));
static void gc_enable_irq __P((int));
@ -181,20 +181,6 @@ mapirq(irq)
return v;
}
/*
* Count leading zeros.
*/
static inline int
cntlzw(x)
int x;
{
int a;
__asm volatile ("cntlzw %0,%1" : "=r"(a) : "r"(x));
return a;
}
uint32_t
gc_read_irq()
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.10 2005/12/24 22:45:36 perry Exp $ */
/* $NetBSD: intr.c,v 1.11 2006/06/13 18:24:37 freza Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.10 2005/12/24 22:45:36 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.11 2006/06/13 18:24:37 freza Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.10 2005/12/24 22:45:36 perry Exp $");
#include <uvm/uvm_extern.h>
#include <machine/cpu.h>
#include <machine/intr.h>
#include <machine/psl.h>
@ -67,7 +68,6 @@ static void intr_calculatemasks(void);
static const char *intr_typename(int);
static int fakeintr(void *);
static inline int cntlzw(int);
volatile int cpl, ipending;
@ -77,15 +77,6 @@ static int intrtype[ICU_LEN], intrmask[ICU_LEN], intrlevel[ICU_LEN];
static struct intrhand *intrhand[ICU_LEN];
static inline int
cntlzw(int x)
{
int a;
__asm volatile ("cntlzw %0,%1" : "=r"(a) : "r"(x));
return a;
}
static int
fakeintr(void *arg)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.48 2006/05/30 22:44:13 freza Exp $ */
/* $NetBSD: cpu.h,v 1.49 2006/06/13 18:24:37 freza Exp $ */
/*
* Copyright (C) 1999 Wolfgang Solfrank.
@ -252,6 +252,15 @@ mfpvr(void)
return (pvr);
}
static __inline int
cntlzw(uint32_t val)
{
int cnt;
__asm volatile ("cntlzw %0,%1" : "=r"(cnt) : "r"(val));
return (cnt);
}
#if defined(PPC_IBM4XX) || defined(PPC_IBM403)
/*
* DCR (Device Control Register) access. These have to be

View File

@ -1,4 +1,4 @@
/* $NetBSD: extintr.c,v 1.15 2005/12/24 20:07:28 perry Exp $ */
/* $NetBSD: extintr.c,v 1.16 2006/06/13 18:24:37 freza Exp $ */
/*
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.15 2005/12/24 20:07:28 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.16 2006/06/13 18:24:37 freza Exp $");
#include "opt_marvell.h"
#include "opt_kgdb.h"
@ -90,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.15 2005/12/24 20:07:28 perry Exp $");
#include <machine/psl.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
#ifdef KGDB
#include <machine/db_machdep.h>
@ -258,19 +259,6 @@ imask_print(char *str, volatile imask_t *imp)
imp->bits[IMASK_SOFTINT]));
}
/*
* Count leading zeros.
*/
static inline int
cntlzw(int x)
{
int a;
__asm volatile ("cntlzw %0,%1" : "=r"(a) : "r"(x));
return a;
}
/*
* softintr_init - establish softclock, softnet; reserve SIR_HWCLOCK
*/