All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: unisys: remove virtpci, virthba, and uislib
@ 2015-04-14  1:16 Benjamin Romer
  2015-04-14  1:16 ` [PATCH 1/3] staging: unisys: remove virthba driver for rewrite Benjamin Romer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Benjamin Romer @ 2015-04-14  1:16 UTC (permalink / raw)
  To: gregkh; +Cc: jkc, driverdev-devel, sparmaintainer, Benjamin Romer

We need to remove the old bus model so it can be replaced with a better design.
By removing virthba and virtpci, we can eliminate uislib as well, which will
get rid of many undesirable wrapper and library functions.

These removals will be followed with the addition of a replacement driver called
visorbus. This driver will consolidate the functions needed to support new
virtual device drivers, so the functions in visorchannel and visorutil will be
moved over to visorbus. Additionally, the message handling done in visorchipset
will make its way here too.

Benjamin Romer (3):
  staging: unisys: remove virthba driver for rewrite
  staging: unisys: remove virtpci driver from staging tree
  staging: unisys: remove uislib module from staging tree

 drivers/staging/unisys/Kconfig            |    3 -
 drivers/staging/unisys/Makefile           |    3 -
 drivers/staging/unisys/uislib/Kconfig     |   10 -
 drivers/staging/unisys/uislib/Makefile    |   12 -
 drivers/staging/unisys/uislib/uislib.c    | 1372 -------------------------
 drivers/staging/unisys/uislib/uisqueue.c  |  322 ------
 drivers/staging/unisys/uislib/uisthread.c |   69 --
 drivers/staging/unisys/uislib/uisutils.c  |  137 ---
 drivers/staging/unisys/virthba/Kconfig    |   13 -
 drivers/staging/unisys/virthba/Makefile   |   12 -
 drivers/staging/unisys/virthba/virthba.c  | 1572 -----------------------------
 drivers/staging/unisys/virthba/virthba.h  |   27 -
 drivers/staging/unisys/virtpci/Kconfig    |   10 -
 drivers/staging/unisys/virtpci/Makefile   |   10 -
 drivers/staging/unisys/virtpci/virtpci.c  | 1394 -------------------------
 drivers/staging/unisys/virtpci/virtpci.h  |  103 --
 16 files changed, 5069 deletions(-)
 delete mode 100644 drivers/staging/unisys/uislib/Kconfig
 delete mode 100644 drivers/staging/unisys/uislib/Makefile
 delete mode 100644 drivers/staging/unisys/uislib/uislib.c
 delete mode 100644 drivers/staging/unisys/uislib/uisqueue.c
 delete mode 100644 drivers/staging/unisys/uislib/uisthread.c
 delete mode 100644 drivers/staging/unisys/uislib/uisutils.c
 delete mode 100644 drivers/staging/unisys/virthba/Kconfig
 delete mode 100644 drivers/staging/unisys/virthba/Makefile
 delete mode 100644 drivers/staging/unisys/virthba/virthba.c
 delete mode 100644 drivers/staging/unisys/virthba/virthba.h
 delete mode 100644 drivers/staging/unisys/virtpci/Kconfig
 delete mode 100644 drivers/staging/unisys/virtpci/Makefile
 delete mode 100644 drivers/staging/unisys/virtpci/virtpci.c
 delete mode 100644 drivers/staging/unisys/virtpci/virtpci.h

-- 
2.1.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] staging: unisys: remove virthba driver for rewrite
  2015-04-14  1:16 [PATCH 0/3] staging: unisys: remove virtpci, virthba, and uislib Benjamin Romer
@ 2015-04-14  1:16 ` Benjamin Romer
  2015-04-14  1:16 ` [PATCH 2/3] staging: unisys: remove virtpci driver from staging tree Benjamin Romer
  2015-04-14  1:16 ` [PATCH 3/3] staging: unisys: remove uislib module " Benjamin Romer
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Romer @ 2015-04-14  1:16 UTC (permalink / raw)
  To: gregkh; +Cc: jkc, driverdev-devel, sparmaintainer, Benjamin Romer

The virthba driver is being rewritten and will be renamed to visorhba, so delete
the old driver from the source tree.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 drivers/staging/unisys/Kconfig           |    1 -
 drivers/staging/unisys/Makefile          |    1 -
 drivers/staging/unisys/virthba/Kconfig   |   13 -
 drivers/staging/unisys/virthba/Makefile  |   12 -
 drivers/staging/unisys/virthba/virthba.c | 1572 ------------------------------
 drivers/staging/unisys/virthba/virthba.h |   27 -
 6 files changed, 1626 deletions(-)
 delete mode 100644 drivers/staging/unisys/virthba/Kconfig
 delete mode 100644 drivers/staging/unisys/virthba/Makefile
 delete mode 100644 drivers/staging/unisys/virthba/virthba.c
 delete mode 100644 drivers/staging/unisys/virthba/virthba.h

diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig
index 19fcb34..906cd58 100644
--- a/drivers/staging/unisys/Kconfig
+++ b/drivers/staging/unisys/Kconfig
@@ -14,6 +14,5 @@ source "drivers/staging/unisys/visorchannel/Kconfig"
 source "drivers/staging/unisys/visorchipset/Kconfig"
 source "drivers/staging/unisys/uislib/Kconfig"
 source "drivers/staging/unisys/virtpci/Kconfig"
-source "drivers/staging/unisys/virthba/Kconfig"
 
 endif # UNISYSSPAR
diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile
index 68b9925..3283a01 100644
--- a/drivers/staging/unisys/Makefile
+++ b/drivers/staging/unisys/Makefile
@@ -6,4 +6,3 @@ obj-$(CONFIG_UNISYS_VISORCHANNEL)	+= visorchannel/
 obj-$(CONFIG_UNISYS_VISORCHIPSET)	+= visorchipset/
 obj-$(CONFIG_UNISYS_UISLIB)		+= uislib/
 obj-$(CONFIG_UNISYS_VIRTPCI)		+= virtpci/
