]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - drivers/staging/unisys/include/uisqueue.h
staging: unisys: clean up enums in uisqueue.h
[mirror_ubuntu-zesty-kernel.git] / drivers / staging / unisys / include / uisqueue.h
1 /* uisqueue.h
2 *
3 * Copyright (C) 2010 - 2013 UNISYS CORPORATION
4 * All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 */
17
18 /*
19 * Unisys IO Virtualization header NOTE: This file contains only Linux
20 * specific structs. All OS-independent structs are in iochannel.h.xx
21 */
22
23 #ifndef __UISQUEUE_H__
24 #define __UISQUEUE_H__
25
26 #include "linux/version.h"
27 #include "iochannel.h"
28 #include "uniklog.h"
29 #include <linux/atomic.h>
30 #include <linux/semaphore.h>
31 #include <linux/uuid.h>
32
33 #include "controlvmchannel.h"
34 #include "controlvmcompletionstatus.h"
35
36 struct uisqueue_info {
37 CHANNEL_HEADER __iomem *chan;
38 /* channel containing queues in which scsi commands &
39 * responses are queued
40 */
41 u64 packets_sent;
42 u64 packets_received;
43 u64 interrupts_sent;
44 u64 interrupts_received;
45 u64 max_not_empty_cnt;
46 u64 total_wakeup_cnt;
47 u64 non_empty_wakeup_cnt;
48
49 struct {
50 SIGNAL_QUEUE_HEADER reserved1; /* */
51 SIGNAL_QUEUE_HEADER reserved2; /* */
52 } safe_uis_queue;
53 unsigned int (*send_int_if_needed)(struct uisqueue_info *info,
54 unsigned int whichcqueue,
55 unsigned char issue_irq_if_empty,
56 u64 irq_handle,
57 unsigned char io_termination);
58 };
59
60 /* uisqueue_put_cmdrsp_with_lock_client queues a commmand or response
61 * to the specified queue, at the tail if the queue is full but
62 * oktowait == 0, then it return 0 indicating failure. otherwise it
63 * wait for the queue to become non-full. If command is queued, return
64 * 1 for success.
65 */
66 #define DONT_ISSUE_INTERRUPT 0
67 #define ISSUE_INTERRUPT 1
68
69 #define DONT_WAIT 0
70 #define OK_TO_WAIT 1
71 #define UISLIB_LOCK_PREFIX \
72 ".section .smp_locks,\"a\"\n" \
73 _ASM_ALIGN "\n" \
74 _ASM_PTR "661f\n" /* address */ \
75 ".previous\n" \
76 "661:\n\tlock; "
77
78 unsigned long long uisqueue_interlocked_or(unsigned long long __iomem *tgt,
79 unsigned long long set);
80 unsigned long long uisqueue_interlocked_and(unsigned long long __iomem *tgt,
81 unsigned long long set);
82
83 int uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo,
84 struct uiscmdrsp *cmdrsp,
85 unsigned int queue,
86 void *insertlock,
87 unsigned char issue_irq_if_empty,
88 u64 irq_handle,
89 char oktowait,
90 u8 *channel_id);
91
92 /* uisqueue_get_cmdrsp gets the cmdrsp entry at the head of the queue
93 * and copies it to the area pointed by cmdrsp param.
94 * returns 0 if queue is empty, 1 otherwise
95 */
96 int
97
98 uisqueue_get_cmdrsp(struct uisqueue_info *queueinfo, void *cmdrsp,
99 unsigned int queue);
100
101 #define MAX_NAME_SIZE_UISQUEUE 64
102
103 struct extport_info {
104 u8 valid:1;
105 /* if 1, indicates this extport slot is occupied
106 * if 0, indicates that extport slot is unoccupied */
107
108 u32 num_devs_using;
109 /* When extport is added, this is set to 0. For exports
110 * located in NETWORK switches:
111 * Each time a VNIC, i.e., intport, is added to the switch this
112 * is used to assign a pref_pnic for the VNIC and when assigned
113 * to a VNIC this counter is incremented. When a VNIC is
114 * deleted, the extport corresponding to the VNIC's pref_pnic
115 * is located and its num_devs_using is decremented. For VNICs,
116 * num_devs_using is basically used to load-balance transmit
117 * traffic from VNICs.
118 */
119
120 struct switch_info *swtch;
121 struct PciId pci_id;
122 char name[MAX_NAME_SIZE_UISQUEUE];
123 union {
124 struct vhba_wwnn wwnn;
125 unsigned char macaddr[MAX_MACADDR_LEN];
126 };
127 };
128
129 struct device_info {
130 void __iomem *chanptr;
131 u64 channel_addr;
132 u64 channel_bytes;
133 uuid_le channel_uuid;
134 uuid_le instance_uuid;
135 struct InterruptInfo intr;
136 struct switch_info *swtch;
137 char devid[30]; /* "vbus<busno>:dev<devno>" */
138 u16 polling;
139 struct semaphore interrupt_callback_lock;
140 u32 bus_no;
141 u32 dev_no;
142 int (*interrupt)(void *);
143 void *interrupt_context;
144 void *private_data;
145 struct list_head list_polling_device_channels;
146 unsigned long long moved_to_tail_cnt;
147 unsigned long long first_busy_cnt;
148 unsigned long long last_on_list_cnt;
149 };
150
151 enum switch_type {
152 RECOVERY_LAN = 1,
153 IB_LAN = 2
154 };
155
156 struct bus_info {
157 u32 busNo, deviceCount;
158 struct device_info **device;
159 u64 guestHandle, recvBusInterruptHandle;
160 uuid_le busInstGuid;
161 ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *pBusChannel;
162 int busChannelBytes;
163 struct proc_dir_entry *proc_dir; /* proc/uislib/vbus/<x> */
164 struct proc_dir_entry *proc_info; /* proc/uislib/vbus/<x>/info */
165 char name[25];
166 char partitionName[99];
167 struct bus_info *next;
168 u8 localVnic; /* 1 if local vnic created internally
169 * by IOVM; 0 otherwise... */
170 };
171
172 #define DEDICATED_SWITCH(s) ((s->extPortCount == 1) && \
173 (s->intPortCount == 1))
174
175 struct sn_list_entry {
176 struct uisscsi_dest pdest; /* scsi bus, target, lun for
177 * phys disk */
178 u8 sernum[MAX_SERIAL_NUM]; /* serial num of physical
179 * disk.. The length is always
180 * MAX_SERIAL_NUM, padded with
181 * spaces */
182 struct sn_list_entry *next;
183 };
184
185 struct network_policy {
186 u32 promiscuous:1;
187 u32 macassign:1;
188 u32 peerforwarding:1;
189 u32 nonotify:1;
190 u32 standby:1;
191 u32 callhome:2;
192 char ip_addr[30];
193 };
194
195 /*
196 * IO messages sent to UisnicControlChanFunc & UissdControlChanFunc by
197 * code that processes the ControlVm channel messages.
198 */
199
200
201 enum iopart_msg_type {
202 IOPART_ADD_VNIC,
203 IOPART_DEL_VNIC,
204 IOPART_DEL_ALL_VNICS,
205 IOPART_ADD_VHBA,
206 IOPART_ADD_VDISK,
207 IOPART_DEL_VHBA,
208 IOPART_DEL_VDISK,
209 IOPART_DEL_ALL_VDISKS_FOR_VHBA,
210 IOPART_DEL_ALL_VHBAS,
211 IOPART_ATTACH_PHBA,
212 IOPART_DETACH_PHBA, /* 10 */
213 IOPART_ATTACH_PNIC,
214 IOPART_DETACH_PNIC,
215 IOPART_DETACH_VHBA,
216 IOPART_DETACH_VNIC,
217 IOPART_PAUSE_VDISK,
218 IOPART_RESUME_VDISK,
219 IOPART_ADD_DEVICE, /* add generic device */
220 IOPART_DEL_DEVICE, /* del generic device */
221 };
222
223 struct add_virt_iopart {
224 void *chanptr; /* pointer to data channel */
225 u64 guest_handle; /* used to convert guest physical
226 * address to real physical address
227 * for DMA, for ex. */
228 u64 recv_bus_irq_handle; /* used to register to receive
229 * bus level interrupts. */
230 struct InterruptInfo intr; /* contains recv & send
231 * interrupt info */
232 /* recvInterruptHandle is used to register to receive
233 * interrupts on the data channel. Used by GuestLinux/Windows
234 * IO drivers to connect to interrupt. sendInterruptHandle is
235 * used by IOPart drivers as parameter to
236 * Issue_VMCALL_IO_QUEUE_TRANSITION to interrupt thread in
237 * guest linux/windows IO drivers when data channel queue for
238 * vhba/vnic goes from EMPTY to NON-EMPTY. */
239 struct switch_info *swtch; /* pointer to the virtual
240 * switch to which the vnic is
241 * connected */
242
243 u8 use_g2g_copy; /* Used to determine if a virtual HBA
244 * needs to use G2G copy. */
245 u8 filler[7];
246
247 u32 bus_no;
248 u32 dev_no;
249 char *params;
250 ulong params_bytes;
251
252 };
253
254 struct add_vdisk_iopart {
255 void *chanptr; /* pointer to data channel */
256 int implicit;
257 struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */
258 struct uisscsi_dest pdest; /* scsi bus, target, lun for phys disk */
259 u8 sernum[MAX_SERIAL_NUM]; /* serial num of physical disk */
260 u32 serlen; /* length of serial num */
261 u32 bus_no;
262 u32 dev_no;
263 };
264
265 struct del_vdisk_iopart {
266 void *chanptr; /* pointer to data channel */
267 struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */
268 u32 bus_no;
269 u32 dev_no;
270 };
271
272 struct del_virt_iopart {
273 void *chanptr; /* pointer to data channel */
274 u32 bus_no;
275 u32 dev_no;
276 };
277
278 struct det_virt_iopart { /* detach internal port */
279 void *chanptr; /* pointer to data channel */
280 struct switch_info *swtch;
281 };
282
283 struct paures_vdisk_iopart {
284 void *chanptr; /* pointer to data channel */
285 struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */
286 };
287
288 struct add_switch_iopart { /* add switch */
289 struct switch_info *swtch;
290 char *params;
291 ulong params_bytes;
292 };
293
294 struct del_switch_iopart { /* destroy switch */
295 struct switch_info *swtch;
296 };
297
298 struct io_msgs {
299 enum iopart_msg_type msgtype;
300
301 /* additional params needed by some messages */
302 union {
303 struct add_virt_iopart add_vhba;
304 struct add_virt_iopart add_vnic;
305 struct add_vdisk_iopart add_vdisk;
306 struct del_virt_iopart del_vhba;
307 struct del_virt_iopart del_vnic;
308 struct det_virt_iopart det_vhba;
309 struct det_virt_iopart det_vnic;
310 struct del_vdisk_iopart del_vdisk;
311 struct del_virt_iopart del_all_vdisks_for_vhba;
312 struct add_virt_iopart add_device;
313 struct del_virt_iopart del_device;
314 struct det_virt_iopart det_intport;
315 struct add_switch_iopart add_switch;
316 struct del_switch_iopart del_switch;
317 struct extport_info *ext_port; /* for attach or detach
318 * pnic/generic delete all
319 * vhbas/allvnics need no
320 * parameters */
321 struct paures_vdisk_iopart paures_vdisk;
322 };
323 };
324
325 /*
326 * Guest messages sent to VirtControlChanFunc by code that processes
327 * the ControlVm channel messages.
328 */
329
330 typedef enum {
331 GUEST_ADD_VBUS,
332 GUEST_ADD_VHBA,
333 GUEST_ADD_VNIC,
334 GUEST_DEL_VBUS,
335 GUEST_DEL_VHBA,
336 GUEST_DEL_VNIC,
337 GUEST_DEL_ALL_VHBAS,
338 GUEST_DEL_ALL_VNICS,
339 GUEST_DEL_ALL_VBUSES, /* deletes all vhbas & vnics on all
340 * buses and deletes all buses */
341 GUEST_PAUSE_VHBA,
342 GUEST_PAUSE_VNIC,
343 GUEST_RESUME_VHBA,
344 GUEST_RESUME_VNIC
345 } GUESTPART_MSG_TYPE;
346
347 struct add_vbus_guestpart {
348 void __iomem *chanptr; /* pointer to data channel for bus -
349 * NOT YET USED */
350 u32 busNo; /* bus number to be created/deleted */
351 u32 deviceCount; /* max num of devices on bus */
352 uuid_le busTypeGuid; /* indicates type of bus */
353 uuid_le busInstGuid; /* instance guid for device */
354 };
355
356 struct del_vbus_guestpart {
357 u32 bus_no; /* bus number to be deleted */
358 /* once we start using the bus's channel, add can dump busNo
359 * into the channel header and then delete will need only one
360 * parameter, chanptr. */
361 };
362
363 struct add_virt_guestpart {
364 void __iomem *chanptr; /* pointer to data channel */
365 u32 bus_no; /* bus number for the operation */
366 u32 device_no; /* number of device on the bus */
367 uuid_le instance_uuid; /* instance guid for device */
368 struct InterruptInfo intr; /* recv/send interrupt info */
369 /* recvInterruptHandle contains info needed in order to
370 * register to receive interrupts on the data channel.
371 * sendInterruptHandle contains handle which is provided to
372 * monitor VMCALL that will cause an interrupt to be generated
373 * for the other end.
374 */
375 };
376
377 struct pause_virt_guestpart {
378 void __iomem *chanptr; /* pointer to data channel */
379 };
380
381 struct resume_virt_guestpart {
382 void __iomem *chanptr; /* pointer to data channel */
383 };
384
385 struct del_virt_guestpart {
386 void __iomem *chanptr; /* pointer to data channel */
387 };
388
389 struct init_chipset_guestpart {
390 u32 bus_count; /* indicates the max number of busses */
391 u32 switch_count; /* indicates the max number of switches */
392 };
393
394 struct guest_msgs {
395 GUESTPART_MSG_TYPE msgtype;
396
397 /* additional params needed by messages */
398 union {
399 struct add_vbus_guestpart add_vbus;
400 struct add_virt_guestpart add_vhba;
401 struct add_virt_guestpart add_vnic;
402 struct pause_virt_guestpart pause_vhba;
403 struct pause_virt_guestpart pause_vnic;
404 struct resume_virt_guestpart resume_vhba;
405 struct resume_virt_guestpart resume_vnic;
406 struct del_vbus_guestpart del_vbus;
407 struct del_virt_guestpart del_vhba;
408 struct del_virt_guestpart del_vnic;
409 struct del_vbus_guestpart del_all_vhbas;
410 struct del_vbus_guestpart del_all_vnics;
411 /* del_all_vbuses needs no parameters */
412 };
413 struct init_chipset_guestpart init_chipset;
414
415 };
416
417 #endif /* __UISQUEUE_H__ */