hardclock_ticks -> getticks()
This commit is contained in:
parent
0da96df8e5
commit
ef06fc5cad
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: clock.c,v 1.57 2020/05/29 05:35:47 rin Exp $ */
|
/* $NetBSD: clock.c,v 1.58 2020/07/03 16:23:03 maxv Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988 University of Utah.
|
* Copyright (c) 1988 University of Utah.
|
||||||
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.57 2020/05/29 05:35:47 rin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.58 2020/07/03 16:23:03 maxv Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
@ -292,9 +292,9 @@ clk_getcounter(struct timecounter *tc)
|
|||||||
u_int counter;
|
u_int counter;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cur_hardclock = hardclock_ticks;
|
cur_hardclock = getticks();
|
||||||
counter = clk_gettick();
|
counter = clk_gettick();
|
||||||
} while (cur_hardclock != hardclock_ticks);
|
} while (cur_hardclock != getticks());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle the situation of a wrapped interval counter, while
|
* Handle the situation of a wrapped interval counter, while
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*$NetBSD: at91st.c,v 1.6 2012/11/12 18:00:36 skrll Exp $*/
|
/*$NetBSD: at91st.c,v 1.7 2020/07/03 16:23:02 maxv Exp $*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AT91RM9200 clock functions
|
* AT91RM9200 clock functions
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: at91st.c,v 1.6 2012/11/12 18:00:36 skrll Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: at91st.c,v 1.7 2020/07/03 16:23:02 maxv Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -213,8 +213,8 @@ at91st_intr(void *arg)
|
|||||||
/* call the kernel timer handler */
|
/* call the kernel timer handler */
|
||||||
hardclock((struct clockframe*) arg);
|
hardclock((struct clockframe*) arg);
|
||||||
#if 0
|
#if 0
|
||||||
if (hardclock_ticks % (HZ * 10) == 0)
|
if (getticks() % (HZ * 10) == 0)
|
||||||
printf("time %i sec\n", hardclock_ticks/HZ);
|
printf("time %i sec\n", getticks()/HZ);
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -333,18 +333,17 @@ microtime(register struct timeval *tvp)
|
|||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
extern int hardclock_ticks;
|
|
||||||
static void tdelay(unsigned int ticks)
|
static void tdelay(unsigned int ticks)
|
||||||
{
|
{
|
||||||
uint32_t start, end, current;
|
uint32_t start, end, current;
|
||||||
|
|
||||||
current = hardclock_ticks;
|
current = getticks();
|
||||||
start = current;
|
start = current;
|
||||||
end = start + ticks;
|
end = start + ticks;
|
||||||
|
|
||||||
/* just loop for the specified number of ticks */
|
/* just loop for the specified number of ticks */
|
||||||
while (current < end)
|
while (current < end)
|
||||||
current = hardclock_ticks;
|
current = getticks();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*$NetBSD: at91tctmr.c,v 1.8 2020/05/29 12:30:38 rin Exp $*/
|
/*$NetBSD: at91tctmr.c,v 1.9 2020/07/03 16:23:02 maxv Exp $*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AT91 Timer Counter (TC) based clock functions
|
* AT91 Timer Counter (TC) based clock functions
|
||||||
@ -40,7 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: at91tctmr.c,v 1.8 2020/05/29 12:30:38 rin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: at91tctmr.c,v 1.9 2020/07/03 16:23:02 maxv Exp $");
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -302,20 +302,20 @@ static void udelay(unsigned int usec)
|
|||||||
unsigned footick = (sc->sc_timerclock * 64ULL / 1000000UL);
|
unsigned footick = (sc->sc_timerclock * 64ULL / 1000000UL);
|
||||||
|
|
||||||
if (usec > 0) {
|
if (usec > 0) {
|
||||||
prev_ticks = hardclock_ticks;
|
prev_ticks = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
prev_cvr = READ_TC(sc, TC_CV);
|
prev_cvr = READ_TC(sc, TC_CV);
|
||||||
ticks = hardclock_ticks;
|
ticks = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
if (ticks != prev_ticks) {
|
if (ticks != prev_ticks) {
|
||||||
prev_cvr = READ_TC(sc, TC_CV);
|
prev_cvr = READ_TC(sc, TC_CV);
|
||||||
prev_ticks = ticks;
|
prev_ticks = ticks;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ticks = hardclock_ticks;
|
ticks = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
cvr = READ_TC(sc, TC_CV);
|
cvr = READ_TC(sc, TC_CV);
|
||||||
ticks2 = hardclock_ticks;
|
ticks2 = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
if (ticks2 != ticks) {
|
if (ticks2 != ticks) {
|
||||||
cvr = READ_TC(sc, TC_CV);
|
cvr = READ_TC(sc, TC_CV);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: clock.c,v 1.61 2020/05/29 12:30:39 rin Exp $ */
|
/* $NetBSD: clock.c,v 1.62 2020/07/03 16:23:03 maxv Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988 University of Utah.
|
* Copyright (c) 1988 University of Utah.
|
||||||
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.61 2020/05/29 12:30:39 rin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.62 2020/07/03 16:23:03 maxv Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
@ -280,7 +280,7 @@ clk_getcounter(struct timecounter *tc)
|
|||||||
static uint32_t lastcount;
|
static uint32_t lastcount;
|
||||||
|
|
||||||
s = splhigh();
|
s = splhigh();
|
||||||
cur_hardclock = hardclock_ticks;
|
cur_hardclock = getticks();
|
||||||
ipra = MFP->mf_ipra;
|
ipra = MFP->mf_ipra;
|
||||||
tadr = MFP->mf_tadr;
|
tadr = MFP->mf_tadr;
|
||||||
delta = divisor - tadr;
|
delta = divisor - tadr;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: clock.c,v 1.59 2020/05/29 12:30:41 rin Exp $ */
|
/* $NetBSD: clock.c,v 1.60 2020/07/03 16:23:03 maxv Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
|
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.59 2020/05/29 12:30:41 rin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.60 2020/07/03 16:23:03 maxv Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -66,13 +66,13 @@ vax_diag_get_counter(struct timecounter *tc)
|
|||||||
u_int counter;
|
u_int counter;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cur_hardclock = hardclock_ticks;
|
cur_hardclock = getticks();
|
||||||
counter = *(volatile u_int *)&ka46_cpu->vc_diagtimu;
|
counter = *(volatile u_int *)&ka46_cpu->vc_diagtimu;
|
||||||
} while (cur_hardclock != hardclock_ticks);
|
} while (cur_hardclock != getticks());
|
||||||
|
|
||||||
counter = (counter & 0x3ff) + (counter >> 16) * 1024;
|
counter = (counter & 0x3ff) + (counter >> 16) * 1024;
|
||||||
|
|
||||||
return counter + hardclock_ticks * tick;
|
return counter + getticks() * tick;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -84,13 +84,13 @@ vax_mfpr_get_counter(struct timecounter *tc)
|
|||||||
static int prev_count, prev_hardclock;
|
static int prev_count, prev_hardclock;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
cur_hardclock = hardclock_ticks;
|
cur_hardclock = getticks();
|
||||||
counter = mfpr(PR_ICR) + tick;
|
counter = mfpr(PR_ICR) + tick;
|
||||||
} while (cur_hardclock != hardclock_ticks);
|
} while (cur_hardclock != getticks());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle interval counter wrapping with interrupts blocked.
|
* Handle interval counter wrapping with interrupts blocked.
|
||||||
* If the current hardclock_ticks is less than what we saw
|
* If the current getticks() is less than what we saw
|
||||||
* previously, use the previous value.
|
* previously, use the previous value.
|
||||||
* If the interval counter is smaller, assume it has wrapped,
|
* If the interval counter is smaller, assume it has wrapped,
|
||||||
* and if the [adjusted] current hardclock ticks is the same
|
* and if the [adjusted] current hardclock ticks is the same
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: completion.h,v 1.6 2017/01/11 11:42:09 skrll Exp $ */
|
/* $NetBSD: completion.h,v 1.7 2020/07/03 16:23:02 maxv Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||||
@ -191,7 +191,7 @@ wait_for_completion_interruptible_timeout(struct completion *completion,
|
|||||||
unsigned long ticks)
|
unsigned long ticks)
|
||||||
{
|
{
|
||||||
/* XXX Arithmetic overflow...? */
|
/* XXX Arithmetic overflow...? */
|
||||||
unsigned int start = hardclock_ticks, now;
|
unsigned int start = getticks(), now;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
mutex_enter(&completion->c_lock);
|
mutex_enter(&completion->c_lock);
|
||||||
@ -202,7 +202,7 @@ wait_for_completion_interruptible_timeout(struct completion *completion,
|
|||||||
&completion->c_lock, ticks);
|
&completion->c_lock, ticks);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out;
|
||||||
now = hardclock_ticks;
|
now = getticks();
|
||||||
if (ticks < (now - start)) {
|
if (ticks < (now - start)) {
|
||||||
error = EWOULDBLOCK;
|
error = EWOULDBLOCK;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: drm_wait_netbsd.h,v 1.16 2020/02/14 04:37:43 riastradh Exp $ */
|
/* $NetBSD: drm_wait_netbsd.h,v 1.17 2020/07/03 16:23:02 maxv Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||||
@ -140,10 +140,10 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, spinlock_t *interlock)
|
|||||||
(RET) = -EBUSY; /* Match Linux... */ \
|
(RET) = -EBUSY; /* Match Linux... */ \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
_dswo_start = hardclock_ticks; \
|
_dswo_start = getticks(); \
|
||||||
/* XXX errno NetBSD->Linux */ \
|
/* XXX errno NetBSD->Linux */ \
|
||||||
(RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->sl_lock, 1); \
|
(RET) = -cv_timedwait_sig((Q), &(INTERLOCK)->sl_lock, 1); \
|
||||||
_dswo_end = hardclock_ticks; \
|
_dswo_end = getticks(); \
|
||||||
if (_dswo_end - _dswo_start < _dswo_ticks) \
|
if (_dswo_end - _dswo_start < _dswo_ticks) \
|
||||||
_dswo_ticks -= _dswo_end - _dswo_start; \
|
_dswo_ticks -= _dswo_end - _dswo_start; \
|
||||||
else \
|
else \
|
||||||
@ -239,11 +239,11 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, spinlock_t *interlock)
|
|||||||
(RET) = 0; \
|
(RET) = 0; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
_dtwu_start = hardclock_ticks; \
|
_dtwu_start = getticks(); \
|
||||||
/* XXX errno NetBSD->Linux */ \
|
/* XXX errno NetBSD->Linux */ \
|
||||||
(RET) = -WAIT((Q), &(INTERLOCK)->mtx_lock, \
|
(RET) = -WAIT((Q), &(INTERLOCK)->mtx_lock, \
|
||||||
MIN(_dtwu_ticks, INT_MAX/2)); \
|
MIN(_dtwu_ticks, INT_MAX/2)); \
|
||||||
_dtwu_end = hardclock_ticks; \
|
_dtwu_end = getticks(); \
|
||||||
if ((_dtwu_end - _dtwu_start) < _dtwu_ticks) \
|
if ((_dtwu_end - _dtwu_start) < _dtwu_ticks) \
|
||||||
_dtwu_ticks -= _dtwu_end - _dtwu_start; \
|
_dtwu_ticks -= _dtwu_end - _dtwu_start; \
|
||||||
else \
|
else \
|
||||||
@ -314,11 +314,11 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, spinlock_t *interlock)
|
|||||||
(RET) = 0; \
|
(RET) = 0; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
_dstwu_start = hardclock_ticks; \
|
_dstwu_start = getticks(); \
|
||||||
/* XXX errno NetBSD->Linux */ \
|
/* XXX errno NetBSD->Linux */ \
|
||||||
(RET) = -WAIT((Q), &(INTERLOCK)->sl_lock, \
|
(RET) = -WAIT((Q), &(INTERLOCK)->sl_lock, \
|
||||||
MIN(_dstwu_ticks, INT_MAX/2)); \
|
MIN(_dstwu_ticks, INT_MAX/2)); \
|
||||||
_dstwu_end = hardclock_ticks; \
|
_dstwu_end = getticks(); \
|
||||||
if ((_dstwu_end - _dstwu_start) < _dstwu_ticks) \
|
if ((_dstwu_end - _dstwu_start) < _dstwu_ticks) \
|
||||||
_dstwu_ticks -= _dstwu_end - _dstwu_start; \
|
_dstwu_ticks -= _dstwu_end - _dstwu_start; \
|
||||||
else \
|
else \
|
||||||
|
6
sys/external/bsd/drm2/include/linux/sched.h
vendored
6
sys/external/bsd/drm2/include/linux/sched.h
vendored
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: sched.h,v 1.14 2020/03/14 18:08:39 ad Exp $ */
|
/* $NetBSD: sched.h,v 1.15 2020/07/03 16:23:02 maxv Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||||
@ -74,10 +74,10 @@ schedule_timeout_uninterruptible(long timeout)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
start = hardclock_ticks;
|
start = getticks();
|
||||||
/* Caller is expected to loop anyway, so no harm in truncating. */
|
/* Caller is expected to loop anyway, so no harm in truncating. */
|
||||||
(void)kpause("loonix", false /*!intr*/, MIN(timeout, INT_MAX), NULL);
|
(void)kpause("loonix", false /*!intr*/, MIN(timeout, INT_MAX), NULL);
|
||||||
end = hardclock_ticks;
|
end = getticks();
|
||||||
|
|
||||||
remain = timeout - (end - start);
|
remain = timeout - (end - start);
|
||||||
return remain > 0 ? remain : 0;
|
return remain > 0 ? remain : 0;
|
||||||
|
12
sys/external/bsd/drm2/linux/linux_fence.c
vendored
12
sys/external/bsd/drm2/linux/linux_fence.c
vendored
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: linux_fence.c,v 1.15 2019/04/16 10:00:04 mrg Exp $ */
|
/* $NetBSD: linux_fence.c,v 1.16 2020/07/03 16:23:02 maxv Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2018 The NetBSD Foundation, Inc.
|
* Copyright (c) 2018 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.15 2019/04/16 10:00:04 mrg Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.16 2020/07/03 16:23:02 maxv Exp $");
|
||||||
|
|
||||||
#include <sys/atomic.h>
|
#include <sys/atomic.h>
|
||||||
#include <sys/condvar.h>
|
#include <sys/condvar.h>
|
||||||
@ -543,7 +543,7 @@ fence_wait_any_timeout(struct fence **fences, uint32_t nfences, bool intr,
|
|||||||
*/
|
*/
|
||||||
mutex_enter(&common.lock);
|
mutex_enter(&common.lock);
|
||||||
while (timeout > 0 && !common.done) {
|
while (timeout > 0 && !common.done) {
|
||||||
start = hardclock_ticks;
|
start = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
if (intr) {
|
if (intr) {
|
||||||
if (timeout != MAX_SCHEDULE_TIMEOUT) {
|
if (timeout != MAX_SCHEDULE_TIMEOUT) {
|
||||||
@ -563,7 +563,7 @@ fence_wait_any_timeout(struct fence **fences, uint32_t nfences, bool intr,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end = hardclock_ticks;
|
end = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (ret == -ERESTART)
|
if (ret == -ERESTART)
|
||||||
@ -677,7 +677,7 @@ fence_default_wait(struct fence *fence, bool intr, long timeout)
|
|||||||
|
|
||||||
/* Find out what our deadline is so we can handle spurious wakeup. */
|
/* Find out what our deadline is so we can handle spurious wakeup. */
|
||||||
if (timeout < MAX_SCHEDULE_TIMEOUT) {
|
if (timeout < MAX_SCHEDULE_TIMEOUT) {
|
||||||
now = hardclock_ticks;
|
now = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
starttime = now;
|
starttime = now;
|
||||||
deadline = starttime + timeout;
|
deadline = starttime + timeout;
|
||||||
@ -690,7 +690,7 @@ fence_default_wait(struct fence *fence, bool intr, long timeout)
|
|||||||
* give up.
|
* give up.
|
||||||
*/
|
*/
|
||||||
if (timeout < MAX_SCHEDULE_TIMEOUT) {
|
if (timeout < MAX_SCHEDULE_TIMEOUT) {
|
||||||
now = hardclock_ticks;
|
now = getticks();
|
||||||
__insn_barrier();
|
__insn_barrier();
|
||||||
if (deadline <= now)
|
if (deadline <= now)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user