sigp.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * include/asm-s390/sigp.h
  3. *
  4. * S390 version
  5. * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
  6. * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
  7. * Martin Schwidefsky (schwidefsky@de.ibm.com)
  8. * Heiko Carstens (heiko.carstens@de.ibm.com)
  9. *
  10. * sigp.h by D.J. Barrow (c) IBM 1999
  11. * contains routines / structures for signalling other S/390 processors in an
  12. * SMP configuration.
  13. */
  14. #ifndef __SIGP__
  15. #define __SIGP__
  16. #include <asm/ptrace.h>
  17. #include <asm/atomic.h>
  18. /* get real cpu address from logical cpu number */
  19. extern volatile int __cpu_logical_map[];
  20. typedef enum
  21. {
  22. sigp_unassigned=0x0,
  23. sigp_sense,
  24. sigp_external_call,
  25. sigp_emergency_signal,
  26. sigp_start,
  27. sigp_stop,
  28. sigp_restart,
  29. sigp_unassigned1,
  30. sigp_unassigned2,
  31. sigp_stop_and_store_status,
  32. sigp_unassigned3,
  33. sigp_initial_cpu_reset,
  34. sigp_cpu_reset,
  35. sigp_set_prefix,
  36. sigp_store_status_at_address,
  37. sigp_store_extended_status_at_address
  38. } sigp_order_code;
  39. typedef __u32 sigp_status_word;
  40. typedef enum
  41. {
  42. sigp_order_code_accepted=0,
  43. sigp_status_stored,
  44. sigp_busy,
  45. sigp_not_operational
  46. } sigp_ccode;
  47. /*
  48. * Definitions for the external call
  49. */
  50. /* 'Bit' signals, asynchronous */
  51. typedef enum
  52. {
  53. ec_schedule=0,
  54. ec_call_function,
  55. ec_call_function_single,
  56. ec_bit_last
  57. } ec_bit_sig;
  58. /*
  59. * Signal processor
  60. */
  61. static inline sigp_ccode
  62. signal_processor(__u16 cpu_addr, sigp_order_code order_code)
  63. {
  64. register unsigned long reg1 asm ("1") = 0;
  65. sigp_ccode ccode;
  66. asm volatile(
  67. " sigp %1,%2,0(%3)\n"
  68. " ipm %0\n"
  69. " srl %0,28\n"
  70. : "=d" (ccode)
  71. : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
  72. "a" (order_code) : "cc" , "memory");
  73. return ccode;
  74. }
  75. /*
  76. * Signal processor with parameter
  77. */
  78. static inline sigp_ccode
  79. signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
  80. {
  81. register unsigned int reg1 asm ("1") = parameter;
  82. sigp_ccode ccode;
  83. asm volatile(
  84. " sigp %1,%2,0(%3)\n"
  85. " ipm %0\n"
  86. " srl %0,28\n"
  87. : "=d" (ccode)
  88. : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
  89. "a" (order_code) : "cc" , "memory");
  90. return ccode;
  91. }
  92. /*
  93. * Signal processor with parameter and return status
  94. */
  95. static inline sigp_ccode
  96. signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
  97. sigp_order_code order_code)
  98. {
  99. register unsigned int reg1 asm ("1") = parameter;
  100. sigp_ccode ccode;
  101. asm volatile(
  102. " sigp %1,%2,0(%3)\n"
  103. " ipm %0\n"
  104. " srl %0,28\n"
  105. : "=d" (ccode), "+d" (reg1)
  106. : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
  107. : "cc" , "memory");
  108. *statusptr = reg1;
  109. return ccode;
  110. }
  111. #endif /* __SIGP__ */