Path: blob/master/arch/powerpc/platforms/powernv/opal-wrappers.S
26481 views
/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* PowerNV OPAL API wrappers3*4* Copyright 2011 IBM Corp.5*/67#include <linux/jump_label.h>8#include <asm/ppc_asm.h>9#include <asm/hvcall.h>10#include <asm/asm-offsets.h>11#include <asm/opal.h>12#include <asm/asm-compat.h>13#include <asm/feature-fixups.h>1415.section ".text"1617/*18* r3-r10 - OPAL call arguments19* STK_PARAM(R11) - OPAL opcode20* STK_PARAM(R12) - MSR to restore21*/22_GLOBAL_TOC(__opal_call)23mflr r024std r0,PPC_LR_STKOFF(r1)25ld r12,STK_PARAM(R12)(r1)26li r0,MSR_IR|MSR_DR|MSR_LE27andc r12,r12,r028LOAD_REG_ADDR(r11, opal_return)29mtlr r1130LOAD_REG_ADDR(r11, opal)31ld r2,0(r11)32ld r11,8(r11)33mtspr SPRN_HSRR0,r1134mtspr SPRN_HSRR1,r1235/* set token to r0 */36ld r0,STK_PARAM(R11)(r1)37hrfid38opal_return:39/*40* Restore MSR on OPAL return. The MSR is set to big-endian.41*/42#ifdef __BIG_ENDIAN__43ld r11,STK_PARAM(R12)(r1)44mtmsrd r1145#else46/* Endian can only be switched with rfi, must byte reverse MSR load */47.short 0x4039 /* li r10,STK_PARAM(R12) */48.byte (STK_PARAM(R12) >> 8) & 0xff49.byte STK_PARAM(R12) & 0xff5051.long 0x280c6a7d /* ldbrx r11,r10,r1 */52.long 0x05009f42 /* bcl 20,31,$+4 */53.long 0xa602487d /* mflr r10 */54.long 0x14004a39 /* addi r10,r10,20 */55.long 0xa64b5a7d /* mthsrr0 r10 */56.long 0xa64b7b7d /* mthsrr1 r11 */57.long 0x2402004c /* hrfid */58#endif59LOAD_PACA_TOC()60ld r0,PPC_LR_STKOFF(r1)61mtlr r062blr636465