Message ID | 1455500220-1324-11-git-send-email-sjg@chromium.org |
---|---|
State | Superseded |
Delegated to: | Simon Glass |
Headers | show |
Hi Simon, On Mon, Feb 15, 2016 at 9:36 AM, Simon Glass <sjg@chromium.org> wrote: > Add support for the early timer so we can use tracing with sandbox again. > > Signed-off-by: Simon Glass <sjg@chromium.org> > --- > > drivers/timer/sandbox_timer.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c > index a8da936..4537c82 100644 > --- a/drivers/timer/sandbox_timer.c > +++ b/drivers/timer/sandbox_timer.c > @@ -18,9 +18,19 @@ void sandbox_timer_add_offset(unsigned long offset) > sandbox_timer_offset += offset; > } > > -static int sandbox_timer_get_count(struct udevice *dev, u64 *count) > +u64 notrace timer_early_get_count(void) > { > - *count = os_get_nsec() / 1000 + sandbox_timer_offset * 1000; > + return os_get_nsec() / 1000 + sandbox_timer_offset * 1000; > +} > + > +unsigned long notrace timer_early_get_rate(void) > +{ > + return 1000000; Hard-coded? > +} > + > +static notrace int sandbox_timer_get_count(struct udevice *dev, u64 *count) > +{ > + *count = timer_early_get_count(); > > return 0; > } > -- Regards, Bin
Hi Bin On 16 February 2016 at 02:22, Bin Meng <bmeng.cn@gmail.com> wrote: > Hi Simon, > > On Mon, Feb 15, 2016 at 9:36 AM, Simon Glass <sjg@chromium.org> wrote: >> Add support for the early timer so we can use tracing with sandbox again. >> >> Signed-off-by: Simon Glass <sjg@chromium.org> >> --- >> >> drivers/timer/sandbox_timer.c | 14 ++++++++++++-- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c >> index a8da936..4537c82 100644 >> --- a/drivers/timer/sandbox_timer.c >> +++ b/drivers/timer/sandbox_timer.c >> @@ -18,9 +18,19 @@ void sandbox_timer_add_offset(unsigned long offset) >> sandbox_timer_offset += offset; >> } >> >> -static int sandbox_timer_get_count(struct udevice *dev, u64 *count) >> +u64 notrace timer_early_get_count(void) >> { >> - *count = os_get_nsec() / 1000 + sandbox_timer_offset * 1000; >> + return os_get_nsec() / 1000 + sandbox_timer_offset * 1000; >> +} >> + >> +unsigned long notrace timer_early_get_rate(void) >> +{ >> + return 1000000; > > Hard-coded? Yes - I'll convert it to a constant. But since the OS calls use nanoseconds and want to convert to milliseconds it is hard-coded. > >> +} >> + >> +static notrace int sandbox_timer_get_count(struct udevice *dev, u64 *count) >> +{ >> + *count = timer_early_get_count(); >> >> return 0; >> } >> -- > > Regards, > Bin Regards, Simon
diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c index a8da936..4537c82 100644 --- a/drivers/timer/sandbox_timer.c +++ b/drivers/timer/sandbox_timer.c @@ -18,9 +18,19 @@ void sandbox_timer_add_offset(unsigned long offset) sandbox_timer_offset += offset; } -static int sandbox_timer_get_count(struct udevice *dev, u64 *count) +u64 notrace timer_early_get_count(void) { - *count = os_get_nsec() / 1000 + sandbox_timer_offset * 1000; + return os_get_nsec() / 1000 + sandbox_timer_offset * 1000; +} + +unsigned long notrace timer_early_get_rate(void) +{ + return 1000000; +} + +static notrace int sandbox_timer_get_count(struct udevice *dev, u64 *count) +{ + *count = timer_early_get_count(); return 0; }
Add support for the early timer so we can use tracing with sandbox again. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/timer/sandbox_timer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)