Liu Yu-B13201 | 2e1ae9c0 | 2012-03-15 10:52:13 +0000 | [diff] [blame] | 1 | /* |
| 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-B13201 | 2f979de | 2012-07-03 05:48:53 +0000 | [diff] [blame] | 11 | #include <asm/epapr_hcalls.h> |
Liu Yu-B13201 | 2e1ae9c0 | 2012-03-15 10:52:13 +0000 | [diff] [blame] | 12 | #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-B13201 | 2f979de | 2012-07-03 05:48:53 +0000 | [diff] [blame] | 17 | #include <asm/asm-compat.h> |
Liu Yu-B13201 | 2e1ae9c0 | 2012-03-15 10:52:13 +0000 | [diff] [blame] | 18 | #include <asm/asm-offsets.h> |
| 19 | |
Liu Yu-B13201 | 2f979de | 2012-07-03 05:48:53 +0000 | [diff] [blame] | 20 | /* epapr_ev_idle() was derived from e500_idle() */ |
| 21 | _GLOBAL(epapr_ev_idle) |
| 22 | CURRENT_THREAD_INFO(r3, r1) |
| 23 | PPC_LL r4, TI_LOCAL_FLAGS(r3) /* set napping bit */ |
| 24 | ori r4, r4,_TLF_NAPPING /* so when we take an exception */ |
| 25 | PPC_STL r4, TI_LOCAL_FLAGS(r3) /* it will return to our caller */ |
| 26 | |
| 27 | wrteei 1 |
| 28 | |
| 29 | idle_loop: |
| 30 | LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE)) |
| 31 | |
| 32 | .global epapr_ev_idle_start |
| 33 | epapr_ev_idle_start: |
| 34 | li r3, -1 |
| 35 | nop |
| 36 | nop |
| 37 | nop |
| 38 | |
| 39 | /* |
| 40 | * Guard against spurious wakeups from a hypervisor -- |
| 41 | * only interrupt will cause us to return to LR due to |
| 42 | * _TLF_NAPPING. |
| 43 | */ |
| 44 | b idle_loop |
| 45 | |
Liu Yu-B13201 | 2e1ae9c0 | 2012-03-15 10:52:13 +0000 | [diff] [blame] | 46 | /* Hypercall entry point. Will be patched with device tree instructions. */ |
| 47 | .global epapr_hypercall_start |
| 48 | epapr_hypercall_start: |
| 49 | li r3, -1 |
| 50 | nop |
| 51 | nop |
| 52 | nop |
| 53 | blr |