sigp.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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_bit_last
  56. } ec_bit_sig;
  57. /*
  58. * Signal processor
  59. */
  60. static inline sigp_ccode
  61. signal_processor(__u16 cpu_addr, sigp_order_code order_code)
  62. {
  63. register unsigned long reg1 asm ("1") = 0;
  64. sigp_ccode ccode;
  65. asm volatile(
  66. " sigp %1,%2,0(%3)\n"
  67. " ipm %0\n"
  68. " srl %0,28\n"
  69. : "=d" (ccode)
  70. : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
  71. "a" (order_code) : "cc" , "memory");
  72. return ccode;
  73. }
  74. /*
  75. * Signal processor with parameter
  76. */
  77. static inline sigp_ccode
  78. signal_processor_p(__u32 parameter, __u16 cpu_addr, sigp_order_code order_code)
  79. {
  80. register unsigned int reg1 asm ("1") = parameter;
  81. sigp_ccode ccode;
  82. asm volatile(
  83. " sigp %1,%2,0(%3)\n"
  84. " ipm %0\n"
  85. " srl %0,28\n"
  86. : "=d" (ccode)
  87. : "d" (reg1), "d" (__cpu_logical_map[cpu_addr]),
  88. "a" (order_code) : "cc" , "memory");
  89. return ccode;
  90. }
  91. /*
  92. * Signal processor with parameter and return status
  93. */
  94. static inline sigp_ccode
  95. signal_processor_ps(__u32 *statusptr, __u32 parameter, __u16 cpu_addr,
  96. sigp_order_code order_code)
  97. {
  98. register unsigned int reg1 asm ("1") = parameter;
  99. sigp_ccode ccode;
  100. asm volatile(
  101. " sigp %1,%2,0(%3)\n"
  102. " ipm %0\n"
  103. " srl %0,28\n"
  104. : "=d" (ccode), "+d" (reg1)
  105. : "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
  106. : "cc" , "memory");
  107. *statusptr = reg1;
  108. return ccode;
  109. }
  110. #endif /* __SIGP__ */