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 H_HAL_TAKEOVER 0x5124
18 #define H_HAL_TAKEOVER_QUERY_MAGIC -1
21 _GLOBAL(opal_query_takeover)
24 std r3,STK_PARAM(R3)(r1)
25 std r4,STK_PARAM(R4)(r1)
27 li r4,H_HAL_TAKEOVER_QUERY_MAGIC
29 ld r10,STK_PARAM(R3)(r1)
31 ld r10,STK_PARAM(R4)(r1)
37 _GLOBAL(opal_do_takeover)
62 .globl opal_secondary_entry
66 li r12,(MSR_SF | MSR_ISF)@highest
82 _GLOBAL(opal_enter_rtas)
85 stdu r1,-PROM_FRAME_SIZE(r1) /* Save SP and create stack space */
87 /* Because PROM is running in 32b mode, it clobbers the high order half
88 * of all registers that it saves. We therefore save those registers
89 * PROM might touch to the stack. (r0, r3-r13 are caller saved)
100 /* Get the PROM entrypoint */
103 /* Switch MSR to 32 bits mode
106 rldicr r12,r12,MSR_SF_LG,(63-MSR_SF_LG)
109 rldicr r12,r12,MSR_ISF_LG,(63-MSR_ISF_LG)
114 /* Enter RTAS here... */
117 /* Just make sure that r1 top 32 bits didn't get
122 /* Restore the MSR (back to 64 bits) */
127 /* Restore other registers */
135 addi r1,r1,PROM_FRAME_SIZE