Current-Users archive

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

patch for sys/arch/macppc/stand/ofwboot/Locore.c



Hi,
Please consider replacing the starting code with the following one so
that ofwboot.xcf can boot on PowerMac machines with PPC601 cpu
installed.
The change touches the second _asm snippet.retaining the first one intact.
The file is /usr/src/sys/arch/macppc/stand/ofwboot/Locore.c
I am sending a complete source instead of a usual diff -u so that it
can be easier to verify what the code in fact does. The code is based
on several posts to port-macppc in 2005 .

__asm(
"       .text                   \n"
"       .globl  _start          \n"
"_start:                        \n"
"       sync                    \n"
"       isync                   \n"
"       lis     %r1,stack@ha    \n"
"       addi    %r1,%r1,stack@l \n"
"       addi    %r1,%r1,8192    \n"
"                               \n"
"       mfmsr   %r8             \n"
"       li      %r0,0           \n"
"       mtmsr   %r0             \n"
"       isync                   \n"
"                               \n" /* test for 601 */
"       mfspr   %r0,287         \n" /* mfpvr %r0 PVR = 287 */
"       srwi    %r0,%r0,0x10    \n"
"       cmpi    0,1,%r0,0x02    \n" /* 601 CPU = 0x0001 */
"       blt     1f              \n" /* skip over non-601 BAT setup */
                                
        /*non PPC 601 BATs*/
"       mtibatu 0,%r0           \n"
"       mtibatu 1,%r0           \n"
"       mtibatu 2,%r0           \n"
"       mtibatu 3,%r0           \n"
"       mtdbatu 0,%r0           \n"
"       mtdbatu 1,%r0           \n"
"       mtdbatu 2,%r0           \n"
"       mtdbatu 3,%r0           \n"
"                               \n"
"       li      %r9,0x12        \n"     /* BATL(0, BAT_M, BAT_PP_RW) */
"       mtibatl 0,%r9           \n"
"       mtdbatl 0,%r9           \n"
"       li      %r9,0x1ffe      \n"     /* BATU(0, BAT_BL_256M, BAT_Vs) */
"       mtibatu 0,%r9           \n"
"       mtdbatu 0,%r9           \n"
"       b 2f                    \n"
        
        /* PPC 601 BATs*/

"1:     mtibatu 0,%r0           \n"
"       mtibatu 1,%r0           \n"
"       mtibatu 2,%r0           \n"
"       mtibatu 3,%r0           \n"
"                               \n"
"       li      %r9,0x7f        \n"
"       mtibatl 0,%r9           \n"
"       li      %r9,0x1a        \n"
"       mtibatu 0,%r9           \n"
"                               \n"
"       lis %r9,0x80            \n"
"       addi %r9,%r9,0x7f       \n"
"       mtibatl 1,%r9           \n"
"       lis %r9,0x80            \n"
"       addi %r9,%r9,0x1a       \n"
"       mtibatu 1,%r9           \n"
"                               \n"
"       lis %r9,0x100           \n"
"       addi %r9,%r9,0x7f       \n"
"       mtibatl 2,%r9           \n"
"       lis %r9,0x100           \n"
"       addi %r9,%r9,0x1a       \n"
"       mtibatu 2,%r9           \n"
"                               \n"
"       lis %r9,0x180           \n"
"       addi %r9,%r9,0x7f       \n"
"       mtibatl 3,%r9           \n"
"       lis %r9,0x180           \n"
"       addi %r9,%r9,0x1a       \n"
"       mtibatu 3,%r9           \n"
"                               \n"
"2:     isync                   \n"
"                               \n"
"       mtmsr   %r8             \n"
"       isync                   \n"
"                               \n"
        /*
         * Make sure that .bss is zeroed
         */
"                               \n"
"       li      %r0,0           \n"
"       lis     %r8,_edata@ha   \n"
"       addi    %r8,%r8,_edata@l\n"
"       lis     %r9,_end@ha     \n"
"       addi    %r9,%r9,_end@l  \n"
"                               \n"
"5:     cmpw    0,%r8,%r9       \n"
"       bge     6f              \n"
"       stw     %r0,0(%r8)      \n"
"       addi    %r8,%r8,4       \n"
"       b       5b              \n"
"                               \n"
"6:     b       startup         \n"
);


Home | Main Index | Thread Index | Old Index