Skip to contentSkip to conversation

Sleeping the powerbook G3 (small progress)

DISCUSSION Benjamin Herrenschmidt 1 participant 1 message Jun 18, 1999 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 19990618195918.021366

#1 lore raw
Quoted 3 lines · Benjamin Herrenschmidt
Quoted 3 lines

if(*(addr+4) != magic_word) return;
*(addr+4) = 0;
branch to **addr;

Apparently, that's it, we need to put 'Lars' at address 4 (physical) and a pointer to a function pointer at address 0. Since the kernel's own entrypoint is located at those addresses, it should be harmless to overwrite them.

So basically, to enable sleep, we should, just after sending the PMU sleep command (the PMU will wait a little bit before shutting you down, around 1 second I think), backup a complete CPU context along with SPRs (BATs, segment regs, latest TB value, DEC value, ....), put a physical pointer to a structure containing the physical pointer to the restore code first, and the backup infos just after, at address 0, 'Lars' and then wait to be shutdown.
The restore code will read at 0 to get the pointer to the structure, restore the registers and, last, re-enable the MMU and jump back to the sleep code.

If you don't have time to experient with actual coding, tell me, I'll try this, but I won't have time myself until one or two weeks from now.

Signature · 11 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
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.   ]]