Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch move more inlines to cpu.h: mftb(), mftbl() and mfp...
details: https://anonhg.NetBSD.org/src/rev/62c2ad51ba9a
branches: trunk
changeset: 534898:62c2ad51ba9a
user: chs <chs%NetBSD.org@localhost>
date: Tue Aug 06 06:14:33 2002 +0000
description:
move more inlines to cpu.h: mftb(), mftbl() and mfpvr().
(the mftb() in pmap.c only wanted the lower 32 bits, so that's now mftbl()).
diffstat:
sys/arch/macppc/macppc/clock.c | 13 +------------
sys/arch/mvmeppc/mvmeppc/clock.c | 14 +-------------
sys/arch/pmppc/pmppc/clock.c | 14 +-------------
sys/arch/powerpc/ibm4xx/clock.c | 14 +-------------
sys/arch/powerpc/include/cpu.h | 36 +++++++++++++++++++++++++++++++++++-
sys/arch/powerpc/mpc6xx/pmap.c | 22 +++-------------------
sys/arch/prep/prep/clock.c | 14 +-------------
sys/arch/sandpoint/sandpoint/clock.c | 14 +-------------
8 files changed, 44 insertions(+), 97 deletions(-)
diffs (290 lines):
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/macppc/macppc/clock.c
--- a/sys/arch/macppc/macppc/clock.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/macppc/macppc/clock.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.18 2001/11/10 15:37:40 augustss Exp $ */
+/* $NetBSD: clock.c,v 1.19 2002/08/06 06:14:33 chs Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -233,17 +233,6 @@
asm volatile ("mtmsr %0" :: "r"(msr));
}
-static __inline u_quad_t
-mftb(void)
-{
- u_long scratch;
- u_quad_t tb;
-
- asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw 0,%0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
/*
* Fill in *tvp with current time with microsecond resolution.
*/
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/mvmeppc/mvmeppc/clock.c
--- a/sys/arch/mvmeppc/mvmeppc/clock.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/mvmeppc/mvmeppc/clock.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.1 2002/02/27 21:02:23 scw Exp $ */
+/* $NetBSD: clock.c,v 1.2 2002/08/06 06:14:34 chs Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@@ -51,7 +51,6 @@
static todr_chip_handle_t clock_handle;
void decr_intr __P((struct clockframe *)); /* Called from trap_subr.S */
-static inline u_quad_t mftb __P((void));
void clock_rtc_config(todr_chip_handle_t);
void
@@ -122,17 +121,6 @@
asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
}
-static inline u_quad_t
-mftb()
-{
- u_long scratch;
- u_quad_t tb;
-
- asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw %0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
/*
* Fill in *tvp with current time with microsecond resolution.
*/
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/pmppc/pmppc/clock.c
--- a/sys/arch/pmppc/pmppc/clock.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/pmppc/pmppc/clock.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.1 2002/05/30 08:51:38 augustss Exp $ */
+/* $NetBSD: clock.c,v 1.2 2002/08/06 06:14:35 chs Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@@ -47,7 +47,6 @@
static volatile u_long lasttb;
void decr_intr(struct clockframe *); /* Called from trap_subr.S */
-static inline u_quad_t mftb(void);
void
decr_intr(struct clockframe *frame)
@@ -128,17 +127,6 @@
asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
}
-static __inline u_quad_t
-mftb(void)
-{
- u_long scratch;
- u_quad_t tb;
-
- asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw 0,%0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
/*
* Fill in *tvp with current time with microsecond resolution.
*/
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/powerpc/ibm4xx/clock.c
--- a/sys/arch/powerpc/ibm4xx/clock.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/powerpc/ibm4xx/clock.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.4 2002/08/03 13:12:44 simonb Exp $ */
+/* $NetBSD: clock.c,v 1.5 2002/08/06 06:14:36 chs Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@@ -54,7 +54,6 @@
void decr_intr(struct clockframe *); /* called from trap_subr.S */
void stat_intr(struct clockframe *); /* called from trap_subr.S */
-static inline u_quad_t mftb(void);
#ifdef FAST_STAT_CLOCK
/* Stat clock runs at ~ 1.5KHz */
@@ -157,17 +156,6 @@
mtdcr(DCR_CPC0_CR1, mfdcr(DCR_CPC0_CR1) & ~CPC0_CR1_CETE);
}
-static inline u_quad_t
-mftb(void)
-{
- u_long scratch;
- u_quad_t tb;
-
- asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw %0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
/*
* Fill in *tvp with current time with microsecond resolution.
*/
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/powerpc/include/cpu.h Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.18 2002/07/28 07:02:29 chs Exp $ */
+/* $NetBSD: cpu.h,v 1.19 2002/08/06 06:14:37 chs Exp $ */
/*
* Copyright (C) 1999 Wolfgang Solfrank.
@@ -174,6 +174,40 @@
asm volatile ("mtmsr %0" : : "r"(msr));
}
+static __inline uint32_t
+mftbl(void)
+{
+ uint32_t tbl;
+
+ asm volatile ("mftbl %0" : "=r"(tbl));
+ return tbl;
+}
+
+static __inline uint64_t
+mftb(void)
+{
+ uint64_t tb;
+ int tmp;
+
+ asm volatile ("
+1: mftbu %0 \n\
+ mftb %0+1 \n\
+ mftbu %1 \n\
+ cmplw %0,%1 \n\
+ bne- 1b"
+ : "=r"(tb), "=r"(tmp));
+ return tb;
+}
+
+static __inline uint32_t
+mfpvr(void)
+{
+ uint32_t pvr;
+
+ asm volatile ("mfpvr %0" : "=r"(pvr));
+ return (pvr);
+}
+
#define CLKF_USERMODE(frame) (((frame)->srr1 & PSL_PR) != 0)
#define CLKF_BASEPRI(frame) ((frame)->pri == 0)
#define CLKF_PC(frame) ((frame)->srr0)
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/powerpc/mpc6xx/pmap.c
--- a/sys/arch/powerpc/mpc6xx/pmap.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/powerpc/mpc6xx/pmap.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.52 2002/07/28 07:03:47 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.53 2002/08/06 06:14:38 chs Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -276,26 +276,10 @@
#define SYNC() __asm __volatile("sync")
#define EIEIO() __asm __volatile("eieio")
#define MFMSR() mfmsr()
-#define MTMSR(psl) __asm __volatile("mtmsr %0" :: "r"(psl))
+#define MTMSR(psl) mtmsr(psl)
#define MFPVR() mfpvr()
#define MFSRIN(va) mfsrin(va)
-#define MFTB() mftb()
-
-static __inline u_int
-mftb(void)
-{
- u_int tb;
- __asm __volatile("mftb %0" : "=r"(tb) : );
- return tb;
-}
-
-static __inline u_int
-mfpvr(void)
-{
- u_int pvr;
- __asm __volatile("mfspr %0,%1" : "=r"(pvr) : "n"(SPR_PVR));
- return pvr;
-}
+#define MFTB() mftbl()
static __inline sr_t
mfsrin(vaddr_t va)
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/prep/prep/clock.c
--- a/sys/arch/prep/prep/clock.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/prep/prep/clock.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.3 2001/11/18 15:30:43 kleink Exp $ */
+/* $NetBSD: clock.c,v 1.4 2002/08/06 06:14:36 chs Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@@ -44,7 +44,6 @@
#define MINYEAR 1990
void decr_intr __P((struct clockframe *));
-static inline u_quad_t mftb __P((void));
/*
* Initially we assume a processor with a bus frequency of 12.5 MHz.
@@ -270,17 +269,6 @@
splx(pri);
}
-static inline u_quad_t
-mftb()
-{
- u_long scratch;
- u_quad_t tb;
-
- asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw %0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
/*
* Fill in *tvp with current time with microsecond resolution.
*/
diff -r 9f382ca51c78 -r 62c2ad51ba9a sys/arch/sandpoint/sandpoint/clock.c
--- a/sys/arch/sandpoint/sandpoint/clock.c Tue Aug 06 04:58:57 2002 +0000
+++ b/sys/arch/sandpoint/sandpoint/clock.c Tue Aug 06 06:14:33 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.2 2001/06/19 08:34:51 simonb Exp $ */
+/* $NetBSD: clock.c,v 1.3 2002/08/06 06:14:37 chs Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@@ -48,7 +48,6 @@
static volatile u_long lasttb;
void decr_intr __P((struct clockframe *)); /* Called from trap_subr.S */
-static inline u_quad_t mftb __P((void));
void
decr_intr(frame)
@@ -118,17 +117,6 @@
asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
}
-static inline u_quad_t
-mftb()
-{
- u_long scratch;
- u_quad_t tb;
-
- asm ("1: mftbu %0; mftb %0+1; mftbu %1; cmpw %0,%1; bne 1b"
- : "=r"(tb), "=r"(scratch));
- return tb;
-}
-
/*
* Fill in *tvp with current time with microsecond resolution.
*/
Home |
Main Index |
Thread Index |
Old Index