From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: TSC on coreboot (Re: [PATCH] High resolution time/TSC patch v3)
Date: Mon, 04 Aug 2008 22:21:20 +0200 [thread overview]
Message-ID: <87proo351b.fsf@xs4all.nl> (raw)
In-Reply-To: <20080803235348.GA23220@thorin> (Robert Millan's message of "Mon, 4 Aug 2008 01:53:48 +0200")
Hi Robert,
Robert Millan <rmh@aybabtu.com> writes:
You forgot the changelog entry :-)
> On Sun, Aug 03, 2008 at 09:48:16PM +0200, Robert Millan wrote:
>> On Mon, Jul 28, 2008 at 10:05:33AM -0700, Colin D Bennett wrote:
>> > +/* Calibrate the TSC based on the RTC. */
>> > +static void
>> > +calibrate_tsc (void)
>> > +{
>> > + /* First calbrate the TSC rate (relative, not absolute time). */
>> > + grub_uint64_t start_tsc;
>> > + grub_uint64_t end_tsc;
>> > + grub_uint32_t initial_tick;
>> > + grub_uint32_t start_tick;
>> > + grub_uint32_t end_tick;
>> > +
>> > + /* Wait for the start of the next tick;
>> > + we'll base out timing off this edge. */
>> > + initial_tick = grub_get_rtc ();
>>
>> Ah, I see the problem. It calls grub_get_rtc() which in grub-coreboot is just
>> a stub.
>>
>> How about using the interval timer for calibration instead?
>
> Here. With this patch your code works on coreboot too.
>
> Note: AFAICT we can't calculate the epoch without RTC. But then again, this
> epoch is just as defined by the time BIOS enables RTC interrupts, so why not
> define it ourselves? I propose that we define epoch as the time in which our
> TSC code is initialized.
>
> If knowing the time in which BIOS was started is really useful, maybe we could
> #ifdef it instead. Though if it's not I'd prefer the simplicity.
If this works and fixes coreboot, it is fine to me ;-)
One comment follows below.
> --- ../grub2.tsc/include/grub/i386/pit.h 1970-01-01 01:00:00.000000000 +0100
> +++ ./include/grub/i386/pit.h 2008-08-04 01:22:12.000000000 +0200
> @@ -0,0 +1,19 @@
> +/*
> + * GRUB -- GRand Unified Bootloader
> + * Copyright (C) 2008 Free Software Foundation, Inc.
> + *
> + * GRUB is free software: you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation, either version 3 of the License, or
> + * (at your option) any later version.
> + *
> + * GRUB is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +extern void grub_pit_wait (grub_uint16_t tics);
Please us an inclusion guard.
--
Marco
next prev parent reply other threads:[~2008-08-04 20:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-23 14:54 [RFC] High resolution time support using x86 TSC Colin D Bennett
2008-07-03 18:52 ` Marco Gerards
2008-07-04 15:58 ` Colin D Bennett
2008-07-04 16:10 ` Vesa Jääskeläinen
2008-07-04 17:26 ` Colin D Bennett
2008-07-20 18:21 ` Marco Gerards
2008-07-04 18:28 ` [RFC] TSC patch v2 Colin D Bennett
2008-07-04 19:49 ` Vesa Jääskeläinen
2008-07-04 20:38 ` Colin D Bennett
2008-07-04 20:48 ` Vesa Jääskeläinen
2008-07-20 18:45 ` Marco Gerards
2008-07-28 17:05 ` [PATCH] High resolution time/TSC patch v3 Colin D Bennett
2008-07-28 17:59 ` Robert Millan
2008-07-31 19:08 ` Marco Gerards
2008-07-31 19:24 ` Robert Millan
2008-07-31 20:07 ` Marco Gerards
2008-07-31 20:35 ` Robert Millan
2008-08-03 19:48 ` Robert Millan
2008-08-03 23:53 ` TSC on coreboot (Re: [PATCH] High resolution time/TSC patch v3) Robert Millan
2008-08-04 2:14 ` Colin D Bennett
2008-08-04 9:09 ` Robert Millan
2008-08-04 20:21 ` Marco Gerards [this message]
2008-08-05 11:59 ` [PATCH] High resolution time/TSC patch v3 Marco Gerards
2008-08-05 20:24 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87proo351b.fsf@xs4all.nl \
--to=mgerards@xs4all.nl \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.