-obj-$(CONFIG_UNISYS_VIRTHBA)		+= virthba/
diff --git a/drivers/staging/unisys/virthba/Kconfig b/drivers/staging/unisys/virthba/Kconfig
deleted file mode 100644
index dfadfc4..0000000
--- a/drivers/staging/unisys/virthba/Kconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Unisys virthba configuration
-#
-
-config UNISYS_VIRTHBA
-	tristate "Unisys virthba driver"
-	depends on SCSI
-	select UNISYS_VISORCHIPSET
-	select UNISYS_UISLIB
-	select UNISYS_VIRTPCI
-	---help---
-	If you say Y here, you will enable the Unisys virthba driver.
-
diff --git a/drivers/staging/unisys/virthba/Makefile b/drivers/staging/unisys/virthba/Makefile
deleted file mode 100644
index a4e4037..0000000
--- a/drivers/staging/unisys/virthba/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Makefile for Unisys virthba
-#
-
-obj-$(CONFIG_UNISYS_VIRTHBA)	+= virthba.o
-
-ccflags-y += -Idrivers/staging/unisys/include
-ccflags-y += -Idrivers/staging/unisys/uislib
-ccflags-y += -Idrivers/staging/unisys/visorchipset
-ccflags-y += -Idrivers/staging/unisys/virtpci
-ccflags-y += -Idrivers/staging/unisys/common-spar/include
-ccflags-y += -Idrivers/staging/unisys/common-spar/include/channels
diff --git a/drivers/staging/unisys/virthba/virthba.c b/drivers/staging/unisys/virthba/virthba.c
deleted file mode 100644
index d9001cc..0000000
--- a/drivers/staging/unisys/virthba/virthba.c
+++ /dev/null
@@ -1,1572 +0,0 @@
-/* virthba.c
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-#define EXPORT_SYMTAB
-
-/* if you want to turn on some debugging of write device data or read
- * device data, define these two undefs.  You will probably want to
- * customize the code which is here since it was written assuming
- * reading and writing a specific data file df.64M.txt which is a
- * 64Megabyte file created by Art Nilson using a scritp I wrote called
- * cr_test_data.pl.  The data file consists of 256 byte lines of text
- * which start with an 8 digit sequence number, a colon, and then
- * letters after that */
-
-#include <linux/kernel.h>
-#ifdef CONFIG_MODVERSIONS
-#include <config/modversions.h>
-#endif
-
-#include "diagnostics/appos_subsystems.h"
-#include "uisutils.h"
-#include "uisqueue.h"
-#include "uisthread.h"
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/spinlock.h>
-#include <linux/device.h>
-#include <linux/slab.h>
-#include <scsi/scsi.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_device.h>
-#include <asm/param.h>
-#include <linux/debugfs.h>
-#include <linux/types.h>
-
-#include "virthba.h"
-#include "virtpci.h"
-#include "visorchipset.h"
-#include "version.h"
-#include "guestlinuxdebug.h"
-/* this is shorter than using __FILE__ (full path name) in
- * debug/info/error messages
- */
-#define CURRENT_FILE_PC VIRT_HBA_PC_virthba_c
-#define __MYFILE__ "virthba.c"
-
-/* NOTE:  L1_CACHE_BYTES >=128 */
-#define DEVICE_ATTRIBUTE struct device_attribute
-
- /* MAX_BUF = 6 lines x 10 MAXVHBA x 80 characters
- *         = 4800 bytes ~ 2^13 = 8192 bytes
- */
-#define MAX_BUF 8192
-
-/*****************************************************/
-/* Forward declarations                              */
-/*****************************************************/
-static int virthba_probe(struct virtpci_dev *dev,
-			 const struct pci_device_id *id);
-static void virthba_remove(struct virtpci_dev *dev);
-static int virthba_abort_handler(struct scsi_cmnd *scsicmd);
-static int virthba_bus_reset_handler(struct scsi_cmnd *scsicmd);
-static int virthba_device_reset_handler(struct scsi_cmnd *scsicmd);
-static int virthba_host_reset_handler(struct scsi_cmnd *scsicmd);
-static const char *virthba_get_info(struct Scsi_Host *shp);
-static int virthba_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
-static int virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
-				     void (*virthba_cmnd_done)
-					   (struct scsi_cmnd *));
-
-static const struct x86_cpu_id unisys_spar_ids[] = {
-	{ X86_VENDOR_INTEL, 6, 62, X86_FEATURE_ANY },
-	{}
-};
-
-/* Autoload */
-MODULE_DEVICE_TABLE(x86cpu, unisys_spar_ids);
-
-#ifdef DEF_SCSI_QCMD
-static DEF_SCSI_QCMD(virthba_queue_command)
-#else
-#define virthba_queue_command virthba_queue_command_lck
-#endif
-
-static int virthba_slave_alloc(struct scsi_device *scsidev);
-static int virthba_slave_configure(struct scsi_device *scsidev);
-static void virthba_slave_destroy(struct scsi_device *scsidev);
-static int process_incoming_rsps(void *);
-static int virthba_serverup(struct virtpci_dev *virtpcidev);
-static int virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state);
-static void do_disk_add_remove(struct work_struct *work);
-static void virthba_serverdown_complete(struct work_struct *work);
-static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-				 size_t len, loff_t *offset);
-static ssize_t enable_ints_write(struct file *file,
-				 const char __user *buffer, size_t count,
-				 loff_t *ppos);
-
-/*****************************************************/
-/* Globals                                           */
-/*****************************************************/
-
-static int rsltq_wait_usecs = 4000;	/* Default 4ms */
-static unsigned int max_buff_len;
-
-/* Module options */
-static char *virthba_options = "NONE";
-
-static const struct pci_device_id virthba_id_table[] = {
-	{PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_VIRTHBA)},
-	{0},
-};
-
-/* export virthba_id_table */
-MODULE_DEVICE_TABLE(pci, virthba_id_table);
-
-static struct workqueue_struct *virthba_serverdown_workqueue;
-
-static struct virtpci_driver virthba_driver = {
-	.name = "uisvirthba",
-	.version = VERSION,
-	.vertag = NULL,
-	.id_table = virthba_id_table,
-	.probe = virthba_probe,
-	.remove = virthba_remove,
-	.resume = virthba_serverup,
-	.suspend = virthba_serverdown
-};
-
-/* The Send and Recive Buffers of the IO Queue may both be full */
-#define MAX_PENDING_REQUESTS (MIN_NUMSIGNALS*2)
-#define INTERRUPT_VECTOR_MASK 0x3F
-
-struct scsipending {
-	char cmdtype;		/* Type of pointer that is being stored */
-	void *sent;		/* The Data being tracked */
-	/* struct scsi_cmnd *type for virthba_queue_command */
-	/* struct uiscmdrsp *type for management commands */
-};
-
-#define VIRTHBA_ERROR_COUNT 30
-#define IOS_ERROR_THRESHOLD 1000
-struct virtdisk_info {
-	u32 valid;
-	u32 channel, id, lun;	/* Disk Path */
-	atomic_t ios_threshold;
-	atomic_t error_count;
-	struct virtdisk_info *next;
-};
-
-/* Each Scsi_Host has a host_data area that contains this struct. */
-struct virthba_info {
-	struct Scsi_Host *scsihost;
-	struct virtpci_dev *virtpcidev;
-	struct list_head dev_info_list;
-	struct chaninfo chinfo;
-	struct irq_info intr;		/* use recvInterrupt info to receive
-					   interrupts when IOs complete */
-	int interrupt_vector;
-	struct scsipending pending[MAX_PENDING_REQUESTS]; /* Tracks the requests
-							     that have been */
-	/* forwarded to the IOVM and haven't returned yet */
-	unsigned int nextinsert;	/* Start search for next pending
-					   free slot here */
-	spinlock_t privlock;
-	bool serverdown;
-	bool serverchangingstate;
-	unsigned long long acquire_failed_cnt;
-	unsigned long long interrupts_rcvd;
-	unsigned long long interrupts_notme;
-	unsigned long long interrupts_disabled;
-	struct work_struct serverdown_completion;
-	u64 __iomem *flags_addr;
-	atomic_t interrupt_rcvd;
-	wait_queue_head_t rsp_queue;
-	struct virtdisk_info head;
-};
-
-/* Work Data for dar_work_queue */
-struct diskaddremove {
-	u8 add;			/* 0-remove, 1-add */
-	struct Scsi_Host *shost; /* Scsi Host for this virthba instance */
-	u32 channel, id, lun;	/* Disk Path */
-	struct diskaddremove *next;
-};
-
-#define virtpci_dev_to_virthba_virthba_get_info(d) \
-	container_of(d, struct virthba_info, virtpcidev)
-
-static DEVICE_ATTRIBUTE *virthba_shost_attrs[];
-static struct scsi_host_template virthba_driver_template = {
-	.name = "Unisys Virtual HBA",
-	.info = virthba_get_info,
-	.ioctl = virthba_ioctl,
-	.queuecommand = virthba_queue_command,
-	.eh_abort_handler = virthba_abort_handler,
-	.eh_device_reset_handler = virthba_device_reset_handler,
-	.eh_bus_reset_handler = virthba_bus_reset_handler,
-	.eh_host_reset_handler = virthba_host_reset_handler,
-	.shost_attrs = virthba_shost_attrs,
-
-#define VIRTHBA_MAX_CMNDS 128
-	.can_queue = VIRTHBA_MAX_CMNDS,
-	.sg_tablesize = 64,	/* largest number of address/length pairs */
-	.this_id = -1,
-	.slave_alloc = virthba_slave_alloc,
-	.slave_configure = virthba_slave_configure,
-	.slave_destroy = virthba_slave_destroy,
-	.use_clustering = ENABLE_CLUSTERING,
-};
-
-struct virthba_devices_open {
-	struct virthba_info *virthbainfo;
-};
-
-static const struct file_operations debugfs_info_fops = {
-	.read = info_debugfs_read,
-};
-
-static const struct file_operations debugfs_enable_ints_fops = {
-	.write = enable_ints_write,
-};
-
-/*****************************************************/
-/* Structs                                           */
-/*****************************************************/
-
-#define VIRTHBASOPENMAX 1
-/* array of open devices maintained by open() and close(); */
-static struct virthba_devices_open virthbas_open[VIRTHBASOPENMAX];
-static struct dentry *virthba_debugfs_dir;
-
-/*****************************************************/
-/* Local Functions				     */
-/*****************************************************/
-static int
-add_scsipending_entry(struct virthba_info *vhbainfo, char cmdtype, void *new)
-{
-	unsigned long flags;
-	int insert_location;
-
-	spin_lock_irqsave(&vhbainfo->privlock, flags);
-	insert_location = vhbainfo->nextinsert;
-	while (vhbainfo->pending[insert_location].sent) {
-		insert_location = (insert_location + 1) % MAX_PENDING_REQUESTS;
-		if (insert_location == (int)vhbainfo->nextinsert) {
-			spin_unlock_irqrestore(&vhbainfo->privlock, flags);
-			return -1;
-		}
-	}
-
-	vhbainfo->pending[insert_location].cmdtype = cmdtype;
-	vhbainfo->pending[insert_location].sent = new;
-	vhbainfo->nextinsert = (insert_location + 1) % MAX_PENDING_REQUESTS;
-	spin_unlock_irqrestore(&vhbainfo->privlock, flags);
-
-	return insert_location;
-}
-
-static unsigned int
-add_scsipending_entry_with_wait(struct virthba_info *vhbainfo, char cmdtype,
-				void *new)
-{
-	int insert_location = add_scsipending_entry(vhbainfo, cmdtype, new);
-
-	while (insert_location == -1) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(msecs_to_jiffies(10));
-		insert_location = add_scsipending_entry(vhbainfo, cmdtype, new);
-	}
-
-	return (unsigned int)insert_location;
-}
-
-static void *
-del_scsipending_entry(struct virthba_info *vhbainfo, uintptr_t del)
-{
-	unsigned long flags;
-	void *sent = NULL;
-
-	if (del < MAX_PENDING_REQUESTS) {
-		spin_lock_irqsave(&vhbainfo->privlock, flags);
-		sent = vhbainfo->pending[del].sent;
-
-		vhbainfo->pending[del].cmdtype = 0;
-		vhbainfo->pending[del].sent = NULL;
-		spin_unlock_irqrestore(&vhbainfo->privlock, flags);
-	}
-
-	return sent;
-}
-
-/* dar_work_queue (Disk Add/Remove) */
-static struct work_struct dar_work_queue;
-static struct diskaddremove *dar_work_queue_head;
-static spinlock_t dar_work_queue_lock;
-static unsigned short dar_work_queue_sched;
-#define QUEUE_DISKADDREMOVE(dar) { \
-	spin_lock_irqsave(&dar_work_queue_lock, flags); \
-	if (!dar_work_queue_head) { \
-		dar_work_queue_head = dar; \
-		dar->next = NULL; \
-	} \
-	else { \
-		dar->next = dar_work_queue_head; \
-		dar_work_queue_head = dar; \
-	} \
-	if (!dar_work_queue_sched) { \
-		schedule_work(&dar_work_queue); \
-		dar_work_queue_sched = 1; \
-	} \
-	spin_unlock_irqrestore(&dar_work_queue_lock, flags); \
-}
-
-static inline void
-send_disk_add_remove(struct diskaddremove *dar)
-{
-	struct scsi_device *sdev;
-	int error;
-
-	sdev = scsi_device_lookup(dar->shost, dar->channel, dar->id, dar->lun);
-	if (sdev) {
-		if (!(dar->add))
-			scsi_remove_device(sdev);
-	} else if (dar->add) {
-		error =
-		    scsi_add_device(dar->shost, dar->channel, dar->id,
-				    dar->lun);
-	}
-	kfree(dar);
-}
-
-/*****************************************************/
-/* dar_work_queue Handler Thread                     */
-/*****************************************************/
-static void
-do_disk_add_remove(struct work_struct *work)
-{
-	struct diskaddremove *dar;
-	struct diskaddremove *tmphead;
-	int i = 0;
-	unsigned long flags;
-
-	spin_lock_irqsave(&dar_work_queue_lock, flags);
-	tmphead = dar_work_queue_head;
-	dar_work_queue_head = NULL;
-	dar_work_queue_sched = 0;
-	spin_unlock_irqrestore(&dar_work_queue_lock, flags);
-	while (tmphead) {
-		dar = tmphead;
-		tmphead = dar->next;
-		send_disk_add_remove(dar);
-		i++;
-	}
-}
-
-/*****************************************************/
-/* Routine to add entry to dar_work_queue            */
-/*****************************************************/
-static void
-process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp)
-{
-	struct diskaddremove *dar;
-	unsigned long flags;
-
-	dar = kzalloc(sizeof(*dar), GFP_ATOMIC);
-	if (dar) {
-		dar->add = cmdrsp->disknotify.add;
-		dar->shost = shost;
-		dar->channel = cmdrsp->disknotify.channel;
-		dar->id = cmdrsp->disknotify.id;
-		dar->lun = cmdrsp->disknotify.lun;
-		QUEUE_DISKADDREMOVE(dar);
-	}
-}
-
-/*****************************************************/
-/* Probe Remove Functions                            */
-/*****************************************************/
-static irqreturn_t
-virthba_isr(int irq, void *dev_id)
-{
-	struct virthba_info *virthbainfo = (struct virthba_info *)dev_id;
-	struct channel_header __iomem *channel_header;
-	struct signal_queue_header __iomem *pqhdr;
-	u64 mask;
-	unsigned long long rc1;
-
-	if (!virthbainfo)
-		return IRQ_NONE;
-	virthbainfo->interrupts_rcvd++;
-	channel_header = virthbainfo->chinfo.queueinfo->chan;
-	if (((readq(&channel_header->features)
-	      & ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0) &&
-	     ((readq(&channel_header->features) &
-		 ULTRA_IO_DRIVER_DISABLES_INTS) !=
-		0)) {
-		virthbainfo->interrupts_disabled++;
-		mask = ~ULTRA_CHANNEL_ENABLE_INTS;
-		rc1 = uisqueue_interlocked_and(virthbainfo->flags_addr, mask);
-	}
-	if (spar_signalqueue_empty(channel_header, IOCHAN_FROM_IOPART)) {
-		virthbainfo->interrupts_notme++;
-		return IRQ_NONE;
-	}
-	pqhdr = (struct signal_queue_header __iomem *)
-		((char __iomem *)channel_header +
-		 readq(&channel_header->ch_space_offset)) + IOCHAN_FROM_IOPART;
-	writeq(readq(&pqhdr->num_irq_received) + 1,
-	       &pqhdr->num_irq_received);
-	atomic_set(&virthbainfo->interrupt_rcvd, 1);
-	wake_up_interruptible(&virthbainfo->rsp_queue);
-	return IRQ_HANDLED;
-}
-
-static int
-virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id)
-{
-	int error;
-	struct Scsi_Host *scsihost;
-	struct virthba_info *virthbainfo;
-	int rsp;
-	int i;
-	irq_handler_t handler = virthba_isr;
-	struct channel_header __iomem *channel_header;
-	struct signal_queue_header __iomem *pqhdr;
-	u64 mask;
-
-	POSTCODE_LINUX_2(VHBA_PROBE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	/* call scsi_host_alloc to register a scsi host adapter
-	 * instance - this virthba that has just been created is an
-	 * instance of a scsi host adapter. This scsi_host_alloc
-	 * function allocates a new Scsi_Host struct & performs basic
-	 * initialization.  The host is not published to the scsi
-	 * midlayer until scsi_add_host is called.
-	 */
-
-	/* arg 2 passed in length of extra space we want allocated
-	 * with scsi_host struct for our own use scsi_host_alloc
-	 * assign host_no
-	 */
-	scsihost = scsi_host_alloc(&virthba_driver_template,
-				   sizeof(struct virthba_info));
-	if (!scsihost)
-		return -ENODEV;
-
-	scsihost->this_id = UIS_MAGIC_VHBA;
-	/* linux treats max-channel differently than max-id & max-lun.
-	 * In the latter cases, those two values result in 0 to max-1
-	 * (inclusive) being scanned. But in the case of channels, the
-	 * scan is 0 to max (inclusive); so we will subtract one from
-	 * the max-channel value.
-	 */
-	scsihost->max_channel = (unsigned)virtpcidev->scsi.max.max_channel;
-	scsihost->max_id = (unsigned)virtpcidev->scsi.max.max_id;
-	scsihost->max_lun = (unsigned)virtpcidev->scsi.max.max_lun;
-	scsihost->cmd_per_lun = (unsigned)virtpcidev->scsi.max.cmd_per_lun;
-	scsihost->max_sectors =
-	    (unsigned short)(virtpcidev->scsi.max.max_io_size >> 9);
-	scsihost->sg_tablesize =
-	    (unsigned short)(virtpcidev->scsi.max.max_io_size / PAGE_SIZE);
-	if (scsihost->sg_tablesize > MAX_PHYS_INFO)
-		scsihost->sg_tablesize = MAX_PHYS_INFO;
-
-	/* this creates "host%d" in sysfs.  If 2nd argument is NULL,
-	 * then this generic /sys/devices/platform/host?  device is
-	 * created and /sys/scsi_host/host? ->
-	 * /sys/devices/platform/host?  If 2nd argument is not NULL,
-	 * then this generic /sys/devices/<path>/host? is created and
-	 * host? points to that device instead.
-	 */
-	error = scsi_add_host(scsihost, &virtpcidev->generic_dev);
-	if (error) {
-		POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		/* decr refcount on scsihost which was incremented by
-		 * scsi_add_host so the scsi_host gets deleted
-		 */
-		scsi_host_put(scsihost);
-		return -ENODEV;
-	}
-
-	virthbainfo = (struct virthba_info *)scsihost->hostdata;
-	memset(virthbainfo, 0, sizeof(struct virthba_info));
-	for (i = 0; i < VIRTHBASOPENMAX; i++) {
-		if (!virthbas_open[i].virthbainfo) {
-			virthbas_open[i].virthbainfo = virthbainfo;
-			break;
-		}
-	}
-	virthbainfo->interrupt_vector = -1;
-	virthbainfo->chinfo.queueinfo = &virtpcidev->queueinfo;
-	virthbainfo->virtpcidev = virtpcidev;
-	spin_lock_init(&virthbainfo->chinfo.insertlock);
-
-	init_waitqueue_head(&virthbainfo->rsp_queue);
-	spin_lock_init(&virthbainfo->privlock);
-	memset(&virthbainfo->pending, 0, sizeof(virthbainfo->pending));
-	virthbainfo->serverdown = false;
-	virthbainfo->serverchangingstate = false;
-
-	virthbainfo->intr = virtpcidev->intr;
-	/* save of host within virthba_info */
-	virthbainfo->scsihost = scsihost;
-
-	/* save of host within virtpci_dev */
-	virtpcidev->scsi.scsihost = scsihost;
-
-	/* Setup workqueue for serverdown messages */
-	INIT_WORK(&virthbainfo->serverdown_completion,
-		  virthba_serverdown_complete);
-
-	writeq(readq(&virthbainfo->chinfo.queueinfo->chan->features) |
-	       ULTRA_IO_CHANNEL_IS_POLLING,
-	       &virthbainfo->chinfo.queueinfo->chan->features);
-	/* start thread that will receive scsicmnd responses */
-
-	channel_header = virthbainfo->chinfo.queueinfo->chan;
-	pqhdr = (struct signal_queue_header __iomem *)
-		((char __iomem *)channel_header +
-		 readq(&channel_header->ch_space_offset)) + IOCHAN_FROM_IOPART;
-	virthbainfo->flags_addr = &pqhdr->features;
-
-	if (!uisthread_start(&virthbainfo->chinfo.threadinfo,
-			     process_incoming_rsps,
-			     virthbainfo, "vhba_incoming")) {
-		/* decr refcount on scsihost which was incremented by
-		 * scsi_add_host so the scsi_host gets deleted
-		 */
-		POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		scsi_host_put(scsihost);
-		return -ENODEV;
-	}
-	virthbainfo->interrupt_vector =
-	    virthbainfo->intr.recv_irq_handle & INTERRUPT_VECTOR_MASK;
-	rsp = request_irq(virthbainfo->interrupt_vector, handler, IRQF_SHARED,
-			  scsihost->hostt->name, virthbainfo);
-	if (rsp != 0) {
-		virthbainfo->interrupt_vector = -1;
-		POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-	} else {
-		u64 __iomem *features_addr =
-		    &virthbainfo->chinfo.queueinfo->chan->features;
-		mask = ~(ULTRA_IO_CHANNEL_IS_POLLING |
-			 ULTRA_IO_DRIVER_DISABLES_INTS);
-		uisqueue_interlocked_and(features_addr, mask);
-		mask = ULTRA_IO_DRIVER_ENABLES_INTS;
-		uisqueue_interlocked_or(features_addr, mask);
-		rsltq_wait_usecs = 4000000;
-	}
-
-	scsi_scan_host(scsihost);
-
-	POSTCODE_LINUX_2(VHBA_PROBE_EXIT_PC, POSTCODE_SEVERITY_INFO);
-	return 0;
-}
-
-static void
-virthba_remove(struct virtpci_dev *virtpcidev)
-{
-	struct virthba_info *virthbainfo;
-	struct Scsi_Host *scsihost =
-	    (struct Scsi_Host *)virtpcidev->scsi.scsihost;
-
-	virthbainfo = (struct virthba_info *)scsihost->hostdata;
-	if (virthbainfo->interrupt_vector != -1)
-		free_irq(virthbainfo->interrupt_vector, virthbainfo);
-
-	scsi_remove_host(scsihost);
-
-	uisthread_stop(&virthbainfo->chinfo.threadinfo);
-
-	/* decr refcount on scsihost which was incremented by
-	 * scsi_add_host so the scsi_host gets deleted
-	 */
-	scsi_host_put(scsihost);
-}
-
-static int
-forward_vdiskmgmt_command(enum vdisk_mgmt_types vdiskcmdtype,
-			  struct Scsi_Host *scsihost,
-			  struct uisscsi_dest *vdest)
-{
-	struct uiscmdrsp *cmdrsp;
-	struct virthba_info *virthbainfo =
-	    (struct virthba_info *)scsihost->hostdata;
-	int notifyresult = 0xffff;
-	wait_queue_head_t notifyevent;
-
-	if (virthbainfo->serverdown || virthbainfo->serverchangingstate)
-		return FAILED;
-
-	cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
-	if (!cmdrsp)
-		return FAILED;  /* reject */
-
-	init_waitqueue_head(&notifyevent);
-
-	/* issue VDISK_MGMT_CMD
-	 * set type to command - as opposed to task mgmt
-	 */
-	cmdrsp->cmdtype = CMD_VDISKMGMT_TYPE;
-	/* specify the event that has to be triggered when this cmd is
-	 * complete
-	 */
-	cmdrsp->vdiskmgmt.notify = (void *)&notifyevent;
-	cmdrsp->vdiskmgmt.notifyresult = (void *)&notifyresult;
-
-	/* save destination */
-	cmdrsp->vdiskmgmt.vdisktype = vdiskcmdtype;
-	cmdrsp->vdiskmgmt.vdest.channel = vdest->channel;
-	cmdrsp->vdiskmgmt.vdest.id = vdest->id;
-	cmdrsp->vdiskmgmt.vdest.lun = vdest->lun;
-	cmdrsp->vdiskmgmt.scsicmd =
-	    (void *)(uintptr_t)
-		add_scsipending_entry_with_wait(virthbainfo, CMD_VDISKMGMT_TYPE,
-						(void *)cmdrsp);
-
-	uisqueue_put_cmdrsp_with_lock_client(virthbainfo->chinfo.queueinfo,
-					     cmdrsp, IOCHAN_TO_IOPART,
-					     &virthbainfo->chinfo.insertlock,
-					     DONT_ISSUE_INTERRUPT, (u64)NULL,
-					     OK_TO_WAIT, "vhba");
-	wait_event(notifyevent, notifyresult != 0xffff);
-	kfree(cmdrsp);
-	return SUCCESS;
-}
-
-/*****************************************************/
-/* Scsi Host support functions                       */
-/*****************************************************/
-
-static int
-forward_taskmgmt_command(enum task_mgmt_types tasktype,
-			 struct scsi_device *scsidev)
-{
-	struct uiscmdrsp *cmdrsp;
-	struct virthba_info *virthbainfo =
-	    (struct virthba_info *)scsidev->host->hostdata;
-	int notifyresult = 0xffff;
-	wait_queue_head_t notifyevent;
-
-	if (virthbainfo->serverdown || virthbainfo->serverchangingstate)
-		return FAILED;
-
-	cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
-	if (!cmdrsp)
-		return FAILED;	/* reject */
-
-	init_waitqueue_head(&notifyevent);
-
-	/* issue TASK_MGMT_ABORT_TASK */
-	/* set type to command - as opposed to task mgmt */
-	cmdrsp->cmdtype = CMD_SCSITASKMGMT_TYPE;
-	/* specify the event that has to be triggered when this */
-	/* cmd is complete */
-	cmdrsp->scsitaskmgmt.notify = (void *)&notifyevent;
-	cmdrsp->scsitaskmgmt.notifyresult = (void *)&notifyresult;
-
-	/* save destination */
-	cmdrsp->scsitaskmgmt.tasktype = tasktype;
-	cmdrsp->scsitaskmgmt.vdest.channel = scsidev->channel;
-	cmdrsp->scsitaskmgmt.vdest.id = scsidev->id;
-	cmdrsp->scsitaskmgmt.vdest.lun = scsidev->lun;
-	cmdrsp->scsitaskmgmt.scsicmd =
-	    (void *)(uintptr_t)
-		add_scsipending_entry_with_wait(virthbainfo,
-						CMD_SCSITASKMGMT_TYPE,
-						(void *)cmdrsp);
-
-	uisqueue_put_cmdrsp_with_lock_client(virthbainfo->chinfo.queueinfo,
-					     cmdrsp, IOCHAN_TO_IOPART,
-					     &virthbainfo->chinfo.insertlock,
-					     DONT_ISSUE_INTERRUPT, (u64)NULL,
-					     OK_TO_WAIT, "vhba");
-	wait_event(notifyevent, notifyresult != 0xffff);
-	kfree(cmdrsp);
-	return SUCCESS;
-}
-
-/* The abort handler returns SUCCESS if it has succeeded to make LLDD
- * and all related hardware forget about the scmd.
- */
-static int
-virthba_abort_handler(struct scsi_cmnd *scsicmd)
-{
-	/* issue TASK_MGMT_ABORT_TASK */
-	struct scsi_device *scsidev;
-	struct virtdisk_info *vdisk;
-
-	scsidev = scsicmd->device;
-	for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
-	     vdisk->next; vdisk = vdisk->next) {
-		if ((scsidev->channel == vdisk->channel) &&
-		    (scsidev->id == vdisk->id) &&
-		    (scsidev->lun == vdisk->lun)) {
-			if (atomic_read(&vdisk->error_count) <
-			    VIRTHBA_ERROR_COUNT) {
-				atomic_inc(&vdisk->error_count);
-				POSTCODE_LINUX_2(VHBA_COMMAND_HANDLER_PC,
-						 POSTCODE_SEVERITY_INFO);
-			} else
-				atomic_set(&vdisk->ios_threshold,
-					   IOS_ERROR_THRESHOLD);
-		}
-	}
-	return forward_taskmgmt_command(TASK_MGMT_ABORT_TASK, scsicmd->device);
-}
-
-static int
-virthba_bus_reset_handler(struct scsi_cmnd *scsicmd)
-{
-	/* issue TASK_MGMT_TARGET_RESET for each target on the bus */
-	struct scsi_device *scsidev;
-	struct virtdisk_info *vdisk;
-
-	scsidev = scsicmd->device;
-	for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
-	     vdisk->next; vdisk = vdisk->next) {
-		if ((scsidev->channel == vdisk->channel) &&
-		    (scsidev->id == vdisk->id) &&
-		    (scsidev->lun == vdisk->lun)) {
-			if (atomic_read(&vdisk->error_count) <
-			    VIRTHBA_ERROR_COUNT) {
-				atomic_inc(&vdisk->error_count);
-				POSTCODE_LINUX_2(VHBA_COMMAND_HANDLER_PC,
-						 POSTCODE_SEVERITY_INFO);
-			} else
-				atomic_set(&vdisk->ios_threshold,
-					   IOS_ERROR_THRESHOLD);
-		}
-	}
-	return forward_taskmgmt_command(TASK_MGMT_BUS_RESET, scsicmd->device);
-}
-
-static int
-virthba_device_reset_handler(struct scsi_cmnd *scsicmd)
-{
-	/* issue TASK_MGMT_LUN_RESET */
-	struct scsi_device *scsidev;
-	struct virtdisk_info *vdisk;
-
-	scsidev = scsicmd->device;
-	for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
-	     vdisk->next; vdisk = vdisk->next) {
-		if ((scsidev->channel == vdisk->channel) &&
-		    (scsidev->id == vdisk->id) &&
-		    (scsidev->lun == vdisk->lun)) {
-			if (atomic_read(&vdisk->error_count) <
-			    VIRTHBA_ERROR_COUNT) {
-				atomic_inc(&vdisk->error_count);
-				POSTCODE_LINUX_2(VHBA_COMMAND_HANDLER_PC,
-						 POSTCODE_SEVERITY_INFO);
-			} else
-				atomic_set(&vdisk->ios_threshold,
-					   IOS_ERROR_THRESHOLD);
-		}
-	}
-	return forward_taskmgmt_command(TASK_MGMT_LUN_RESET, scsicmd->device);
-}
-
-static int
-virthba_host_reset_handler(struct scsi_cmnd *scsicmd)
-{
-	/* issue TASK_MGMT_TARGET_RESET for each target on each bus for host */
-	return SUCCESS;
-}
-
-static char virthba_get_info_str[256];
-
-static const char *
-virthba_get_info(struct Scsi_Host *shp)
-{
-	/* Return version string */
-	sprintf(virthba_get_info_str, "virthba, version %s\n", VIRTHBA_VERSION);
-	return virthba_get_info_str;
-}
-
-static int
-virthba_ioctl(struct scsi_device *dev, int cmd, void __user *arg)
-{
-	return -EINVAL;
-}
-
-/* This returns SCSI_MLQUEUE_DEVICE_BUSY if the signal queue to IOpart
- * is full.
- */
-static int
-virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
-			  void (*virthba_cmnd_done)(struct scsi_cmnd *))
-{
-	struct scsi_device *scsidev = scsicmd->device;
-	int insert_location;
-	unsigned char op;
-	unsigned char *cdb = scsicmd->cmnd;
-	struct Scsi_Host *scsihost = scsidev->host;
-	struct uiscmdrsp *cmdrsp;
-	unsigned int i;
-	struct virthba_info *virthbainfo =
-	    (struct virthba_info *)scsihost->hostdata;
-	struct scatterlist *sg = NULL;
-	struct scatterlist *sgl = NULL;
-	int sg_failed = 0;
-
-	if (virthbainfo->serverdown || virthbainfo->serverchangingstate)
-		return SCSI_MLQUEUE_DEVICE_BUSY;
-	cmdrsp = kzalloc(SIZEOF_CMDRSP, GFP_ATOMIC);
-	if (!cmdrsp)
-		return 1;	/* reject the command */
-
-	/* now saving everything we need from scsi_cmd into cmdrsp
-	 * before we queue cmdrsp set type to command - as opposed to
-	 * task mgmt
-	 */
-	cmdrsp->cmdtype = CMD_SCSI_TYPE;
-	/* save the pending insertion location.  Deletion from pending
-	 * will return the scsicmd pointer for completion
-	 */
-	insert_location =
-	    add_scsipending_entry(virthbainfo, CMD_SCSI_TYPE, (void *)scsicmd);
-	if (insert_location != -1) {
-		cmdrsp->scsi.scsicmd = (void *)(uintptr_t)insert_location;
-	} else {
-		kfree(cmdrsp);
-		return SCSI_MLQUEUE_DEVICE_BUSY;
-	}
-	/* save done function that we have call when cmd is complete */
-	scsicmd->scsi_done = virthba_cmnd_done;
-	/* save destination */
-	cmdrsp->scsi.vdest.channel = scsidev->channel;
-	cmdrsp->scsi.vdest.id = scsidev->id;
-	cmdrsp->scsi.vdest.lun = scsidev->lun;
-	/* save datadir */
-	cmdrsp->scsi.data_dir = scsicmd->sc_data_direction;
-	memcpy(cmdrsp->scsi.cmnd, cdb, MAX_CMND_SIZE);
-
-	cmdrsp->scsi.bufflen = scsi_bufflen(scsicmd);
-
-	/* keep track of the max buffer length so far. */
-	if (cmdrsp->scsi.bufflen > max_buff_len)
-		max_buff_len = cmdrsp->scsi.bufflen;
-
-	if (scsi_sg_count(scsicmd) > MAX_PHYS_INFO) {
-		del_scsipending_entry(virthbainfo, (uintptr_t)insert_location);
-		kfree(cmdrsp);
-		return 1;	/* reject the command */
-	}
-
-	/* This is what we USED to do when we assumed we were running */
-	/* uissd & virthba on the same Linux system. */
-	/* cmdrsp->scsi.buffer = scsicmd->request_buffer; */
-	/* The following code does NOT make that assumption. */
-	/* convert buffer to phys information */
-	if (scsi_sg_count(scsicmd) == 0) {
-		if (scsi_bufflen(scsicmd) > 0) {
-			BUG_ON(scsi_sg_count(scsicmd) == 0);
-		}
-	} else {
-		/* buffer is scatterlist - copy it out */
-		sgl = scsi_sglist(scsicmd);
-
-		for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) {
-			cmdrsp->scsi.gpi_list[i].address = sg_phys(sg);
-			cmdrsp->scsi.gpi_list[i].length = sg->length;
-		}
-
-		if (sg_failed) {
-			/* BUG(); ***** For now, let it fail in uissd
-			 * if it is a problem, as it might just
-			 * work
-			 */
-		}
-
-		cmdrsp->scsi.guest_phys_entries = scsi_sg_count(scsicmd);
-	}
-
-	op = cdb[0];
-	i = uisqueue_put_cmdrsp_with_lock_client(virthbainfo->chinfo.queueinfo,
-						 cmdrsp, IOCHAN_TO_IOPART,
-						 &virthbainfo->chinfo.
-						 insertlock,
-						 DONT_ISSUE_INTERRUPT,
-						 (u64)NULL, DONT_WAIT, "vhba");
-	if (i == 0) {
-		/* queue must be full - and we said don't wait - return busy */
-		kfree(cmdrsp);
-		del_scsipending_entry(virthbainfo, (uintptr_t)insert_location);
-		return SCSI_MLQUEUE_DEVICE_BUSY;
-	}
-
-	/* we're done with cmdrsp space - data from it has been copied
-	 * into channel - free it now.
-	 */
-	kfree(cmdrsp);
-	return 0;		/* non-zero implies host/device is busy */
-}
-
-static int
-virthba_slave_alloc(struct scsi_device *scsidev)
-{
-	/* this called by the midlayer before scan for new devices -
-	 * LLD can alloc any struct & do init if needed.
-	 */
-	struct virtdisk_info *vdisk;
-	struct virtdisk_info *tmpvdisk;
-	struct virthba_info *virthbainfo;
-	struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host;
-
-	virthbainfo = (struct virthba_info *)scsihost->hostdata;
-	if (!virthbainfo)
-		return 0;	/* even though we errored, treat as success */
-
-	for (vdisk = &virthbainfo->head; vdisk->next; vdisk = vdisk->next) {
-		if (vdisk->next->valid &&
-		    (vdisk->next->channel == scsidev->channel) &&
-		    (vdisk->next->id == scsidev->id) &&
-		    (vdisk->next->lun == scsidev->lun))
-			return 0;
-	}
-	tmpvdisk = kzalloc(sizeof(*tmpvdisk), GFP_ATOMIC);
-	if (!tmpvdisk)
-		return 0;
-
-	tmpvdisk->channel = scsidev->channel;
-	tmpvdisk->id = scsidev->id;
-	tmpvdisk->lun = scsidev->lun;
-	tmpvdisk->valid = 1;
-	vdisk->next = tmpvdisk;
-	return 0;		/* success */
-}
-
-static int
-virthba_slave_configure(struct scsi_device *scsidev)
-{
-	return 0;		/* success */
-}
-
-static void
-virthba_slave_destroy(struct scsi_device *scsidev)
-{
-	/* midlevel calls this after device has been quiesced and
-	 * before it is to be deleted.
-	 */
-	struct virtdisk_info *vdisk, *delvdisk;
-	struct virthba_info *virthbainfo;
-	struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host;
-
-	virthbainfo = (struct virthba_info *)scsihost->hostdata;
-	for (vdisk = &virthbainfo->head; vdisk->next; vdisk = vdisk->next) {
-		if (vdisk->next->valid &&
-		    (vdisk->next->channel == scsidev->channel) &&
-		    (vdisk->next->id == scsidev->id) &&
-		    (vdisk->next->lun == scsidev->lun)) {
-			delvdisk = vdisk->next;
-			vdisk->next = vdisk->next->next;
-			kfree(delvdisk);
-			return;
-		}
-	}
-}
-
-/*****************************************************/
-/* Scsi Cmnd support thread                          */
-/*****************************************************/
-
-static void
-do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
-{
-	struct virtdisk_info *vdisk;
-	struct scsi_device *scsidev;
-	struct sense_data *sd;
-
-	scsidev = scsicmd->device;
-	memcpy(scsicmd->sense_buffer, cmdrsp->scsi.sensebuf, MAX_SENSE_SIZE);
-	sd = (struct sense_data *)scsicmd->sense_buffer;
-
-	/* Do not log errors for disk-not-present inquiries */
-	if ((cmdrsp->scsi.cmnd[0] == INQUIRY) &&
-	    (host_byte(cmdrsp->scsi.linuxstat) == DID_NO_CONNECT) &&
-	    (cmdrsp->scsi.addlstat == ADDL_SEL_TIMEOUT))
-		return;
-
-	/* Okay see what our error_count is here.... */
-	for (vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
-	     vdisk->next; vdisk = vdisk->next) {
-		if ((scsidev->channel != vdisk->channel) ||
-		    (scsidev->id != vdisk->id) ||
-		    (scsidev->lun != vdisk->lun))
-			continue;
-
-		if (atomic_read(&vdisk->error_count) < VIRTHBA_ERROR_COUNT) {
-			atomic_inc(&vdisk->error_count);
-			atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD);
-		}
-	}
-}
-
-static void
-do_scsi_nolinuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
-{
-	struct scsi_device *scsidev;
-	unsigned char buf[36];
-	struct scatterlist *sg;
-	unsigned int i;
-	char *thispage;
-	char *thispage_orig;
-	int bufind = 0;
-	struct virtdisk_info *vdisk;
-
-	scsidev = scsicmd->device;
-	if ((cmdrsp->scsi.cmnd[0] == INQUIRY) &&
-	    (cmdrsp->scsi.bufflen >= MIN_INQUIRY_RESULT_LEN)) {
-		if (cmdrsp->scsi.no_disk_result == 0)
-			return;
-
-		/* Linux scsi code is weird; it wants
-		 * a device at Lun 0 to issue report
-		 * luns, but we don't want a disk
-		 * there so we'll present a processor
-		 * there. */
-		SET_NO_DISK_INQUIRY_RESULT(buf, cmdrsp->scsi.bufflen,
-					   scsidev->lun,
-					   DEV_DISK_CAPABLE_NOT_PRESENT,
-					   DEV_NOT_CAPABLE);
-
-		if (scsi_sg_count(scsicmd) == 0) {
-			if (scsi_bufflen(scsicmd) > 0) {
-				BUG_ON(scsi_sg_count(scsicmd) ==
-				       0);
-			}
-			memcpy(scsi_sglist(scsicmd), buf,
-			       cmdrsp->scsi.bufflen);
-			return;
-		}
-
-		sg = scsi_sglist(scsicmd);
-		for (i = 0; i < scsi_sg_count(scsicmd); i++) {
-			thispage_orig = kmap_atomic(sg_page(sg + i));
-			thispage = (void *)((unsigned long)thispage_orig |
-					     sg[i].offset);
-			memcpy(thispage, buf + bufind, sg[i].length);
-			kunmap_atomic(thispage_orig);
-			bufind += sg[i].length;
-		}
-	} else {
-		vdisk = &((struct virthba_info *)scsidev->host->hostdata)->head;
-		for ( ; vdisk->next; vdisk = vdisk->next) {
-			if ((scsidev->channel != vdisk->channel) ||
-			    (scsidev->id != vdisk->id) ||
-			    (scsidev->lun != vdisk->lun))
-				continue;
-
-			if (atomic_read(&vdisk->ios_threshold) > 0) {
-				atomic_dec(&vdisk->ios_threshold);
-				if (atomic_read(&vdisk->ios_threshold) == 0) {
-					atomic_set(&vdisk->error_count, 0);
-				}
-			}
-		}
-	}
-}
-
-static void
-complete_scsi_command(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd)
-{
-	/* take what we need out of cmdrsp and complete the scsicmd */
-	scsicmd->result = cmdrsp->scsi.linuxstat;
-	if (cmdrsp->scsi.linuxstat)
-		do_scsi_linuxstat(cmdrsp, scsicmd);
-	else
-		do_scsi_nolinuxstat(cmdrsp, scsicmd);
-
-	if (scsicmd->scsi_done)
-		scsicmd->scsi_done(scsicmd);
-}
-
-static inline void
-complete_vdiskmgmt_command(struct uiscmdrsp *cmdrsp)
-{
-	/* copy the result of the taskmgmt and */
-	/* wake up the error handler that is waiting for this */
-	*(int *)cmdrsp->vdiskmgmt.notifyresult = cmdrsp->vdiskmgmt.result;
-	wake_up_all((wait_queue_head_t *)cmdrsp->vdiskmgmt.notify);
-}
-
-static inline void
-complete_taskmgmt_command(struct uiscmdrsp *cmdrsp)
-{
-	/* copy the result of the taskmgmt and */
-	/* wake up the error handler that is waiting for this */
-	*(int *)cmdrsp->scsitaskmgmt.notifyresult =
-	    cmdrsp->scsitaskmgmt.result;
-	wake_up_all((wait_queue_head_t *)cmdrsp->scsitaskmgmt.notify);
-}
-
-static void
-drain_queue(struct virthba_info *virthbainfo, struct chaninfo *dc,
-	    struct uiscmdrsp *cmdrsp)
-{
-	unsigned long flags;
-	int qrslt = 0;
-	struct scsi_cmnd *scsicmd;
-	struct Scsi_Host *shost = virthbainfo->scsihost;
-
-	while (1) {
-		spin_lock_irqsave(&virthbainfo->chinfo.insertlock, flags);
-		if (!spar_channel_client_acquire_os(dc->queueinfo->chan,
-						    "vhba")) {
-			spin_unlock_irqrestore(&virthbainfo->chinfo.insertlock,
-					       flags);
-			virthbainfo->acquire_failed_cnt++;
-			break;
-		}
-		qrslt = uisqueue_get_cmdrsp(dc->queueinfo, cmdrsp,
-					    IOCHAN_FROM_IOPART);
-		spar_channel_client_release_os(dc->queueinfo->chan, "vhba");
-		spin_unlock_irqrestore(&virthbainfo->chinfo.insertlock, flags);
-		if (qrslt == 0)
-			break;
-		if (cmdrsp->cmdtype == CMD_SCSI_TYPE) {
-			/* scsicmd location is returned by the
-			 * deletion
-			 */
-			scsicmd = del_scsipending_entry(virthbainfo,
-							(uintptr_t)
-							 cmdrsp->scsi.scsicmd);
-			if (!scsicmd)
-				break;
-			/* complete the orig cmd */
-			complete_scsi_command(cmdrsp, scsicmd);
-		} else if (cmdrsp->cmdtype == CMD_SCSITASKMGMT_TYPE) {
-			if (!del_scsipending_entry(virthbainfo,
-				   (uintptr_t)cmdrsp->scsitaskmgmt.scsicmd))
-				break;
-			complete_taskmgmt_command(cmdrsp);
-		} else if (cmdrsp->cmdtype == CMD_NOTIFYGUEST_TYPE) {
-			/* The vHba pointer has no meaning in
-			 * a Client/Guest Partition. Let's be
-			 * safe and set it to NULL now.  Do
-			 * not use it here! */
-			cmdrsp->disknotify.v_hba = NULL;
-			process_disk_notify(shost, cmdrsp);
-		} else if (cmdrsp->cmdtype == CMD_VDISKMGMT_TYPE) {
-			if (!del_scsipending_entry(virthbainfo,
-						   (uintptr_t)
-						    cmdrsp->vdiskmgmt.scsicmd))
-				break;
-			complete_vdiskmgmt_command(cmdrsp);
-		}
-		/* cmdrsp is now available for reuse */
-	}
-}
-
-/* main function for the thread that waits for scsi commands to arrive
- * in a specified queue
- */
-static int
-process_incoming_rsps(void *v)
-{
-	struct virthba_info *virthbainfo = v;
-	struct chaninfo *dc = &virthbainfo->chinfo;
-	struct uiscmdrsp *cmdrsp = NULL;
-	const int SZ = sizeof(struct uiscmdrsp);
-	u64 mask;
-	unsigned long long rc1;
-
-	UIS_DAEMONIZE("vhba_incoming");
-	/* alloc once and reuse */
-	cmdrsp = kmalloc(SZ, GFP_ATOMIC);
-	if (!cmdrsp) {
-		complete_and_exit(&dc->threadinfo.has_stopped, 0);
-		return 0;
-	}
-	mask = ULTRA_CHANNEL_ENABLE_INTS;
-	while (1) {
-		if (kthread_should_stop())
-			break;
-		wait_event_interruptible_timeout(virthbainfo->rsp_queue,
-			 (atomic_read(&virthbainfo->interrupt_rcvd) == 1),
-				      usecs_to_jiffies(rsltq_wait_usecs));
-		atomic_set(&virthbainfo->interrupt_rcvd, 0);
-		/* drain queue */
-		drain_queue(virthbainfo, dc, cmdrsp);
-		rc1 = uisqueue_interlocked_or(virthbainfo->flags_addr, mask);
-	}
-
-	kfree(cmdrsp);
-
-	complete_and_exit(&dc->threadinfo.has_stopped, 0);
-}
-
-/*****************************************************/
-/* Debugfs filesystem functions                      */
-/*****************************************************/
-
-static ssize_t info_debugfs_read(struct file *file,
-				 char __user *buf, size_t len, loff_t *offset)
-{
-	ssize_t bytes_read = 0;
-	int str_pos = 0;
-	u64 phys_flags_addr;
-	int i;
-	struct virthba_info *virthbainfo;
-	char *vbuf;
-
-	if (len > MAX_BUF)
-		len = MAX_BUF;
-	vbuf = kzalloc(len, GFP_KERNEL);
-	if (!vbuf)
-		return -ENOMEM;
-
-	for (i = 0; i < VIRTHBASOPENMAX; i++) {
-		if (!virthbas_open[i].virthbainfo)
-			continue;
-
-		virthbainfo = virthbas_open[i].virthbainfo;
-
-		str_pos += scnprintf(vbuf + str_pos,
-				len - str_pos, "max_buff_len:%u\n",
-				max_buff_len);
-
-		str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-				"\nvirthba result queue poll wait:%d usecs.\n",
-				rsltq_wait_usecs);
-		str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-				"\ninterrupts_rcvd = %llu, interrupts_disabled = %llu\n",
-				virthbainfo->interrupts_rcvd,
-				virthbainfo->interrupts_disabled);
-		str_pos += scnprintf(vbuf + str_pos,
-				len - str_pos, "\ninterrupts_notme = %llu,\n",
-				virthbainfo->interrupts_notme);
-		phys_flags_addr = virt_to_phys((__force  void *)
-					       virthbainfo->flags_addr);
-		str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-				"flags_addr = %p, phys_flags_addr=0x%016llx, FeatureFlags=%llu\n",
-				virthbainfo->flags_addr, phys_flags_addr,
-				(__le64)readq(virthbainfo->flags_addr));
-		str_pos += scnprintf(vbuf + str_pos,
-			len - str_pos, "acquire_failed_cnt:%llu\n",
-			virthbainfo->acquire_failed_cnt);
-		str_pos += scnprintf(vbuf + str_pos, len - str_pos, "\n");
-	}
-
-	bytes_read = simple_read_from_buffer(buf, len, offset, vbuf, str_pos);
-	kfree(vbuf);
-	return bytes_read;
-}
-
-static ssize_t enable_ints_write(struct file *file, const char __user *buffer,
-				 size_t count, loff_t *ppos)
-{
-	char buf[4];
-	int i, new_value;
-	struct virthba_info *virthbainfo;
-
-	u64 __iomem *features_addr;
-	u64 mask;
-
-	if (count >= ARRAY_SIZE(buf))
-		return -EINVAL;
-
-	buf[count] = '\0';
-	if (copy_from_user(buf, buffer, count))
-		return -EFAULT;
-
-	i = kstrtoint(buf, 10, &new_value);
-
-	if (i != 0)
-		return -EFAULT;
-
-	/* set all counts to new_value usually 0 */
-	for (i = 0; i < VIRTHBASOPENMAX; i++) {
-		if (virthbas_open[i].virthbainfo) {
-			virthbainfo = virthbas_open[i].virthbainfo;
-			features_addr =
-				&virthbainfo->chinfo.queueinfo->chan->features;
-			if (new_value == 1) {
-				mask = ~(ULTRA_IO_CHANNEL_IS_POLLING |
-					 ULTRA_IO_DRIVER_DISABLES_INTS);
-				uisqueue_interlocked_and(features_addr, mask);
-				mask = ULTRA_IO_DRIVER_ENABLES_INTS;
-				uisqueue_interlocked_or(features_addr, mask);
-				rsltq_wait_usecs = 4000000;
-			} else {
-				mask = ~(ULTRA_IO_DRIVER_ENABLES_INTS |
-					 ULTRA_IO_DRIVER_DISABLES_INTS);
-				uisqueue_interlocked_and(features_addr, mask);
-				mask = ULTRA_IO_CHANNEL_IS_POLLING;
-				uisqueue_interlocked_or(features_addr, mask);
-				rsltq_wait_usecs = 4000;
-			}
-		}
-	}
-	return count;
-}
-
-/* As per VirtpciFunc returns 1 for success and 0 for failure */
-static int
-virthba_serverup(struct virtpci_dev *virtpcidev)
-{
-	struct virthba_info *virthbainfo =
-	    (struct virthba_info *)((struct Scsi_Host *)virtpcidev->scsi.
-				     scsihost)->hostdata;
-
-	if (!virthbainfo->serverdown)
-		return 1;
-
-	if (virthbainfo->serverchangingstate)
-		return 0;
-
-	virthbainfo->serverchangingstate = true;
-	/* Must transition channel to ATTACHED state BEFORE we
-	 * can start using the device again
-	 */
-	SPAR_CHANNEL_CLIENT_TRANSITION(virthbainfo->chinfo.queueinfo->chan,
-				       dev_name(&virtpcidev->generic_dev),
-				       CHANNELCLI_ATTACHED, NULL);
-
-	/* Start Processing the IOVM Response Queue Again */
-	if (!uisthread_start(&virthbainfo->chinfo.threadinfo,
-			     process_incoming_rsps,
-			     virthbainfo, "vhba_incoming")) {
-		return 0;
-	}
-	virthbainfo->serverdown = false;
-	virthbainfo->serverchangingstate = false;
-
-	return 1;
-}
-
-static void
-virthba_serverdown_complete(struct work_struct *work)
-{
-	struct virthba_info *virthbainfo;
-	struct virtpci_dev *virtpcidev;
-	int i;
-	struct scsipending *pendingdel = NULL;
-	struct scsi_cmnd *scsicmd = NULL;
-	struct uiscmdrsp *cmdrsp;
-	unsigned long flags;
-
-	virthbainfo = container_of(work, struct virthba_info,
-				   serverdown_completion);
-
-	/* Stop Using the IOVM Response Queue (queue should be drained
-	 * by the end)
-	 */
-	uisthread_stop(&virthbainfo->chinfo.threadinfo);
-
-	/* Fail Commands that weren't completed */
-	spin_lock_irqsave(&virthbainfo->privlock, flags);
-	for (i = 0; i < MAX_PENDING_REQUESTS; i++) {
-		pendingdel = &virthbainfo->pending[i];
-		switch (pendingdel->cmdtype) {
-		case CMD_SCSI_TYPE:
-			scsicmd = (struct scsi_cmnd *)pendingdel->sent;
-			scsicmd->result = DID_RESET << 16;
-			if (scsicmd->scsi_done)
-				scsicmd->scsi_done(scsicmd);
-			break;
-		case CMD_SCSITASKMGMT_TYPE:
-			cmdrsp = (struct uiscmdrsp *)pendingdel->sent;
-			wake_up_all((wait_queue_head_t *)
-				    cmdrsp->scsitaskmgmt.notify);
-			*(int *)cmdrsp->scsitaskmgmt.notifyresult =
-				TASK_MGMT_FAILED;
-			break;
-		case CMD_VDISKMGMT_TYPE:
-			cmdrsp = (struct uiscmdrsp *)pendingdel->sent;
-			*(int *)cmdrsp->vdiskmgmt.notifyresult =
-			    VDISK_MGMT_FAILED;
-			wake_up_all((wait_queue_head_t *)
-				    cmdrsp->vdiskmgmt.notify);
-			break;
-		default:
-			break;
-		}
-		pendingdel->cmdtype = 0;
-		pendingdel->sent = NULL;
-	}
-	spin_unlock_irqrestore(&virthbainfo->privlock, flags);
-
-	virtpcidev = virthbainfo->virtpcidev;
-
-	virthbainfo->serverdown = true;
-	virthbainfo->serverchangingstate = false;
-	/* Return the ServerDown response to Command */
-	visorchipset_device_pause_response(virtpcidev->bus_no,
-					   virtpcidev->device_no, 0);
-}
-
-/* As per VirtpciFunc returns 1 for success and 0 for failure */
-static int
-virthba_serverdown(struct virtpci_dev *virtpcidev, u32 state)
-{
-	int stat = 1;
-
-	struct virthba_info *virthbainfo =
-	    (struct virthba_info *)((struct Scsi_Host *)virtpcidev->scsi.
-				     scsihost)->hostdata;
-
-	if (!virthbainfo->serverdown && !virthbainfo->serverchangingstate) {
-		virthbainfo->serverchangingstate = true;
-		queue_work(virthba_serverdown_workqueue,
-			   &virthbainfo->serverdown_completion);
-	} else if (virthbainfo->serverchangingstate) {
-		stat = 0;
-	}
-
-	return stat;
-}
-
-/*****************************************************/
-/* Module Init & Exit functions                      */
-/*****************************************************/
-
-static int __init
-virthba_parse_line(char *str)
-{
-	return 1;
-}
-
-static void __init
-virthba_parse_options(char *line)
-{
-	char *next = line;
-
-	POSTCODE_LINUX_2(VHBA_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	if (!line || !*line)
-		return;
-	while ((line = next)) {
-		next = strchr(line, ' ');
-		if (next)
-			*next++ = 0;
-		virthba_parse_line(line);
-	}
-
-	POSTCODE_LINUX_2(VHBA_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
-}
-
-static int __init
-virthba_mod_init(void)
-{
-	int error;
-	int i;
-
-	if (!unisys_spar_platform)
-		return -ENODEV;
-
-	POSTCODE_LINUX_2(VHBA_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	virthba_parse_options(virthba_options);
-
-	error = virtpci_register_driver(&virthba_driver);
-	if (error < 0) {
-		POSTCODE_LINUX_3(VHBA_CREATE_FAILURE_PC, error,
-				 POSTCODE_SEVERITY_ERR);
-	} else {
-		/* create the debugfs directories and entries */
-		virthba_debugfs_dir = debugfs_create_dir("virthba", NULL);
-		debugfs_create_file("info", S_IRUSR, virthba_debugfs_dir,
-				    NULL, &debugfs_info_fops);
-		debugfs_create_u32("rqwait_usecs", S_IRUSR | S_IWUSR,
-				   virthba_debugfs_dir, &rsltq_wait_usecs);
-		debugfs_create_file("enable_ints", S_IWUSR,
-				    virthba_debugfs_dir, NULL,
-				    &debugfs_enable_ints_fops);
-		/* Initialize dar_work_queue */
-		INIT_WORK(&dar_work_queue, do_disk_add_remove);
-		spin_lock_init(&dar_work_queue_lock);
-
-		/* clear out array */
-		for (i = 0; i < VIRTHBASOPENMAX; i++)
-			virthbas_open[i].virthbainfo = NULL;
-		/* Initialize the serverdown workqueue */
-		virthba_serverdown_workqueue =
-		    create_singlethread_workqueue("virthba_serverdown");
-		if (!virthba_serverdown_workqueue) {
-			POSTCODE_LINUX_2(VHBA_CREATE_FAILURE_PC,
-					 POSTCODE_SEVERITY_ERR);
-			error = -1;
-		}
-	}
-
-	POSTCODE_LINUX_2(VHBA_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
-	return error;
-}
-
-static ssize_t
-virthba_acquire_lun(struct device *cdev, struct device_attribute *attr,
-		    const char *buf, size_t count)
-{
-	struct uisscsi_dest vdest;
-	struct Scsi_Host *shost = class_to_shost(cdev);
-	int i;
-
-	i = sscanf(buf, "%d-%d-%d", &vdest.channel, &vdest.id, &vdest.lun);
-	if (i != 3)
-		return i;
-
-	return forward_vdiskmgmt_command(VDISK_MGMT_ACQUIRE, shost, &vdest);
-}
-
-static ssize_t
-virthba_release_lun(struct device *cdev, struct device_attribute *attr,
-		    const char *buf, size_t count)
-{
-	struct uisscsi_dest vdest;
-	struct Scsi_Host *shost = class_to_shost(cdev);
-	int i;
-
-	i = sscanf(buf, "%d-%d-%d", &vdest.channel, &vdest.id, &vdest.lun);
-	if (i != 3)
-		return i;
-
-	return forward_vdiskmgmt_command(VDISK_MGMT_RELEASE, shost, &vdest);
-}
-
-#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store)      \
-	struct device_attribute class_device_attr_##_name =   \
-		__ATTR(_name, _mode, _show, _store)
-
-static CLASS_DEVICE_ATTR(acquire_lun, S_IWUSR, NULL, virthba_acquire_lun);
-static CLASS_DEVICE_ATTR(release_lun, S_IWUSR, NULL, virthba_release_lun);
-
-static DEVICE_ATTRIBUTE *virthba_shost_attrs[] = {
-	&class_device_attr_acquire_lun,
-	&class_device_attr_release_lun,
-	NULL
-};
-
-static void __exit
-virthba_mod_exit(void)
-{
-	virtpci_unregister_driver(&virthba_driver);
-	/* unregister is going to call virthba_remove */
-	/* destroy serverdown completion workqueue */
-	if (virthba_serverdown_workqueue) {
-		destroy_workqueue(virthba_serverdown_workqueue);
-		virthba_serverdown_workqueue = NULL;
-	}
-
-	debugfs_remove_recursive(virthba_debugfs_dir);
-}
-
-/* specify function to be run at module insertion time */
-module_init(virthba_mod_init);
-
-/* specify function to be run when module is removed */
-module_exit(virthba_mod_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Usha Srinivasan");
-MODULE_ALIAS("uisvirthba");
-	/* this is extracted during depmod and kept in modules.dep */
-/* module parameter */
-module_param(virthba_options, charp, S_IRUGO);
diff --git a/drivers/staging/unisys/virthba/virthba.h b/drivers/staging/unisys/virthba/virthba.h
deleted file mode 100644
index 5990166..0000000
--- a/drivers/staging/unisys/virthba/virthba.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* virthba.h
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-/*
- * Unisys Virtual HBA driver header
- */
-
-#ifndef __VIRTHBA_H__
-#define __VIRTHBA_H__
-
-#define VIRTHBA_VERSION "01.00"
-
-#endif /* __VIRTHBA_H__ */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] staging: unisys: remove virtpci driver from staging tree
  2015-04-14  1:16 [PATCH 0/3] staging: unisys: remove virtpci, virthba, and uislib Benjamin Romer
  2015-04-14  1:16 ` [PATCH 1/3] staging: unisys: remove virthba driver for rewrite Benjamin Romer
@ 2015-04-14  1:16 ` Benjamin Romer
  2015-04-14  1:16 ` [PATCH 3/3] staging: unisys: remove uislib module " Benjamin Romer
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Romer @ 2015-04-14  1:16 UTC (permalink / raw)
  To: gregkh; +Cc: jkc, driverdev-devel, sparmaintainer, Benjamin Romer

The virtpci driver is being rewritten, so remove the driver from the staging
tree.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 drivers/staging/unisys/Kconfig           |    1 -
 drivers/staging/unisys/Makefile          |    1 -
 drivers/staging/unisys/virtpci/Kconfig   |   10 -
 drivers/staging/unisys/virtpci/Makefile  |   10 -
 drivers/staging/unisys/virtpci/virtpci.c | 1394 ------------------------------
 drivers/staging/unisys/virtpci/virtpci.h |  103 ---
 6 files changed, 1519 deletions(-)
 delete mode 100644 drivers/staging/unisys/virtpci/Kconfig
 delete mode 100644 drivers/staging/unisys/virtpci/Makefile
 delete mode 100644 drivers/staging/unisys/virtpci/virtpci.c
 delete mode 100644 drivers/staging/unisys/virtpci/virtpci.h

diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig
index 906cd58..1de86d1 100644
--- a/drivers/staging/unisys/Kconfig
+++ b/drivers/staging/unisys/Kconfig
@@ -13,6 +13,5 @@ source "drivers/staging/unisys/visorutil/Kconfig"
 source "drivers/staging/unisys/visorchannel/Kconfig"
 source "drivers/staging/unisys/visorchipset/Kconfig"
 source "drivers/staging/unisys/uislib/Kconfig"
-source "drivers/staging/unisys/virtpci/Kconfig"
 
 endif # UNISYSSPAR
diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile
index 3283a01..899b0cb 100644
--- a/drivers/staging/unisys/Makefile
+++ b/drivers/staging/unisys/Makefile
@@ -5,4 +5,3 @@ obj-$(CONFIG_UNISYS_VISORUTIL)		+= visorutil/
 obj-$(CONFIG_UNISYS_VISORCHANNEL)	+= visorchannel/
 obj-$(CONFIG_UNISYS_VISORCHIPSET)	+= visorchipset/
 obj-$(CONFIG_UNISYS_UISLIB)		+= uislib/
-obj-$(CONFIG_UNISYS_VIRTPCI)		+= virtpci/
diff --git a/drivers/staging/unisys/virtpci/Kconfig b/drivers/staging/unisys/virtpci/Kconfig
deleted file mode 100644
index 6d19482..0000000
--- a/drivers/staging/unisys/virtpci/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Unisys virtpci configuration
-#
-
-config UNISYS_VIRTPCI
-	tristate "Unisys virtpci driver"
-	select UNISYS_UISLIB
-	---help---
-	If you say Y here, you will enable the Unisys virtpci driver.
-
diff --git a/drivers/staging/unisys/virtpci/Makefile b/drivers/staging/unisys/virtpci/Makefile
deleted file mode 100644
index a26c696..0000000
--- a/drivers/staging/unisys/virtpci/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Makefile for Unisys virtpci
-#
-
-obj-$(CONFIG_UNISYS_VIRTPCI)	+= virtpci.o
-
-ccflags-y += -Idrivers/staging/unisys/include
-ccflags-y += -Idrivers/staging/unisys/uislib
-ccflags-y += -Idrivers/staging/unisys/common-spar/include
-ccflags-y += -Idrivers/staging/unisys/common-spar/include/channels
diff --git a/drivers/staging/unisys/virtpci/virtpci.c b/drivers/staging/unisys/virtpci/virtpci.c
deleted file mode 100644
index d5ad017..0000000
--- a/drivers/staging/unisys/virtpci/virtpci.c
+++ /dev/null
@@ -1,1394 +0,0 @@
-/* virtpci.c
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-#define EXPORT_SYMTAB
-
-#include <linux/kernel.h>
-#ifdef CONFIG_MODVERSIONS
-#include <config/modversions.h>
-#endif
-#include "diagnostics/appos_subsystems.h"
-#include "uisutils.h"
-#include "vbuschannel.h"
-#include "vbushelper.h"
-#include <linux/types.h>
-#include <linux/io.h>
-#include <linux/uuid.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/device.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <linux/mod_devicetable.h>
-#include <linux/if_ether.h>
-#include <linux/version.h>
-#include <linux/debugfs.h>
-#include "version.h"
-#include "guestlinuxdebug.h"
-#include "timskmod.h"
-
-struct driver_private {
-	struct kobject kobj;
-	struct klist klist_devices;
-	struct klist_node knode_bus;
-	struct module_kobject *mkobj;
-	struct device_driver *driver;
-};
-
-#define to_driver(obj) container_of(obj, struct driver_private, kobj)
-
-/* bus_id went away in 2.6.30 - the size was 20 bytes, so we'll define
- * it ourselves, and a macro to make getting the field a bit simpler.
- */
-#ifndef BUS_ID_SIZE
-#define BUS_ID_SIZE 20
-#endif
-
-#define BUS_ID(x) dev_name(x)
-
-/* MAX_BUF = 4 busses x ( 32 devices/bus + 1 busline) x 80 characters
- *         = 10,560 bytes ~ 2^14 = 16,384 bytes
- */
-#define MAX_BUF 16384
-
-#include "virtpci.h"
-
-/* this is shorter than using __FILE__ (full path name) in
- * debug/info/error messages
- */
-#define CURRENT_FILE_PC VIRT_PCI_PC_virtpci_c
-#define __MYFILE__ "virtpci.c"
-
-#define VIRTPCI_VERSION "01.00"
-
-/*****************************************************/
-/* Forward declarations                              */
-/*****************************************************/
-
-static int delete_vbus_device(struct device *vbus, void *data);
-static int match_busid(struct device *dev, void *data);
-static void virtpci_bus_release(struct device *dev);
-static void virtpci_device_release(struct device *dev);
-static int virtpci_device_add(struct device *parentbus, int devtype,
-			      struct add_virt_guestpart *addparams,
-			      struct scsi_adap_info *scsi,
-			      struct net_adap_info *net);
-static int virtpci_device_del(struct device *parentbus, int devtype,
-			      struct vhba_wwnn *wwnn, unsigned char macaddr[]);
-static int virtpci_device_serverdown(struct device *parentbus, int devtype,
-				     struct vhba_wwnn *wwnn,
-				     unsigned char macaddr[]);
-static int virtpci_device_serverup(struct device *parentbus, int devtype,
-				   struct vhba_wwnn *wwnn,
-				   unsigned char macaddr[]);
-static ssize_t virtpci_driver_attr_show(struct kobject *kobj,
-					struct attribute *attr, char *buf);
-static ssize_t virtpci_driver_attr_store(struct kobject *kobj,
-					 struct attribute *attr,
-					 const char *buf, size_t count);
-static int virtpci_bus_match(struct device *dev, struct device_driver *drv);
-static int virtpci_uevent(struct device *dev, struct kobj_uevent_env *env);
-static int virtpci_device_probe(struct device *dev);
-static int virtpci_device_remove(struct device *dev);
-
-static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-				 size_t len, loff_t *offset);
-
-static const struct file_operations debugfs_info_fops = {
-	.read = info_debugfs_read,
-};
-
-/*****************************************************/
-/* Globals                                           */
-/*****************************************************/
-
-/* methods in bus_type struct allow the bus code to serve as an
- * intermediary between the device core and individual device core and
- * individual drivers
- */
-static struct bus_type virtpci_bus_type = {
-	.name = "uisvirtpci",
-	.match = virtpci_bus_match,
-	.uevent = virtpci_uevent,
-};
-
-static struct device virtpci_rootbus_device = {
-	.init_name = "vbusroot",	/* root bus */
-	.release = virtpci_bus_release
-};
-
-/* filled in with info about parent chipset driver when we register with it */
-static struct ultra_vbus_deviceinfo chipset_driver_info;
-
-static const struct sysfs_ops virtpci_driver_sysfs_ops = {
-	.show = virtpci_driver_attr_show,
-	.store = virtpci_driver_attr_store,
-};
-
-static struct kobj_type virtpci_driver_kobj_type = {
-	.sysfs_ops = &virtpci_driver_sysfs_ops,
-};
-
-static struct virtpci_dev *vpcidev_list_head;
-static DEFINE_RWLOCK(vpcidev_list_lock);
-
-/* filled in with info about this driver, wrt it servicing client busses */
-static struct ultra_vbus_deviceinfo bus_driver_info;
-
-/*****************************************************/
-/* debugfs entries                                   */
-/*****************************************************/
-/* dentry is used to create the debugfs entry directory
- * for virtpci
- */
-static struct dentry *virtpci_debugfs_dir;
-
-struct virtpci_busdev {
-	struct device virtpci_bus_device;
-};
-
-/*****************************************************/
-/* Local functions                                   */
-/*****************************************************/
-
-static inline
-int WAIT_FOR_IO_CHANNEL(struct spar_io_channel_protocol __iomem  *chanptr)
-{
-	int count = 120;
-
-	while (count > 0) {
-		if (SPAR_CHANNEL_SERVER_READY(&chanptr->channel_header))
-			return 1;
-		UIS_THREAD_WAIT_SEC(1);
-		count--;
-	}
-	return 0;
-}
-
-/* Write the contents of <info> to the ULTRA_VBUS_CHANNEL_PROTOCOL.ChpInfo. */
-static int write_vbus_chp_info(struct spar_vbus_channel_protocol *chan,
-			       struct ultra_vbus_deviceinfo *info)
-{
-	int off;
-
-	if (!chan)
-		return -1;
-
-	off = sizeof(struct channel_header) + chan->hdr_info.chp_info_offset;
-	if (chan->hdr_info.chp_info_offset == 0) {
-		return -1;
-	}
-	memcpy(((u8 *)(chan)) + off, info, sizeof(*info));
-	return 0;
-}
-
-/* Write the contents of <info> to the ULTRA_VBUS_CHANNEL_PROTOCOL.BusInfo. */
-static int write_vbus_bus_info(struct spar_vbus_channel_protocol *chan,
-			       struct ultra_vbus_deviceinfo *info)
-{
-	int off;
-
-	if (!chan)
-		return -1;
-
-	off = sizeof(struct channel_header) + chan->hdr_info.bus_info_offset;
-	if (chan->hdr_info.bus_info_offset == 0)
-		return -1;
-	memcpy(((u8 *)(chan)) + off, info, sizeof(*info));
-	return 0;
-}
-
-/* Write the contents of <info> to the
- * ULTRA_VBUS_CHANNEL_PROTOCOL.DevInfo[<devix>].
- */
-static int
-write_vbus_dev_info(struct spar_vbus_channel_protocol *chan,
-		    struct ultra_vbus_deviceinfo *info, int devix)
-{
-	int off;
-
-	if (!chan)
-		return -1;
-
-	off =
-	    (sizeof(struct channel_header) +
-	     chan->hdr_info.dev_info_offset) +
-	    (chan->hdr_info.device_info_struct_bytes * devix);
-	if (chan->hdr_info.dev_info_offset == 0)
-		return -1;
-
-	memcpy(((u8 *)(chan)) + off, info, sizeof(*info));
-	return 0;
-}
-
-/* adds a vbus
- * returns 0 failure, 1 success,
- */
-static int add_vbus(struct add_vbus_guestpart *addparams)
-{
-	int ret;
-	struct device *vbus;
-
-	vbus = kzalloc(sizeof(*vbus), GFP_ATOMIC);
-
-	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	if (!vbus)
-		return 0;
-
-	dev_set_name(vbus, "vbus%d", addparams->bus_no);
-	vbus->release = virtpci_bus_release;
-	vbus->parent = &virtpci_rootbus_device;	/* root bus is parent */
-	vbus->bus = &virtpci_bus_type;	/* bus type */
-	vbus->platform_data = (__force void *)addparams->chanptr;
-
-	/* register a virt bus device -
-	 * this bus shows up under /sys/devices with .name value
-	 * "virtpci%d" any devices added to this bus then show up under
-	 * /sys/devices/virtpci0
-	 */
-	ret = device_register(vbus);
-	if (ret) {
-		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-	write_vbus_chp_info(vbus->platform_data /* chanptr */,
-			    &chipset_driver_info);
-	write_vbus_bus_info(vbus->platform_data /* chanptr */,
-			    &bus_driver_info);
-	POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
-	return 1;
-}
-
-/* for CHANSOCK wwwnn/max are AUTO-GENERATED; for normal channels,
- * wwnn/max are in the channel header.
- */
-#define GET_SCSIADAPINFO_FROM_CHANPTR(chanptr) {			\
-	memcpy_fromio(&scsi.wwnn,					\
-		      &((struct spar_io_channel_protocol __iomem *)	\
-			chanptr)->vhba.wwnn,				\
-		      sizeof(struct vhba_wwnn));			\
-	memcpy_fromio(&scsi.max,					\
-		      &((struct spar_io_channel_protocol __iomem *)	\
-			chanptr)->vhba.max,				\
-		      sizeof(struct vhba_config_max));			\
-	}
-
-/* adds a vhba
- * returns 0 failure, 1 success,
- */
-static int add_vhba(struct add_virt_guestpart *addparams)
-{
-	int i;
-	struct scsi_adap_info scsi;
-	struct device *vbus;
-	unsigned char busid[BUS_ID_SIZE];
-
-	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	if (!WAIT_FOR_IO_CHANNEL
-	    ((struct spar_io_channel_protocol __iomem *)addparams->chanptr)) {
-		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-
-	GET_SCSIADAPINFO_FROM_CHANPTR(addparams->chanptr);
-
-	/* find bus device with the busid that matches match_busid */
-	sprintf(busid, "vbus%d", addparams->bus_no);
-	vbus = bus_find_device(&virtpci_bus_type, NULL,
-			       (void *)busid, match_busid);
-	if (!vbus)
-		return 0;
-
-	i = virtpci_device_add(vbus, VIRTHBA_TYPE, addparams, &scsi, NULL);
-	if (i) {
-		POSTCODE_LINUX_3(VPCI_CREATE_EXIT_PC, i,
-				 POSTCODE_SEVERITY_INFO);
-	}
-	return i;
-}
-
-/* for CHANSOCK macaddr is AUTO-GENERATED; for normal channels,
- * macaddr is in the channel header.
- */
-#define GET_NETADAPINFO_FROM_CHANPTR(chanptr) {				\
-		memcpy_fromio(net.mac_addr,				\
-		       ((struct spar_io_channel_protocol __iomem *)	\
-		       chanptr)->vnic.macaddr,				\
-		       MAX_MACADDR_LEN);				\
-		net.num_rcv_bufs =					\
-			readl(&((struct spar_io_channel_protocol __iomem *)\
-			      chanptr)->vnic.num_rcv_bufs);		\
-		net.mtu = readl(&((struct spar_io_channel_protocol __iomem *) \
-				chanptr)->vnic.mtu);			\
-		memcpy_fromio(&net.zone_uuid, \
-			      &((struct spar_io_channel_protocol __iomem *)\
-			      chanptr)->vnic.zone_uuid,		\
-			      sizeof(uuid_le));				\
-}
-
-/* adds a vnic
- * returns 0 failure, 1 success,
- */
-static int
-add_vnic(struct add_virt_guestpart *addparams)
-{
-	int i;
-	struct net_adap_info net;
-	struct device *vbus;
-	unsigned char busid[BUS_ID_SIZE];
-
-	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	if (!WAIT_FOR_IO_CHANNEL
-	    ((struct spar_io_channel_protocol __iomem *)addparams->chanptr)) {
-		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-
-	GET_NETADAPINFO_FROM_CHANPTR(addparams->chanptr);
-
-	/* find bus device with the busid that matches match_busid */
-	sprintf(busid, "vbus%d", addparams->bus_no);
-	vbus = bus_find_device(&virtpci_bus_type, NULL,
-			       (void *)busid, match_busid);
-	if (!vbus)
-		return 0;
-
-	i = virtpci_device_add(vbus, VIRTNIC_TYPE, addparams, NULL, &net);
-	if (i) {
-		POSTCODE_LINUX_3(VPCI_CREATE_EXIT_PC, i,
-				 POSTCODE_SEVERITY_INFO);
-		return 1;
-	}
-	return 0;
-}
-
-/* delete vbus
- * returns 0 failure, 1 success,
- */
-static int
-delete_vbus(struct del_vbus_guestpart *delparams)
-{
-	struct device *vbus;
-	unsigned char busid[BUS_ID_SIZE];
-
-	/* find bus device with the busid that matches match_busid */
-	sprintf(busid, "vbus%d", delparams->bus_no);
-	vbus = bus_find_device(&virtpci_bus_type, NULL,
-			       (void *)busid, match_busid);
-	if (!vbus)
-		return 0;
-
-	/* ensure that bus has no devices? -- TBD */
-	return 1;
-}
-
-static int
-delete_vbus_device(struct device *vbus, void *data)
-{
-	struct device *dev = &virtpci_rootbus_device;
-
-	if ((data) && match_busid(vbus, (void *)BUS_ID(dev))) {
-		/* skip it - don't delete root bus */
-		return 0;	/* pretend no error */
-	}
-	device_unregister(vbus);
-	kfree(vbus);
-	return 0;		/* no error */
-}
-
-/* pause vhba
-* returns 0 failure, 1 success,
-*/
-static int pause_vhba(struct pause_virt_guestpart *pauseparams)
-{
-	int i;
-	struct scsi_adap_info scsi;
-
-	GET_SCSIADAPINFO_FROM_CHANPTR(pauseparams->chanptr);
-
-	i = virtpci_device_serverdown(NULL /*no parent bus */, VIRTHBA_TYPE,
-				      &scsi.wwnn, NULL);
-	return i;
-}
-
-/* pause vnic
- * returns 0 failure, 1 success,
- */
-static int pause_vnic(struct pause_virt_guestpart *pauseparams)
-{
-	int i;
-	struct net_adap_info net;
-
-	GET_NETADAPINFO_FROM_CHANPTR(pauseparams->chanptr);
-
-	i = virtpci_device_serverdown(NULL /*no parent bus */, VIRTNIC_TYPE,
-				      NULL, net.mac_addr);
-	return i;
-}
-
-/* resume vhba
- * returns 0 failure, 1 success,
- */
-static int resume_vhba(struct resume_virt_guestpart *resumeparams)
-{
-	int i;
-	struct scsi_adap_info scsi;
-
-	GET_SCSIADAPINFO_FROM_CHANPTR(resumeparams->chanptr);
-
-	i = virtpci_device_serverup(NULL /*no parent bus */, VIRTHBA_TYPE,
-				    &scsi.wwnn, NULL);
-	return i;
-}
-
-/* resume vnic
-* returns 0 failure, 1 success,
-*/
-static int
-resume_vnic(struct resume_virt_guestpart *resumeparams)
-{
-	int i;
-	struct net_adap_info net;
-
-	GET_NETADAPINFO_FROM_CHANPTR(resumeparams->chanptr);
-
-	i = virtpci_device_serverup(NULL /*no parent bus */, VIRTNIC_TYPE,
-				    NULL, net.mac_addr);
-	return i;
-}
-
-/* delete vhba
-* returns 0 failure, 1 success,
-*/
-static int delete_vhba(struct del_virt_guestpart *delparams)
-{
-	int i;
-	struct scsi_adap_info scsi;
-
-	GET_SCSIADAPINFO_FROM_CHANPTR(delparams->chanptr);
-
-	i = virtpci_device_del(NULL /*no parent bus */, VIRTHBA_TYPE,
-			       &scsi.wwnn, NULL);
-	if (i) {
-		return 1;
-	}
-	return 0;
-}
-
-/* deletes a vnic
- * returns 0 failure, 1 success,
- */
-static int delete_vnic(struct del_virt_guestpart *delparams)
-{
-	int i;
-	struct net_adap_info net;
-
-	GET_NETADAPINFO_FROM_CHANPTR(delparams->chanptr);
-
-	i = virtpci_device_del(NULL /*no parent bus */, VIRTNIC_TYPE, NULL,
-			       net.mac_addr);
-	return i;
-}
-
-#define DELETE_ONE_VPCIDEV(vpcidev) { \
-	device_unregister(&vpcidev->generic_dev); \
-	kfree(vpcidev); \
-}
-
-/* deletes all vhbas and vnics
- * returns 0 failure, 1 success,
- */
-static void delete_all(void)
-{
-	int count = 0;
-	unsigned long flags;
-	struct virtpci_dev *tmpvpcidev, *nextvpcidev;
-
-	/* delete the entire vhba/vnic list in one shot */
-	write_lock_irqsave(&vpcidev_list_lock, flags);
-	tmpvpcidev = vpcidev_list_head;
-	vpcidev_list_head = NULL;
-	write_unlock_irqrestore(&vpcidev_list_lock, flags);
-
-	/* delete one vhba/vnic at a time */
-	while (tmpvpcidev) {
-		nextvpcidev = tmpvpcidev->next;
-		/* delete the vhba/vnic at tmpvpcidev */
-		DELETE_ONE_VPCIDEV(tmpvpcidev);
-		tmpvpcidev = nextvpcidev;
-		count++;
-	}
-
-	/* now delete each vbus */
-	bus_for_each_dev(&virtpci_bus_type, NULL, (void *)1,
-			 delete_vbus_device);
-}
-
-/* deletes all vnics or vhbas
- * returns 0 failure, 1 success,
- */
-static int delete_all_virt(enum virtpci_dev_type devtype,
-			   struct del_vbus_guestpart *delparams)
-{
-	int i;
-	unsigned char busid[BUS_ID_SIZE];
-	struct device *vbus;
-
-	/* find bus device with the busid that matches match_busid */
-	sprintf(busid, "vbus%d", delparams->bus_no);
-	vbus = bus_find_device(&virtpci_bus_type, NULL,
-			       (void *)busid, match_busid);
-	if (!vbus)
-		return 0;
-
-	if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
-		return 0;
-
-	/* delete all vhbas/vnics */
-	i = virtpci_device_del(vbus, devtype, NULL, NULL);
-	return 1;
-}
-
-static int virtpci_ctrlchan_func(struct guest_msgs *msg)
-{
-	switch (msg->msgtype) {
-	case GUEST_ADD_VBUS:
-		return add_vbus(&msg->add_vbus);
-	case GUEST_ADD_VHBA:
-		return add_vhba(&msg->add_vhba);
-	case GUEST_ADD_VNIC:
-		return add_vnic(&msg->add_vnic);
-	case GUEST_DEL_VBUS:
-		return delete_vbus(&msg->del_vbus);
-	case GUEST_DEL_VHBA:
-		return delete_vhba(&msg->del_vhba);
-	case GUEST_DEL_VNIC:
-		return delete_vnic(&msg->del_vhba);
-	case GUEST_DEL_ALL_VHBAS:
-		return delete_all_virt(VIRTHBA_TYPE, &msg->del_all_vhbas);
-	case GUEST_DEL_ALL_VNICS:
-		return delete_all_virt(VIRTNIC_TYPE, &msg->del_all_vnics);
-	case GUEST_DEL_ALL_VBUSES:
-		delete_all();
-		return 1;
-	case GUEST_PAUSE_VHBA:
-		return pause_vhba(&msg->pause_vhba);
-	case GUEST_PAUSE_VNIC:
-		return pause_vnic(&msg->pause_vnic);
-	case GUEST_RESUME_VHBA:
-		return resume_vhba(&msg->resume_vhba);
-	case GUEST_RESUME_VNIC:
-		return resume_vnic(&msg->resume_vnic);
-	default:
-		return 0;
-	}
-}
-
-/* same as driver_helper in bus.c linux */
-static int match_busid(struct device *dev, void *data)
-{
-	const char *name = data;
-
-	if (strcmp(name, BUS_ID(dev)) == 0)
-		return 1;
-	return 0;
-}
-
-/*****************************************************/
-/*  Bus functions                                    */
-/*****************************************************/
-
-static const struct pci_device_id *
-virtpci_match_device(const struct pci_device_id *ids,
-		     const struct virtpci_dev *dev)
-{
-	while (ids->vendor || ids->subvendor || ids->class_mask) {
-		if ((ids->vendor == dev->vendor) &&
-		    (ids->device == dev->device))
-			return ids;
-
-		ids++;
-	}
-	return NULL;
-}
-
-/* NOTE: !!!!!!  This function is called when a new device is added
-* for this bus.  Or, it is called for existing devices when a new
-* driver is added for this bus.  It returns nonzero if a given device
-* can be handled by the given driver.
-*/
-static int virtpci_bus_match(struct device *dev, struct device_driver *drv)
-{
-	struct virtpci_dev *virtpcidev = device_to_virtpci_dev(dev);
-	struct virtpci_driver *virtpcidrv = driver_to_virtpci_driver(drv);
-	int match = 0;
-
-	/* check ids list for a match */
-	if (virtpci_match_device(virtpcidrv->id_table, virtpcidev))
-		match = 1;
-
-	return match;		/* 0 - no match; 1 - yes it matches */
-}
-
-static int virtpci_uevent(struct device *dev, struct kobj_uevent_env *env)
-{
-	/* add variables to the environment prior to the generation of
-	 * hotplug events to user space
-	 */
-	if (add_uevent_var(env, "VIRTPCI_VERSION=%s", VIRTPCI_VERSION))
-		return -ENOMEM;
-	return 0;
-}
-
-/* For a child device just created on a client bus, fill in
- * information about the driver that is controlling this device into
- * the appropriate slot within the vbus channel of the bus
- * instance.
- */
-static void fix_vbus_dev_info(struct device *dev, int dev_no, int dev_type,
-			      struct virtpci_driver *virtpcidrv)
-{
-	struct device *vbus;
-	void *chan;
-	struct ultra_vbus_deviceinfo dev_info;
-	const char *stype;
-
-	if (!dev)
-		return;
-	if (!virtpcidrv)
-		return;
-
-	vbus = dev->parent;
-	if (!vbus)
-		return;
-
-	chan = vbus->platform_data;
-	if (!chan)
-		return;
-
-	switch (dev_type) {
-	case PCI_DEVICE_ID_VIRTHBA:
-		stype = "vHBA";
-		break;
-	case PCI_DEVICE_ID_VIRTNIC:
-		stype = "vNIC";
-		break;
-	default:
-		stype = "unknown";
-		break;
-	}
-	bus_device_info_init(&dev_info, stype,
-			     virtpcidrv->name,
-			     virtpcidrv->version,
-			     virtpcidrv->vertag);
-	write_vbus_dev_info(chan, &dev_info, dev_no);
-
-	/* Re-write bus+chipset info, because it is possible that this
-	* was previously written by our good counterpart, visorbus.
-	*/
-	write_vbus_chp_info(chan, &chipset_driver_info);
-	write_vbus_bus_info(chan, &bus_driver_info);
-}
-
-/* This function is called to query the existence of a specific device
-* and whether this driver can work with it.  It should return -ENODEV
-* in case of failure.
-*/
-static int virtpci_device_probe(struct device *dev)
-{
-	struct virtpci_dev *virtpcidev = device_to_virtpci_dev(dev);
-	struct virtpci_driver *virtpcidrv =
-	    driver_to_virtpci_driver(dev->driver);
-	const struct pci_device_id *id;
-	int error = 0;
-
-	POSTCODE_LINUX_2(VPCI_PROBE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-	/* static match and static probe vs dynamic match & dynamic
-	 * probe - do we care?.
-	 */
-	if (!virtpcidrv->id_table)
-		return -ENODEV;
-
-	id = virtpci_match_device(virtpcidrv->id_table, virtpcidev);
-	if (!id)
-		return -ENODEV;
-
-	/* increment reference count */
-	get_device(dev);
-
-	/* if virtpcidev is not already claimed & probe function is
-	 * valid, probe it
-	 */
-	if (!virtpcidev->mydriver && virtpcidrv->probe) {
-		/* call the probe function - virthba or virtnic probe
-		 * is what it should be
-		 */
-		error = virtpcidrv->probe(virtpcidev, id);
-		if (!error) {
-			fix_vbus_dev_info(dev, virtpcidev->device_no,
-					  virtpcidev->device, virtpcidrv);
-			virtpcidev->mydriver = virtpcidrv;
-			POSTCODE_LINUX_2(VPCI_PROBE_EXIT_PC,
-					 POSTCODE_SEVERITY_INFO);
-		} else {
-			put_device(dev);
-		}
-	}
-	POSTCODE_LINUX_2(VPCI_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-	return error;		/* -ENODEV for probe failure */
-}
-
-static int virtpci_device_remove(struct device *dev_)
-{
-	/* dev_ passed in is the HBA device which we called
-	* generic_dev in our virtpcidev struct
-	*/
-	struct virtpci_dev *virtpcidev = device_to_virtpci_dev(dev_);
-	struct virtpci_driver *virtpcidrv = virtpcidev->mydriver;
-
-	if (virtpcidrv) {
-		/* TEMP: assuming we have only one such driver for now */
-		if (virtpcidrv->remove)
-			virtpcidrv->remove(virtpcidev);
-		virtpcidev->mydriver = NULL;
-	}
-
-	put_device(dev_);
-	return 0;
-}
-
-/*****************************************************/
-/* Bus functions                                     */
-/*****************************************************/
-
-static void virtpci_bus_release(struct device *dev)
-{
-}
-
-/*****************************************************/
-/* Adapter functions                                 */
-/*****************************************************/
-
-/* scsi is expected to be NULL for VNIC add
- * net is expected to be NULL for VHBA add
- */
-static int virtpci_device_add(struct device *parentbus, int devtype,
-			      struct add_virt_guestpart *addparams,
-			      struct scsi_adap_info *scsi,
-			      struct net_adap_info *net)
-{
-	struct virtpci_dev *virtpcidev = NULL;
-	struct virtpci_dev *tmpvpcidev = NULL, *prev;
-	unsigned long flags;
-	int ret;
-	struct spar_io_channel_protocol __iomem *io_chan = NULL;
-	struct device *dev;
-
-	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-
-	if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) {
-		POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, devtype,
-				 POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-
-	/* add a Virtual Device */
-	virtpcidev = kzalloc(sizeof(*virtpcidev), GFP_ATOMIC);
-	if (!virtpcidev) {
-		POSTCODE_LINUX_2(MALLOC_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-
-	/* initialize stuff unique to virtpci_dev struct */
-	virtpcidev->devtype = devtype;
-	if (devtype == VIRTHBA_TYPE) {
-		virtpcidev->device = PCI_DEVICE_ID_VIRTHBA;
-		virtpcidev->scsi = *scsi;
-	} else {
-		virtpcidev->device = PCI_DEVICE_ID_VIRTNIC;
-		virtpcidev->net = *net;
-	}
-	virtpcidev->vendor = PCI_VENDOR_ID_UNISYS;
-	virtpcidev->bus_no = addparams->bus_no;
-	virtpcidev->device_no = addparams->device_no;
-
-	virtpcidev->queueinfo.chan = addparams->chanptr;
-	virtpcidev->queueinfo.send_int_if_needed = NULL;
-
-	/* Set up safe queue... */
-	io_chan = (struct spar_io_channel_protocol __iomem *)
-		virtpcidev->queueinfo.chan;
-
-	virtpcidev->intr = addparams->intr;
-
-	/* initialize stuff in the device portion of the struct */
-	virtpcidev->generic_dev.bus = &virtpci_bus_type;
-	virtpcidev->generic_dev.parent = parentbus;
-	virtpcidev->generic_dev.release = virtpci_device_release;
-
-	dev_set_name(&virtpcidev->generic_dev, "%x:%x",
-		     addparams->bus_no, addparams->device_no);
-
-	/* add the vhba/vnic to virtpci device list - but check for
-	 * duplicate wwnn/macaddr first
-	 */
-	write_lock_irqsave(&vpcidev_list_lock, flags);
-	for (tmpvpcidev = vpcidev_list_head; tmpvpcidev;
-	     tmpvpcidev = tmpvpcidev->next) {
-		if (devtype == VIRTHBA_TYPE) {
-			if ((tmpvpcidev->scsi.wwnn.wwnn1 == scsi->wwnn.wwnn1) &&
-			    (tmpvpcidev->scsi.wwnn.wwnn2 == scsi->wwnn.wwnn2)) {
-				/* duplicate - already have vpcidev
-				   with this wwnn */
-				break;
-			}
-		} else
-		    if (memcmp
-			(tmpvpcidev->net.mac_addr, net->mac_addr,
-			 MAX_MACADDR_LEN) == 0) {
-			/* duplicate - already have vnic with this wwnn */
-			break;
-		}
-	}
-	if (tmpvpcidev) {
-		/* found a vhba/vnic already in the list with same
-		 * wwnn or macaddr - reject add
-		 */
-		write_unlock_irqrestore(&vpcidev_list_lock, flags);
-		kfree(virtpcidev);
-		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-
-	/* add it at the head */
-	if (!vpcidev_list_head) {
-		vpcidev_list_head = virtpcidev;
-	} else {
-		/* insert virtpcidev at the head of our linked list of
-		 * vpcidevs
-		 */
-		virtpcidev->next = vpcidev_list_head;
-		vpcidev_list_head = virtpcidev;
-	}
-
-	write_unlock_irqrestore(&vpcidev_list_lock, flags);
-
-	/* Must transition channel to ATTACHED state BEFORE
-	 * registering the device, because polling of the channel
-	 * queues can begin at any time after device_register().
-	 */
-	dev = &virtpcidev->generic_dev;
-	SPAR_CHANNEL_CLIENT_TRANSITION(addparams->chanptr,
-				       BUS_ID(dev),
-				       CHANNELCLI_ATTACHED, NULL);
-
-	/* don't register until device has been added to
-	* list. Otherwise, a device_unregister from this function can
-	* cause a "scheduling while atomic".
-	*/
-	ret = device_register(&virtpcidev->generic_dev);
-	/* NOTE: THIS IS CALLING HOTPLUG virtpci_hotplug!!!
-	 * This call to device_register results in virtpci_bus_match
-	 * being called !!!!!  And, if match returns success, then
-	 * virtpcidev->generic_dev.driver is setup to core_driver,
-	 * i.e., virtpci and the probe function
-	 * virtpcidev->generic_dev.driver->probe is called which
-	 * results in virtpci_device_probe being called. And if
-	 * virtpci_device_probe is successful
-	 */
-	if (ret) {
-		dev = &virtpcidev->generic_dev;
-		SPAR_CHANNEL_CLIENT_TRANSITION(addparams->chanptr,
-					       BUS_ID(dev),
-					       CHANNELCLI_DETACHED, NULL);
-		/* remove virtpcidev, the one we just added, from the list */
-		write_lock_irqsave(&vpcidev_list_lock, flags);
-		for (tmpvpcidev = vpcidev_list_head, prev = NULL;
-		     tmpvpcidev;
-		     prev = tmpvpcidev, tmpvpcidev = tmpvpcidev->next) {
-			if (tmpvpcidev == virtpcidev) {
-				if (prev)
-					prev->next = tmpvpcidev->next;
-				else
-					vpcidev_list_head = tmpvpcidev->next;
-				break;
-			}
-		}
-		write_unlock_irqrestore(&vpcidev_list_lock, flags);
-		kfree(virtpcidev);
-		return 0;
-	}
-
-	POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
-	return 1;
-}
-
-static int virtpci_device_serverdown(struct device *parentbus,
-				     int devtype,
-				     struct vhba_wwnn *wwnn,
-				     unsigned char macaddr[])
-{
-	int pausethisone = 0;
-	bool found = false;
-	struct virtpci_dev *tmpvpcidev, *prevvpcidev;
-	struct virtpci_driver *vpcidriver;
-	unsigned long flags;
-	int rc = 0;
-
-	if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
-		return 0;
-
-	/* find the vhba or vnic in virtpci device list */
-	write_lock_irqsave(&vpcidev_list_lock, flags);
-
-	for (tmpvpcidev = vpcidev_list_head, prevvpcidev = NULL;
-	     (tmpvpcidev && !found);
-	     prevvpcidev = tmpvpcidev, tmpvpcidev = tmpvpcidev->next) {
-		if (tmpvpcidev->devtype != devtype)
-			continue;
-
-		if (devtype == VIRTHBA_TYPE) {
-			pausethisone =
-			    ((tmpvpcidev->scsi.wwnn.wwnn1 == wwnn->wwnn1) &&
-			     (tmpvpcidev->scsi.wwnn.wwnn2 == wwnn->wwnn2));
-			/* devtype is vhba, we're pausing vhba whose
-			* wwnn matches the current device's wwnn
-			*/
-		} else {	/* VIRTNIC_TYPE */
-			pausethisone =
-			    memcmp(tmpvpcidev->net.mac_addr, macaddr,
-				   MAX_MACADDR_LEN) == 0;
-			/* devtype is vnic, we're pausing vnic whose
-			* macaddr matches the current device's macaddr */
-		}
-
-		if (!pausethisone)
-			continue;
-
-		found = true;
-		vpcidriver = tmpvpcidev->mydriver;
-		rc = vpcidriver->suspend(tmpvpcidev, 0);
-	}
-	write_unlock_irqrestore(&vpcidev_list_lock, flags);
-
-	if (!found)
-		return 0;
-
-	return rc;
-}
-
-static int virtpci_device_serverup(struct device *parentbus,
-				   int devtype,
-				   struct vhba_wwnn *wwnn,
-				   unsigned char macaddr[])
-{
-	int resumethisone = 0;
-	bool found = false;
-	struct virtpci_dev *tmpvpcidev, *prevvpcidev;
-	struct virtpci_driver *vpcidriver;
-	unsigned long flags;
-	int rc = 0;
-
-	if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
-		return 0;
-
-
-	/* find the vhba or vnic in virtpci device list */
-	write_lock_irqsave(&vpcidev_list_lock, flags);
-
-	for (tmpvpcidev = vpcidev_list_head, prevvpcidev = NULL;
-	     (tmpvpcidev && !found);
-	     prevvpcidev = tmpvpcidev, tmpvpcidev = tmpvpcidev->next) {
-		if (tmpvpcidev->devtype != devtype)
-			continue;
-
-		if (devtype == VIRTHBA_TYPE) {
-			resumethisone =
-			    ((tmpvpcidev->scsi.wwnn.wwnn1 == wwnn->wwnn1) &&
-			     (tmpvpcidev->scsi.wwnn.wwnn2 == wwnn->wwnn2));
-			/* devtype is vhba, we're resuming vhba whose
-			* wwnn matches the current device's wwnn */
-		} else {	/* VIRTNIC_TYPE */
-			resumethisone =
-			    memcmp(tmpvpcidev->net.mac_addr, macaddr,
-				   MAX_MACADDR_LEN) == 0;
-			/* devtype is vnic, we're resuming vnic whose
-			* macaddr matches the current device's macaddr */
-		}
-
-		if (!resumethisone)
-			continue;
-
-		found = true;
-		vpcidriver = tmpvpcidev->mydriver;
-		/* This should be done at BUS resume time, but an
-		* existing problem prevents us from ever getting a bus
-		* resume...  This hack would fail to work should we
-		* ever have a bus that contains NO devices, since we
-		* would never even get here in that case.
-		*/
-		fix_vbus_dev_info(&tmpvpcidev->generic_dev,
-				  tmpvpcidev->device_no,
-				  tmpvpcidev->device, vpcidriver);
-		rc = vpcidriver->resume(tmpvpcidev);
-	}
-
-	write_unlock_irqrestore(&vpcidev_list_lock, flags);
-
-	if (!found)
-		return 0;
-
-	return rc;
-}
-
-static int virtpci_device_del(struct device *parentbus,
-			      int devtype, struct vhba_wwnn *wwnn,
-			      unsigned char macaddr[])
-{
-	int count = 0, all = 0, delthisone;
-	struct virtpci_dev *tmpvpcidev, *prevvpcidev, *dellist = NULL;
-	unsigned long flags;
-
-#define DEL_CONTINUE { \
-	prevvpcidev = tmpvpcidev;\
-	tmpvpcidev = tmpvpcidev->next;\
-	continue; \
-}
-
-	if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
-		return 0;
-
-	/* see if we are to delete all - NOTE: all implies we have a
-	 * valid parentbus
-	 */
-	all = ((devtype == VIRTHBA_TYPE) && (!wwnn)) ||
-	    ((devtype == VIRTNIC_TYPE) && (!macaddr));
-
-	/* find all the vhba or vnic or both in virtpci device list
-	* keep list of ones we are deleting so we can call
-	* device_unregister after we release the lock; otherwise we
-	* encounter "schedule while atomic"
-	*/
-	write_lock_irqsave(&vpcidev_list_lock, flags);
-	for (tmpvpcidev = vpcidev_list_head, prevvpcidev = NULL; tmpvpcidev;) {
-		if (tmpvpcidev->devtype != devtype)
-			DEL_CONTINUE;
-
-		if (all) {
-			delthisone =
-			    (tmpvpcidev->generic_dev.parent == parentbus);
-			/* we're deleting all vhbas or vnics on the
-			 * specified parent bus
-			 */
-		} else if (devtype == VIRTHBA_TYPE) {
-			delthisone =
-			    ((tmpvpcidev->scsi.wwnn.wwnn1 == wwnn->wwnn1) &&
-			     (tmpvpcidev->scsi.wwnn.wwnn2 == wwnn->wwnn2));
-			/* devtype is vhba, we're deleting vhba whose
-			 * wwnn matches the current device's wwnn
-			 */
-		} else {	/* VIRTNIC_TYPE */
-			delthisone =
-			    memcmp(tmpvpcidev->net.mac_addr, macaddr,
-				   MAX_MACADDR_LEN) == 0;
-			/* devtype is vnic, we're deleting vnic whose
-			* macaddr matches the current device's macaddr
-			*/
-		}
-
-		if (!delthisone)
-			DEL_CONTINUE;
-
-		/* take vhba/vnic out of the list */
-		if (prevvpcidev)
-			/* not at head */
-			prevvpcidev->next = tmpvpcidev->next;
-		else
-			vpcidev_list_head = tmpvpcidev->next;
-
-		/* add it to our deletelist */
-		tmpvpcidev->next = dellist;
-		dellist = tmpvpcidev;
-
-		count++;
-		if (!all)
-			break;	/* done */
-		/* going to top of loop again - set tmpvpcidev to next
-		 * one we're to process
-		 */
-		if (prevvpcidev)
-			tmpvpcidev = prevvpcidev->next;
-		else
-			tmpvpcidev = vpcidev_list_head;
-	}
-	write_unlock_irqrestore(&vpcidev_list_lock, flags);
-
-	if (!all && (count == 0))
-		return 0;
-
-	/* now delete each one from delete list */
-	while (dellist) {
-		/* save next */
-		tmpvpcidev = dellist->next;
-		/* delete the vhba/vnic at dellist */
-		DELETE_ONE_VPCIDEV(dellist);
-		/* do next */
-		dellist = tmpvpcidev;
-	}
-
-	return count;
-}
-
-static void virtpci_device_release(struct device *dev_)
-{
-	/* this function is called when the last reference to the
-	 * device is removed
-	 */
-}
-
-/*****************************************************/
-/* Driver functions                                  */
-/*****************************************************/
-
-#define kobj_to_device_driver(obj) container_of(obj, struct device_driver, kobj)
-#define attribute_to_driver_attribute(obj) \
-	container_of(obj, struct driver_attribute, attr)
-
-static ssize_t virtpci_driver_attr_show(struct kobject *kobj,
-					struct attribute *attr,
-					char *buf)
-{
-	struct driver_attribute *dattr = attribute_to_driver_attribute(attr);
-	ssize_t ret = 0;
-
-	struct driver_private *dprivate = to_driver(kobj);
-	struct device_driver *driver = dprivate->driver;
-
-	if (dattr->show)
-		ret = dattr->show(driver, buf);
-
-	return ret;
-}
-
-static ssize_t virtpci_driver_attr_store(struct kobject *kobj,
-					 struct attribute *attr,
-					 const char *buf, size_t count)
-{
-	struct driver_attribute *dattr = attribute_to_driver_attribute(attr);
-	ssize_t ret = 0;
-
-	struct driver_private *dprivate = to_driver(kobj);
-	struct device_driver *driver = dprivate->driver;
-
-	if (dattr->store)
-		ret = dattr->store(driver, buf, count);
-
-	return ret;
-}
-
-/* register a new virtpci driver */
-int virtpci_register_driver(struct virtpci_driver *drv)
-{
-	int result = 0;
-
-	if (!drv->id_table)
-		return 1;
-	/* initialize core driver fields needed to call driver_register */
-	drv->core_driver.name = drv->name;	/* name of driver in sysfs */
-	drv->core_driver.bus = &virtpci_bus_type;	/* type of bus this
-							 * driver works with */
-	drv->core_driver.probe = virtpci_device_probe;	/* called to query the
-							 * existence of a
-							 * specific device and
-							 * whether this driver
-							 *can work with it */
-	drv->core_driver.remove = virtpci_device_remove; /* called when the
-							  * device is removed
-							  * from the system */
-	/* register with core */
-	result = driver_register(&drv->core_driver);
-	/* calls bus_add_driver which calls driver_attach and
-	 * module_add_driver
-	 */
-	if (result)
-		return result;	/* failed */
-
-	drv->core_driver.p->kobj.ktype = &virtpci_driver_kobj_type;
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(virtpci_register_driver);
-
-void virtpci_unregister_driver(struct virtpci_driver *drv)
-{
-	driver_unregister(&drv->core_driver);
-	/* driver_unregister calls bus_remove_driver
-	 * bus_remove_driver calls device_detach
-	 * device_detach calls device_release_driver for each of the
-	 * driver's devices
-	 * device_release driver calls drv->remove which is
-	 * virtpci_device_remove
-	 * virtpci_device_remove calls virthba_remove
-	 */
-}
-EXPORT_SYMBOL_GPL(virtpci_unregister_driver);
-
-/*****************************************************/
-/* debugfs filesystem functions                      */
-/*****************************************************/
-struct print_vbus_info {
-	int *str_pos;
-	char *buf;
-	size_t *len;
-};
-
-static int print_vbus(struct device *vbus, void *data)
-{
-	struct print_vbus_info *p = (struct print_vbus_info *)data;
-
-	*p->str_pos += scnprintf(p->buf + *p->str_pos, *p->len - *p->str_pos,
-				"bus_id:%s\n", dev_name(vbus));
-	return 0;
-}
-
-static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-				 size_t len, loff_t *offset)
-{
-	ssize_t bytes_read = 0;
-	int str_pos = 0;
-	struct virtpci_dev *tmpvpcidev;
-	unsigned long flags;
-	struct print_vbus_info printparam;
-	char *vbuf;
-
-	if (len > MAX_BUF)
-		len = MAX_BUF;
-	vbuf = kzalloc(len, GFP_KERNEL);
-	if (!vbuf)
-		return -ENOMEM;
-
-	str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-			" Virtual PCI Bus devices\n");
-	printparam.str_pos = &str_pos;
-	printparam.buf = vbuf;
-	printparam.len = &len;
-	bus_for_each_dev(&virtpci_bus_type, NULL, (void *)&printparam,
-			 print_vbus);
-
-	str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-			"\n Virtual PCI devices\n");
-	read_lock_irqsave(&vpcidev_list_lock, flags);
-	tmpvpcidev = vpcidev_list_head;
-	while (tmpvpcidev) {
-		if (tmpvpcidev->devtype == VIRTHBA_TYPE) {
-			str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-					"[%d:%d] VHba:%08x:%08x max-config:%d-%d-%d-%d",
-					tmpvpcidev->bus_no,
-					tmpvpcidev->device_no,
-					tmpvpcidev->scsi.wwnn.wwnn1,
-					tmpvpcidev->scsi.wwnn.wwnn2,
-					tmpvpcidev->scsi.max.max_channel,
-					tmpvpcidev->scsi.max.max_id,
-					tmpvpcidev->scsi.max.max_lun,
-					tmpvpcidev->scsi.max.cmd_per_lun);
-		} else {
-			str_pos += scnprintf(vbuf + str_pos, len - str_pos,
-					"[%d:%d] VNic:%pM num_rcv_bufs:%d mtu:%d",
-					tmpvpcidev->bus_no,
-					tmpvpcidev->device_no,
-					tmpvpcidev->net.mac_addr,
-					tmpvpcidev->net.num_rcv_bufs,
-					tmpvpcidev->net.mtu);
-		}
-		str_pos += scnprintf(vbuf + str_pos,
-				len - str_pos, " chanptr:%p\n",
-				tmpvpcidev->queueinfo.chan);
-				tmpvpcidev = tmpvpcidev->next;
-	}
-	read_unlock_irqrestore(&vpcidev_list_lock, flags);
-
-	str_pos += scnprintf(vbuf + str_pos, len - str_pos, "\n");
-	bytes_read = simple_read_from_buffer(buf, len, offset, vbuf, str_pos);
-	kfree(vbuf);
-	return bytes_read;
-}
-
-/*****************************************************/
-/* Module Init & Exit functions                      */
-/*****************************************************/
-
-static int __init virtpci_mod_init(void)
-{
-	int ret;
-
-	if (!unisys_spar_platform)
-		return -ENODEV;
-
-	POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-
-	ret = bus_register(&virtpci_bus_type);
-	/* creates /sys/bus/uisvirtpci which contains devices &
-	 * drivers directory
-	 */
-	if (ret) {
-		POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, ret,
-				 POSTCODE_SEVERITY_ERR);
-		return ret;
-	}
-	bus_device_info_init(&bus_driver_info, "clientbus", "virtpci",
-			     VERSION, NULL);
-
-	/* create a root bus used to parent all the virtpci buses. */
-	ret = device_register(&virtpci_rootbus_device);
-	if (ret) {
-		bus_unregister(&virtpci_bus_type);
-		POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, ret,
-				 POSTCODE_SEVERITY_ERR);
-		return ret;
-	}
-
-	if (!uisctrl_register_req_handler(2, (void *)&virtpci_ctrlchan_func,
-					  &chipset_driver_info)) {
-		POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
-		device_unregister(&virtpci_rootbus_device);
-		bus_unregister(&virtpci_bus_type);
-		return -1;
-	}
-
-	/* create debugfs directory and info file inside. */
-	virtpci_debugfs_dir = debugfs_create_dir("virtpci", NULL);
-	debugfs_create_file("info", S_IRUSR, virtpci_debugfs_dir,
-			    NULL, &debugfs_info_fops);
-	POSTCODE_LINUX_2(VPCI_CREATE_EXIT_PC, POSTCODE_SEVERITY_INFO);
-	return 0;
-}
-
-static void __exit virtpci_mod_exit(void)
-{
-	/* unregister the callback function */
-	device_unregister(&virtpci_rootbus_device);
-	bus_unregister(&virtpci_bus_type);
-	debugfs_remove_recursive(virtpci_debugfs_dir);
-}
-
-module_init(virtpci_mod_init);
-module_exit(virtpci_mod_exit);
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Usha Srinivasan");
-MODULE_ALIAS("uisvirtpci");
-
diff --git a/drivers/staging/unisys/virtpci/virtpci.h b/drivers/staging/unisys/virtpci/virtpci.h
deleted file mode 100644
index 9d85f55..0000000
--- a/drivers/staging/unisys/virtpci/virtpci.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* virtpci.h
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-/*
- * Unisys Virtual PCI driver header
- */
-
-#ifndef __VIRTPCI_H__
-#define __VIRTPCI_H__
-
-#include "uisqueue.h"
-#include <linux/version.h>
-#include <linux/uuid.h>
-
-#define PCI_DEVICE_ID_VIRTHBA 0xAA00
-#define PCI_DEVICE_ID_VIRTNIC 0xAB00
-
-struct scsi_adap_info {
-	void *scsihost;		/* scsi host if this device is a scsi hba */
-	struct vhba_wwnn wwnn;	/* the world wide node name of vhba */
-	struct vhba_config_max max;	/* various max specifications used
-					 * to config vhba */
-};
-
-struct net_adap_info {
-	struct net_device *netdev;	/* network device if this
-					 * device is a NIC */
-	u8 mac_addr[MAX_MACADDR_LEN];
-	int num_rcv_bufs;
-	unsigned mtu;
-	uuid_le zone_uuid;
-};
-
-enum virtpci_dev_type {
-	VIRTHBA_TYPE = 0,
-	VIRTNIC_TYPE = 1,
-	VIRTBUS_TYPE = 6,
-};
-
-struct virtpci_dev {
-	enum virtpci_dev_type devtype;	/* indicates type of the
-					 * virtual pci device */
-	struct virtpci_driver *mydriver;	/* which driver has allocated
-						 * this device */
-	unsigned short vendor;	/* vendor id for device */
-	unsigned short device;	/* device id for device */
-	u32 bus_no;		/* number of bus on which device exists */
-	u32 device_no;		/* device's number on the bus */
-	struct irq_info intr;	/* interrupt info */
-	struct device generic_dev;	/* generic device */
-	union {
-		struct scsi_adap_info scsi;
-		struct net_adap_info net;
-	};
-
-	struct uisqueue_info queueinfo;	/* holds ptr to channel where cmds &
-					 * rsps are queued & retrieved */
-	struct virtpci_dev *next;	/* points to next virtpci device */
-};
-
-struct virtpci_driver {
-	struct list_head node;
-	const char *name;	/* the name of the driver in sysfs */
-	const char *version;
-	const char *vertag;
-	const struct pci_device_id *id_table;	/* must be non-NULL for probe
-						 * to be called */
-	int (*probe)(struct virtpci_dev *dev,
-		     const struct pci_device_id *id); /* device inserted */
-	void (*remove)(struct virtpci_dev *dev); /* Device removed (NULL if
-						    * not a hot-plug capable
-						    * driver) */
-	int (*suspend)(struct virtpci_dev *dev,
-		       u32 state);		   /* Device suspended */
-	int (*resume)(struct virtpci_dev *dev);	/* Device woken up */
-	int (*enable_wake)(struct virtpci_dev *dev,
-			   u32 state, int enable);	/* Enable wake event */
-	struct device_driver core_driver;	/* VIRTPCI core fills this in */
-};
-
-#define	driver_to_virtpci_driver(in_drv) \
-	container_of(in_drv, struct virtpci_driver, core_driver)
-#define device_to_virtpci_dev(in_dev) \
-	container_of(in_dev, struct virtpci_dev, generic_dev)
-
-int virtpci_register_driver(struct virtpci_driver *);
-void virtpci_unregister_driver(struct virtpci_driver *);
-
-#endif /* __VIRTPCI_H__ */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] staging: unisys: remove uislib module from staging tree
  2015-04-14  1:16 [PATCH 0/3] staging: unisys: remove virtpci, virthba, and uislib Benjamin Romer
  2015-04-14  1:16 ` [PATCH 1/3] staging: unisys: remove virthba driver for rewrite Benjamin Romer
  2015-04-14  1:16 ` [PATCH 2/3] staging: unisys: remove virtpci driver from staging tree Benjamin Romer
@ 2015-04-14  1:16 ` Benjamin Romer
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Romer @ 2015-04-14  1:16 UTC (permalink / raw)
  To: gregkh; +Cc: jkc, driverdev-devel, sparmaintainer, Benjamin Romer

This module is being removed completely, because it contained wrapper functions
and utility functions that were used in virtpci and virthba. Since these two
drivers are being rewritten to not use these wrappers and utilities, uislib
needs to go.

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Reviewed-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 drivers/staging/unisys/Kconfig            |    1 -
 drivers/staging/unisys/Makefile           |    1 -
 drivers/staging/unisys/uislib/Kconfig     |   10 -
 drivers/staging/unisys/uislib/Makefile    |   12 -
 drivers/staging/unisys/uislib/uislib.c    | 1372 -----------------------------
 drivers/staging/unisys/uislib/uisqueue.c  |  322 -------
 drivers/staging/unisys/uislib/uisthread.c |   69 --
 drivers/staging/unisys/uislib/uisutils.c  |  137 ---
 8 files changed, 1924 deletions(-)
 delete mode 100644 drivers/staging/unisys/uislib/Kconfig
 delete mode 100644 drivers/staging/unisys/uislib/Makefile
 delete mode 100644 drivers/staging/unisys/uislib/uislib.c
 delete mode 100644 drivers/staging/unisys/uislib/uisqueue.c
 delete mode 100644 drivers/staging/unisys/uislib/uisthread.c
 delete mode 100644 drivers/staging/unisys/uislib/uisutils.c

diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig
index 1de86d1..14e1ea6 100644
--- a/drivers/staging/unisys/Kconfig
+++ b/drivers/staging/unisys/Kconfig
@@ -12,6 +12,5 @@ if UNISYSSPAR
 source "drivers/staging/unisys/visorutil/Kconfig"
 source "drivers/staging/unisys/visorchannel/Kconfig"
 source "drivers/staging/unisys/visorchipset/Kconfig"
-source "drivers/staging/unisys/uislib/Kconfig"
 
 endif # UNISYSSPAR
diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile
index 899b0cb..97e750d 100644
--- a/drivers/staging/unisys/Makefile
+++ b/drivers/staging/unisys/Makefile
@@ -4,4 +4,3 @@
 obj-$(CONFIG_UNISYS_VISORUTIL)		+= visorutil/
 obj-$(CONFIG_UNISYS_VISORCHANNEL)	+= visorchannel/
 obj-$(CONFIG_UNISYS_VISORCHIPSET)	+= visorchipset/
-obj-$(CONFIG_UNISYS_UISLIB)		+= uislib/
diff --git a/drivers/staging/unisys/uislib/Kconfig b/drivers/staging/unisys/uislib/Kconfig
deleted file mode 100644
index c39a0a2..0000000
--- a/drivers/staging/unisys/uislib/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Unisys uislib configuration
-#
-
-config UNISYS_UISLIB
-	tristate "Unisys uislib driver"
-	select UNISYS_VISORCHIPSET
-	---help---
-	If you say Y here, you will enable the Unisys uislib driver.
-
diff --git a/drivers/staging/unisys/uislib/Makefile b/drivers/staging/unisys/uislib/Makefile
deleted file mode 100644
index 860f494..0000000
--- a/drivers/staging/unisys/uislib/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Makefile for Unisys uislib
-#
-
-obj-$(CONFIG_UNISYS_UISLIB)	+= visoruislib.o
-
-visoruislib-y := uislib.o uisqueue.o  uisthread.o  uisutils.o
-
-ccflags-y += -Idrivers/staging/unisys/include
-ccflags-y += -Idrivers/staging/unisys/visorchipset
-ccflags-y += -Idrivers/staging/unisys/common-spar/include
-ccflags-y += -Idrivers/staging/unisys/common-spar/include/channels
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c
deleted file mode 100644
index f93d0bb..0000000
--- a/drivers/staging/unisys/uislib/uislib.c
+++ /dev/null
@@ -1,1372 +0,0 @@
-/* uislib.c
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-/* @ALL_INSPECTED */
-#define EXPORT_SYMTAB
-#include <linux/kernel.h>
-#include <linux/highmem.h>
-#ifdef CONFIG_MODVERSIONS
-#include <config/modversions.h>
-#endif
-#include <linux/module.h>
-#include <linux/debugfs.h>
-
-#include <linux/types.h>
-#include <linux/uuid.h>
-
-#include <linux/version.h>
-#include "diagnostics/appos_subsystems.h"
-#include "uisutils.h"
-#include "vbuschannel.h"
-
-#include <linux/proc_fs.h>
-#include <linux/uaccess.h>	/* for copy_from_user */
-#include <linux/ctype.h>	/* for toupper */
-#include <linux/list.h>
-
-#include "sparstop.h"
-#include "visorchipset.h"
-#include "version.h"
-#include "guestlinuxdebug.h"
-
-#define SET_PROC_OWNER(x, y)
-
-#define POLLJIFFIES_NORMAL 1
-/* Choose whether or not you want to wakeup the request-polling thread
- * after an IO termination:
- * this is shorter than using __FILE__ (full path name) in
- * debug/info/error messages
- */
-#define CURRENT_FILE_PC UISLIB_PC_uislib_c
-#define __MYFILE__ "uislib.c"
-
-/* global function pointers that act as callback functions into virtpcimod */
-int (*virt_control_chan_func)(struct guest_msgs *);
-
-static int debug_buf_valid;
-static char *debug_buf;	/* Note this MUST be global,
-					 * because the contents must */
-static unsigned int chipset_inited;
-
-#define WAIT_ON_CALLBACK(handle)	\
-	do {			\
-		if (handle)		\
-			break;		\
-		UIS_THREAD_WAIT;	\
-	} while (1)
-
-static struct bus_info *bus_list;
-static rwlock_t bus_list_lock;
-static int bus_list_count;	/* number of buses in the list */
-static int max_bus_count;		/* maximum number of buses expected */
-static u64 phys_data_chan;
-static int platform_no;
-
-static struct uisthread_info incoming_ti;
-static BOOL incoming_started = FALSE;
-static LIST_HEAD(poll_dev_chan);
-static unsigned long long tot_moved_to_tail_cnt;
-static unsigned long long tot_wait_cnt;
-static unsigned long long tot_wakeup_cnt;
-static unsigned long long tot_schedule_cnt;
-static int en_smart_wakeup = 1;
-static DEFINE_SEMAPHORE(poll_dev_lock);	/* unlocked */
-static DECLARE_WAIT_QUEUE_HEAD(poll_dev_wake_q);
-static int poll_dev_start;
-
-#define CALLHOME_PROC_ENTRY_FN "callhome"
-#define CALLHOME_THROTTLED_PROC_ENTRY_FN "callhome_throttled"
-
-#define DIR_DEBUGFS_ENTRY "uislib"
-static struct dentry *dir_debugfs;
-
-#define PLATFORMNUMBER_DEBUGFS_ENTRY_FN "platform"
-static struct dentry *platformnumber_debugfs_read;
-
-#define CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN "cycles_before_wait"
-static struct dentry *cycles_before_wait_debugfs_read;
-
-#define SMART_WAKEUP_DEBUGFS_ENTRY_FN "smart_wakeup"
-static struct dentry *smart_wakeup_debugfs_entry;
-
-#define INFO_DEBUGFS_ENTRY_FN "info"
-static struct dentry *info_debugfs_entry;
-
-static unsigned long long cycles_before_wait, wait_cycles;
-
-/*****************************************************/
-/* local functions                                   */
-/*****************************************************/
-
-static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-				 size_t len, loff_t *offset);
-static const struct file_operations debugfs_info_fops = {
-	.read = info_debugfs_read,
-};
-
-static void
-init_msg_header(struct controlvm_message *msg, u32 id, uint rsp, uint svr)
-{
-	memset(msg, 0, sizeof(struct controlvm_message));
-	msg->hdr.id = id;
-	msg->hdr.flags.response_expected = rsp;
-	msg->hdr.flags.server = svr;
-}
-
-static __iomem void *init_vbus_channel(u64 ch_addr, u32 ch_bytes)
-{
-	void __iomem *ch = uislib_ioremap_cache(ch_addr, ch_bytes);
-
-	if (!ch)
-		return NULL;
-
-	if (!SPAR_VBUS_CHANNEL_OK_CLIENT(ch)) {
-		uislib_iounmap(ch);
-		return NULL;
-	}
-	return ch;
-}
-
-static int
-create_bus(struct controlvm_message *msg, char *buf)
-{
-	u32 bus_no, dev_count;
-	struct bus_info *tmp, *bus;
-	size_t size;
-
-	if (max_bus_count == bus_list_count) {
-		POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, max_bus_count,
-				 POSTCODE_SEVERITY_ERR);
-		return CONTROLVM_RESP_ERROR_MAX_BUSES;
-	}
-
-	bus_no = msg->cmd.create_bus.bus_no;
-	dev_count = msg->cmd.create_bus.dev_count;
-
-	POSTCODE_LINUX_4(BUS_CREATE_ENTRY_PC, bus_no, dev_count,
-			 POSTCODE_SEVERITY_INFO);
-
-	size =
-	    sizeof(struct bus_info) +
-	    (dev_count * sizeof(struct device_info *));
-	bus = kzalloc(size, GFP_ATOMIC);
-	if (!bus) {
-		POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
-				 POSTCODE_SEVERITY_ERR);
-		return CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
-	}
-
-	/* Currently by default, the bus Number is the GuestHandle.
-	 * Configure Bus message can override this.
-	 */
-	if (msg->hdr.flags.test_message) {
-		/* This implies we're the IOVM so set guest handle to 0... */
-		bus->guest_handle = 0;
-		bus->bus_no = bus_no;
-		bus->local_vnic = 1;
-	} else {
-		bus->bus_no = bus_no;
-		bus->guest_handle = bus_no;
-	}
-	sprintf(bus->name, "%d", (int)bus->bus_no);
-	bus->device_count = dev_count;
-	bus->device =
-	    (struct device_info **)((char *)bus + sizeof(struct bus_info));
-	bus->bus_inst_uuid = msg->cmd.create_bus.bus_inst_uuid;
-	bus->bus_channel_bytes = 0;
-	bus->bus_channel = NULL;
-
-	/* add bus to our bus list - but check for duplicates first */
-	read_lock(&bus_list_lock);
-	for (tmp = bus_list; tmp; tmp = tmp->next) {
-		if (tmp->bus_no == bus->bus_no)
-			break;
-	}
-	read_unlock(&bus_list_lock);
-	if (tmp) {
-		/* found a bus already in the list with same bus_no -
-		 * reject add
-		 */
-		POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no,
-				 POSTCODE_SEVERITY_ERR);
-		kfree(bus);
-		return CONTROLVM_RESP_ERROR_ALREADY_DONE;
-	}
-	if ((msg->cmd.create_bus.channel_addr != 0) &&
-	    (msg->cmd.create_bus.channel_bytes != 0)) {
-		bus->bus_channel_bytes = msg->cmd.create_bus.channel_bytes;
-		bus->bus_channel =
-		    init_vbus_channel(msg->cmd.create_bus.channel_addr,
-				      msg->cmd.create_bus.channel_bytes);
-	}
-	/* the msg is bound for virtpci; send guest_msgs struct to callback */
-	if (!msg->hdr.flags.server) {
-		struct guest_msgs cmd;
-
-		cmd.msgtype = GUEST_ADD_VBUS;
-		cmd.add_vbus.bus_no = bus_no;
-		cmd.add_vbus.chanptr = bus->bus_channel;
-		cmd.add_vbus.dev_count = dev_count;
-		cmd.add_vbus.bus_uuid = msg->cmd.create_bus.bus_data_type_uuid;
-		cmd.add_vbus.instance_uuid = msg->cmd.create_bus.bus_inst_uuid;
-		if (!virt_control_chan_func) {
-			POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no,
-					 POSTCODE_SEVERITY_ERR);
-			kfree(bus);
-			return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-		}
-		if (!virt_control_chan_func(&cmd)) {
-			POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no,
-					 POSTCODE_SEVERITY_ERR);
-			kfree(bus);
-			return
-			    CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-		}
-	}
-
-	/* add bus at the head of our list */
-	write_lock(&bus_list_lock);
-	if (!bus_list) {
-		bus_list = bus;
-	} else {
-		bus->next = bus_list;
-		bus_list = bus;
-	}
-	bus_list_count++;
-	write_unlock(&bus_list_lock);
-
-	POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus->bus_no,
-			 POSTCODE_SEVERITY_INFO);
-	return CONTROLVM_RESP_SUCCESS;
-}
-
-static int
-destroy_bus(struct controlvm_message *msg, char *buf)
-{
-	int i;
-	struct bus_info *bus, *prev = NULL;
-	struct guest_msgs cmd;
-	u32 bus_no;
-
-	bus_no = msg->cmd.destroy_bus.bus_no;
-
-	read_lock(&bus_list_lock);
-
-	bus = bus_list;
-	while (bus) {
-		if (bus->bus_no == bus_no)
-			break;
-		prev = bus;
-		bus = bus->next;
-	}
-
-	if (!bus) {
-		read_unlock(&bus_list_lock);
-		return CONTROLVM_RESP_ERROR_ALREADY_DONE;
-	}
-
-	/* verify that this bus has no devices. */
-	for (i = 0; i < bus->device_count; i++) {
-		if (bus->device[i]) {
-			read_unlock(&bus_list_lock);
-			return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED;
-		}
-	}
-	read_unlock(&bus_list_lock);
-
-	if (msg->hdr.flags.server)
-		goto remove;
-
-	/* client messages require us to call the virtpci callback associated
-	   with this bus. */
-	cmd.msgtype = GUEST_DEL_VBUS;
-	cmd.del_vbus.bus_no = bus_no;
-	if (!virt_control_chan_func)
-		return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-
-	if (!virt_control_chan_func(&cmd))
-		return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-
-	/* finally, remove the bus from the list */
-remove:
-	write_lock(&bus_list_lock);
-	if (prev)	/* not at head */
-		prev->next = bus->next;
-	else
-		bus_list = bus->next;
-	bus_list_count--;
-	write_unlock(&bus_list_lock);
-
-	if (bus->bus_channel) {
-		uislib_iounmap(bus->bus_channel);
-		bus->bus_channel = NULL;
-	}
-
-	kfree(bus);
-	return CONTROLVM_RESP_SUCCESS;
-}
-
-static int create_device(struct controlvm_message *msg, char *buf)
-{
-	struct device_info *dev;
-	struct bus_info *bus;
-	struct guest_msgs cmd;
-	u32 bus_no, dev_no;
-	int result = CONTROLVM_RESP_SUCCESS;
-	u64 min_size = MIN_IO_CHANNEL_SIZE;
-	struct req_handler_info *req_handler;
-
-	bus_no = msg->cmd.create_device.bus_no;
-	dev_no = msg->cmd.create_device.dev_no;
-
-	POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_INFO);
-
-	dev = kzalloc(sizeof(*dev), GFP_ATOMIC);
-	if (!dev) {
-		POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
-				 POSTCODE_SEVERITY_ERR);
-		return CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
-	}
-
-	dev->channel_uuid = msg->cmd.create_device.data_type_uuid;
-	dev->intr = msg->cmd.create_device.intr;
-	dev->channel_addr = msg->cmd.create_device.channel_addr;
-	dev->bus_no = bus_no;
-	dev->dev_no = dev_no;
-	sema_init(&dev->interrupt_callback_lock, 1);	/* unlocked */
-	sprintf(dev->devid, "vbus%u:dev%u", (unsigned)bus_no, (unsigned)dev_no);
-	/* map the channel memory for the device. */
-	if (msg->hdr.flags.test_message) {
-		dev->chanptr = (void __iomem *)__va(dev->channel_addr);
-	} else {
-		req_handler = req_handler_find(dev->channel_uuid);
-		if (req_handler)
-			/* generic service handler registered for this
-			 * channel
-			 */
-			min_size = req_handler->min_channel_bytes;
-		if (min_size > msg->cmd.create_device.channel_bytes) {
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_ERR);
-			result = CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL;
-			goto cleanup;
-		}
-		dev->chanptr =
-		    uislib_ioremap_cache(dev->channel_addr,
-					 msg->cmd.create_device.channel_bytes);
-		if (!dev->chanptr) {
-			result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_ERR);
-			goto cleanup;
-		}
-	}
-	dev->instance_uuid = msg->cmd.create_device.dev_inst_uuid;
-	dev->channel_bytes = msg->cmd.create_device.channel_bytes;
-
-	read_lock(&bus_list_lock);
-	for (bus = bus_list; bus; bus = bus->next) {
-		if (bus->bus_no != bus_no)
-			continue;
-		/* make sure the device number is valid */
-		if (dev_no >= bus->device_count) {
-			result = CONTROLVM_RESP_ERROR_MAX_DEVICES;
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_ERR);
-			read_unlock(&bus_list_lock);
-			goto cleanup;
-		}
-		/* make sure this device is not already set */
-		if (bus->device[dev_no]) {
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC,
-					 dev_no, bus_no,
-					 POSTCODE_SEVERITY_ERR);
-			result = CONTROLVM_RESP_ERROR_ALREADY_DONE;
-			read_unlock(&bus_list_lock);
-			goto cleanup;
-		}
-		read_unlock(&bus_list_lock);
-		/* the msg is bound for virtpci; send
-		 * guest_msgs struct to callback
-		 */
-		if (msg->hdr.flags.server) {
-			bus->device[dev_no] = dev;
-			POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_INFO);
-			return CONTROLVM_RESP_SUCCESS;
-		}
-		if (uuid_le_cmp(dev->channel_uuid,
-				spar_vhba_channel_protocol_uuid) == 0) {
-			wait_for_valid_guid(&((struct channel_header __iomem *)
-					    (dev->chanptr))->chtype);
-			if (!SPAR_VHBA_CHANNEL_OK_CLIENT(dev->chanptr)) {
-				POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC,
-						 dev_no, bus_no,
-						 POSTCODE_SEVERITY_ERR);
-				result = CONTROLVM_RESP_ERROR_CHANNEL_INVALID;
-				goto cleanup;
-			}
-			cmd.msgtype = GUEST_ADD_VHBA;
-			cmd.add_vhba.chanptr = dev->chanptr;
-			cmd.add_vhba.bus_no = bus_no;
-			cmd.add_vhba.device_no = dev_no;
-			cmd.add_vhba.instance_uuid = dev->instance_uuid;
-			cmd.add_vhba.intr = dev->intr;
-		} else if (uuid_le_cmp(dev->channel_uuid,
-				       spar_vnic_channel_protocol_uuid) == 0) {
-			wait_for_valid_guid(&((struct channel_header __iomem *)
-					    (dev->chanptr))->chtype);
-			if (!SPAR_VNIC_CHANNEL_OK_CLIENT(dev->chanptr)) {
-				POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC,
-						 dev_no, bus_no,
-						 POSTCODE_SEVERITY_ERR);
-				result = CONTROLVM_RESP_ERROR_CHANNEL_INVALID;
-				goto cleanup;
-			}
-			cmd.msgtype = GUEST_ADD_VNIC;
-			cmd.add_vnic.chanptr = dev->chanptr;
-			cmd.add_vnic.bus_no = bus_no;
-			cmd.add_vnic.device_no = dev_no;
-			cmd.add_vnic.instance_uuid = dev->instance_uuid;
-			cmd.add_vhba.intr = dev->intr;
-		} else {
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_ERR);
-			result = CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
-			goto cleanup;
-		}
-
-		if (!virt_control_chan_func) {
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_ERR);
-			result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-			goto cleanup;
-		}
-
-		if (!virt_control_chan_func(&cmd)) {
-			POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
-					 bus_no, POSTCODE_SEVERITY_ERR);
-			result =
-			     CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-			goto cleanup;
-		}
-
-		bus->device[dev_no] = dev;
-		POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no,
-				 bus_no, POSTCODE_SEVERITY_INFO);
-		return CONTROLVM_RESP_SUCCESS;
-	}
-	read_unlock(&bus_list_lock);
-
-	POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_ERR);
-	result = CONTROLVM_RESP_ERROR_BUS_INVALID;
-
-cleanup:
-	if (!msg->hdr.flags.test_message) {
-		uislib_iounmap(dev->chanptr);
-		dev->chanptr = NULL;
-	}
-
-	kfree(dev);
-	return result;
-}
-
-static int pause_device(struct controlvm_message *msg)
-{
-	u32 bus_no, dev_no;
-	struct bus_info *bus;
-	struct device_info *dev;
-	struct guest_msgs cmd;
-	int retval = CONTROLVM_RESP_SUCCESS;
-
-	bus_no = msg->cmd.device_change_state.bus_no;
-	dev_no = msg->cmd.device_change_state.dev_no;
-
-	read_lock(&bus_list_lock);
-	for (bus = bus_list; bus; bus = bus->next) {
-		if (bus->bus_no == bus_no) {
-			/* make sure the device number is valid */
-			if (dev_no >= bus->device_count) {
-				retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
-			} else {
-				/* make sure this device exists */
-				dev = bus->device[dev_no];
-				if (!dev) {
-					retval =
-					  CONTROLVM_RESP_ERROR_ALREADY_DONE;
-				}
-			}
-			break;
-		}
-	}
-	if (!bus)
-		retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
-
-	read_unlock(&bus_list_lock);
-	if (retval == CONTROLVM_RESP_SUCCESS) {
-		/* the msg is bound for virtpci; send
-		 * guest_msgs struct to callback
-		 */
-		if (uuid_le_cmp(dev->channel_uuid,
-				spar_vhba_channel_protocol_uuid) == 0) {
-			cmd.msgtype = GUEST_PAUSE_VHBA;
-			cmd.pause_vhba.chanptr = dev->chanptr;
-		} else if (uuid_le_cmp(dev->channel_uuid,
-				       spar_vnic_channel_protocol_uuid) == 0) {
-			cmd.msgtype = GUEST_PAUSE_VNIC;
-			cmd.pause_vnic.chanptr = dev->chanptr;
-		} else {
-			return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
-		}
-		if (!virt_control_chan_func)
-			return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-		if (!virt_control_chan_func(&cmd)) {
-			return
-			  CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-		}
-	}
-	return retval;
-}
-
-static int resume_device(struct controlvm_message *msg)
-{
-	u32 bus_no, dev_no;
-	struct bus_info *bus;
-	struct device_info *dev;
-	struct guest_msgs cmd;
-	int retval = CONTROLVM_RESP_SUCCESS;
-
-	bus_no = msg->cmd.device_change_state.bus_no;
-	dev_no = msg->cmd.device_change_state.dev_no;
-
-	read_lock(&bus_list_lock);
-	for (bus = bus_list; bus; bus = bus->next) {
-		if (bus->bus_no == bus_no) {
-			/* make sure the device number is valid */
-			if (dev_no >= bus->device_count) {
-				retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
-			} else {
-				/* make sure this device exists */
-				dev = bus->device[dev_no];
-				if (!dev) {
-					retval =
-					  CONTROLVM_RESP_ERROR_ALREADY_DONE;
-				}
-			}
-			break;
-		}
-	}
-
-	if (!bus)
-		retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
-
-	read_unlock(&bus_list_lock);
-	/* the msg is bound for virtpci; send
-	 * guest_msgs struct to callback
-	 */
-	if (retval == CONTROLVM_RESP_SUCCESS) {
-		if (uuid_le_cmp(dev->channel_uuid,
-				spar_vhba_channel_protocol_uuid) == 0) {
-			cmd.msgtype = GUEST_RESUME_VHBA;
-			cmd.resume_vhba.chanptr = dev->chanptr;
-		} else if (uuid_le_cmp(dev->channel_uuid,
-				       spar_vnic_channel_protocol_uuid) == 0) {
-			cmd.msgtype = GUEST_RESUME_VNIC;
-			cmd.resume_vnic.chanptr = dev->chanptr;
-		} else {
-			return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
-		}
-		if (!virt_control_chan_func)
-			return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-		if (!virt_control_chan_func(&cmd)) {
-			return
-			  CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-		}
-	}
-	return retval;
-}
-
-static int destroy_device(struct controlvm_message *msg, char *buf)
-{
-	u32 bus_no, dev_no;
-	struct bus_info *bus;
-	struct device_info *dev;
-	struct guest_msgs cmd;
-	int retval = CONTROLVM_RESP_SUCCESS;
-
-	bus_no = msg->cmd.destroy_device.bus_no;
-	dev_no = msg->cmd.destroy_device.bus_no;
-
-	read_lock(&bus_list_lock);
-	for (bus = bus_list; bus; bus = bus->next) {
-		if (bus->bus_no == bus_no) {
-			/* make sure the device number is valid */
-			if (dev_no >= bus->device_count) {
-				retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
-			} else {
-				/* make sure this device exists */
-				dev = bus->device[dev_no];
-				if (!dev) {
-					retval =
-					     CONTROLVM_RESP_ERROR_ALREADY_DONE;
-				}
-			}
-			break;
-		}
-	}
-
-	if (!bus)
-		retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
-	read_unlock(&bus_list_lock);
-	if (retval == CONTROLVM_RESP_SUCCESS) {
-		/* the msg is bound for virtpci; send
-		 * guest_msgs struct to callback
-		 */
-		if (uuid_le_cmp(dev->channel_uuid,
-				spar_vhba_channel_protocol_uuid) == 0) {
-			cmd.msgtype = GUEST_DEL_VHBA;
-			cmd.del_vhba.chanptr = dev->chanptr;
-		} else if (uuid_le_cmp(dev->channel_uuid,
-				       spar_vnic_channel_protocol_uuid) == 0) {
-			cmd.msgtype = GUEST_DEL_VNIC;
-			cmd.del_vnic.chanptr = dev->chanptr;
-		} else {
-			return
-			    CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
-		}
-		if (!virt_control_chan_func) {
-			return
-			    CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
-		}
-		if (!virt_control_chan_func(&cmd)) {
-			return
-			    CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
-		}
-/* you must disable channel interrupts BEFORE you unmap the channel,
- * because if you unmap first, there may still be some activity going
- * on which accesses the channel and you will get a "unable to handle
- * kernel paging request"
- */
-		if (dev->polling)
-			uislib_disable_channel_interrupts(bus_no, dev_no);
-		/* unmap the channel memory for the device. */
-		if (!msg->hdr.flags.test_message)
-			uislib_iounmap(dev->chanptr);
-		kfree(dev);
-		bus->device[dev_no] = NULL;
-	}
-	return retval;
-}
-
-static int
-init_chipset(struct controlvm_message *msg, char *buf)
-{
-	POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-
-	max_bus_count = msg->cmd.init_chipset.bus_count;
-	platform_no = msg->cmd.init_chipset.platform_number;
-	phys_data_chan = 0;
-
-	/* We need to make sure we have our functions registered
-	* before processing messages.  If we are a test vehicle the
-	* test_message for init_chipset will be set.  We can ignore the
-	* waits for the callbacks, since this will be manually entered
-	* from a user.  If no test_message is set, we will wait for the
-	* functions.
-	*/
-	if (!msg->hdr.flags.test_message)
-		WAIT_ON_CALLBACK(virt_control_chan_func);
-
-	chipset_inited = 1;
-	POSTCODE_LINUX_2(CHIPSET_INIT_EXIT_PC, POSTCODE_SEVERITY_INFO);
-
-	return CONTROLVM_RESP_SUCCESS;
-}
-
-static int delete_bus_glue(u32 bus_no)
-{
-	struct controlvm_message msg;
-
-	init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0);
-	msg.cmd.destroy_bus.bus_no = bus_no;
-	if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
-		return 0;
-	return 1;
-}
-
-static int delete_device_glue(u32 bus_no, u32 dev_no)
-{
-	struct controlvm_message msg;
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0);
-	msg.cmd.destroy_device.bus_no = bus_no;
-	msg.cmd.destroy_device.dev_no = dev_no;
-	if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
-		return 0;
-	return 1;
-}
-
-int
-uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid,
-			     u64 channel_addr, ulong n_channel_bytes)
-{
-	struct controlvm_message msg;
-
-	/* step 0: init the chipset */
-	POSTCODE_LINUX_3(CHIPSET_INIT_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO);
-
-	if (!chipset_inited) {
-		/* step: initialize the chipset */
-		init_msg_header(&msg, CONTROLVM_CHIPSET_INIT, 0, 0);
-		/* this change is needed so that console will come up
-		* OK even when the bus 0 create comes in late.  If the
-		* bus 0 create is the first create, then the add_vnic
-		* will work fine, but if the bus 0 create arrives
-		* after number 4, then the add_vnic will fail, and the
-		* ultraboot will fail.
-		*/
-		msg.cmd.init_chipset.bus_count = 23;
-		msg.cmd.init_chipset.switch_count = 0;
-		if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
-			return 0;
-		POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no,
-				 POSTCODE_SEVERITY_INFO);
-	}
-
-	/* step 1: create a bus */
-	POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no,
-			 POSTCODE_SEVERITY_WARNING);
-	init_msg_header(&msg, CONTROLVM_BUS_CREATE, 0, 0);
-	msg.cmd.create_bus.bus_no = bus_no;
-	msg.cmd.create_bus.dev_count = 23;	/* devNo+1; */
-	msg.cmd.create_bus.channel_addr = channel_addr;
-	msg.cmd.create_bus.channel_bytes = n_channel_bytes;
-	if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
-		POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
-				 POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-	POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO);
-
-	return 1;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_add_bus);
-
-int
-uislib_client_inject_del_bus(u32 bus_no)
-{
-	return delete_bus_glue(bus_no);
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_del_bus);
-
-int
-uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no)
-{
-	struct controlvm_message msg;
-	int rc;
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0);
-	msg.cmd.device_change_state.bus_no = bus_no;
-	msg.cmd.device_change_state.dev_no = dev_no;
-	msg.cmd.device_change_state.state = segment_state_standby;
-	rc = pause_device(&msg);
-	if (rc != CONTROLVM_RESP_SUCCESS)
-		return rc;
-	return 0;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vhba);
-
-int
-uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no)
-{
-	struct controlvm_message msg;
-	int rc;
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0);
-	msg.cmd.device_change_state.bus_no = bus_no;
-	msg.cmd.device_change_state.dev_no = dev_no;
-	msg.cmd.device_change_state.state = segment_state_running;
-	rc = resume_device(&msg);
-	if (rc != CONTROLVM_RESP_SUCCESS)
-		return rc;
-	return 0;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba);
-
-int
-uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no,
-			      u64 phys_chan_addr, u32 chan_bytes,
-			      int is_test_addr, uuid_le inst_uuid,
-			      struct irq_info *intr)
-{
-	struct controlvm_message msg;
-
-	/* chipset init'ed with bus bus has been previously created -
-	* Verify it still exists step 2: create the VHBA device on the
-	* bus
-	*/
-	POSTCODE_LINUX_4(VHBA_CREATE_ENTRY_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_INFO);
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0);
-	if (is_test_addr)
-		/* signify that the physical channel address does NOT
-		 * need to be ioremap()ed
-		 */
-		msg.hdr.flags.test_message = 1;
-	msg.cmd.create_device.bus_no = bus_no;
-	msg.cmd.create_device.dev_no = dev_no;
-	msg.cmd.create_device.dev_inst_uuid = inst_uuid;
-	if (intr)
-		msg.cmd.create_device.intr = *intr;
-	else
-		memset(&msg.cmd.create_device.intr, 0,
-		       sizeof(struct irq_info));
-	msg.cmd.create_device.channel_addr = phys_chan_addr;
-	if (chan_bytes < MIN_IO_CHANNEL_SIZE) {
-		POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, chan_bytes,
-				 MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-	msg.cmd.create_device.channel_bytes = chan_bytes;
-	msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid;
-	if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
-		POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no,
-				 POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-	POSTCODE_LINUX_4(VHBA_CREATE_SUCCESS_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_INFO);
-	return 1;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_add_vhba);
-
-int
-uislib_client_inject_del_vhba(u32 bus_no, u32 dev_no)
-{
-	return delete_device_glue(bus_no, dev_no);
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_del_vhba);
-
-int
-uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no,
-			      u64 phys_chan_addr, u32 chan_bytes,
-			      int is_test_addr, uuid_le inst_uuid,
-			      struct irq_info *intr)
-{
-	struct controlvm_message msg;
-
-	/* chipset init'ed with bus bus has been previously created -
-	* Verify it still exists step 2: create the VNIC device on the
-	* bus
-	*/
-	POSTCODE_LINUX_4(VNIC_CREATE_ENTRY_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_INFO);
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_CREATE, 0, 0);
-	if (is_test_addr)
-		/* signify that the physical channel address does NOT
-		 * need to be ioremap()ed
-		 */
-		msg.hdr.flags.test_message = 1;
-	msg.cmd.create_device.bus_no = bus_no;
-	msg.cmd.create_device.dev_no = dev_no;
-	msg.cmd.create_device.dev_inst_uuid = inst_uuid;
-	if (intr)
-		msg.cmd.create_device.intr = *intr;
-	else
-		memset(&msg.cmd.create_device.intr, 0,
-		       sizeof(struct irq_info));
-	msg.cmd.create_device.channel_addr = phys_chan_addr;
-	if (chan_bytes < MIN_IO_CHANNEL_SIZE) {
-		POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, chan_bytes,
-				 MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-	msg.cmd.create_device.channel_bytes = chan_bytes;
-	msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid;
-	if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
-		POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no,
-				 POSTCODE_SEVERITY_ERR);
-		return 0;
-	}
-
-	POSTCODE_LINUX_4(VNIC_CREATE_SUCCESS_PC, dev_no, bus_no,
-			 POSTCODE_SEVERITY_INFO);
-	return 1;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_add_vnic);
-
-int
-uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no)
-{
-	struct controlvm_message msg;
-	int rc;
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0);
-	msg.cmd.device_change_state.bus_no = bus_no;
-	msg.cmd.device_change_state.dev_no = dev_no;
-	msg.cmd.device_change_state.state = segment_state_standby;
-	rc = pause_device(&msg);
-	if (rc != CONTROLVM_RESP_SUCCESS)
-		return -1;
-	return 0;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vnic);
-
-int
-uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no)
-{
-	struct controlvm_message msg;
-	int rc;
-
-	init_msg_header(&msg, CONTROLVM_DEVICE_CHANGESTATE, 0, 0);
-	msg.cmd.device_change_state.bus_no = bus_no;
-	msg.cmd.device_change_state.dev_no = dev_no;
-	msg.cmd.device_change_state.state = segment_state_running;
-	rc = resume_device(&msg);
-	if (rc != CONTROLVM_RESP_SUCCESS)
-		return -1;
-	return 0;
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic);
-
-int
-uislib_client_inject_del_vnic(u32 bus_no, u32 dev_no)
-{
-	return delete_device_glue(bus_no, dev_no);
-}
-EXPORT_SYMBOL_GPL(uislib_client_inject_del_vnic);
-
-void *
-uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln)
-{
-	/* __GFP_NORETRY means "ok to fail", meaning kmalloc() can
-	* return NULL.  If you do NOT specify __GFP_NORETRY, Linux
-	* will go to extreme measures to get memory for you (like,
-	* invoke oom killer), which will probably cripple the system.
-	*/
-	void *p = kmem_cache_alloc(cur_pool, GFP_ATOMIC | __GFP_NORETRY);
-
-	if (!p)
-		return NULL;
-	return p;
-}
-EXPORT_SYMBOL_GPL(uislib_cache_alloc);
-
-void
-uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln)
-{
-	if (!p)
-		return;
-	kmem_cache_free(cur_pool, p);
-}
-EXPORT_SYMBOL_GPL(uislib_cache_free);
-
-/*****************************************************/
-/* proc filesystem callback functions                */
-/*****************************************************/
-
-#define PLINE(...) uisutil_add_proc_line_ex(&tot, buff, \
-					       buff_len, __VA_ARGS__)
-
-static int
-info_debugfs_read_helper(char **buff, int *buff_len)
-{
-	int i, tot = 0;
-	struct bus_info *bus;
-
-	if (PLINE("\nBuses:\n") < 0)
-		goto err_done;
-
-	read_lock(&bus_list_lock);
-	for (bus = bus_list; bus; bus = bus->next) {
-		if (PLINE("    bus=0x%p, busNo=%d, deviceCount=%d\n",
-			  bus, bus->bus_no, bus->device_count) < 0)
-			goto err_done_unlock;
-
-		if (PLINE("        Devices:\n") < 0)
-			goto err_done_unlock;
-
-		for (i = 0; i < bus->device_count; i++) {
-			if (bus->device[i]) {
-				if (PLINE("            busNo %d, device[%i]: 0x%p, chanptr=0x%p, swtch=0x%p\n",
-					  bus->bus_no, i, bus->device[i],
-					  bus->device[i]->chanptr,
-					  bus->device[i]->swtch) < 0)
-					goto err_done_unlock;
-
-				if (PLINE("            first_busy_cnt=%llu, moved_to_tail_cnt=%llu, last_on_list_cnt=%llu\n",
-					  bus->device[i]->first_busy_cnt,
-					  bus->device[i]->moved_to_tail_cnt,
-					  bus->device[i]->last_on_list_cnt) < 0)
-					goto err_done_unlock;
-			}
-		}
-	}
-	read_unlock(&bus_list_lock);
-
-	if (PLINE("UisUtils_Registered_Services: %d\n",
-		  atomic_read(&uisutils_registered_services)) < 0)
-		goto err_done;
-	if (PLINE("cycles_before_wait %llu wait_cycles:%llu\n",
-		  cycles_before_wait, wait_cycles) < 0)
-			goto err_done;
-	if (PLINE("tot_wakeup_cnt %llu:tot_wait_cnt %llu:tot_schedule_cnt %llu\n",
-		  tot_wakeup_cnt, tot_wait_cnt, tot_schedule_cnt) < 0)
-			goto err_done;
-	if (PLINE("en_smart_wakeup %d\n", en_smart_wakeup) < 0)
-			goto err_done;
-	if (PLINE("tot_moved_to_tail_cnt %llu\n", tot_moved_to_tail_cnt) < 0)
-			goto err_done;
-
-	return tot;
-
-err_done_unlock:
-	read_unlock(&bus_list_lock);
-err_done:
-	return -1;
-}
-
-static ssize_t info_debugfs_read(struct file *file, char __user *buf,
-				 size_t len, loff_t *offset)
-{
-	char *temp;
-	int total_bytes = 0;
-	int remaining_bytes = PROC_READ_BUFFER_SIZE;
-
-/* *start = buf; */
-	if (!debug_buf) {
-		debug_buf = vmalloc(PROC_READ_BUFFER_SIZE);
-
-		if (!debug_buf)
-			return -ENOMEM;
-	}
-
-	temp = debug_buf;
-
-	if ((*offset == 0) || (!debug_buf_valid)) {
-		/* if the read fails, then -1 will be returned */
-		total_bytes = info_debugfs_read_helper(&temp, &remaining_bytes);
-		debug_buf_valid = 1;
-	} else {
-		total_bytes = strlen(debug_buf);
-	}
-
-	return simple_read_from_buffer(buf, len, offset,
-				       debug_buf, total_bytes);
-}
-
-static struct device_info *find_dev(u32 bus_no, u32 dev_no)
-{
-	struct bus_info *bus;
-	struct device_info *dev = NULL;
-
-	read_lock(&bus_list_lock);
-	for (bus = bus_list; bus; bus = bus->next) {
-		if (bus->bus_no == bus_no) {
-			/* make sure the device number is valid */
-			if (dev_no >= bus->device_count)
-				break;
-			dev = bus->device[dev_no];
-			break;
-		}
-	}
-	read_unlock(&bus_list_lock);
-	return dev;
-}
-
-/*  This thread calls the "interrupt" function for each device that has
- *  enabled such using uislib_enable_channel_interrupts().  The "interrupt"
- *  function typically reads and processes the devices's channel input
- *  queue.  This thread repeatedly does this, until the thread is told to stop
- *  (via uisthread_stop()).  Sleeping rules:
- *  - If we have called the "interrupt" function for all devices, and all of
- *    them have reported "nothing processed" (returned 0), then we will go to
- *    sleep for a maximum of POLLJIFFIES_NORMAL jiffies.
- *  - If anyone calls uislib_force_channel_interrupt(), the above jiffy
- *    sleep will be interrupted, and we will resume calling the "interrupt"
- *    function for all devices.
- *  - The list of devices is dynamically re-ordered in order to
- *    attempt to preserve fairness.  Whenever we spin thru the list of
- *    devices and call the dev->interrupt() function, if we find
- *    devices which report that there is still more work to do, the
- *    the first such device we find is moved to the end of the device
- *    list.  This ensures that extremely busy devices don't starve out
- *    less-busy ones.
- *
- */
-static int process_incoming(void *v)
-{
-	unsigned long long cur_cycles, old_cycles, idle_cycles, delta_cycles;
-	struct list_head *new_tail = NULL;
-	int i;
-
-	UIS_DAEMONIZE("dev_incoming");
-	for (i = 0; i < 16; i++) {
-		old_cycles = get_cycles();
-		wait_event_timeout(poll_dev_wake_q,
-				   0, POLLJIFFIES_NORMAL);
-		cur_cycles = get_cycles();
-		if (wait_cycles == 0) {
-			wait_cycles = (cur_cycles - old_cycles);
-		} else {
-			if (wait_cycles < (cur_cycles - old_cycles))
-				wait_cycles = (cur_cycles - old_cycles);
-		}
-	}
-	cycles_before_wait = wait_cycles;
-	idle_cycles = 0;
-	poll_dev_start = 0;
-	while (1) {
-		struct list_head *lelt, *tmp;
-		struct device_info *dev = NULL;
-
-		/* poll each channel for input */
-		down(&poll_dev_lock);
-		new_tail = NULL;
-		list_for_each_safe(lelt, tmp, &poll_dev_chan) {
-			int rc = 0;
-
-			dev = list_entry(lelt, struct device_info,
-					 list_polling_device_channels);
-			down(&dev->interrupt_callback_lock);
-			if (dev->interrupt)
-				rc = dev->interrupt(dev->interrupt_context);
-			else
-				continue;
-			up(&dev->interrupt_callback_lock);
-			if (rc) {
-				/* dev->interrupt returned, but there
-				* is still more work to do.
-				* Reschedule work to occur as soon as
-				* possible. */
-				idle_cycles = 0;
-				if (!new_tail) {
-					dev->first_busy_cnt++;
-					if (!
-					    (list_is_last
-					     (lelt,
-					      &poll_dev_chan))) {
-						new_tail = lelt;
-						dev->moved_to_tail_cnt++;
-					} else {
-						dev->last_on_list_cnt++;
-					}
-				}
-			}
-			if (kthread_should_stop())
-				break;
-		}
-		if (new_tail) {
-			tot_moved_to_tail_cnt++;
-			list_move_tail(new_tail, &poll_dev_chan);
-		}
-		up(&poll_dev_lock);
-		cur_cycles = get_cycles();
-		delta_cycles = cur_cycles - old_cycles;
-		old_cycles = cur_cycles;
-
-		/* At this point, we have scanned thru all of the
-		* channels, and at least one of the following is true:
-		* - there is no input waiting on any of the channels
-		* - we have received a signal to stop this thread
-		*/
-		if (kthread_should_stop())
-			break;
-		if (en_smart_wakeup == 0xFF)
-			break;
-		/* wait for POLLJIFFIES_NORMAL jiffies, or until
-		* someone wakes up poll_dev_wake_q,
-		* whichever comes first only do a wait when we have
-		* been idle for cycles_before_wait cycles.
-		*/
-		if (idle_cycles > cycles_before_wait) {
-			poll_dev_start = 0;
-			tot_wait_cnt++;
-			wait_event_timeout(poll_dev_wake_q,
-					   poll_dev_start,
-					   POLLJIFFIES_NORMAL);
-			poll_dev_start = 1;
-		} else {
-			tot_schedule_cnt++;
-			schedule();
-			idle_cycles = idle_cycles + delta_cycles;
-		}
-	}
-	complete_and_exit(&incoming_ti.has_stopped, 0);
-}
-
-static BOOL
-initialize_incoming_thread(void)
-{
-	if (incoming_started)
-		return TRUE;
-	if (!uisthread_start(&incoming_ti,
-			     &process_incoming, NULL, "dev_incoming")) {
-		return FALSE;
-	}
-	incoming_started = TRUE;
-	return TRUE;
-}
-
-/*  Add a new device/channel to the list being processed by
- *  process_incoming().
- *  <interrupt> - indicates the function to call periodically.
- *  <interrupt_context> - indicates the data to pass to the <interrupt>
- *                        function.
- */
-void
-uislib_enable_channel_interrupts(u32 bus_no, u32 dev_no,
-				 int (*interrupt)(void *),
-				 void *interrupt_context)
-{
-	struct device_info *dev;
-
-	dev = find_dev(bus_no, dev_no);
-	if (!dev)
-		return;
-
-	down(&poll_dev_lock);
-	initialize_incoming_thread();
-	dev->interrupt = interrupt;
-	dev->interrupt_context = interrupt_context;
-	dev->polling = TRUE;
-	list_add_tail(&dev->list_polling_device_channels,
-		      &poll_dev_chan);
-	up(&poll_dev_lock);
-}
-EXPORT_SYMBOL_GPL(uislib_enable_channel_interrupts);
-
-/*  Remove a device/channel from the list being processed by
- *  process_incoming().
- */
-void
-uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no)
-{
-	struct device_info *dev;
-
-	dev = find_dev(bus_no, dev_no);
-	if (!dev)
-		return;
-	down(&poll_dev_lock);
-	list_del(&dev->list_polling_device_channels);
-	dev->polling = FALSE;
-	dev->interrupt = NULL;
-	up(&poll_dev_lock);
-}
-EXPORT_SYMBOL_GPL(uislib_disable_channel_interrupts);
-
-static void
-do_wakeup_polling_device_channels(struct work_struct *dummy)
-{
-	if (!poll_dev_start) {
-		poll_dev_start = 1;
-		wake_up(&poll_dev_wake_q);
-	}
-}
-
-static DECLARE_WORK(work_wakeup_polling_device_channels,
-		    do_wakeup_polling_device_channels);
-
-/*  Call this function when you want to send a hint to process_incoming() that
- *  your device might have more requests.
- */
-void
-uislib_force_channel_interrupt(u32 bus_no, u32 dev_no)
-{
-	if (en_smart_wakeup == 0)
-		return;
-	if (poll_dev_start)
-		return;
-	/* The point of using schedule_work() instead of just doing
-	 * the work inline is to force a slight delay before waking up
-	 * the process_incoming() thread.
-	 */
-	tot_wakeup_cnt++;
-	schedule_work(&work_wakeup_polling_device_channels);
-}
-EXPORT_SYMBOL_GPL(uislib_force_channel_interrupt);
-
-/*****************************************************/
-/* Module Init & Exit functions                      */
-/*****************************************************/
-
-static int __init
-uislib_mod_init(void)
-{
-	if (!unisys_spar_platform)
-		return -ENODEV;
-
-	/* initialize global pointers to NULL */
-	bus_list = NULL;
-	bus_list_count = 0;
-	max_bus_count = 0;
-	rwlock_init(&bus_list_lock);
-	virt_control_chan_func = NULL;
-
-	/* Issue VMCALL_GET_CONTROLVM_ADDR to get CtrlChanPhysAddr and
-	 * then map this physical address to a virtual address. */
-	POSTCODE_LINUX_2(DRIVER_ENTRY_PC, POSTCODE_SEVERITY_INFO);
-
-	dir_debugfs = debugfs_create_dir(DIR_DEBUGFS_ENTRY, NULL);
-	if (dir_debugfs) {
-		info_debugfs_entry = debugfs_create_file(
-			INFO_DEBUGFS_ENTRY_FN, 0444, dir_debugfs, NULL,
-			&debugfs_info_fops);
-
-		platformnumber_debugfs_read = debugfs_create_u32(
-			PLATFORMNUMBER_DEBUGFS_ENTRY_FN, 0444, dir_debugfs,
-			&platform_no);
-
-		cycles_before_wait_debugfs_read = debugfs_create_u64(
-			CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN, 0666, dir_debugfs,
-			&cycles_before_wait);
-
-		smart_wakeup_debugfs_entry = debugfs_create_bool(
-			SMART_WAKEUP_DEBUGFS_ENTRY_FN, 0666, dir_debugfs,
-			&en_smart_wakeup);
-	}
-
-	POSTCODE_LINUX_3(DRIVER_EXIT_PC, 0, POSTCODE_SEVERITY_INFO);
-	return 0;
-}
-
-static void __exit
-uislib_mod_exit(void)
-{
-	if (debug_buf) {
-		vfree(debug_buf);
-		debug_buf = NULL;
-	}
-
-	debugfs_remove(info_debugfs_entry);
-	debugfs_remove(smart_wakeup_debugfs_entry);
-	debugfs_remove(cycles_before_wait_debugfs_read);
-	debugfs_remove(platformnumber_debugfs_read);
-	debugfs_remove(dir_debugfs);
-}
-
-module_init(uislib_mod_init);
-module_exit(uislib_mod_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Usha Srinivasan");
-MODULE_ALIAS("uislib");
-  /* this is extracted during depmod and kept in modules.dep */
diff --git a/drivers/staging/unisys/uislib/uisqueue.c b/drivers/staging/unisys/uislib/uisqueue.c
deleted file mode 100644
index d46dd74..0000000
--- a/drivers/staging/unisys/uislib/uisqueue.c
+++ /dev/null
@@ -1,322 +0,0 @@
-/* uisqueue.c
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-/* @ALL_INSPECTED */
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-#include "uisutils.h"
-
-/* this is shorter than using __FILE__ (full path name) in
- * debug/info/error messages */
-#define CURRENT_FILE_PC UISLIB_PC_uisqueue_c
-#define __MYFILE__ "uisqueue.c"
-
-#define CHECK_CACHE_ALIGN 0
-
-/*****************************************************/
-/* Exported functions                                */
-/*****************************************************/
-
-/*
- * Routine Description:
- * Tries to insert the prebuilt signal pointed to by pSignal into the nth
- * Queue of the Channel pointed to by pChannel
- *
- * Parameters:
- * pChannel: (IN) points to the IO Channel
- * Queue: (IN) nth Queue of the IO Channel
- * pSignal: (IN) pointer to the signal
- *
- * Assumptions:
- * - pChannel, Queue and pSignal are valid.
- * - If insertion fails due to a full queue, the caller will determine the
- * retry policy (e.g. wait & try again, report an error, etc.).
- *
- * Return value:
- * 1 if the insertion succeeds, 0 if the queue was full.
- */
-unsigned char spar_signal_insert(struct channel_header __iomem *ch, u32 queue,
-				 void *sig)
-{
-	void __iomem *psignal;
-	unsigned int head, tail, nof;
-
-	struct signal_queue_header __iomem *pqhdr =
-	    (struct signal_queue_header __iomem *)
-		((char __iomem *)ch + readq(&ch->ch_space_offset))
-		+ queue;
-
-	/* capture current head and tail */
-	head = readl(&pqhdr->head);
-	tail = readl(&pqhdr->tail);
-
-	/* queue is full if (head + 1) % n equals tail */
-	if (((head + 1) % readl(&pqhdr->max_slots)) == tail) {
-		nof = readq(&pqhdr->num_overflows) + 1;
-		writeq(nof, &pqhdr->num_overflows);
-		return 0;
-	}
-
-	/* increment the head index */
-	head = (head + 1) % readl(&pqhdr->max_slots);
-
-	/* copy signal to the head location from the area pointed to
-	 * by pSignal
-	 */
-	psignal = (char __iomem *)pqhdr + readq(&pqhdr->sig_base_offset) +
-		(head * readl(&pqhdr->signal_size));
-	memcpy_toio(psignal, sig, readl(&pqhdr->signal_size));
-
-	mb(); /* channel synch */
-	writel(head, &pqhdr->head);
-
-	writeq(readq(&pqhdr->num_sent) + 1, &pqhdr->num_sent);
-	return 1;
-}
-EXPORT_SYMBOL_GPL(spar_signal_insert);
-
-/*
- * Routine Description:
- * Removes one signal from Channel pChannel's nth Queue at the
- * time of the call and copies it into the memory pointed to by
- * pSignal.
- *
- * Parameters:
- * pChannel: (IN) points to the IO Channel
- * Queue: (IN) nth Queue of the IO Channel
- * pSignal: (IN) pointer to where the signals are to be copied
- *
- * Assumptions:
- * - pChannel and Queue are valid.
- * - pSignal points to a memory area large enough to hold queue's SignalSize
- *
- * Return value:
- * 1 if the removal succeeds, 0 if the queue was empty.
- */
-unsigned char
-spar_signal_remove(struct channel_header __iomem *ch, u32 queue, void *sig)
-{
-	void __iomem *psource;
-	unsigned int head, tail;
-	struct signal_queue_header __iomem *pqhdr =
-	    (struct signal_queue_header __iomem *)((char __iomem *)ch +
-				    readq(&ch->ch_space_offset)) + queue;
-
-	/* capture current head and tail */
-	head = readl(&pqhdr->head);
-	tail = readl(&pqhdr->tail);
-
-	/* queue is empty if the head index equals the tail index */
-	if (head == tail) {
-		writeq(readq(&pqhdr->num_empty) + 1, &pqhdr->num_empty);
-		return 0;
-	}
-
-	/* advance past the 'empty' front slot */
-	tail = (tail + 1) % readl(&pqhdr->max_slots);
-
-	/* copy signal from tail location to the area pointed to by pSignal */
-	psource = (char __iomem *)pqhdr + readq(&pqhdr->sig_base_offset) +
-		(tail * readl(&pqhdr->signal_size));
-	memcpy_fromio(sig, psource, readl(&pqhdr->signal_size));
-
-	mb(); /* channel synch */
-	writel(tail, &pqhdr->tail);
-
-	writeq(readq(&pqhdr->num_received) + 1,
-	       &pqhdr->num_received);
-	return 1;
-}
-EXPORT_SYMBOL_GPL(spar_signal_remove);
-
-/*
- * Routine Description:
- * Removes all signals present in Channel pChannel's nth Queue at the
- * time of the call and copies them into the memory pointed to by
- * pSignal.  Returns the # of signals copied as the value of the routine.
- *
- * Parameters:
- * pChannel: (IN) points to the IO Channel
- * Queue: (IN) nth Queue of the IO Channel
- * pSignal: (IN) pointer to where the signals are to be copied
- *
- * Assumptions:
- * - pChannel and Queue are valid.
- * - pSignal points to a memory area large enough to hold Queue's MaxSignals
- * # of signals, each of which is Queue's SignalSize.
- *
- * Return value:
- * # of signals copied.
- */
-unsigned int spar_signal_remove_all(struct channel_header *ch, u32 queue,
-				    void *sig)
-{
-	void *psource;
-	unsigned int head, tail, count = 0;
-	struct signal_queue_header *pqhdr =
-	    (struct signal_queue_header *)((char *)ch +
-				    ch->ch_space_offset) + queue;
-
-	/* capture current head and tail */
-	head = pqhdr->head;
-	tail = pqhdr->tail;
-
-	/* queue is empty if the head index equals the tail index */
-	if (head == tail)
-		return 0;
-
-	while (head != tail) {
-		/* advance past the 'empty' front slot */
-		tail = (tail + 1) % pqhdr->max_slots;
-
-		/* copy signal from tail location to the area pointed
-		 * to by pSignal
-		 */
-		psource =
-		    (char *)pqhdr + pqhdr->sig_base_offset +
-		    (tail * pqhdr->signal_size);
-		memcpy((char *)sig + (pqhdr->signal_size * count),
-		       psource, pqhdr->signal_size);
-
-		mb(); /* channel synch */
-		pqhdr->tail = tail;
-
-		count++;
-		pqhdr->num_received++;
-	}
-
-	return count;
-}
-
-/*
- * Routine Description:
- * Determine whether a signal queue is empty.
- *
- * Parameters:
- * pChannel: (IN) points to the IO Channel
- * Queue: (IN) nth Queue of the IO Channel
- *
- * Return value:
- * 1 if the signal queue is empty, 0 otherwise.
- */
-unsigned char spar_signalqueue_empty(struct channel_header __iomem *ch,
-				     u32 queue)
-{
-	struct signal_queue_header __iomem *pqhdr =
-	    (struct signal_queue_header __iomem *)((char __iomem *)ch +
-				    readq(&ch->ch_space_offset)) + queue;
-	return readl(&pqhdr->head) == readl(&pqhdr->tail);
-}
-EXPORT_SYMBOL_GPL(spar_signalqueue_empty);
-
-unsigned long long
-uisqueue_interlocked_or(unsigned long long __iomem *tgt,
-			unsigned long long set)
-{
-	unsigned long long i;
-	unsigned long long j;
-
-	j = readq(tgt);
-	do {
-		i = j;
-		j = cmpxchg((__force unsigned long long *)tgt, i, i | set);
-
-	} while (i != j);
-
-	return j;
-}
-EXPORT_SYMBOL_GPL(uisqueue_interlocked_or);
-
-unsigned long long
-uisqueue_interlocked_and(unsigned long long __iomem *tgt,
-			 unsigned long long set)
-{
-	unsigned long long i;
-	unsigned long long j;
-
-	j = readq(tgt);
-	do {
-		i = j;
-		j = cmpxchg((__force unsigned long long *)tgt, i, i & set);
-
-	} while (i != j);
-
-	return j;
-}
-EXPORT_SYMBOL_GPL(uisqueue_interlocked_and);
-
-static u8
-do_locked_client_insert(struct uisqueue_info *queueinfo,
-			unsigned int whichqueue,
-			void *signal,
-			spinlock_t *lock,
-			u8 *channel_id)
-{
-	unsigned long flags;
-	u8 rc = 0;
-
-	spin_lock_irqsave(lock, flags);
-	if (!spar_channel_client_acquire_os(queueinfo->chan, channel_id))
-		goto unlock;
-	if (spar_signal_insert(queueinfo->chan, whichqueue, signal)) {
-		queueinfo->packets_sent++;
-		rc = 1;
-	}
-	spar_channel_client_release_os(queueinfo->chan, channel_id);
-unlock:
-	spin_unlock_irqrestore((spinlock_t *)lock, flags);
-	return rc;
-}
-
-int
-uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo,
-				     struct uiscmdrsp *cmdrsp,
-				     unsigned int whichqueue,
-				     void *insertlock,
-				     unsigned char issue_irq_if_empty,
-				     u64 irq_handle,
-				     char oktowait, u8 *channel_id)
-{
-	while (!do_locked_client_insert(queueinfo, whichqueue, cmdrsp,
-					(spinlock_t *)insertlock,
-					channel_id)) {
-		if (oktowait != OK_TO_WAIT)
-			return 0;	/* failed to queue */
-
-		/* try again */
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule_timeout(msecs_to_jiffies(10));
-	}
-	return 1;
-}
-EXPORT_SYMBOL_GPL(uisqueue_put_cmdrsp_with_lock_client);
-
-/* uisqueue_get_cmdrsp gets the cmdrsp entry at the head of the queue
- * returns NULL if queue is empty */
-int
-uisqueue_get_cmdrsp(struct uisqueue_info *queueinfo,
-		    void *cmdrsp, unsigned int whichqueue)
-{
-	if (!spar_signal_remove(queueinfo->chan, whichqueue, cmdrsp))
-		return 0;
-
-	queueinfo->packets_received++;
-
-	return 1;		/* Success */
-}
-EXPORT_SYMBOL_GPL(uisqueue_get_cmdrsp);
diff --git a/drivers/staging/unisys/uislib/uisthread.c b/drivers/staging/unisys/uislib/uisthread.c
deleted file mode 100644
index d3c973b..0000000
--- a/drivers/staging/unisys/uislib/uisthread.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* uisthread.c
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-/* @ALL_INSPECTED */
-#include <asm/processor.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/kthread.h>
-#include "uisutils.h"
-#include "uisthread.h"
-
-/* this is shorter than using __FILE__ (full path name) in
- * debug/info/error messages
- */
-#define CURRENT_FILE_PC UISLIB_PC_uisthread_c
-#define __MYFILE__ "uisthread.c"
-
-/*****************************************************/
-/* Exported functions                                */
-/*****************************************************/
-
-/* returns 0 for failure, 1 for success */
-int
-uisthread_start(struct uisthread_info *thrinfo,
-		int (*threadfn)(void *), void *thrcontext, char *name)
-{
-	/* used to stop the thread */
-	init_completion(&thrinfo->has_stopped);
-	thrinfo->task = kthread_run(threadfn, thrcontext, name);
-	if (IS_ERR(thrinfo->task)) {
-		thrinfo->id = 0;
-		return 0;	/* failure */
-	}
-	thrinfo->id = thrinfo->task->pid;
-	return 1;
-}
-EXPORT_SYMBOL_GPL(uisthread_start);
-
-void
-uisthread_stop(struct uisthread_info *thrinfo)
-{
-	int stopped = 0;
-
-	if (thrinfo->id == 0)
-		return;		/* thread not running */
-
-	kthread_stop(thrinfo->task);
-	/* give up if the thread has NOT died in 1 minute */
-	if (wait_for_completion_timeout(&thrinfo->has_stopped, 60 * HZ))
-		stopped = 1;
-
-	if (stopped)
-		thrinfo->id = 0;
-}
-EXPORT_SYMBOL_GPL(uisthread_stop);
diff --git a/drivers/staging/unisys/uislib/uisutils.c b/drivers/staging/unisys/uislib/uisutils.c
deleted file mode 100644
index 26ab765..0000000
--- a/drivers/staging/unisys/uislib/uisutils.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* uisutils.c
- *
- * Copyright (C) 2010 - 2013 UNISYS CORPORATION
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- */
-
-#include <linux/string.h>
-#include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/uuid.h>
-#include <linux/spinlock.h>
-#include <linux/list.h>
-#include "uisutils.h"
-#include "version.h"
-#include "vbushelper.h"
-#include <linux/skbuff.h>
-#ifdef CONFIG_HIGHMEM
-#include <linux/highmem.h>
-#endif
-
-/* this is shorter than using __FILE__ (full path name) in
- * debug/info/error messages
- */
-#define CURRENT_FILE_PC UISLIB_PC_uisutils_c
-#define __MYFILE__ "uisutils.c"
-
-/* exports */
-atomic_t uisutils_registered_services = ATOMIC_INIT(0);
-					/* num registrations via
-					 * uisctrl_register_req_handler() or
-					 * uisctrl_register_req_handler_ex() */
-
-/*****************************************************/
-/* Utility functions                                 */
-/*****************************************************/
-
-int
-uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining,
-			 char *format, ...)
-{
-	va_list args;
-	int len;
-
-	va_start(args, format);
-	len = vsnprintf(*buffer, *buffer_remaining, format, args);
-	va_end(args);
-	if (len >= *buffer_remaining) {
-		*buffer += *buffer_remaining;
-		*total += *buffer_remaining;
-		*buffer_remaining = 0;
-		return -1;
-	}
-	*buffer_remaining -= len;
-	*buffer += len;
-	*total += len;
-	return len;
-}
-EXPORT_SYMBOL_GPL(uisutil_add_proc_line_ex);
-
-int
-uisctrl_register_req_handler(int type, void *fptr,
-			     struct ultra_vbus_deviceinfo *chipset_driver_info)
-{
-	switch (type) {
-	case 2:
-		if (fptr) {
-			if (!virt_control_chan_func)
-				atomic_inc(&uisutils_registered_services);
-			virt_control_chan_func = fptr;
-		} else {
-			if (virt_control_chan_func)
-				atomic_dec(&uisutils_registered_services);
-			virt_control_chan_func = NULL;
-		}
-		break;
-
-	default:
-		return 0;
-	}
-	if (chipset_driver_info)
-		bus_device_info_init(chipset_driver_info, "chipset", "uislib",
-				     VERSION, NULL);
-
-	return 1;
-}
-EXPORT_SYMBOL_GPL(uisctrl_register_req_handler);
-
-/*
- * unsigned int uisutil_copy_fragsinfo_from_skb(unsigned char *calling_ctx,
- *					     void *skb_in,
- *					     unsigned int firstfraglen,
- *					     unsigned int frags_max,
- *					     struct phys_info frags[])
- *
- *	calling_ctx - input -   a string that is displayed to show
- *				who called * this func
- *	void *skb_in -  skb whose frag info we're copying type is hidden so we
- *			don't need to include skbbuff in uisutils.h which is
- *			included in non-networking code.
- *	unsigned int firstfraglen - input - length of first fragment in skb
- *	unsigned int frags_max - input - max len of frags array
- *	struct phys_info frags[] - output - frags array filled in on output
- *					    return value indicates number of
- *					    entries filled in frags
- */
-
-static LIST_HEAD(req_handler_info_list); /* list of struct req_handler_info */
-static DEFINE_SPINLOCK(req_handler_info_list_lock);
-
-struct req_handler_info *
-req_handler_find(uuid_le switch_uuid)
-{
-	struct list_head *lelt, *tmp;
-	struct req_handler_info *entry = NULL;
-
-	spin_lock(&req_handler_info_list_lock);
-	list_for_each_safe(lelt, tmp, &req_handler_info_list) {
-		entry = list_entry(lelt, struct req_handler_info, list_link);
-		if (uuid_le_cmp(entry->switch_uuid, switch_uuid) == 0) {
-			spin_unlock(&req_handler_info_list_lock);
-			return entry;
-		}
-	}
-	spin_unlock(&req_handler_info_list_lock);
-	return NULL;
-}
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-14  1:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-14  1:16 [PATCH 0/3] staging: unisys: remove virtpci, virthba, and uislib Benjamin Romer
2015-04-14  1:16 ` [PATCH 1/3] staging: unisys: remove virthba driver for rewrite Benjamin Romer
2015-04-14  1:16 ` [PATCH 2/3] staging: unisys: remove virtpci driver from staging tree Benjamin Romer
2015-04-14  1:16 ` [PATCH 3/3] staging: unisys: remove uislib module " Benjamin Romer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.