blob: 9f1ebf7338f1084499fcc03e50efa71b66a73b76 [file] [log] [blame]
Liu Yu-B132012e1ae9c2012-03-15 10:52:13 +00001/*
2 * Copyright (C) 2012 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <linux/threads.h>
Liu Yu-B132012f979de2012-07-03 05:48:53 +000011#include <asm/epapr_hcalls.h>
Liu Yu-B132012e1ae9c2012-03-15 10:52:13 +000012#include <asm/reg.h>
13#include <asm/page.h>
14#include <asm/cputable.h>
15#include <asm/thread_info.h>
16#include <asm/ppc_asm.h>
Liu Yu-B132012f979de2012-07-03 05:48:53 +000017#include <asm/asm-compat.h>
Liu Yu-B132012e1ae9c2012-03-15 10:52:13 +000018#include <asm/asm-offsets.h>
19
Stuart Yoderf0709862013-02-08 13:22:56 -060020#ifndef CONFIG_PPC64
Liu Yu-B132012f979de2012-07-03 05:48:53 +000021/* epapr_ev_idle() was derived from e500_idle() */
22_GLOBAL(epapr_ev_idle)
23 CURRENT_THREAD_INFO(r3, r1)
24 PPC_LL r4, TI_LOCAL_FLAGS(r3) /* set napping bit */
25 ori r4, r4,_TLF_NAPPING /* so when we take an exception */
26 PPC_STL r4, TI_LOCAL_FLAGS(r3) /* it will return to our caller */
27
28 wrteei 1
29
30idle_loop:
31 LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
32
33.global epapr_ev_idle_start
34epapr_ev_idle_start:
35 li r3, -1
36 nop
37 nop
38 nop
39
40 /*
41 * Guard against spurious wakeups from a hypervisor --
42 * only interrupt will cause us to return to LR due to
43 * _TLF_NAPPING.
44 */
45 b idle_loop
Stuart Yoderf0709862013-02-08 13:22:56 -060046#endif
Liu Yu-B132012f979de2012-07-03 05:48:53 +000047
Liu Yu-B132012e1ae9c2012-03-15 10:52:13 +000048/* Hypercall entry point. Will be patched with device tree instructions. */
49.global epapr_hypercall_start
50epapr_hypercall_start:
51 li r3, -1
52 nop
53 nop
54 nop
55 blr