epapr_hcalls.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #include <linux/threads.h>
  10. #include <asm/epapr_hcalls.h>
  11. #include <asm/reg.h>
  12. #include <asm/page.h>
  13. #include <asm/cputable.h>
  14. #include <asm/thread_info.h>
  15. #include <asm/ppc_asm.h>
  16. #include <asm/asm-compat.h>
  17. #include <asm/asm-offsets.h>
  18. #include <asm/export.h>
  19. #ifndef CONFIG_PPC64
  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. wrteei 1
  27. idle_loop:
  28. LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
  29. .global epapr_ev_idle_start
  30. epapr_ev_idle_start:
  31. li r3, -1
  32. nop
  33. nop
  34. nop
  35. /*
  36. * Guard against spurious wakeups from a hypervisor --
  37. * only interrupt will cause us to return to LR due to
  38. * _TLF_NAPPING.
  39. */
  40. b idle_loop
  41. #endif
  42. /* Hypercall entry point. Will be patched with device tree instructions. */
  43. .global epapr_hypercall_start
  44. epapr_hypercall_start:
  45. li r3, -1
  46. nop
  47. nop
  48. nop
  49. blr
  50. EXPORT_SYMBOL(epapr_hypercall_start)