Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1KPpbv-0000jz-Fi for mharc-grub-devel@gnu.org; Sun, 03 Aug 2008 22:15:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KPpbu-0000ij-DE for grub-devel@gnu.org; Sun, 03 Aug 2008 22:15:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KPpbt-0000hk-Pm for grub-devel@gnu.org; Sun, 03 Aug 2008 22:15:46 -0400 Received: from [199.232.76.173] (port=59525 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KPpbt-0000hZ-Mv for grub-devel@gnu.org; Sun, 03 Aug 2008 22:15:45 -0400 Received: from gateway02.websitewelcome.com ([67.18.66.20]:54563) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KPpbt-00072n-Dm for grub-devel@gnu.org; Sun, 03 Aug 2008 22:15:45 -0400 Received: (qmail 29064 invoked from network); 4 Aug 2008 02:28:58 -0000 Received: from gator297.hostgator.com (74.53.228.114) by gateway02.websitewelcome.com with SMTP; 4 Aug 2008 02:28:58 -0000 Received: from c-67-185-142-228.hsd1.wa.comcast.net ([67.185.142.228]:50681 helo=localhost) by gator297.hostgator.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1KPpbn-0000uX-Rp; Sun, 03 Aug 2008 21:15:40 -0500 Date: Sun, 3 Aug 2008 19:14:29 -0700 From: Colin D Bennett To: The development of GRUB 2 Message-ID: <20080803191429.46c7d34e@gibibit.com> In-Reply-To: <20080803235348.GA23220@thorin> References: <20080623075438.5861e6d1@gibibit.com> <878wwi6bqy.fsf@xs4all.nl> <20080704112801.470827ea@gibibit.com> <87tzekiecu.fsf@xs4all.nl> <20080728100533.19118c0b@gibibit.com> <20080803194816.GA13744@thorin> <20080803235348.GA23220@thorin> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/rp4EZu/k8+hbzZ/N8r9zvYI"; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator297.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gibibit.com X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Cc: rmh@aybabtu.com Subject: Re: TSC on coreboot (Re: [PATCH] High resolution time/TSC patch v3) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Aug 2008 02:15:46 -0000 --Sig_/rp4EZu/k8+hbzZ/N8r9zvYI Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Mon, 4 Aug 2008 01:53:48 +0200 Robert Millan wrote: > 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 =3D grub_get_rtc (); > >=20 > > Ah, I see the problem. It calls grub_get_rtc() which in > > grub-coreboot is just a stub. > >=20 > > How about using the interval timer for calibration instead? >=20 > Here. With this patch your code works on coreboot too. >=20 > 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. >=20 > 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. So far we never use the value returned by ``grub_get_time_ms()`` as an absolute time. It is currently only used in relative terms, so only the rate at which it changes is important, not the definition of the zero point. Perhaps that simplifies things? I think it's fine to go with that definition for now -- if we need to use absolute time at some point, we can deal with it then. Regards, Colin --Sig_/rp4EZu/k8+hbzZ/N8r9zvYI Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkiWZggACgkQokx8fzcGbYcaZACeJIQ3K9/biL/v1v/rdyjXytp4 CFwAn1p5rXoMyatezmrwIOq4beQAaeO8 =4i1E -----END PGP SIGNATURE----- --Sig_/rp4EZu/k8+hbzZ/N8r9zvYI--