ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc64 / iSeries / HvLpEvent.h
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
20 //======================================================================
21 //
22 //      This file contains the class for HV events in the system.
23 //
24 //=====================================================================
25 #ifndef _HVLPEVENT_H
26 #define _HVLPEVENT_H
27
28 #include <asm/types.h>
29 #include <asm/ptrace.h>
30 #include <asm/iSeries/HvTypes.h>
31 #include <asm/iSeries/HvCallEvent.h>
32
33 //=====================================================================
34 //
35 // HvLpEvent is the structure for Lp Event messages passed between
36 // partitions through PLIC. 
37 //
38 //=====================================================================
39
40 struct HvEventFlags
41 {
42         u8      xValid:1;               // Indicates a valid request    x00-x00
43         u8      xRsvd1:4;               // Reserved                     ...
44         u8      xAckType:1;             // Immediate or deferred        ...
45         u8      xAckInd:1;              // Indicates if ACK required    ...
46         u8      xFunction:1;            // Interrupt or Acknowledge     ...
47 };
48
49
50 struct HvLpEvent
51 {
52         struct HvEventFlags xFlags;     // Event flags                  x00-x00
53         u8      xType;                  // Type of message              x01-x01
54         u16     xSubtype;               // Subtype for event            x02-x03
55         u8      xSourceLp;              // Source LP                    x04-x04
56         u8      xTargetLp;              // Target LP                    x05-x05
57         u8      xSizeMinus1;            // Size of Derived class - 1    x06-x06
58         u8      xRc;                    // RC for Ack flows             x07-x07
59         u16     xSourceInstanceId;      // Source sides instance id     x08-x09
60         u16     xTargetInstanceId;      // Target sides instance id     x0A-x0B
61         union {
62                 u32     xSubtypeData;   // Data usable by the subtype   x0C-x0F
63                 u16     xSubtypeDataShort[2];   // Data as 2 shorts
64                 u8      xSubtypeDataChar[4];    // Data as 4 chars
65         } x;
66
67         u64     xCorrelationToken;      // Unique value for source/type x10-x17
68 };
69
70 // Lp Event handler function
71 typedef void (*LpEventHandler)(struct HvLpEvent *, struct pt_regs *);
72
73 // Register a handler for an event type
74 //  returns 0 on success
75 extern int HvLpEvent_registerHandler( HvLpEvent_Type eventType, LpEventHandler hdlr);
76
77 // Unregister a handler for an event type
78 //  returns 0 on success
79 //  Unregister will fail if there are any paths open for the type
80 extern int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType );
81
82 // Open an Lp Event Path for an event type
83 //  returns 0 on success
84 //  openPath will fail if there is no handler registered for the event type.
85 //  The lpIndex specified is the partition index for the target partition
86 //  (for VirtualIo, VirtualLan and SessionMgr) other types specify zero) 
87 extern int HvLpEvent_openPath( HvLpEvent_Type eventType, HvLpIndex lpIndex );
88
89
90 // Close an Lp Event Path for a type and partition
91 //  returns 0 on sucess
92 extern int HvLpEvent_closePath( HvLpEvent_Type eventType, HvLpIndex lpIndex );
93
94 #define HvLpEvent_Type_Hypervisor 0
95 #define HvLpEvent_Type_MachineFac 1
96 #define HvLpEvent_Type_SessionMgr 2
97 #define HvLpEvent_Type_SpdIo      3
98 #define HvLpEvent_Type_VirtualBus 4
99 #define HvLpEvent_Type_PciIo      5
100 #define HvLpEvent_Type_RioIo      6
101 #define HvLpEvent_Type_VirtualLan 7
102 #define HvLpEvent_Type_VirtualIo  8
103 #define HvLpEvent_Type_NumTypes   9
104
105 #define HvLpEvent_Rc_Good 0
106 #define HvLpEvent_Rc_BufferNotAvailable 1
107 #define HvLpEvent_Rc_Cancelled 2
108 #define HvLpEvent_Rc_GenericError 3
109 #define HvLpEvent_Rc_InvalidAddress 4
110 #define HvLpEvent_Rc_InvalidPartition 5
111 #define HvLpEvent_Rc_InvalidSize 6
112 #define HvLpEvent_Rc_InvalidSubtype 7
113 #define HvLpEvent_Rc_InvalidSubtypeData 8
114 #define HvLpEvent_Rc_InvalidType 9
115 #define HvLpEvent_Rc_PartitionDead 10
116 #define HvLpEvent_Rc_PathClosed 11
117 #define HvLpEvent_Rc_SubtypeError 12
118
119 #define HvLpEvent_Function_Ack 0
120 #define HvLpEvent_Function_Int 1
121
122 #define HvLpEvent_AckInd_NoAck 0
123 #define HvLpEvent_AckInd_DoAck 1
124
125 #define HvLpEvent_AckType_ImmediateAck 0
126 #define HvLpEvent_AckType_DeferredAck 1
127
128 #define HvLpDma_Direction_LocalToRemote 0
129 #define HvLpDma_Direction_RemoteToLocal 1
130
131 #define HvLpDma_AddressType_TceIndex 0
132 #define HvLpDma_AddressType_RealAddress 1
133
134 #define HvLpDma_Rc_Good 0
135 #define HvLpDma_Rc_Error 1
136 #define HvLpDma_Rc_PartitionDead 2
137 #define HvLpDma_Rc_PathClosed 3
138 #define HvLpDma_Rc_InvalidAddress 4
139 #define HvLpDma_Rc_InvalidLength 5
140
141 #endif // _HVLPEVENT_H