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()).
This commit is contained in:
parent
cf8807954f
commit
301f1ebf31
|
@ -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 @@ found:
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -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 volatile u_long lasttb;
|
|||
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 @@ cpu_initclocks()
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -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 long ticks_per_intr;
|
|||
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 @@ cpu_initclocks(void)
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -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 @@ static volatile int tickspending;
|
|||
|
||||
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 @@ calc_delayconst(void)
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -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 @@ mtmsr(int msr)
|
|||
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)
|
||||
|
|
|
@ -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 @@ unsigned int pmapdebug = 0;
|
|||
#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)
|
||||
|
|
|
@ -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 @@ decr_intr(frame)
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -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 long ticks_per_intr;
|
|||
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 @@ cpu_initclocks()
|
|||
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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue