Port-powerpc archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: iBook suspend mode and assembly help
Hello,
On Wed, 22 Jun 2022 15:18:13 +0000
Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
> 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?
IIRC the kernel code and most (MM)IO space is BAT-mapped 1:1 on
machines that have BATs, otherwise we'd crash and burn when turning off
the MMU. So, that should be a NOP on NetBSD.
> 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?
I'm not sure about that, PowerPC MMU stuff breaks my brain. IIRC we
only really care about the first one since that's where the kernel code
lives.
have fun
Michael
Home |
Main Index |
Thread Index |
Old Index