All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* PowerBook sleep, first try
       [not found] <19990614114347.006593>
@ 1999-06-23  8:43 ` Benjamin Herrenschmidt
  1999-06-23 17:44   ` Josh Huber
  0 siblings, 1 reply; 7+ messages in thread
From: Benjamin Herrenschmidt @ 1999-06-23  8:43 UTC (permalink / raw
  To: linuxppc-dev; +Cc: kevyn, Paul.Mackerras, huberj


Hi !

I've uploaded a first-try implementation of sleep on PowerBook G3 Series
(Grackle/mac-io based). It's NOT functional yet, it still hangs when
waking up. However, it no longer resets the machine, so it looks like the
ROM code is correctly identifying the wakeup code when the CPU is powered
back on.

I would really appreciate if some people could review it and give me
their feeling about possible bugs and why it's currently not working. The
overall layout along with some strange hacks are directly reverse-eng.
from MacOS nanokernel (MacOS 8.6 version).

The code is at <http://calvaweb.calvacom.fr/bh40/sleep_test.tar.gz>, the
patches were made against a 2.2.9 vger kernel but should apply cleanly
(hum... mostly) on 2.2.10.

For those who didn't follow the whole story, when the PowerBook goes to
sleep, it actually shuts down the CPU (but not Grackle). There is some
code in the ROM reset vectors that detects that Grackle is not in it's
initial state. If it is not, it then looks for the magic value 'Lars' at
address 4 (physical). If found, it looks for a pointer at address 0. at
this pointer address, there's a pointer to the code to be executed.

So basically, just after we have sent the PMU sleep command (we then have
approx. 1/2 second to backup everything) we need to backup the CPU
context and store those magic values. The code also must make sure that
all those datas are properly flushed before the CPU is reset (I disable
the data cache to be sure). Apparently, we must also switch the CPU to
sleep mode (which in turn will put Grackle in NAP mode) and wait to be reset.
For unknown reasons, the MacOS code for that just re-enables the i-cache
and does some strange things around the sleep code. My code does approx.
the same. I've heard "rumors" about Grackle bugs that needed to be worked
around by Apple, I'm wondering if those strange tricks may be related to
those bugs, and in this case, if my fixes are correct.

According to an Apple eng. I met at WWDC, there is no need to save the
pci config registers, PCI devices are not turned off unless explicitely
done by their respective drivers.

Of course, we still lack a sleep notifier for devices like bmac, and the
hack I added to atyfb is probably not correct, but I want to get the core
operation to work first, and then spend time with the various devices.


-- 
           Perso. e-mail: <mailto:bh40@calva.net>
           Work   e-mail: <mailto:benh@mipsys.com>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>




[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PowerBook sleep, first try
@ 1999-06-23 13:08 Kevin Puetz
  1999-06-23 16:23 ` David A. Gatwood
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Puetz @ 1999-06-23 13:08 UTC (permalink / raw
  To: Benjamin Herrenschmidt, linuxppc-dev


Cool! Is there any hope of this working on the desktop machines that can 
sleep? (I like my machine getting quiet when not in use, though I can live
without.).

--
+--------------------------------------------------------------------+
|            .-'''''-.       Kevin Puetz                             |
|          .'   _/|   `.                                             |
|         :   =/_/      :    kp11901@cedarnet.org -preferred         |
|        :   _/ |        :   Kevin.Puetz@039-server.pls.uni.edu      |
|       (\  /  ,|        :   webmaster@039-server.pls.uni.edu        |
|        \\/^\/||__     :                                            |
|     _/~`~`""~`"` \_ .'  "Could you please continue the petty       |
|  __/  -'/  `-._ `\_\__   bickering?  I find it - most intriguing." |
|/     /-'`  `\   \  \-.\    --Data, STTNG, "Haven"                  |
+--------------------------------------------------------------------+

----------
>From: Benjamin Herrenschmidt <bh40@calva.net>
>To: linuxppc-dev@lists.linuxppc.ORG
>Cc: kevyn@apple.COM, Paul.Mackerras@cs.anu.edu.au, huberj@WPI.EDU
>Subject: PowerBook sleep, first try
>Date: Wed, Jun 23, 1999, 3:43 AM
>

>
> Hi !
>
> I've uploaded a first-try implementation of sleep on PowerBook G3 Series
> (Grackle/mac-io based). It's NOT functional yet, it still hangs when
> waking up. However, it no longer resets the machine, so it looks like the
> ROM code is correctly identifying the wakeup code when the CPU is powered
> back on.

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PowerBook sleep, first try
  1999-06-23 13:08 Kevin Puetz
@ 1999-06-23 16:23 ` David A. Gatwood
  1999-06-23 20:14   ` chris
  0 siblings, 1 reply; 7+ messages in thread
From: David A. Gatwood @ 1999-06-23 16:23 UTC (permalink / raw
  To: Kevin Puetz; +Cc: Benjamin Herrenschmidt, linuxppc-dev


On Wed, 23 Jun 1999, Kevin Puetz wrote:

> Cool! Is there any hope of this working on the desktop machines that can 
> sleep? (I like my machine getting quiet when not in use, though I can live
> without.).

A desktop sleep is pretty different from a PowerBook sleep.  When a
desktop machine is asleep, it can still services network requests, and is
essentially still running, it just shuts a few things down.  The key there
is to figure out how to spin down and spin up the hard drive without
getting confused by the long delay on data access.  Then, when you do a
desktop sleep, you just cut the video sync, spin down the drives, and set
it up so that if there's any access to the drive, you spin it up long
enough to do the access, then wait a few seconds for the access to finish,
then spin back down.  Presumably, there's other stuff dealing with the
ADB, as far as shutting down other unused hardware and putting the
processor in a low speed setting or something, but I have no idea there.
Somebody else with actual cuda knowledge could probably say more in that
department.


Later,
David


[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PowerBook sleep, first try
  1999-06-23  8:43 ` PowerBook sleep, first try Benjamin Herrenschmidt
@ 1999-06-23 17:44   ` Josh Huber
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Huber @ 1999-06-23 17:44 UTC (permalink / raw
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev


Still looking at the code, but I just thought I'd mention that I can't seem to get a kernel (Paul's 2.2.10) patched with your patches to boot using atyfb.  Right after the initial boot screen (before the linux console gets initialized, after bootx) the screen 'melts' away. This is the best description I have.

Looking at the changes to atyfb I can't see what could be causing this.  Perhaps someone who knows atyfb a little better could take a look?

Josh

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PowerBook sleep, first try
  1999-06-23 16:23 ` David A. Gatwood
@ 1999-06-23 20:14   ` chris
  0 siblings, 0 replies; 7+ messages in thread
From: chris @ 1999-06-23 20:14 UTC (permalink / raw
  To: linuxppc-dev



On Wed, 23 Jun 1999, David A. Gatwood wrote:

> 
> On Wed, 23 Jun 1999, Kevin Puetz wrote:
> 
> > Cool! Is there any hope of this working on the desktop machines that can 
> > sleep? (I like my machine getting quiet when not in use, though I can live
> > without.).
> 
> A desktop sleep is pretty different from a PowerBook sleep.  When a
> desktop machine is asleep, it can still services network requests, and is
> essentially still running, it just shuts a few things down.  The key there
> is to figure out how to spin down and spin up the hard drive without
> getting confused by the long delay on data access.  Then, when you do a
> desktop sleep, you just cut the video sync, spin down the drives, and set
> it up so that if there's any access to the drive, you spin it up long
> enough to do the access, then wait a few seconds for the access to finish,
> then spin back down.  Presumably, there's other stuff dealing with the
> ADB, as far as shutting down other unused hardware and putting the
> processor in a low speed setting or something, but I have no idea there.
> Somebody else with actual cuda knowledge could probably say more in that
> department.
> 
I've had good luck with using hdparm to set the timeout to spin down the
disk in my powerbook.  I imagine it should work for most other people with
ide drives.  also, I noticed a rather dramatic speed increase setting the
PIO mode to 4, and "set IDE 32-bit IO setting"..  namely:

hdparm -S 5 /dev/hda  # sets standby timeout to 25 seconds..
hdparm -c 1 /dev/hda  # 32-bit transfer mode
hdparm -p 4 /dev/hda  # PIO mode 4
  or
hdparm -S 5 -c 1 -p 4 /dev/hda

there's all sorts of other options in there too, but they didn't seem to
make that much of a difference to me..  and note that I stopped using the
standby option as I was getting tired of listening to the disk spin up and
down, but that's how to do it if anyone cares..

ttyl,
  chris

> 
> Later,
> David
> 



[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PowerBook sleep, first try
@ 1999-06-24 23:17 Jonathan Levi, M.D.
  1999-06-25 11:45 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Levi, M.D. @ 1999-06-24 23:17 UTC (permalink / raw
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, kevyn, Paul.Mackerras, huberj


At 10:43 AM 6/23/99, Benjamin Herrenschmidt wrote:
>I've uploaded a first-try implementation of sleep on PowerBook G3 Series..
>I would really appreciate if some people could review it...

Should PB1400- and 5300-users try it too, or just G3-users?

Jonathan



[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PowerBook sleep, first try
  1999-06-24 23:17 Jonathan Levi, M.D.
@ 1999-06-25 11:45 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 1999-06-25 11:45 UTC (permalink / raw
  To: Jonathan Levi, M.D., linuxppc-dev


On Thu, Jun 24, 1999, Jonathan Levi, M.D. <drjlevi@netonecom.net> wrote:

>>I've uploaded a first-try implementation of sleep on PowerBook G3 Series..
>>I would really appreciate if some people could review it...
>
>Should PB1400- and 5300-users try it too, or just G3-users?

It's for linuxppc and is only useful to G3 Series users since those
machines have a different sleep mecanism.

Note: Please don't answer to all the recipients of the original message.

-- 
           Perso. e-mail: <mailto:bh40@calva.net>
           Work   e-mail: <mailto:benh@mipsys.com>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>




[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1999-06-25 11:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <19990614114347.006593>
1999-06-23  8:43 ` PowerBook sleep, first try Benjamin Herrenschmidt
1999-06-23 17:44   ` Josh Huber
1999-06-23 13:08 Kevin Puetz
1999-06-23 16:23 ` David A. Gatwood
1999-06-23 20:14   ` chris
  -- strict thread matches above, loose matches on Subject: below --
1999-06-24 23:17 Jonathan Levi, M.D.
1999-06-25 11:45 ` Benjamin Herrenschmidt

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.