All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Paubert <paubert@iram.es>
To: Chris Studholme <cvs@cs.utoronto.ca>
Cc: linuxppc-dev@lists.linuxppc.org,
	Terry Greeniaus <tgree@phys.ualberta.ca>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: pismo upgraded to 750fx not detected correctly
Date: Mon, 23 Jun 2003 10:27:51 +0200	[thread overview]
Message-ID: <20030623082751.GA2738@iram.es> (raw)
In-Reply-To: <Pine.LNX.4.44.0306230032020.17411-100000@stoa.dhs.org>


On Mon, Jun 23, 2003 at 12:47:56AM -0400, Chris Studholme wrote:
>
> On Sun, 22 Jun 2003, Benjamin Herrenschmidt wrote:
> > Note that the kernel doesn't use the device tree to detect the
> > CPU type. It rather runs the PVR through a table in
> > arch/ppc/kernel/cputable.c. There is currently no hook you could
> > use to 'fix' that. Ideally, you should make sure the CPU is properly
> > detected before the fixups are done or you may "lose" some 750fx
> > specific code.
>
> Ok, so to properly detect the cpu, I ported Terry's code to assembler and
> added it to identify_cpu in arch/ppc/kernel/misc.S.  See the attached diff
> below.  This code does the following:
>
> - detects 750FX strapped as 750 in identify_cpu
> - stores the real pvr is a new global called 'real_pvr'
> - updates the cache and clock_frequency values in the device tree at the
>   end of finish_device_tree() in prom.c
> - makes use of real_pvr instead of mfspr(PVR) in show_cpuinfo() in setup.c
>
> Note that I currently hardcode the clock frequency to 900MHz (speed of my
> pismo).  I'll fix that as soon as I learn how to detect the true processor
> speed.
>
> For a complete solution, I believe all that needs to be done is to change
> all instances of 'mfspr(PVR)' to 'real_pvr', except the one in prom.c.
>
> Also, I just learned ppc assembler today while doing this so please let me
> know if you see a more efficient/eloquent way to do the cpu detection, or
> if you find a bug in what I have.  I've only tested this on my upgraded
> pismo and it seems to work.  Here's my /proc/cpuinfo now:
>
>   cpu             : 750FX
>   temperature     : 18-20 C (uncalibrated)
>   clock           : 900MHz
>   revision        : 2.2 (pvr 7000 0202)
>   bogomips        : 1795.68
>   machine         : PowerBook3,1
>   motherboard     : PowerBook3,1 MacRISC2 MacRISC Power Macintosh
>   detected as     : 70 (PowerBook Pismo)
>   pmac flags      : 0000000f
>   L2 cache        : 512K unified
>   memory          : 256MB
>   pmac-generation : NewWorld
>
> Chris.
>
>
> diff -c -r linux-2.4.21-ac1.orig/arch/ppc/kernel/cputable.c linux-2.4.21-ac1/arch/ppc/kernel/cputable.c
> *** linux-2.4.21-ac1.orig/arch/ppc/kernel/cputable.c	Fri Jun 13 10:51:31 2003
> --- linux-2.4.21-ac1/arch/ppc/kernel/cputable.c	Sun Jun 22 21:10:37 2003
> ***************
> *** 18,23 ****
> --- 18,25 ----
>
>   struct cpu_spec* cur_cpu_spec[NR_CPUS];
>
> + unsigned int real_pvr;
> +
>   extern void __setup_cpu_601(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
>   extern void __setup_cpu_603(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
>   extern void __setup_cpu_604(unsigned long offset, int cpu_nr, struct cpu_spec* spec);
> diff -c -r linux-2.4.21-ac1.orig/arch/ppc/kernel/misc.S linux-2.4.21-ac1/arch/ppc/kernel/misc.S
> *** linux-2.4.21-ac1.orig/arch/ppc/kernel/misc.S	Fri Jun 13 10:51:31 2003
> --- linux-2.4.21-ac1/arch/ppc/kernel/misc.S	Sun Jun 22 21:25:32 2003
> ***************
> *** 113,118 ****
> --- 113,139 ----
>   	addis	r8,r3,cpu_specs@ha
>   	addi	r8,r8,cpu_specs@l
>   	mfpvr	r7
> +
> + /* check for 750fx strapped on as 750 */
> + 	srwi	r6,r7,16
> + 	cmpli	0,r6,8
> + 	bne	1f
> + 	mfspr	r5,0x3F1
> + 	srwi.	r6,r5,17
> + 	bso	2f

Are you sure you want to test the summary overflow bit
in this branch ? This bit is not related to the result
of the preceding srwi. instruction, so this looks
strange to say the least.


> + 	xori	r6,r5,0x0200
> + 	b	3f
> + 2:
> + 	xori	r6,r5,0x0002
> + 3:
> + 	mtspr	0x3F1,r6
> + 	mfspr	r6,0x3F1
> + 	cmplw	0,r5,r6
> + 	beq	1f
> +
> + /* pvr is actually 0x7000nnnn, not 0x0008nnnn */
> + 	xoris	r7,r7,0x7008
> +
>   1:
>   	lwz	r5,CPU_SPEC_PVR_MASK(r8)
>   	and	r5,r5,r7
> ***************
> *** 127,132 ****
> --- 148,158 ----
>   	slwi	r4,r4,2
>   	sub	r8,r8,r3
>   	stwx	r8,r4,r6
> +
> + 	addis	r6,r3,real_pvr@ha
> + 	addi	r6,r6,real_pvr@l
> + 	stwx	r7,0,r6

A bit convoluted no? r3 is supposed to be zero, so
the standard way of performing this is:

	lis r6,real_pvr@ha
	stw r7,real_pvr@l(r6)

> +
>   	blr
>

The rest looks fine, but I can't test it and did not check
the details of the boring C code.

	Regards,
	Gabriel


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

  reply	other threads:[~2003-06-23  8:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200306200459.XAA31217@lists.linuxppc.org>
2003-06-20  5:53 ` pismo upgraded to 750fx not detected correctly Terry Greeniaus
2003-06-21 15:58   ` Chris Studholme
2003-06-22  9:49     ` Benjamin Herrenschmidt
2003-06-22 21:58       ` Terry Greeniaus
2003-06-23  6:01         ` Benjamin Herrenschmidt
2003-06-23  4:47       ` Chris Studholme
2003-06-23  8:27         ` Gabriel Paubert [this message]
2003-06-23 17:16           ` Chris Studholme
2003-06-24  8:18             ` Gabriel Paubert
2003-06-23 17:46           ` Benjamin Herrenschmidt
2003-06-26 17:02       ` how to setup PLL1 on 750FX Chris Studholme
2003-06-26 17:33         ` Terry Greeniaus
2003-06-26 20:47           ` Chris Studholme
2003-06-27 11:37             ` Benjamin Herrenschmidt
2003-06-28  3:05               ` Chris Studholme
2003-06-28  8:23                 ` Benjamin Herrenschmidt
2003-06-30 18:57                   ` Chris Studholme
2003-07-01  9:52                     ` Benjamin Herrenschmidt
     [not found] <200306130459.XAA18908@lists.linuxppc.org>
2003-06-13  5:44 ` pismo upgraded to 750fx not detected correctly Terry Greeniaus
2003-06-19 18:18   ` Chris Studholme
2003-06-12 20:05 Chris Studholme

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=20030623082751.GA2738@iram.es \
    --to=paubert@iram.es \
    --cc=benh@kernel.crashing.org \
    --cc=cvs@cs.utoronto.ca \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=tgree@phys.ualberta.ca \
    /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.