Subject: Re: Powerbook G4 Performace
To: Graham J Lee <leeg@teaching.physics.ox.ac.uk>
From: Michael Lorenz <macallan@netbsd.org>
List: port-macppc
Date: 03/09/2006 11:00:31
--Signature_Thu__9_Mar_2006_11_00_31_-0500_OsQV8I03UgzTGgvT
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Hello,

> >> My powerbook is quite slow too: the proc does not run as the
> >> desired speed: dmesg says
> >>
> >> cpu0: 668.73 MHz, 512KB L2 cache
> >>
> >> when the cpu should run twice as fast...
> >
> > That's - sadly - quite normal. Apple used at least two different =20
> > ways to
> > control CPU speed - by switching bus clock and by having the PMU
> > manipulate the core clock frequency. I have a patch sitting around =20
> > which
> > supports the former method on my iBook G4 ( early 2004, it doesn't =20
> > work
> > on later models where the CPU runs at more than 800MHz ).
> > The reason why this happens is that the firmware doesn't start up
> > the CPU at full speed and NetBSD just uses what it finds.
> >
> > To fix this Someone(tm) will have to dig through the Darwin source,=20
> >=20
> > find
> > the part that controls CPU clock via PMU and then adapt our PMU
> > code.
>=20
> As Someone(tm) who's been spending a lot of time reading Darwin =20
> sources of late, I can tell you that starts in AppleMacRISC2PE; have =20
> a look at MacRISC2CPU.{h,cpp}; then have a look at iokit/Kernel/=20
> IOPMrootDomain.cpp in xnu.

Yes, that's where it happens.
My problem is that I don't have that much time to hack the iBook and I'm
not even 100% sure it supports the PMU method so I picked the easier way
( bus clock via gpio ) and just added a sysctl knob to switch between
'slow' and 'fast'.

> As Someone(tm) who doesn't really know NetBSD I've got no idea how =20
> you'd implement that (nor indeed whether the Darwin sources =20
> completely specify the appropriate code, I believe they do though).

Right now there's no power management framework in place that could do
things like lowering CPU speed when it's getting too hot, all we have is
a way to program different thresholds into some fan controllers to keep
the unit (sort of) cool.

have fun
Michael

--Signature_Thu__9_Mar_2006_11_00_31_-0500_OsQV8I03UgzTGgvT
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (NetBSD)

iQEVAwUBRBBRH8pnzkX8Yg2nAQIf1gf/de0E57HoAcikpkwcG7rbo0elJ54J6H8w
OWzWcFdQL3vCA0TwIUysPTyQb+mEl3RYcgizlfsS1HLyogvoAy09dqtUGj3OvBhU
jVOPtMasXa+5pxXsnFQJvJNKM75LUPwItzv9mLXVIYH6tlkvcFmHGjvrFHO/pHna
qnTMwTGOBc0e4IVmfbBi9CcFmYXAq29JmajbLa99Eru7P8IjkajQdSPxhN5zR2Vg
x7WTMnsnFPkSJNUMh8zSq7uo2K/8SUBKVOlWZNZ03TxzNL36HhFL7yp7RU7DR/yE
GcTMio/if3/WDJwx8hESTJaHvJDLt+rS7f0tU6UBQt9R9rDYTJr7Gw==
=JmZW
-----END PGP SIGNATURE-----

--Signature_Thu__9_Mar_2006_11_00_31_-0500_OsQV8I03UgzTGgvT--