2 * PowerNV OPAL takeover assembly code, for use by prom_init.c
4 * Copyright 2011 IBM Corp.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #include <asm/ppc_asm.h>
13 #include <asm/hvcall.h>
14 #include <asm/asm-offsets.h>
17 #define STK_PARAM(i) (48 + ((i)-3)*8)
19 #define H_HAL_TAKEOVER 0x5124
20 #define H_HAL_TAKEOVER_QUERY_MAGIC -1
23 _GLOBAL(opal_query_takeover)
26 std r3,STK_PARAM(r3)(r1)
27 std r4,STK_PARAM(r4)(r1)
29 li r4,H_HAL_TAKEOVER_QUERY_MAGIC
31 ld r10,STK_PARAM(r3)(r1)
33 ld r10,STK_PARAM(r4)(r1)
39 _GLOBAL(opal_do_takeover)
64 .globl opal_secondary_entry
68 li r12,(MSR_SF | MSR_ISF)@highest
84 _GLOBAL(opal_enter_rtas)
87 stdu r1,-PROM_FRAME_SIZE(r1) /* Save SP and create stack space */
89 /* Because PROM is running in 32b mode, it clobbers the high order half
90 * of all registers that it saves. We therefore save those registers
91 * PROM might touch to the stack. (r0, r3-r13 are caller saved)
102 /* Get the PROM entrypoint */
105 /* Switch MSR to 32 bits mode
108 rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG)
111 rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
116 /* Enter RTAS here... */
119 /* Just make sure that r1 top 32 bits didn't get
124 /* Restore the MSR (back to 64 bits) */
129 /* Restore other registers */
137 addi r1,r1,PROM_FRAME_SIZE