112e364b9f08aa335dc7716ce74113e834c993765Ken Cox/* uisqueue.h
212e364b9f08aa335dc7716ce74113e834c993765Ken Cox *
3f6d0c1e62b111bef3be279e4bf1bc2a6d560e205Benjamin Romer * Copyright (C) 2010 - 2013 UNISYS CORPORATION
412e364b9f08aa335dc7716ce74113e834c993765Ken Cox * All rights reserved.
512e364b9f08aa335dc7716ce74113e834c993765Ken Cox *
612e364b9f08aa335dc7716ce74113e834c993765Ken Cox * This program is free software; you can redistribute it and/or modify
712e364b9f08aa335dc7716ce74113e834c993765Ken Cox * it under the terms of the GNU General Public License as published by
812e364b9f08aa335dc7716ce74113e834c993765Ken Cox * the Free Software Foundation; either version 2 of the License, or (at
912e364b9f08aa335dc7716ce74113e834c993765Ken Cox * your option) any later version.
1012e364b9f08aa335dc7716ce74113e834c993765Ken Cox *
1112e364b9f08aa335dc7716ce74113e834c993765Ken Cox * This program is distributed in the hope that it will be useful, but
1212e364b9f08aa335dc7716ce74113e834c993765Ken Cox * WITHOUT ANY WARRANTY; without even the implied warranty of
1312e364b9f08aa335dc7716ce74113e834c993765Ken Cox * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
1412e364b9f08aa335dc7716ce74113e834c993765Ken Cox * NON INFRINGEMENT.  See the GNU General Public License for more
1512e364b9f08aa335dc7716ce74113e834c993765Ken Cox * details.
1612e364b9f08aa335dc7716ce74113e834c993765Ken Cox */
1712e364b9f08aa335dc7716ce74113e834c993765Ken Cox
1812e364b9f08aa335dc7716ce74113e834c993765Ken Cox/*
1912e364b9f08aa335dc7716ce74113e834c993765Ken Cox * Unisys IO Virtualization header NOTE: This file contains only Linux
2012e364b9f08aa335dc7716ce74113e834c993765Ken Cox * specific structs.  All OS-independent structs are in iochannel.h.xx
2112e364b9f08aa335dc7716ce74113e834c993765Ken Cox */
2212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
2312e364b9f08aa335dc7716ce74113e834c993765Ken Cox#ifndef __UISQUEUE_H__
2412e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define __UISQUEUE_H__
2512e364b9f08aa335dc7716ce74113e834c993765Ken Cox
2612e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include "linux/version.h"
2712e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include "iochannel.h"
2812e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include "uniklog.h"
2912e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include <linux/atomic.h>
3012e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include <linux/semaphore.h>
3190addb0218d47a886c846a22d75979fe5bf3471bBenjamin Romer#include <linux/uuid.h>
3212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
3312e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include "controlvmchannel.h"
3412e364b9f08aa335dc7716ce74113e834c993765Ken Cox#include "controlvmcompletionstatus.h"
3512e364b9f08aa335dc7716ce74113e834c993765Ken Cox
3612e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct uisqueue_info {
3712e364b9f08aa335dc7716ce74113e834c993765Ken Cox
388504ff6cab9cc43591999e542e437445db5cfd92Ken Cox	CHANNEL_HEADER __iomem *chan;
3912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* channel containing queues in which scsi commands &
4012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	 * responses are queued
4112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	 */
425fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 packets_sent;
435fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 packets_received;
445fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 interrupts_sent;
455fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 interrupts_received;
465fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 max_not_empty_cnt;
475fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 total_wakeup_cnt;
485fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 non_empty_wakeup_cnt;
4912e364b9f08aa335dc7716ce74113e834c993765Ken Cox
5012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct {
51833c7255cebceefe3208290c4a06456ad743fa59Benjamin Romer		SIGNAL_QUEUE_HEADER reserved1;	/*  */
52833c7255cebceefe3208290c4a06456ad743fa59Benjamin Romer		SIGNAL_QUEUE_HEADER reserved2;	/*  */
5312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	} safe_uis_queue;
5412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	unsigned int (*send_int_if_needed)(struct uisqueue_info *info,
5512e364b9f08aa335dc7716ce74113e834c993765Ken Cox					   unsigned int whichcqueue,
5682dd8152efc4bd8e8cce27df23ef033b24148616Benjamin Romer					   unsigned char issue_irq_if_empty,
5782dd8152efc4bd8e8cce27df23ef033b24148616Benjamin Romer					   u64 irq_handle,
5812e364b9f08aa335dc7716ce74113e834c993765Ken Cox					   unsigned char io_termination);
5912e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
6012e364b9f08aa335dc7716ce74113e834c993765Ken Cox
6112e364b9f08aa335dc7716ce74113e834c993765Ken Cox/* uisqueue_put_cmdrsp_with_lock_client queues a commmand or response
6212e364b9f08aa335dc7716ce74113e834c993765Ken Cox * to the specified queue, at the tail if the queue is full but
6312e364b9f08aa335dc7716ce74113e834c993765Ken Cox * oktowait == 0, then it return 0 indicating failure.  otherwise it
6412e364b9f08aa335dc7716ce74113e834c993765Ken Cox * wait for the queue to become non-full. If command is queued, return
6512e364b9f08aa335dc7716ce74113e834c993765Ken Cox * 1 for success.
6612e364b9f08aa335dc7716ce74113e834c993765Ken Cox */
6712e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define DONT_ISSUE_INTERRUPT 0
6812e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define ISSUE_INTERRUPT		 1
6912e364b9f08aa335dc7716ce74113e834c993765Ken Cox
7012e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define DONT_WAIT			 0
7112e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define OK_TO_WAIT			 1
7212e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define UISLIB_LOCK_PREFIX \
7312e364b9f08aa335dc7716ce74113e834c993765Ken Cox		".section .smp_locks,\"a\"\n"   \
7412e364b9f08aa335dc7716ce74113e834c993765Ken Cox		_ASM_ALIGN "\n"                 \
7512e364b9f08aa335dc7716ce74113e834c993765Ken Cox		_ASM_PTR "661f\n" /* address */ \
7612e364b9f08aa335dc7716ce74113e834c993765Ken Cox		".previous\n"                   \
7712e364b9f08aa335dc7716ce74113e834c993765Ken Cox		"661:\n\tlock; "
7812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
7917f5e49167cfca5c2c0d04863b8373736448238bBenjamin Romerunsigned long long uisqueue_interlocked_or(unsigned long long __iomem *tgt,
8017f5e49167cfca5c2c0d04863b8373736448238bBenjamin Romer					   unsigned long long set);
8117f5e49167cfca5c2c0d04863b8373736448238bBenjamin Romerunsigned long long uisqueue_interlocked_and(unsigned long long __iomem *tgt,
8217f5e49167cfca5c2c0d04863b8373736448238bBenjamin Romer					    unsigned long long set);
8312e364b9f08aa335dc7716ce74113e834c993765Ken Cox
8412e364b9f08aa335dc7716ce74113e834c993765Ken Coxint uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo,
8512e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 struct uiscmdrsp *cmdrsp,
8612e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 unsigned int queue,
8712e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 void *insertlock,
8821f8c6b845e4dda0f456a0ec159455540f5376c7Benjamin Romer					 unsigned char issue_irq_if_empty,
8921f8c6b845e4dda0f456a0ec159455540f5376c7Benjamin Romer					 u64 irq_handle,
9012e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 char oktowait,
9121f8c6b845e4dda0f456a0ec159455540f5376c7Benjamin Romer					 u8 *channel_id);
9212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
9312e364b9f08aa335dc7716ce74113e834c993765Ken Cox/* uisqueue_get_cmdrsp gets the cmdrsp entry at the head of the queue
9412e364b9f08aa335dc7716ce74113e834c993765Ken Cox * and copies it to the area pointed by cmdrsp param.
9512e364b9f08aa335dc7716ce74113e834c993765Ken Cox * returns 0 if queue is empty, 1 otherwise
9612e364b9f08aa335dc7716ce74113e834c993765Ken Cox */
9712e364b9f08aa335dc7716ce74113e834c993765Ken Coxint
9812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
9912e364b9f08aa335dc7716ce74113e834c993765Ken Coxuisqueue_get_cmdrsp(struct uisqueue_info *queueinfo, void *cmdrsp,
10012e364b9f08aa335dc7716ce74113e834c993765Ken Cox		    unsigned int queue);
10112e364b9f08aa335dc7716ce74113e834c993765Ken Cox
10212e364b9f08aa335dc7716ce74113e834c993765Ken Cox#define MAX_NAME_SIZE_UISQUEUE 64
10312e364b9f08aa335dc7716ce74113e834c993765Ken Cox
10412e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct extport_info {
105c242233e5b578ef08362d98171c10519876d0d93Benjamin Romer	u8 valid:1;
10612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* if 1, indicates this extport slot is occupied
10712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	 * if 0, indicates that extport slot is unoccupied */
10812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
109b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 num_devs_using;
11012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* When extport is added, this is set to 0.  For exports
11112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* located in NETWORK switches:
11212e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* Each time a VNIC, i.e., intport, is added to the switch this
11312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* is used to assign a pref_pnic for the VNIC and when assigned
11412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* to a VNIC this counter is incremented. When a VNIC is
11512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* deleted, the extport corresponding to the VNIC's pref_pnic
11612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* is located and its num_devs_using is decremented. For VNICs,
11712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* num_devs_using is basically used to load-balance transmit
11812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* traffic from VNICs.
11912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	*/
12012e364b9f08aa335dc7716ce74113e834c993765Ken Cox
12112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct switch_info *swtch;
12212e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct PciId pci_id;
12312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char name[MAX_NAME_SIZE_UISQUEUE];
12412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	union {
12512e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct vhba_wwnn wwnn;
12612e364b9f08aa335dc7716ce74113e834c993765Ken Cox		unsigned char macaddr[MAX_MACADDR_LEN];
12712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	};
12812e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
12912e364b9f08aa335dc7716ce74113e834c993765Ken Cox
13012e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct device_info {
1318504ff6cab9cc43591999e542e437445db5cfd92Ken Cox	void __iomem *chanptr;
132f796e84cc92f90bcf266f1418311518e21ebf2fcBenjamin Romer	u64 channel_addr;
133f796e84cc92f90bcf266f1418311518e21ebf2fcBenjamin Romer	u64 channel_bytes;
134f796e84cc92f90bcf266f1418311518e21ebf2fcBenjamin Romer	uuid_le channel_uuid;
135f796e84cc92f90bcf266f1418311518e21ebf2fcBenjamin Romer	uuid_le instance_uuid;
13612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct InterruptInfo intr;
13712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct switch_info *swtch;
13812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char devid[30];		/* "vbus<busno>:dev<devno>" */
139b06bdf7d5bd4f817b481674d69a63174279e6662Benjamin Romer	u16 polling;
14012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct semaphore interrupt_callback_lock;
141f796e84cc92f90bcf266f1418311518e21ebf2fcBenjamin Romer	u32 bus_no;
142f796e84cc92f90bcf266f1418311518e21ebf2fcBenjamin Romer	u32 dev_no;
14312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	int (*interrupt)(void *);
14412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *interrupt_context;
14512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *private_data;
14612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct list_head list_polling_device_channels;
14712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	unsigned long long moved_to_tail_cnt;
14812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	unsigned long long first_busy_cnt;
14912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	unsigned long long last_on_list_cnt;
15012e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
15112e364b9f08aa335dc7716ce74113e834c993765Ken Cox
15212e364b9f08aa335dc7716ce74113e834c993765Ken Coxtypedef enum {
15312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	RECOVERY_LAN = 1,
15412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IB_LAN = 2
15512e364b9f08aa335dc7716ce74113e834c993765Ken Cox} SWITCH_TYPE;
15612e364b9f08aa335dc7716ce74113e834c993765Ken Cox
15712e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct bus_info {
158b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 busNo, deviceCount;
15912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct device_info **device;
1605fc0229ae5e68b8b20552b3b1944255583476c35Benjamin Romer	u64 guestHandle, recvBusInterruptHandle;
16190addb0218d47a886c846a22d75979fe5bf3471bBenjamin Romer	uuid_le busInstGuid;
1628504ff6cab9cc43591999e542e437445db5cfd92Ken Cox	ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *pBusChannel;
16312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	int busChannelBytes;
16412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct proc_dir_entry *proc_dir;	/* proc/uislib/vbus/<x> */
16512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct proc_dir_entry *proc_info;	/* proc/uislib/vbus/<x>/info */
16612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char name[25];
16712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char partitionName[99];
16812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct bus_info *next;
169c242233e5b578ef08362d98171c10519876d0d93Benjamin Romer	u8 localVnic;		/* 1 if local vnic created internally
17012e364b9f08aa335dc7716ce74113e834c993765Ken Cox				 * by IOVM; 0 otherwise... */
17112e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
17212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
173059ec04b64470ed4801940d91b4f1343010f1ec3Benjamin Romer#define DEDICATED_SWITCH(s) ((s->extPortCount == 1) &&	\
174059ec04b64470ed4801940d91b4f1343010f1ec3Benjamin Romer			     (s->intPortCount == 1))
17512e364b9f08aa335dc7716ce74113e834c993765Ken Cox
17612e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct sn_list_entry {
17712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct uisscsi_dest pdest;	/* scsi bus, target, lun for
17812e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * phys disk */
179c242233e5b578ef08362d98171c10519876d0d93Benjamin Romer	u8 sernum[MAX_SERIAL_NUM];	/* serial num of physical
18012e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * disk.. The length is always
18112e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * MAX_SERIAL_NUM, padded with
18212e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * spaces */
18312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct sn_list_entry *next;
18412e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
18512e364b9f08aa335dc7716ce74113e834c993765Ken Cox
186c6d40f42586f19ca0bbca1c748f602781f0cf93aBenjamin Romerstruct network_policy {
187b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 promiscuous:1;
188b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 macassign:1;
189b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 peerforwarding:1;
190b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 nonotify:1;
191b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 standby:1;
192b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 callhome:2;
19312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char ip_addr[30];
19412e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
19512e364b9f08aa335dc7716ce74113e834c993765Ken Cox
19612e364b9f08aa335dc7716ce74113e834c993765Ken Cox/*
19712e364b9f08aa335dc7716ce74113e834c993765Ken Cox * IO messages sent to UisnicControlChanFunc & UissdControlChanFunc by
19812e364b9f08aa335dc7716ce74113e834c993765Ken Cox * code that processes the ControlVm channel messages.
19912e364b9f08aa335dc7716ce74113e834c993765Ken Cox */
20012e364b9f08aa335dc7716ce74113e834c993765Ken Cox
20112e364b9f08aa335dc7716ce74113e834c993765Ken Cox
20212e364b9f08aa335dc7716ce74113e834c993765Ken Coxtypedef enum {
20312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_ADD_VNIC,
20412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_VNIC,
20512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_ALL_VNICS,
20612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_ADD_VHBA,
20712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_ADD_VDISK,
20812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_VHBA,
20912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_VDISK,
21012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_ALL_VDISKS_FOR_VHBA,
21112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_ALL_VHBAS,
21212e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_ATTACH_PHBA,
21312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DETACH_PHBA,	/* 10 */
21412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_ATTACH_PNIC,
21512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DETACH_PNIC,
21612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DETACH_VHBA,
21712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DETACH_VNIC,
21812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_PAUSE_VDISK,
21912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_RESUME_VDISK,
22012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_ADD_DEVICE,	/* add generic device */
22112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_DEL_DEVICE,	/* del generic device */
22212e364b9f08aa335dc7716ce74113e834c993765Ken Cox} IOPART_MSG_TYPE;
22312e364b9f08aa335dc7716ce74113e834c993765Ken Cox
22412e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct add_virt_iopart {
22512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *chanptr;		/* pointer to data channel */
22644589920d0af06fabcec6a5fe599ce492d66fc48Benjamin Romer	u64 guest_handle;	/* used to convert guest physical
22712e364b9f08aa335dc7716ce74113e834c993765Ken Cox				 * address to real physical address
22812e364b9f08aa335dc7716ce74113e834c993765Ken Cox				 * for DMA, for ex. */
22944589920d0af06fabcec6a5fe599ce492d66fc48Benjamin Romer	u64 recv_bus_irq_handle;	/* used to register to receive
23012e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * bus level interrupts. */
23112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct InterruptInfo intr;	/* contains recv & send
23212e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * interrupt info */
23312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* recvInterruptHandle is used to register to receive
23412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* interrupts on the data channel. Used by GuestLinux/Windows
23512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* IO drivers to connect to interrupt.  sendInterruptHandle is
23612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* used by IOPart drivers as parameter to
23712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* Issue_VMCALL_IO_QUEUE_TRANSITION to interrupt thread in
23812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* guest linux/windows IO drivers when data channel queue for
23912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* vhba/vnic goes from EMPTY to NON-EMPTY. */
24012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct switch_info *swtch;	/* pointer to the virtual
24112e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * switch to which the vnic is
24212e364b9f08aa335dc7716ce74113e834c993765Ken Cox					 * connected */
24312e364b9f08aa335dc7716ce74113e834c993765Ken Cox
24444589920d0af06fabcec6a5fe599ce492d66fc48Benjamin Romer	u8 use_g2g_copy;	/* Used to determine if a virtual HBA
24512e364b9f08aa335dc7716ce74113e834c993765Ken Cox				 * needs to use G2G copy. */
24644589920d0af06fabcec6a5fe599ce492d66fc48Benjamin Romer	u8 filler[7];
24712e364b9f08aa335dc7716ce74113e834c993765Ken Cox
24844589920d0af06fabcec6a5fe599ce492d66fc48Benjamin Romer	u32 bus_no;
24944589920d0af06fabcec6a5fe599ce492d66fc48Benjamin Romer	u32 dev_no;
25012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char *params;
25112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	ulong params_bytes;
25212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
25312e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
25412e364b9f08aa335dc7716ce74113e834c993765Ken Cox
25512e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct add_vdisk_iopart {
25612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *chanptr;		      /* pointer to data channel */
25712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	int implicit;
25812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct uisscsi_dest vdest;    /* scsi bus, target, lun for virt disk */
25912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct uisscsi_dest pdest;    /* scsi bus, target, lun for phys disk */
260c242233e5b578ef08362d98171c10519876d0d93Benjamin Romer	u8 sernum[MAX_SERIAL_NUM];    /* serial num of physical disk */
261b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 serlen;		      /* length of serial num */
262057546f02e003c6dc242b85a1c766c68ec6b04fbBenjamin Romer	u32 bus_no;
263057546f02e003c6dc242b85a1c766c68ec6b04fbBenjamin Romer	u32 dev_no;
26412e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
26512e364b9f08aa335dc7716ce74113e834c993765Ken Cox
26612e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct del_vdisk_iopart {
26712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *chanptr;		     /* pointer to data channel */
26812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct uisscsi_dest vdest;   /* scsi bus, target, lun for virt disk */
2693af0c34f6b9858e5d313192443df2b5d17a7f802Benjamin Romer	u32 bus_no;
2703af0c34f6b9858e5d313192443df2b5d17a7f802Benjamin Romer	u32 dev_no;
27112e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
27212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
27312e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct del_virt_iopart {
27412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *chanptr;		     /* pointer to data channel */
2757867499b13d6f79aa8e873a417331d427eb75f9fBenjamin Romer	u32 bus_no;
2767867499b13d6f79aa8e873a417331d427eb75f9fBenjamin Romer	u32 dev_no;
27712e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
27812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
27912e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct det_virt_iopart {	     /* detach internal port */
28012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *chanptr;		     /* pointer to data channel */
28112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct switch_info *swtch;
28212e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
28312e364b9f08aa335dc7716ce74113e834c993765Ken Cox
28412e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct paures_vdisk_iopart {
28512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	void *chanptr;		     /* pointer to data channel */
28612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct uisscsi_dest vdest;   /* scsi bus, target, lun for virt disk */
28712e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
28812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
28912e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct add_switch_iopart {	     /* add switch */
29012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct switch_info *swtch;
29112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	char *params;
29212e364b9f08aa335dc7716ce74113e834c993765Ken Cox	ulong params_bytes;
29312e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
29412e364b9f08aa335dc7716ce74113e834c993765Ken Cox
29512e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct del_switch_iopart {	     /* destroy switch */
29612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct switch_info *swtch;
29712e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
29812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
29912e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct io_msgs {
30012e364b9f08aa335dc7716ce74113e834c993765Ken Cox
30112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	IOPART_MSG_TYPE msgtype;
30212e364b9f08aa335dc7716ce74113e834c993765Ken Cox
30312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* additional params needed by some messages */
30412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	union {
30512e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct add_virt_iopart add_vhba;
30612e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct add_virt_iopart add_vnic;
30712e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct add_vdisk_iopart add_vdisk;
30812e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct del_virt_iopart del_vhba;
30912e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct del_virt_iopart del_vnic;
31012e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct det_virt_iopart det_vhba;
31112e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct det_virt_iopart det_vnic;
31212e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct del_vdisk_iopart del_vdisk;
31312e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct del_virt_iopart del_all_vdisks_for_vhba;
31412e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct add_virt_iopart add_device;
31512e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct del_virt_iopart del_device;
31612e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct det_virt_iopart det_intport;
31712e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct add_switch_iopart add_switch;
31812e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct del_switch_iopart del_switch;
3190014c3ccdab1441972bfa6d8296e0c3bf61ad854Benjamin Romer		struct extport_info *ext_port;	/* for attach or detach
32012e364b9f08aa335dc7716ce74113e834c993765Ken Cox						 * pnic/generic delete all
32112e364b9f08aa335dc7716ce74113e834c993765Ken Cox						 * vhbas/allvnics need no
32212e364b9f08aa335dc7716ce74113e834c993765Ken Cox						 * parameters */
32312e364b9f08aa335dc7716ce74113e834c993765Ken Cox		struct paures_vdisk_iopart paures_vdisk;
32412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	};
32512e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
32612e364b9f08aa335dc7716ce74113e834c993765Ken Cox
32712e364b9f08aa335dc7716ce74113e834c993765Ken Cox/*
32812e364b9f08aa335dc7716ce74113e834c993765Ken Cox* Guest messages sent to VirtControlChanFunc by code that processes
32912e364b9f08aa335dc7716ce74113e834c993765Ken Cox* the ControlVm channel messages.
33012e364b9f08aa335dc7716ce74113e834c993765Ken Cox*/
33112e364b9f08aa335dc7716ce74113e834c993765Ken Cox
33212e364b9f08aa335dc7716ce74113e834c993765Ken Coxtypedef enum {
33312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_ADD_VBUS,
33412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_ADD_VHBA,
33512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_ADD_VNIC,
33612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_DEL_VBUS,
33712e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_DEL_VHBA,
33812e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_DEL_VNIC,
33912e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_DEL_ALL_VHBAS,
34012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_DEL_ALL_VNICS,
34112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_DEL_ALL_VBUSES,	/* deletes all vhbas & vnics on all
34212e364b9f08aa335dc7716ce74113e834c993765Ken Cox				 * buses and deletes all buses */
34312e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_PAUSE_VHBA,
34412e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_PAUSE_VNIC,
34512e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_RESUME_VHBA,
34612e364b9f08aa335dc7716ce74113e834c993765Ken Cox	GUEST_RESUME_VNIC
34712e364b9f08aa335dc7716ce74113e834c993765Ken Cox} GUESTPART_MSG_TYPE;
34812e364b9f08aa335dc7716ce74113e834c993765Ken Cox
34912e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct add_vbus_guestpart {
3508504ff6cab9cc43591999e542e437445db5cfd92Ken Cox	void __iomem *chanptr;		/* pointer to data channel for bus -
3518504ff6cab9cc43591999e542e437445db5cfd92Ken Cox					 * NOT YET USED */
352b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 busNo;		/* bus number to be created/deleted */
353b3c55b13a1e458878e813c4fe2cccfa97c75f884Benjamin Romer	u32 deviceCount;	/* max num of devices on bus */
35490addb0218d47a886c846a22d75979fe5bf3471bBenjamin Romer	uuid_le busTypeGuid;	/* indicates type of bus */
35590addb0218d47a886c846a22d75979fe5bf3471bBenjamin Romer	uuid_le busInstGuid;	/* instance guid for device */
35612e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
35712e364b9f08aa335dc7716ce74113e834c993765Ken Cox
35812e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct del_vbus_guestpart {
359a990356d21a6032d49441472f1e2240ba6325cf7Benjamin Romer	u32 bus_no;		/* bus number to be deleted */
36012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* once we start using the bus's channel, add can dump busNo
36112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* into the channel header and then delete will need only one
36212e364b9f08aa335dc7716ce74113e834c993765Ken Cox	* parameter, chanptr. */
36312e364b9f08aa335dc7716ce74113e834c993765Ken Cox};
36412e364b9f08aa335dc7716ce74113e834c993765Ken Cox
36512e364b9f08aa335dc7716ce74113e834c993765Ken Coxstruct add_virt_guestpart {
3668504ff6cab9cc43591999e542e437445db5cfd92Ken Cox	void __iomem *chanptr;		/* pointer to data channel */
3678bd352ef0a71432a17dffa6bfe87b46db86d1546Benjamin Romer	u32 bus_no;		/* bus number for the operation */
3688bd352ef0a71432a17dffa6bfe87b46db86d1546Benjamin Romer	u32 device_no;		/* number of device on the bus */
3698bd352ef0a71432a17dffa6bfe87b46db86d1546Benjamin Romer	uuid_le instance_uuid;	/* instance guid for device */
37012e364b9f08aa335dc7716ce74113e834c993765Ken Cox	struct InterruptInfo intr;	/* recv/send interrupt info */
37112e364b9f08aa335dc7716ce74113e834c993765Ken Cox	/* recvInterruptHandle contains info needed in order to
37212e364b9f08aa335dc7716ce74113e834c993765Ken Cox	 * register to receive interrupts on the data channel.