Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

iBook suspend mode and assembly help



Hello

As told here, I try to implemnt suspend mode support for Apple iBook G4:
http://mail-index.netbsd.org/port-macppc/2022/05/15/msg002981.html

The easy part is to setup the PMU, that seems to work. There is also
a quite long (at least for me) routine in PowerPC assembly to prepare
sleep and to wake up. It can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/powerpc/platforms/powermac/sleep.S

The authors agreed to re-license the code as 2-clause BSD and I got it 
building. Of course that does not means it works. I need some help 
with PowerPC specific stuff. Let us consider that:

	/* Setup stuffs at 0x80-0x84 for Core99 */
	lis	r3,core99_wake_up@ha
	addi	r3,r3,core99_wake_up@l
	tophys(r3,r3)
	stw	r3,0x80(r4)
	stw	r5,0x84(r4)

Linux defines tophys by #define tophys(rd, rs)  addis   rd, rs, -PAGE_OFFSET@h
NetBSD vtophys seems much more complicated, is the equivalent I should
call?

Then there is:
	/* Restore the kernel's segment registers before
	 * we do any r1 memory access as we are not sure they
	 * are in a sane state above the first 256Mb region
	 */
	bl	load_segment_registers

That is defined in linux/arch/powerpc/kernel/head_32.S
The closest thing I find in NetBSD powerpc code is RESTORE_KERN_SRS
Is it the right direction?

There is more, but this is certainly the first showstopper.

-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index