9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: arisawa@ar.aichi-u.ac.jp arisawa@ar.aichi-u.ac.jp
Subject: [9fans] AMD cpu detection
Date: Tue, 22 Feb 2000 09:01:11 +0900	[thread overview]
Message-ID: <20000222000111.hAEuMIJRrxJWbPmmaqri3c3XaYc14CdmjEADiTzUJ-0@z> (raw)

Hello 9fans,

I received a mail from Jim.
His patch to:
	/sys/src/9/pc/clock.c
	/sys/src/fs/pc/8253.c
fixed the problem with the CPU speed being unsteady.

Thanks Jim.

Kenji Arisawa
E-mail: arisawa@aichi-u.ac.jp

From: jmk@plan9.bell-labs.com
Subject: Re: [9fans] Re: b.com from fd
Date: Mon, 21 Feb 2000 11:45:30 -0500
To: arisawa@aichi-u.ac.jp

Here's something which might fix your problem with the CPU speed
being unsteady. This code is from our current fileserver kernel and goes
in 8253.c/clockinit:

	...
	/*
	 *  set clock for 1/HZ seconds
	 */
	outb(Tmode, Load0|Square);
	outb(T0cntr, (Freq/HZ));	/* low byte */
	outb(T0cntr, (Freq/HZ)>>8);	/* high byte */

	/*
	 * Introduce a little delay to make sure the count is
	 * latched and the timer is counting down; with a fast
	 * enough processor this may not be the case.
	 * The i8254 (which this probably is) has a read-back
	 * command which can be used to make sure the counting
	 * register has been written into the counting element.
	 */
	x = (Freq/HZ);
	for(loops = 0; loops < 100000 && x >= (Freq/HZ); loops++){
		outb(Tmode, Latch0);
		x = inb(T0cntr);
		x |= inb(T0cntr)<<8;
	}

	/* find biggest loop that doesn't wrap */
	...

I admit to not having tried this on a non-Intel processor. The delay is
also necessary in the terminal/cpuserver kernels.
If that fixes your problem, let me know and feel free to post the fix
to 9fans.

By the way, the x86amd[] table values for the Athlon are the same as
for the K6:
	{ 6,	1,	11,	"AMD-Athlon", },/* trial and error */
	{ 6,	2,	11,	"AMD-Athlon", },/* trial and error */
I have a 700MHz Athlon with an ASUS K7M motherboard; it's quite refreshing
to see not a single Intel chip in the system.

--jim




             reply	other threads:[~2000-02-22  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-22  0:01 arisawa [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-04-29 14:45 jim
1998-04-29  5:29 forsyth
1998-04-29  2:56 jim

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=20000222000111.hAEuMIJRrxJWbPmmaqri3c3XaYc14CdmjEADiTzUJ-0@z \
    --to=arisawa@ar.aichi-u.ac.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).