Hi,
I need a software mechanism to reboot my system (MPC8323) and I tried the shutdown utility, but it show some exception
while rebooting and doesn't restart the system properly.
So, I decided to understand the following code taken from the directory given below
bsp-nto640-freescale-mpc8323e-rdb-trunk/src/hardware/startup/boards/mpc8323e-rdb
filename:- callout_reboot_8323rdb.s
.include "callout.ah"
patcher:
# R3: syspage paddr
# R4: syspage vaddr
# R5: rtn dst offset
# R6: r/w offset
# R7: patch data
# R8: rtn src
stwu %r1, -32(%r1)
mflr %r0
stw %r31, 28(%r1)
stw %r0, 36(%r1)
add %r31,%r3,%r5
loadi %r4, 0xF8000000
loadi %r3, 32
bl callout_io_map
sth %r3, 6(%r31)
srwi %r3,%r3, 16
sth %r3, 2(%r31)
lwz %r0, 36(%r1)
mtlr %r0
lwz %r31, 28(%r1)
addi %r1, %r1, 32
blr
CALLOUT_START reboot_mpc8323rdb, 0, patcher
lis %r4, 0x1234
ori %r4, %r4, 0x5678
#disable interrupts
loadi %r9,PPC_MSR_EE
mfmsr %r8
andc %r9,%r8,%r9
mtmsr %r9
isync
lbz %r0, 7(%r4)
rlwinm %r6, %r0, 0, 24, 30
stb %r6, 7(%r4)
1:
b 1b
CALLOUT_END reboot_mpc8323rdb
But while going through the code we didn't understand what is happenning in it. Plz answer the following querries about
the code.
a) Here, Patcher is providing an address to Callout, what is that address?
b) What is significance of address 28(%r1), 36(%r1), 6(%r31), 2(%r31), 7(%r4) in the code and what is the link of these
address with System Page Entries?
c) If possible please explain the complete flow.
Thanks,
Regards
Vijayraj