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