HvLpEvent.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * HvLpEvent.h
  3. * Copyright (C) 2001 Mike Corrigan IBM Corporation
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. /* This file contains the class for HV events in the system. */
  20. #ifndef _HVLPEVENT_H
  21. #define _HVLPEVENT_H
  22. #include <asm/types.h>
  23. #include <asm/ptrace.h>
  24. #include <asm/iSeries/HvTypes.h>
  25. #include <asm/iSeries/HvCallEvent.h>
  26. /*
  27. * HvLpEvent is the structure for Lp Event messages passed between
  28. * partitions through PLIC.
  29. */
  30. struct HvEventFlags {
  31. u8 xValid:1; /* Indicates a valid request x00-x00 */
  32. u8 xRsvd1:4; /* Reserved ... */
  33. u8 xAckType:1; /* Immediate or deferred ... */
  34. u8 xAckInd:1; /* Indicates if ACK required ... */
  35. u8 xFunction:1; /* Interrupt or Acknowledge ... */
  36. };
  37. struct HvLpEvent {
  38. struct HvEventFlags xFlags; /* Event flags x00-x00 */
  39. u8 xType; /* Type of message x01-x01 */
  40. u16 xSubtype; /* Subtype for event x02-x03 */
  41. u8 xSourceLp; /* Source LP x04-x04 */
  42. u8 xTargetLp; /* Target LP x05-x05 */
  43. u8 xSizeMinus1; /* Size of Derived class - 1 x06-x06 */
  44. u8 xRc; /* RC for Ack flows x07-x07 */
  45. u16 xSourceInstanceId; /* Source sides instance id x08-x09 */
  46. u16 xTargetInstanceId; /* Target sides instance id x0A-x0B */
  47. union {
  48. u32 xSubtypeData; /* Data usable by the subtype x0C-x0F */
  49. u16 xSubtypeDataShort[2]; /* Data as 2 shorts */
  50. u8 xSubtypeDataChar[4]; /* Data as 4 chars */
  51. } x;
  52. u64 xCorrelationToken; /* Unique value for source/type x10-x17 */
  53. };
  54. typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *);
  55. /* Register a handler for an event type - returns 0 on success */
  56. extern int HvLpEvent_registerHandler(HvLpEvent_Type eventType,
  57. LpEventHandler hdlr);
  58. /*
  59. * Unregister a handler for an event type
  60. *
  61. * This call will sleep until the handler being removed is guaranteed to
  62. * be no longer executing on any CPU. Do not call with locks held.
  63. *
  64. * returns 0 on success
  65. * Unregister will fail if there are any paths open for the type
  66. */
  67. extern int HvLpEvent_unregisterHandler(HvLpEvent_Type eventType);
  68. /*
  69. * Open an Lp Event Path for an event type
  70. * returns 0 on success
  71. * openPath will fail if there is no handler registered for the event type.
  72. * The lpIndex specified is the partition index for the target partition
  73. * (for VirtualIo, VirtualLan and SessionMgr) other types specify zero)
  74. */
  75. extern int HvLpEvent_openPath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
  76. /*
  77. * Close an Lp Event Path for a type and partition
  78. * returns 0 on sucess
  79. */
  80. extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
  81. #define HvLpEvent_Type_Hypervisor 0
  82. #define HvLpEvent_Type_MachineFac 1
  83. #define HvLpEvent_Type_SessionMgr 2
  84. #define HvLpEvent_Type_SpdIo 3
  85. #define HvLpEvent_Type_VirtualBus 4
  86. #define HvLpEvent_Type_PciIo 5
  87. #define HvLpEvent_Type_RioIo 6
  88. #define HvLpEvent_Type_VirtualLan 7
  89. #define HvLpEvent_Type_VirtualIo 8
  90. #define HvLpEvent_Type_NumTypes 9
  91. #define HvLpEvent_Rc_Good 0
  92. #define HvLpEvent_Rc_BufferNotAvailable 1
  93. #define HvLpEvent_Rc_Cancelled 2
  94. #define HvLpEvent_Rc_GenericError 3
  95. #define HvLpEvent_Rc_InvalidAddress 4
  96. #define HvLpEvent_Rc_InvalidPartition 5
  97. #define HvLpEvent_Rc_InvalidSize 6
  98. #define HvLpEvent_Rc_InvalidSubtype 7
  99. #define HvLpEvent_Rc_InvalidSubtypeData 8
  100. #define HvLpEvent_Rc_InvalidType 9
  101. #define HvLpEvent_Rc_PartitionDead 10
  102. #define HvLpEvent_Rc_PathClosed 11
  103. #define HvLpEvent_Rc_SubtypeError 12
  104. #define HvLpEvent_Function_Ack 0
  105. #define HvLpEvent_Function_Int 1
  106. #define HvLpEvent_AckInd_NoAck 0
  107. #define HvLpEvent_AckInd_DoAck 1
  108. #define HvLpEvent_AckType_ImmediateAck 0
  109. #define HvLpEvent_AckType_DeferredAck 1
  110. #define HvLpDma_Direction_LocalToRemote 0
  111. #define HvLpDma_Direction_RemoteToLocal 1
  112. #define HvLpDma_AddressType_TceIndex 0
  113. #define HvLpDma_AddressType_RealAddress 1
  114. #define HvLpDma_Rc_Good 0
  115. #define HvLpDma_Rc_Error 1
  116. #define HvLpDma_Rc_PartitionDead 2
  117. #define HvLpDma_Rc_PathClosed 3
  118. #define HvLpDma_Rc_InvalidAddress 4
  119. #define HvLpDma_Rc_InvalidLength 5
  120. #endif /* _HVLPEVENT_H */