summaryrefslogtreecommitdiff
path: root/drivers/staging/unisys/include
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/unisys/include')
-rw-r--r--drivers/staging/unisys/include/channel.h555
-rw-r--r--drivers/staging/unisys/include/channel_guid.h61
-rw-r--r--drivers/staging/unisys/include/diagchannel.h43
-rw-r--r--drivers/staging/unisys/include/guestlinuxdebug.h3
-rw-r--r--drivers/staging/unisys/include/iochannel.h644
-rw-r--r--drivers/staging/unisys/include/periodic_work.h10
-rw-r--r--drivers/staging/unisys/include/procobjecttree.h47
-rw-r--r--drivers/staging/unisys/include/sparstop.h30
-rw-r--r--drivers/staging/unisys/include/timskmod.h153
-rw-r--r--drivers/staging/unisys/include/uisqueue.h396
-rw-r--r--drivers/staging/unisys/include/uisthread.h42
-rw-r--r--drivers/staging/unisys/include/uisutils.h299
-rw-r--r--drivers/staging/unisys/include/vbushelper.h2
-rw-r--r--drivers/staging/unisys/include/version.h45
-rw-r--r--drivers/staging/unisys/include/visorbus.h222
15 files changed, 1577 insertions, 975 deletions
diff --git a/drivers/staging/unisys/include/channel.h b/drivers/staging/unisys/include/channel.h
new file mode 100644
index 000000000..da0b5387f
--- /dev/null
+++ b/drivers/staging/unisys/include/channel.h
@@ -0,0 +1,555 @@
+/* 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.
+ */
+
+#ifndef __CHANNEL_H__
+#define __CHANNEL_H__
+
+#include <linux/types.h>
+#include <linux/io.h>
+#include <linux/uuid.h>
+
+/*
+* Whenever this file is changed a corresponding change must be made in
+* the Console/ServicePart/visordiag_early/supervisor_channel.h file
+* which is needed for Linux kernel compiles. These two files must be
+* in sync.
+*/
+
+/* define the following to prevent include nesting in kernel header
+ * files of similar abbreviated content
+ */
+#define __SUPERVISOR_CHANNEL_H__
+
+#define SIGNATURE_16(A, B) ((A) | (B<<8))
+#define SIGNATURE_32(A, B, C, D) \
+ (SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
+#define SIGNATURE_64(A, B, C, D, E, F, G, H) \
+ (SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32))
+
+#ifndef lengthof
+#define lengthof(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
+#endif
+#ifndef COVERQ
+#define COVERQ(v, d) (((v)+(d)-1) / (d))
+#endif
+#ifndef COVER
+#define COVER(v, d) ((d)*COVERQ(v, d))
+#endif
+
+#define ULTRA_CHANNEL_PROTOCOL_SIGNATURE SIGNATURE_32('E', 'C', 'N', 'L')
+
+enum channel_serverstate {
+ CHANNELSRV_UNINITIALIZED = 0, /* channel is in an undefined state */
+ CHANNELSRV_READY = 1 /* channel has been initialized by server */
+};
+
+enum channel_clientstate {
+ CHANNELCLI_DETACHED = 0,
+ CHANNELCLI_DISABLED = 1, /* client can see channel but is NOT
+ * allowed to use it unless given TBD
+ * explicit request (should actually be
+ * < DETACHED) */
+ CHANNELCLI_ATTACHING = 2, /* legacy EFI client request
+ * for EFI server to attach */
+ CHANNELCLI_ATTACHED = 3, /* idle, but client may want
+ * to use channel any time */
+ CHANNELCLI_BUSY = 4, /* client either wants to use or is
+ * using channel */
+ CHANNELCLI_OWNED = 5 /* "no worries" state - client can
+ * access channel anytime */
+};
+
+static inline const u8 *
+ULTRA_CHANNELCLI_STRING(u32 v)
+{
+ switch (v) {
+ case CHANNELCLI_DETACHED:
+ return (const u8 *)("DETACHED");
+ case CHANNELCLI_DISABLED:
+ return (const u8 *)("DISABLED");
+ case CHANNELCLI_ATTACHING:
+ return (const u8 *)("ATTACHING");
+ case CHANNELCLI_ATTACHED:
+ return (const u8 *)("ATTACHED");
+ case CHANNELCLI_BUSY:
+ return (const u8 *)("BUSY");
+ case CHANNELCLI_OWNED:
+ return (const u8 *)("OWNED");
+ default:
+ break;
+ }
+ return (const u8 *)("?");
+}
+
+#define SPAR_CHANNEL_SERVER_READY(ch) \
+ (readl(&(ch)->srv_state) == CHANNELSRV_READY)
+
+#define ULTRA_VALID_CHANNELCLI_TRANSITION(o, n) \
+ (((((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_DISABLED)) || \
+ (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_DISABLED)) || \
+ (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_DISABLED)) || \
+ (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_DETACHED)) || \
+ (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_DETACHED)) || \
+ (((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_ATTACHING)) || \
+ (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_ATTACHED)) || \
+ (((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_ATTACHED)) || \
+ (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_ATTACHED)) || \
+ (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_BUSY)) || \
+ (((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_OWNED)) || \
+ (((o) == CHANNELCLI_DISABLED) && ((n) == CHANNELCLI_OWNED)) || \
+ (((o) == CHANNELCLI_ATTACHING) && ((n) == CHANNELCLI_OWNED)) || \
+ (((o) == CHANNELCLI_ATTACHED) && ((n) == CHANNELCLI_OWNED)) || \
+ (((o) == CHANNELCLI_BUSY) && ((n) == CHANNELCLI_OWNED)) || (0)) \
+ ? (1) : (0))
+
+/* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorBoot: */
+/* throttling invalid boot channel statetransition error due to client
+ * disabled */
+#define ULTRA_CLIERRORBOOT_THROTTLEMSG_DISABLED 0x01
+
+/* throttling invalid boot channel statetransition error due to client
+ * not attached */
+#define ULTRA_CLIERRORBOOT_THROTTLEMSG_NOTATTACHED 0x02
+
+/* throttling invalid boot channel statetransition error due to busy channel */
+#define ULTRA_CLIERRORBOOT_THROTTLEMSG_BUSY 0x04
+
+/* Values for ULTRA_CHANNEL_PROTOCOL.CliErrorOS: */
+/* throttling invalid guest OS channel statetransition error due to
+ * client disabled */
+#define ULTRA_CLIERROROS_THROTTLEMSG_DISABLED 0x01
+
+/* throttling invalid guest OS channel statetransition error due to
+ * client not attached */
+#define ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED 0x02
+
+/* throttling invalid guest OS channel statetransition error due to
+ * busy channel */
+#define ULTRA_CLIERROROS_THROTTLEMSG_BUSY 0x04
+
+/* Values for ULTRA_CHANNEL_PROTOCOL.Features: This define exists so
+* that windows guest can look at the FeatureFlags in the io channel,
+* and configure the windows driver to use interrupts or not based on
+* this setting. This flag is set in uislib after the
+* ULTRA_VHBA_init_channel is called. All feature bits for all
+* channels should be defined here. The io channel feature bits are
+* defined right here */
+#define ULTRA_IO_DRIVER_ENABLES_INTS (0x1ULL << 1)
+#define ULTRA_IO_CHANNEL_IS_POLLING (0x1ULL << 3)
+#define ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS (0x1ULL << 4)
+#define ULTRA_IO_DRIVER_DISABLES_INTS (0x1ULL << 5)
+#define ULTRA_IO_DRIVER_SUPPORTS_ENHANCED_RCVBUF_CHECKING (0x1ULL << 6)
+
+#pragma pack(push, 1) /* both GCC and VC now allow this pragma */
+/* Common Channel Header */
+struct channel_header {
+ u64 signature; /* Signature */
+ u32 legacy_state; /* DEPRECATED - being replaced by */
+ /* / SrvState, CliStateBoot, and CliStateOS below */
+ u32 header_size; /* sizeof(struct channel_header) */
+ u64 size; /* Total size of this channel in bytes */
+ u64 features; /* Flags to modify behavior */
+ uuid_le chtype; /* Channel type: data, bus, control, etc. */
+ u64 partition_handle; /* ID of guest partition */
+ u64 handle; /* Device number of this channel in client */
+ u64 ch_space_offset; /* Offset in bytes to channel specific area */
+ u32 version_id; /* struct channel_header Version ID */
+ u32 partition_index; /* Index of guest partition */
+ uuid_le zone_uuid; /* Guid of Channel's zone */
+ u32 cli_str_offset; /* offset from channel header to
+ * nul-terminated ClientString (0 if
+ * ClientString not present) */
+ u32 cli_state_boot; /* CHANNEL_CLIENTSTATE of pre-boot
+ * EFI client of this channel */
+ u32 cmd_state_cli; /* CHANNEL_COMMANDSTATE (overloaded in
+ * Windows drivers, see ServerStateUp,
+ * ServerStateDown, etc) */
+ u32 cli_state_os; /* CHANNEL_CLIENTSTATE of Guest OS
+ * client of this channel */
+ u32 ch_characteristic; /* CHANNEL_CHARACTERISTIC_<xxx> */
+ u32 cmd_state_srv; /* CHANNEL_COMMANDSTATE (overloaded in
+ * Windows drivers, see ServerStateUp,
+ * ServerStateDown, etc) */
+ u32 srv_state; /* CHANNEL_SERVERSTATE */
+ u8 cli_error_boot; /* bits to indicate err states for
+ * boot clients, so err messages can
+ * be throttled */
+ u8 cli_error_os; /* bits to indicate err states for OS
+ * clients, so err messages can be
+ * throttled */
+ u8 filler[1]; /* Pad out to 128 byte cacheline */
+ /* Please add all new single-byte values below here */
+ u8 recover_channel;
+};
+
+#define ULTRA_CHANNEL_ENABLE_INTS (0x1ULL << 0)
+
+/* Subheader for the Signal Type variation of the Common Channel */
+struct signal_queue_header {
+ /* 1st cache line */
+ u32 version; /* SIGNAL_QUEUE_HEADER Version ID */
+ u32 chtype; /* Queue type: storage, network */
+ u64 size; /* Total size of this queue in bytes */
+ u64 sig_base_offset; /* Offset to signal queue area */
+ u64 features; /* Flags to modify behavior */
+ u64 num_sent; /* Total # of signals placed in this queue */
+ u64 num_overflows; /* Total # of inserts failed due to
+ * full queue */
+ u32 signal_size; /* Total size of a signal for this queue */
+ u32 max_slots; /* Max # of slots in queue, 1 slot is
+ * always empty */
+ u32 max_signals; /* Max # of signals in queue
+ * (MaxSignalSlots-1) */
+ u32 head; /* Queue head signal # */
+ /* 2nd cache line */
+ u64 num_received; /* Total # of signals removed from this queue */
+ u32 tail; /* Queue tail signal # (on separate
+ * cache line) */
+ u32 reserved1; /* Reserved field */
+ u64 reserved2; /* Reserved field */
+ u64 client_queue;
+ u64 num_irq_received; /* Total # of Interrupts received. This
+ * is incremented by the ISR in the
+ * guest windows driver */
+ u64 num_empty; /* Number of times that visor_signal_remove
+ * is called and returned Empty
+ * Status. */
+ u32 errorflags; /* Error bits set during SignalReinit
+ * to denote trouble with client's
+ * fields */
+ u8 filler[12]; /* Pad out to 64 byte cacheline */
+};
+
+#pragma pack(pop)
+
+#define spar_signal_init(chan, QHDRFLD, QDATAFLD, QDATATYPE, ver, typ) \
+ do { \
+ memset(&chan->QHDRFLD, 0, sizeof(chan->QHDRFLD)); \
+ chan->QHDRFLD.version = ver; \
+ chan->QHDRFLD.chtype = typ; \
+ chan->QHDRFLD.size = sizeof(chan->QDATAFLD); \
+ chan->QHDRFLD.signal_size = sizeof(QDATATYPE); \
+ chan->QHDRFLD.sig_base_offset = (u64)(chan->QDATAFLD)- \
+ (u64)(&chan->QHDRFLD); \
+ chan->QHDRFLD.max_slots = \
+ sizeof(chan->QDATAFLD)/sizeof(QDATATYPE); \
+ chan->QHDRFLD.max_signals = chan->QHDRFLD.max_slots-1; \
+ } while (0)
+
+/* Generic function useful for validating any type of channel when it is
+ * received by the client that will be accessing the channel.
+ * Note that <logCtx> is only needed for callers in the EFI environment, and
+ * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
+ */
+static inline int
+spar_check_channel_client(void __iomem *ch,
+ uuid_le expected_uuid,
+ char *chname,
+ u64 expected_min_bytes,
+ u32 expected_version,
+ u64 expected_signature)
+{
+ if (uuid_le_cmp(expected_uuid, NULL_UUID_LE) != 0) {
+ uuid_le guid;
+
+ memcpy_fromio(&guid,
+ &((struct channel_header __iomem *)(ch))->chtype,
+ sizeof(guid));
+ /* caller wants us to verify type GUID */
+ if (uuid_le_cmp(guid, expected_uuid) != 0) {
+ pr_err("Channel mismatch on channel=%s(%pUL) field=type expected=%pUL actual=%pUL\n",
+ chname, &expected_uuid,
+ &expected_uuid, &guid);
+ return 0;
+ }
+ }
+ if (expected_min_bytes > 0) { /* caller wants us to verify
+ * channel size */
+ unsigned long long bytes =
+ readq(&((struct channel_header __iomem *)
+ (ch))->size);
+ if (bytes < expected_min_bytes) {
+ pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8Lx actual=0x%-8.8Lx\n",
+ chname, &expected_uuid,
+ (unsigned long long)expected_min_bytes, bytes);
+ return 0;
+ }
+ }
+ if (expected_version > 0) { /* caller wants us to verify
+ * channel version */
+ unsigned long ver = readl(&((struct channel_header __iomem *)
+ (ch))->version_id);
+ if (ver != expected_version) {
+ pr_err("Channel mismatch on channel=%s(%pUL) field=version expected=0x%-8.8lx actual=0x%-8.8lx\n",
+ chname, &expected_uuid,
+ (unsigned long)expected_version, ver);
+ return 0;
+ }
+ }
+ if (expected_signature > 0) { /* caller wants us to verify
+ * channel signature */
+ unsigned long long sig =
+ readq(&((struct channel_header __iomem *)
+ (ch))->signature);
+ if (sig != expected_signature) {
+ pr_err("Channel mismatch on channel=%s(%pUL) field=signature expected=0x%-8.8llx actual=0x%-8.8llx\n",
+ chname, &expected_uuid,
+ expected_signature, sig);
+ return 0;
+ }
+ }
+ return 1;
+}
+
+/* Generic function useful for validating any type of channel when it is about
+ * to be initialized by the server of the channel.
+ * Note that <logCtx> is only needed for callers in the EFI environment, and
+ * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
+ */
+static inline int spar_check_channel_server(uuid_le typeuuid, char *name,
+ u64 expected_min_bytes,
+ u64 actual_bytes)
+{
+ if (expected_min_bytes > 0) /* caller wants us to verify
+ * channel size */
+ if (actual_bytes < expected_min_bytes) {
+ pr_err("Channel mismatch on channel=%s(%pUL) field=size expected=0x%-8.8llx actual=0x%-8.8llx\n",
+ name, &typeuuid, expected_min_bytes,
+ actual_bytes);
+ return 0;
+ }
+ return 1;
+}
+
+/* Given a file pathname <s> (with '/' or '\' separating directory nodes),
+ * returns a pointer to the beginning of a node within that pathname such
+ * that the number of nodes from that pointer to the end of the string is
+ * NOT more than <n>. Note that if the pathname has less than <n> nodes
+ * in it, the return pointer will be to the beginning of the string.
+ */
+static inline u8 *
+pathname_last_n_nodes(u8 *s, unsigned int n)
+{
+ u8 *p = s;
+ unsigned int node_count = 0;
+
+ while (*p != '\0') {
+ if ((*p == '/') || (*p == '\\'))
+ node_count++;
+ p++;
+ }
+ if (node_count <= n)
+ return s;
+ while (n > 0) {
+ p--;
+ if (p == s)
+ break; /* should never happen, unless someone
+ * is changing the string while we are
+ * looking at it!! */
+ if ((*p == '/') || (*p == '\\'))
+ n--;
+ }
+ return p + 1;
+}
+
+static inline int
+spar_channel_client_acquire_os(void __iomem *ch, u8 *id)
+{
+ struct channel_header __iomem *hdr = ch;
+
+ if (readl(&hdr->cli_state_os) == CHANNELCLI_DISABLED) {
+ if ((readb(&hdr->cli_error_os)
+ & ULTRA_CLIERROROS_THROTTLEMSG_DISABLED) == 0) {
+ /* we are NOT throttling this message */
+ writeb(readb(&hdr->cli_error_os) |
+ ULTRA_CLIERROROS_THROTTLEMSG_DISABLED,
+ &hdr->cli_error_os);
+ /* throttle until acquire successful */
+
+ pr_info("%s Channel StateTransition INVALID! - acquire failed because OS client DISABLED\n",
+ id);
+ }
+ return 0;
+ }
+ if ((readl(&hdr->cli_state_os) != CHANNELCLI_OWNED) &&
+ (readl(&hdr->cli_state_boot) == CHANNELCLI_DISABLED)) {
+ /* Our competitor is DISABLED, so we can transition to OWNED */
+ pr_info("%s Channel StateTransition (%s) %s(%d)-->%s(%d)\n",
+ id, "cli_state_os",
+ ULTRA_CHANNELCLI_STRING(readl(&hdr->cli_state_os)),
+ readl(&hdr->cli_state_os),
+ ULTRA_CHANNELCLI_STRING(CHANNELCLI_OWNED),
+ CHANNELCLI_OWNED);
+ writel(CHANNELCLI_OWNED, &hdr->cli_state_os);
+ mb(); /* required for channel synch */
+ }
+ if (readl(&hdr->cli_state_os) == CHANNELCLI_OWNED) {
+ if (readb(&hdr->cli_error_os) != 0) {
+ /* we are in an error msg throttling state;
+ * come out of it */
+ pr_info("%s Channel OS client acquire now successful\n",
+ id);
+ writeb(0, &hdr->cli_error_os);
+ }
+ return 1;
+ }
+
+ /* We have to do it the "hard way". We transition to BUSY,
+ * and can use the channel iff our competitor has not also
+ * transitioned to BUSY. */
+ if (readl(&hdr->cli_state_os) != CHANNELCLI_ATTACHED) {
+ if ((readb(&hdr->cli_error_os)
+ & ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) == 0) {
+ /* we are NOT throttling this message */
+ writeb(readb(&hdr->cli_error_os) |
+ ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED,
+ &hdr->cli_error_os);
+ /* throttle until acquire successful */
+ pr_info("%s Channel StateTransition INVALID! - acquire failed because OS client NOT ATTACHED (state=%s(%d))\n",
+ id, ULTRA_CHANNELCLI_STRING(
+ readl(&hdr->cli_state_os)),
+ readl(&hdr->cli_state_os));
+ }
+ return 0;
+ }
+ writel(CHANNELCLI_BUSY, &hdr->cli_state_os);
+ mb(); /* required for channel synch */
+ if (readl(&hdr->cli_state_boot) == CHANNELCLI_BUSY) {
+ if ((readb(&hdr->cli_error_os)
+ & ULTRA_CLIERROROS_THROTTLEMSG_BUSY) == 0) {
+ /* we are NOT throttling this message */
+ writeb(readb(&hdr->cli_error_os) |
+ ULTRA_CLIERROROS_THROTTLEMSG_BUSY,
+ &hdr->cli_error_os);
+ /* throttle until acquire successful */
+ pr_info("%s Channel StateTransition failed - host OS acquire failed because boot BUSY\n",
+ id);
+ }
+ /* reset busy */
+ writel(CHANNELCLI_ATTACHED, &hdr->cli_state_os);
+ mb(); /* required for channel synch */
+ return 0;
+ }
+ if (readb(&hdr->cli_error_os) != 0) {
+ /* we are in an error msg throttling state; come out of it */
+ pr_info("%s Channel OS client acquire now successful\n", id);
+ writeb(0, &hdr->cli_error_os);
+ }
+ return 1;
+}
+
+static inline void
+spar_channel_client_release_os(void __iomem *ch, u8 *id)
+{
+ struct channel_header __iomem *hdr = ch;
+
+ if (readb(&hdr->cli_error_os) != 0) {
+ /* we are in an error msg throttling state; come out of it */
+ pr_info("%s Channel OS client error state cleared\n", id);
+ writeb(0, &hdr->cli_error_os);
+ }
+ if (readl(&hdr->cli_state_os) == CHANNELCLI_OWNED)
+ return;
+ if (readl(&hdr->cli_state_os) != CHANNELCLI_BUSY) {
+ pr_info("%s Channel StateTransition INVALID! - release failed because OS client NOT BUSY (state=%s(%d))\n",
+ id, ULTRA_CHANNELCLI_STRING(
+ readl(&hdr->cli_state_os)),
+ readl(&hdr->cli_state_os));
+ /* return; */
+ }
+ writel(CHANNELCLI_ATTACHED, &hdr->cli_state_os); /* release busy */
+}
+
+/*
+* 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);
+
+/*
+* 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);
+
+/*
+* 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);
+
+/*
+* 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);
+
+#endif
diff --git a/drivers/staging/unisys/include/channel_guid.h b/drivers/staging/unisys/include/channel_guid.h
new file mode 100644
index 000000000..706363fc3
--- /dev/null
+++ b/drivers/staging/unisys/include/channel_guid.h
@@ -0,0 +1,61 @@
+/* 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.
+ */
+
+/*
+ * CHANNEL Guids
+ */
+
+/* Used in IOChannel
+ * {414815ed-c58c-11da-95a9-00e08161165f}
+ */
+#define SPAR_VHBA_CHANNEL_PROTOCOL_UUID \
+ UUID_LE(0x414815ed, 0xc58c, 0x11da, \
+ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
+static const uuid_le spar_vhba_channel_protocol_uuid =
+ SPAR_VHBA_CHANNEL_PROTOCOL_UUID;
+
+/* Used in IOChannel
+ * {8cd5994d-c58e-11da-95a9-00e08161165f}
+ */
+#define SPAR_VNIC_CHANNEL_PROTOCOL_UUID \
+ UUID_LE(0x8cd5994d, 0xc58e, 0x11da, \
+ 0x95, 0xa9, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f)
+static const uuid_le spar_vnic_channel_protocol_uuid =
+ SPAR_VNIC_CHANNEL_PROTOCOL_UUID;
+
+/* Used in IOChannel
+ * {72120008-4AAB-11DC-8530-444553544200}
+ */
+#define SPAR_SIOVM_UUID \
+ UUID_LE(0x72120008, 0x4AAB, 0x11DC, \
+ 0x85, 0x30, 0x44, 0x45, 0x53, 0x54, 0x42, 0x00)
+static const uuid_le spar_siovm_uuid = SPAR_SIOVM_UUID;
+
+/* Used in visornoop/visornoop_main.c
+ * {5b52c5ac-e5f5-4d42-8dff-429eaecd221f}
+ */
+#define SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID \
+ UUID_LE(0x5b52c5ac, 0xe5f5, 0x4d42, \
+ 0x8d, 0xff, 0x42, 0x9e, 0xae, 0xcd, 0x22, 0x1f)
+
+static const uuid_le spar_controldirector_channel_protocol_uuid =
+ SPAR_CONTROLDIRECTOR_CHANNEL_PROTOCOL_UUID;
+
+/* Used in visorchipset/visorchipset_main.c
+ * {B4E79625-AEDE-4EAA-9E11-D3EDDCD4504C}
+ */
+#define SPAR_DIAG_POOL_CHANNEL_PROTOCOL_UUID \
+ UUID_LE(0xb4e79625, 0xaede, 0x4eaa, \
+ 0x9e, 0x11, 0xd3, 0xed, 0xdc, 0xd4, 0x50, 0x4c)
diff --git a/drivers/staging/unisys/include/diagchannel.h b/drivers/staging/unisys/include/diagchannel.h
new file mode 100644
index 000000000..d2d35685d
--- /dev/null
+++ b/drivers/staging/unisys/include/diagchannel.h
@@ -0,0 +1,43 @@
+/* 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.
+ */
+
+#ifndef _DIAG_CHANNEL_H_
+#define _DIAG_CHANNEL_H_
+
+#define MAX_MODULE_NAME_SIZE 128 /* Maximum length of module name... */
+#define MAX_ADDITIONAL_INFO_SIZE 256 /* Maximum length of any additional
+ * info accompanying event...
+ */
+
+/* Levels of severity for diagnostic events, in order from lowest severity to
+ * highest (i.e. fatal errors are the most severe, and should always be logged,
+ * but info events rarely need to be logged except during debugging). The
+ * values DIAG_SEVERITY_ENUM_BEGIN and DIAG_SEVERITY_ENUM_END are not valid
+ * severity values. They exist merely to dilineate the list, so that future
+ * additions won't require changes to the driver (i.e. when checking for
+ * out-of-range severities in SetSeverity). The values DIAG_SEVERITY_OVERRIDE
+ * and DIAG_SEVERITY_SHUTOFF are not valid severity values for logging events
+ * but they are valid for controlling the amount of event data. Changes made
+ * to the enum, need to be reflected in s-Par.
+ */
+enum diag_severity {
+ DIAG_SEVERITY_VERBOSE = 0,
+ DIAG_SEVERITY_INFO = 1,
+ DIAG_SEVERITY_WARNING = 2,
+ DIAG_SEVERITY_ERR = 3,
+ DIAG_SEVERITY_PRINT = 4,
+};
+
+#endif
diff --git a/drivers/staging/unisys/include/guestlinuxdebug.h b/drivers/staging/unisys/include/guestlinuxdebug.h
index 957a627d0..82ee56539 100644
--- a/drivers/staging/unisys/include/guestlinuxdebug.h
+++ b/drivers/staging/unisys/include/guestlinuxdebug.h
@@ -22,7 +22,6 @@
* ISSUE_IO_VMCALL_POSTCODE_SEVERITY */
/******* INFO ON ISSUE_POSTCODE_LINUX() BELOW *******/
-#include "vmcallinterface.h"
enum driver_pc { /* POSTCODE driver identifier tuples */
/* visorchipset driver files */
VISOR_CHIPSET_PC = 0xA0,
@@ -135,7 +134,7 @@ enum event_pc { /* POSTCODE event identifier tuples */
#define POSTCODE_SEVERITY_ERR DIAG_SEVERITY_ERR
#define POSTCODE_SEVERITY_WARNING DIAG_SEVERITY_WARNING
#define POSTCODE_SEVERITY_INFO DIAG_SEVERITY_PRINT /* TODO-> Info currently
- * doesnt show, so we
+ * doesn't show, so we
* set info=warning */
/* example call of POSTCODE_LINUX_2(VISOR_CHIPSET_PC, POSTCODE_SEVERITY_ERR);
* Please also note that the resulting postcode is in hex, so if you are
diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h
new file mode 100644
index 000000000..a55981234
--- /dev/null
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -0,0 +1,644 @@
+/* Copyright (C) 2010 - 2013 UNISYS CORPORATION */
+/* All rights reserved. */
+#ifndef __IOCHANNEL_H__
+#define __IOCHANNEL_H__
+
+/*
+ * Everything needed for IOPart-GuestPart communication is define in
+ * this file. Note: Everything is OS-independent because this file is
+ * used by Windows, Linux and possible EFI drivers. */
+
+/*
+ * Communication flow between the IOPart and GuestPart uses the channel headers
+ * channel state. The following states are currently being used:
+ * UNINIT(All Zeroes), CHANNEL_ATTACHING, CHANNEL_ATTACHED, CHANNEL_OPENED
+ *
+ * additional states will be used later. No locking is needed to switch between
+ * states due to the following rules:
+ *
+ * 1. IOPart is only the only partition allowed to change from UNIT
+ * 2. IOPart is only the only partition allowed to change from
+ * CHANNEL_ATTACHING
+ * 3. GuestPart is only the only partition allowed to change from
+ * CHANNEL_ATTACHED
+ *
+ * The state changes are the following: IOPart sees the channel is in UNINIT,
+ * UNINIT -> CHANNEL_ATTACHING (performed only by IOPart)
+ * CHANNEL_ATTACHING -> CHANNEL_ATTACHED (performed only by IOPart)
+ * CHANNEL_ATTACHED -> CHANNEL_OPENED (performed only by GuestPart)
+ */
+
+#include <linux/uuid.h>
+
+#include <linux/dma-direction.h>
+#include "channel.h"
+#include "channel_guid.h"
+
+#define ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
+#define ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE ULTRA_CHANNEL_PROTOCOL_SIGNATURE
+#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_SIGNATURE \
+ ULTRA_CHANNEL_PROTOCOL_SIGNATURE
+
+/* Must increment these whenever you insert or delete fields within this channel
+ * struct. Also increment whenever you change the meaning of fields within this
+ * channel struct so as to break pre-existing software. Note that you can
+ * usually add fields to the END of the channel struct withOUT needing to
+ * increment this.
+ */
+#define ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID 2
+#define ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID 2
+#define ULTRA_VSWITCH_CHANNEL_PROTOCOL_VERSIONID 1
+
+#define SPAR_VHBA_CHANNEL_OK_CLIENT(ch) \
+ (spar_check_channel_client(ch, spar_vhba_channel_protocol_uuid, \
+ "vhba", MIN_IO_CHANNEL_SIZE, \
+ ULTRA_VHBA_CHANNEL_PROTOCOL_VERSIONID, \
+ ULTRA_VHBA_CHANNEL_PROTOCOL_SIGNATURE))
+
+#define SPAR_VNIC_CHANNEL_OK_CLIENT(ch) \
+ (spar_check_channel_client(ch, spar_vnic_channel_protocol_uuid, \
+ "vnic", MIN_IO_CHANNEL_SIZE, \
+ ULTRA_VNIC_CHANNEL_PROTOCOL_VERSIONID, \
+ ULTRA_VNIC_CHANNEL_PROTOCOL_SIGNATURE))
+
+/*
+ * Everything necessary to handle SCSI & NIC traffic between Guest Partition and
+ * IO Partition is defined below.
+ */
+
+/*
+ * Defines and enums.
+ */
+
+#define MINNUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXNUM(a, b) (((a) > (b)) ? (a) : (b))
+
+/* these define the two queues per data channel between iopart and
+ * ioguestparts
+ */
+#define IOCHAN_TO_IOPART 0 /* used by ioguestpart to 'insert' signals to
+ * iopart */
+
+#define IOCHAN_FROM_IOPART 1 /* used by ioguestpart to 'remove' signals from
+ * iopart - same queue as previous queue */
+
+/* size of cdb - i.e., scsi cmnd */
+#define MAX_CMND_SIZE 16
+
+#define MAX_SENSE_SIZE 64
+
+#define MAX_PHYS_INFO 64
+
+/* various types of network packets that can be sent in cmdrsp */
+enum net_types {
+ NET_RCV_POST = 0, /* submit buffer to hold receiving
+ * incoming packet */
+ /* virtnic -> uisnic */
+ NET_RCV, /* incoming packet received */
+ /* uisnic -> virtpci */
+ NET_XMIT, /* for outgoing net packets */
+ /* virtnic -> uisnic */
+ NET_XMIT_DONE, /* outgoing packet xmitted */
+ /* uisnic -> virtpci */
+ NET_RCV_ENBDIS, /* enable/disable packet reception */
+ /* virtnic -> uisnic */
+ NET_RCV_ENBDIS_ACK, /* acknowledge enable/disable packet
+ * reception */
+ /* uisnic -> virtnic */
+ NET_RCV_PROMISC, /* enable/disable promiscuous mode */
+ /* virtnic -> uisnic */
+ NET_CONNECT_STATUS, /* indicate the loss or restoration of a network
+ * connection */
+ /* uisnic -> virtnic */
+ NET_MACADDR, /* indicates the client has requested to update
+ * its MAC addr */
+ NET_MACADDR_ACK, /* MAC address */
+
+};
+
+#define ETH_HEADER_SIZE 14 /* size of ethernet header */
+
+#define ETH_MIN_DATA_SIZE 46 /* minimum eth data size */
+#define ETH_MIN_PACKET_SIZE (ETH_HEADER_SIZE + ETH_MIN_DATA_SIZE)
+
+#define ETH_MAX_MTU 16384 /* maximum data size */
+
+#ifndef MAX_MACADDR_LEN
+#define MAX_MACADDR_LEN 6 /* number of bytes in MAC address */
+#endif /* MAX_MACADDR_LEN */
+
+/* various types of scsi task mgmt commands */
+enum task_mgmt_types {
+ TASK_MGMT_ABORT_TASK = 1,
+ TASK_MGMT_BUS_RESET,
+ TASK_MGMT_LUN_RESET,
+ TASK_MGMT_TARGET_RESET,
+};
+
+/* various types of vdisk mgmt commands */
+enum vdisk_mgmt_types {
+ VDISK_MGMT_ACQUIRE = 1,
+ VDISK_MGMT_RELEASE,
+};
+
+struct phys_info {
+ u64 pi_pfn;
+ u16 pi_off;
+ u16 pi_len;
+} __packed;
+
+struct guest_phys_info {
+ u64 address;
+ u64 length;
+} __packed;
+
+#define GPI_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof(struct guest_phys_info))
+
+struct uisscsi_dest {
+ u32 channel; /* channel == bus number */
+ u32 id; /* id == target number */
+ u32 lun; /* lun == logical unit number */
+} __packed;
+
+struct vhba_wwnn {
+ u32 wwnn1;
+ u32 wwnn2;
+} __packed;
+
+/* WARNING: Values stired in this structure must contain maximum counts (not
+ * maximum values). */
+struct vhba_config_max { /* 20 bytes */
+ u32 max_channel; /* maximum channel for devices attached to this
+ * bus */
+ u32 max_id; /* maximum SCSI ID for devices attached to this
+ * bus */
+ u32 max_lun; /* maximum SCSI LUN for devices attached to this
+ * bus */
+ u32 cmd_per_lun; /* maximum number of outstanding commands per
+ * lun that are allowed at one time */
+ u32 max_io_size; /* maximum io size for devices attached to this
+ * bus */
+ /* max io size is often determined by the resource of the hba. e.g */
+ /* max scatter gather list length * page size / sector size */
+} __packed;
+
+struct uiscmdrsp_scsi {
+ void *scsicmd; /* the handle to the cmd that was received -
+ * send it back as is in the rsp packet. */
+ u8 cmnd[MAX_CMND_SIZE]; /* the cdb for the command */
+ u32 bufflen; /* length of data to be transferred out or in */
+ u16 guest_phys_entries; /* Number of entries in scatter-gather (sg)
+ * list */
+ struct guest_phys_info gpi_list[MAX_PHYS_INFO]; /* physical address
+ * information for each
+ * fragment */
+ enum dma_data_direction data_dir; /* direction of the data, if any */
+ struct uisscsi_dest vdest; /* identifies the virtual hba, id,
+ * channel, lun to which cmd was sent */
+
+ /* the following fields are needed to queue the rsp back to cmd
+ * originator */
+ int linuxstat; /* the original Linux status - for use by linux
+ * vdisk code */
+ u8 scsistat; /* the scsi status */
+ u8 addlstat; /* non-scsi status - covers cases like timeout
+ * needed by windows guests */
+#define ADDL_SEL_TIMEOUT 4
+
+ /* the following fields are need to determine the result of command */
+ u8 sensebuf[MAX_SENSE_SIZE]; /* sense info in case cmd failed; */
+ /* it holds the sense_data struct; */
+ /* see that struct for details. */
+ void *vdisk; /* contains pointer to the vdisk so that we can clean up
+ * when the IO completes. */
+ int no_disk_result;
+ /* used to return no disk inquiry result
+ * when no_disk_result is set to 1,
+ * scsi.scsistat is SAM_STAT_GOOD
+ * scsi.addlstat is 0
+ * scsi.linuxstat is SAM_STAT_GOOD
+ * That is, there is NO error.
+ */
+} __packed;
+
+/* Defines to support sending correct inquiry result when no disk is
+ * configured.
+ */
+
+/* From SCSI SPC2 -
+ *
+ * If the target is not capable of supporting a device on this logical unit, the
+ * device server shall set this field to 7Fh (PERIPHERAL QUALIFIER set to 011b
+ * and PERIPHERAL DEVICE TYPE set to 1Fh).
+ *
+ *The device server is capable of supporting the specified peripheral device
+ *type on this logical unit. However, the physical device is not currently
+ *connected to this logical unit.
+ */
+
+#define DEV_NOT_CAPABLE 0x7f /* peripheral qualifier of 0x3 */
+ /* peripheral type of 0x1f */
+ /* specifies no device but target present */
+
+#define DEV_DISK_CAPABLE_NOT_PRESENT 0x20 /* peripheral qualifier of 0x1 */
+ /* peripheral type of 0 - disk */
+ /* specifies device capable, but not present */
+
+#define DEV_HISUPPORT 0x10 /* HiSup = 1; shows support for report luns */
+ /* must be returned for lun 0. */
+
+/* NOTE: Linux code assumes inquiry contains 36 bytes. Without checking length
+ * in buf[4] some linux code accesses bytes beyond 5 to retrieve vendor, product
+ * & revision. Yikes! So let us always send back 36 bytes, the minimum for
+ * inquiry result.
+ */
+#define NO_DISK_INQUIRY_RESULT_LEN 36
+
+#define MIN_INQUIRY_RESULT_LEN 5 /* we need at least 5 bytes minimum for inquiry
+ * result */
+
+/* SCSI device version for no disk inquiry result */
+#define SCSI_SPC2_VER 4 /* indicates SCSI SPC2 (SPC3 is 5) */
+
+/* Windows and Linux want different things for a non-existent lun. So, we'll let
+ * caller pass in the peripheral qualifier and type.
+ * NOTE:[4] SCSI returns (n-4); so we return length-1-4 or length-5. */
+
+#define SET_NO_DISK_INQUIRY_RESULT(buf, len, lun, lun0notpresent, notpresent) \
+ do { \
+ memset(buf, 0, \
+ MINNUM(len, \
+ (unsigned int)NO_DISK_INQUIRY_RESULT_LEN)); \
+ buf[2] = (u8)SCSI_SPC2_VER; \
+ if (lun == 0) { \
+ buf[0] = (u8)lun0notpresent; \
+ buf[3] = (u8)DEV_HISUPPORT; \
+ } else \
+ buf[0] = (u8)notpresent; \
+ buf[4] = (u8)( \
+ MINNUM(len, \
+ (unsigned int)NO_DISK_INQUIRY_RESULT_LEN) - 5);\
+ if (len >= NO_DISK_INQUIRY_RESULT_LEN) { \
+ buf[8] = 'D'; \
+ buf[9] = 'E'; \
+ buf[10] = 'L'; \
+ buf[11] = 'L'; \
+ buf[16] = 'P'; \
+ buf[17] = 'S'; \
+ buf[18] = 'E'; \
+ buf[19] = 'U'; \
+ buf[20] = 'D'; \
+ buf[21] = 'O'; \
+ buf[22] = ' '; \
+ buf[23] = 'D'; \
+ buf[24] = 'E'; \
+ buf[25] = 'V'; \
+ buf[26] = 'I'; \
+ buf[27] = 'C'; \
+ buf[28] = 'E'; \
+ buf[30] = ' '; \
+ buf[31] = '.'; \
+ } \
+ } while (0)
+
+/*
+ * Struct & Defines to support sense information.
+ */
+
+/* The following struct is returned in sensebuf field in uiscmdrsp_scsi. It is
+ * initialized in exactly the manner that is recommended in Windows (hence the
+ * odd values).
+ * When set, these fields will have the following values:
+ * ErrorCode = 0x70 indicates current error
+ * Valid = 1 indicates sense info is valid
+ * SenseKey contains sense key as defined by SCSI specs.
+ * AdditionalSenseCode contains sense key as defined by SCSI specs.
+ * AdditionalSenseCodeQualifier contains qualifier to sense code as defined by
+ * scsi docs.
+ * AdditionalSenseLength contains will be sizeof(sense_data)-8=10.
+ */
+struct sense_data {
+ u8 errorcode:7;
+ u8 valid:1;
+ u8 segment_number;
+ u8 sense_key:4;
+ u8 reserved:1;
+ u8 incorrect_length:1;
+ u8 end_of_media:1;
+ u8 file_mark:1;
+ u8 information[4];
+ u8 additional_sense_length;
+ u8 command_specific_information[4];
+ u8 additional_sense_code;
+ u8 additional_sense_code_qualifier;
+ u8 fru_code;
+ u8 sense_key_specific[3];
+} __packed;
+
+struct net_pkt_xmt {
+ int len; /* full length of data in the packet */
+ int num_frags; /* number of fragments in frags containing data */
+ struct phys_info frags[MAX_PHYS_INFO]; /* physical page information for
+ * each fragment */
+ char ethhdr[ETH_HEADER_SIZE]; /* the ethernet header */
+ struct {
+ /* these are needed for csum at uisnic end */
+ u8 valid; /* 1 = rest of this struct is valid - else
+ * ignore */
+ u8 hrawoffv; /* 1 = hwrafoff is valid */
+ u8 nhrawoffv; /* 1 = nhwrafoff is valid */
+ u16 protocol; /* specifies packet protocol */
+ u32 csum; /* value used to set skb->csum at IOPart */
+ u32 hrawoff; /* value used to set skb->h.raw at IOPart */
+ /* hrawoff points to the start of the TRANSPORT LAYER HEADER */
+ u32 nhrawoff; /* value used to set skb->nh.raw at IOPart */
+ /* nhrawoff points to the start of the NETWORK LAYER HEADER */
+ } lincsum;
+
+ /* **** NOTE ****
+ * The full packet is described in frags but the ethernet header is
+ * separately kept in ethhdr so that uisnic doesn't have "MAP" the
+ * guest memory to get to the header. uisnic needs ethhdr to
+ * determine how to route the packet.
+ */
+} __packed;
+
+struct net_pkt_xmtdone {
+ u32 xmt_done_result; /* result of NET_XMIT */
+} __packed;
+
+/* RCVPOST_BUF_SIZe must be at most page_size(4096) - cache_line_size (64) The
+ * reason is because dev_skb_alloc which is used to generate RCV_POST skbs in
+ * virtnic requires that there is "overhead" in the buffer, and pads 16 bytes. I
+ * prefer to use 1 full cache line size for "overhead" so that transfers are
+ * better. IOVM requires that a buffer be represented by 1 phys_info structure
+ * which can only cover page_size.
+ */
+#define RCVPOST_BUF_SIZE 4032
+#define MAX_NET_RCV_CHAIN \
+ ((ETH_MAX_MTU+ETH_HEADER_SIZE + RCVPOST_BUF_SIZE-1) / RCVPOST_BUF_SIZE)
+
+struct net_pkt_rcvpost {
+ /* rcv buf size must be large enough to include ethernet data len +
+ * ethernet header len - we are choosing 2K because it is guaranteed
+ * to be describable */
+ struct phys_info frag; /* physical page information for the
+ * single fragment 2K rcv buf */
+ u64 unique_num; /* This is used to make sure that
+ * receive posts are returned to */
+ /* the Adapter which we sent them originally. */
+} __packed;
+
+struct net_pkt_rcv {
+ /* the number of receive buffers that can be chained */
+ /* is based on max mtu and size of each rcv buf */
+ u32 rcv_done_len; /* length of received data */
+ u8 numrcvbufs; /* number of receive buffers that contain the */
+ /* incoming data; guest end MUST chain these together. */
+ void *rcvbuf[MAX_NET_RCV_CHAIN]; /* the list of receive buffers
+ * that must be chained; */
+ /* each entry is a receive buffer provided by NET_RCV_POST. */
+ /* NOTE: first rcvbuf in the chain will also be provided in net.buf. */
+ u64 unique_num;
+ u32 rcvs_dropped_delta;
+} __packed;
+
+struct net_pkt_enbdis {
+ void *context;
+ u16 enable; /* 1 = enable, 0 = disable */
+} __packed;
+
+struct net_pkt_macaddr {
+ void *context;
+ u8 macaddr[MAX_MACADDR_LEN]; /* 6 bytes */
+} __packed;
+
+/* cmd rsp packet used for VNIC network traffic */
+struct uiscmdrsp_net {
+ enum net_types type;
+ void *buf;
+ union {
+ struct net_pkt_xmt xmt; /* used for NET_XMIT */
+ struct net_pkt_xmtdone xmtdone; /* used for NET_XMIT_DONE */
+ struct net_pkt_rcvpost rcvpost; /* used for NET_RCV_POST */
+ struct net_pkt_rcv rcv; /* used for NET_RCV */
+ struct net_pkt_enbdis enbdis; /* used for NET_RCV_ENBDIS, */
+ /* NET_RCV_ENBDIS_ACK, */
+ /* NET_RCV_PROMSIC, */
+ /* and NET_CONNECT_STATUS */
+ struct net_pkt_macaddr macaddr;
+ };
+} __packed;
+
+struct uiscmdrsp_scsitaskmgmt {
+ enum task_mgmt_types tasktype;
+
+ /* the type of task */
+ struct uisscsi_dest vdest;
+
+ /* the vdisk for which this task mgmt is generated */
+ void *scsicmd;
+
+ /* This is some handle that the guest has saved off for its own use.
+ * Its value is preserved by iopart & returned as is in the task
+ * mgmt rsp.
+ */
+ void *notify;
+
+ /* For linux guests, this is a pointer to wait_queue_head that a
+ * thread is waiting on to see if the taskmgmt command has completed.
+ * For windows guests, this is a pointer to a location that a waiting
+ * thread is testing to see if the taskmgmt command has completed.
+ * When the rsp is received by guest, the thread receiving the
+ * response uses this to notify the thread waiting for taskmgmt
+ * command completion. Its value is preserved by iopart & returned
+ * as is in the task mgmt rsp.
+ */
+ void *notifyresult;
+
+ /* this is a handle to location in guest where the result of the
+ * taskmgmt command (result field) is to saved off when the response
+ * is handled. Its value is preserved by iopart & returned as is in
+ * the task mgmt rsp.
+ */
+ char result;
+
+ /* result of taskmgmt command - set by IOPart - values are: */
+#define TASK_MGMT_FAILED 0
+} __packed;
+
+/* The following is used by uissd to send disk add/remove notifications to
+ * Guest */
+/* Note that the vHba pointer is not used by the Client/Guest side. */
+struct uiscmdrsp_disknotify {
+ u8 add; /* 0-remove, 1-add */
+ void *v_hba; /* Pointer to vhba_info for channel info to
+ * route msg */
+ u32 channel, id, lun; /* SCSI Path of Disk to added or removed */
+} __packed;
+
+/* The following is used by virthba/vSCSI to send the Acquire/Release commands
+ * to the IOVM. */
+struct uiscmdrsp_vdiskmgmt {
+ enum vdisk_mgmt_types vdisktype;
+
+ /* the type of task */
+ struct uisscsi_dest vdest;
+
+ /* the vdisk for which this task mgmt is generated */
+ void *scsicmd;
+
+ /* This is some handle that the guest has saved off for its own use.
+ * Its value is preserved by iopart & returned as is in the task
+ * mgmt rsp.
+ */
+ void *notify;
+
+ /* For linux guests, this is a pointer to wait_queue_head that a
+ * thread is waiting on to see if the tskmgmt command has completed.
+ * For win32 guests, this is a pointer to a location that a waiting
+ * thread is testing to see if the taskmgmt command has completed.
+ * When the rsp is received by guest, the thread receiving the
+ * response uses this to notify the thread waiting for taskmgmt
+ * command completion. Its value is preserved by iopart & returned
+ * as is in the task mgmt rsp.
+ */
+ void *notifyresult;
+
+ /* this is a handle to location in guest where the result of the
+ * taskmgmt command (result field) is to saved off when the response
+ * is handled. Its value is preserved by iopart & returned as is in
+ * the task mgmt rsp.
+ */
+ char result;
+
+ /* result of taskmgmt command - set by IOPart - values are: */
+#define VDISK_MGMT_FAILED 0
+} __packed;
+
+/* keeping cmd & rsp info in one structure for now cmd rsp packet for scsi */
+struct uiscmdrsp {
+ char cmdtype;
+
+/* describes what type of information is in the struct */
+#define CMD_SCSI_TYPE 1
+#define CMD_NET_TYPE 2
+#define CMD_SCSITASKMGMT_TYPE 3
+#define CMD_NOTIFYGUEST_TYPE 4
+#define CMD_VDISKMGMT_TYPE 5
+ union {
+ struct uiscmdrsp_scsi scsi;
+ struct uiscmdrsp_net net;
+ struct uiscmdrsp_scsitaskmgmt scsitaskmgmt;
+ struct uiscmdrsp_disknotify disknotify;
+ struct uiscmdrsp_vdiskmgmt vdiskmgmt;
+ };
+ void *private_data; /* used to send the response when the cmd is
+ * done (scsi & scsittaskmgmt). */
+ struct uiscmdrsp *next; /* General Purpose Queue Link */
+ struct uiscmdrsp *activeQ_next; /* Used to track active commands */
+ struct uiscmdrsp *activeQ_prev; /* Used to track active commands */
+} __packed;
+
+struct iochannel_vhba {
+ struct vhba_wwnn wwnn; /* 8 bytes */
+ struct vhba_config_max max; /* 20 bytes */
+} __packed; /* total = 28 bytes */
+struct iochannel_vnic {
+ u8 macaddr[6]; /* 6 bytes */
+ u32 num_rcv_bufs; /* 4 bytes */
+ u32 mtu; /* 4 bytes */
+ uuid_le zone_uuid; /* 16 bytes */
+} __packed;
+/* This is just the header of the IO channel. It is assumed that directly after
+ * this header there is a large region of memory which contains the command and
+ * response queues as specified in cmd_q and rsp_q SIGNAL_QUEUE_HEADERS.
+ */
+struct spar_io_channel_protocol {
+ struct channel_header channel_header;
+ struct signal_queue_header cmd_q;
+ struct signal_queue_header rsp_q;
+ union {
+ struct iochannel_vhba vhba;
+ struct iochannel_vnic vnic;
+ } __packed;
+
+#define MAX_CLIENTSTRING_LEN 1024
+ u8 client_string[MAX_CLIENTSTRING_LEN];/* NULL terminated - so holds
+ * max - 1 bytes */
+} __packed;
+
+
+/*
+ * INLINE functions for initializing and accessing I/O data channels
+ */
+
+#define SIZEOF_PROTOCOL (COVER(sizeof(struct spar_io_channel_protocol), 64))
+#define SIZEOF_CMDRSP (COVER(sizeof(struct uiscmdrsp), 64))
+
+#define MIN_IO_CHANNEL_SIZE COVER(SIZEOF_PROTOCOL + \
+ 2 * MIN_NUMSIGNALS * SIZEOF_CMDRSP, 4096)
+
+/*
+ * INLINE function for expanding a guest's pfn-off-size into multiple 4K page
+ * pfn-off-size entires.
+ */
+
+/* we deal with 4K page sizes when we it comes to passing page information
+ * between */
+/* Guest and IOPartition. */
+#define PI_PAGE_SIZE 0x1000
+#define PI_PAGE_MASK 0x0FFF
+
+/* returns next non-zero index on success or zero on failure (i.e. out of
+ * room)
+ */
+static inline u16
+add_physinfo_entries(u32 inp_pfn, /* input - specifies the pfn to be used
+ * to add entries */
+ u16 inp_off, /* input - specifies the off to be used
+ * to add entries */
+ u32 inp_len, /* input - specifies the len to be used
+ * to add entries */
+ u16 index, /* input - index in array at which new
+ * entries are added */
+ u16 max_pi_arr_entries, /* input - specifies the maximum
+ * entries pi_arr can hold */
+ struct phys_info pi_arr[]) /* input & output - array to
+ * which entries are added */
+{
+ u32 len;
+ u16 i, firstlen;
+
+ firstlen = PI_PAGE_SIZE - inp_off;
+ if (inp_len <= firstlen) {
+ /* the input entry spans only one page - add as is */
+ if (index >= max_pi_arr_entries)
+ return 0;
+ pi_arr[index].pi_pfn = inp_pfn;
+ pi_arr[index].pi_off = (u16)inp_off;
+ pi_arr[index].pi_len = (u16)inp_len;
+ return index + 1;
+ }
+
+ /* this entry spans multiple pages */
+ for (len = inp_len, i = 0; len;
+ len -= pi_arr[index + i].pi_len, i++) {
+ if (index + i >= max_pi_arr_entries)
+ return 0;
+ pi_arr[index + i].pi_pfn = inp_pfn + i;
+ if (i == 0) {
+ pi_arr[index].pi_off = inp_off;
+ pi_arr[index].pi_len = firstlen;
+ }
+
+ else {
+ pi_arr[index + i].pi_off = 0;
+ pi_arr[index + i].pi_len =
+ (u16)MINNUM(len, (u32)PI_PAGE_SIZE);
+ }
+ }
+ return index + i;
+}
+
+#endif /* __IOCHANNEL_H__ */
diff --git a/drivers/staging/unisys/include/periodic_work.h b/drivers/staging/unisys/include/periodic_work.h
index 26ec10bdf..4e19c28dc 100644
--- a/drivers/staging/unisys/include/periodic_work.h
+++ b/drivers/staging/unisys/include/periodic_work.h
@@ -18,7 +18,9 @@
#ifndef __PERIODIC_WORK_H__
#define __PERIODIC_WORK_H__
-#include "timskmod.h"
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+
/* PERIODIC_WORK an opaque structure to users.
* Fields are declared only in the implementation .c files.
@@ -31,8 +33,8 @@ struct periodic_work *visor_periodic_work_create(ulong jiffy_interval,
void *workfuncarg,
const char *devnam);
void visor_periodic_work_destroy(struct periodic_work *pw);
-BOOL visor_periodic_work_nextperiod(struct periodic_work *pw);
-BOOL visor_periodic_work_start(struct periodic_work *pw);
-BOOL visor_periodic_work_stop(struct periodic_work *pw);
+bool visor_periodic_work_nextperiod(struct periodic_work *pw);
+bool visor_periodic_work_start(struct periodic_work *pw);
+bool visor_periodic_work_stop(struct periodic_work *pw);
#endif
diff --git a/drivers/staging/unisys/include/procobjecttree.h b/drivers/staging/unisys/include/procobjecttree.h
deleted file mode 100644
index 809c67942..000000000
--- a/drivers/staging/unisys/include/procobjecttree.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* procobjecttree.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.
- */
-
-/** @file *********************************************************************
- *
- * This describes the interfaces necessary for creating a tree of types,
- * objects, and properties in /proc.
- *
- ******************************************************************************
- */
-
-#ifndef __PROCOBJECTTREE_H__
-#define __PROCOBJECTTREE_H__
-
-#include "timskmod.h"
-
-/* These are opaque structures to users.
- * Fields are declared only in the implementation .c files.
- */
-typedef struct MYPROCOBJECT_Tag MYPROCOBJECT;
-typedef struct MYPROCTYPE_Tag MYPROCTYPE;
-
-MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type, const char *name,
- void *context);
-void visor_proc_DestroyObject(MYPROCOBJECT *obj);
-MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procRootDir,
- const char **name,
- const char **propertyNames,
- void (*show_property)(struct seq_file *,
- void *, int));
-void visor_proc_DestroyType(MYPROCTYPE *type);
-
-#endif
diff --git a/drivers/staging/unisys/include/sparstop.h b/drivers/staging/unisys/include/sparstop.h
deleted file mode 100644
index 05837399a..000000000
--- a/drivers/staging/unisys/include/sparstop.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* sparstop.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.
- */
-
-#ifndef __SPARSTOP_H__
-#define __SPARSTOP_H__
-
-#include "timskmod.h"
-#include "version.h"
-#include <linux/ctype.h>
-
-typedef void (*SPARSTOP_COMPLETE_FUNC) (void *context, int status);
-
-int sp_stop(void *context, SPARSTOP_COMPLETE_FUNC get_complete_func);
-void test_remove_stop_device(void);
-
-#endif
diff --git a/drivers/staging/unisys/include/timskmod.h b/drivers/staging/unisys/include/timskmod.h
deleted file mode 100644
index cde2494ad..000000000
--- a/drivers/staging/unisys/include/timskmod.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* timskmod.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.
- */
-
-#ifndef __TIMSKMOD_H__
-#define __TIMSKMOD_H__
-
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/device.h>
-#include <linux/kobject.h>
-#include <linux/sysfs.h>
-#include <linux/fs.h>
-#include <linux/string.h>
-#include <linux/sched.h>
-#include <linux/spinlock.h>
-#include <linux/slab.h>
-#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/wait.h>
-#include <linux/vmalloc.h>
-#include <linux/proc_fs.h>
-#include <linux/cdev.h>
-#include <linux/types.h>
-#include <asm/irq.h>
-#include <linux/io.h>
-#include <asm/dma.h>
-#include <linux/uaccess.h>
-#include <linux/list.h>
-#include <linux/poll.h>
-/* #define EXPORT_SYMTAB */
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/fcntl.h>
-#include <linux/workqueue.h>
-#include <linux/kthread.h>
-#include <linux/seq_file.h>
-#include <linux/mm.h>
-
-/* #define DEBUG */
-#ifndef BOOL
-#define BOOL int
-#endif
-#define FALSE 0
-#define TRUE 1
-#if !defined SUCCESS
-#define SUCCESS 0
-#endif
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#define STRUCTSEQUAL(x, y) (memcmp(&x, &y, sizeof(x)) == 0)
-#ifndef HOSTADDRESS
-#define HOSTADDRESS unsigned long long
-#endif
-
-#define sizeofmember(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
-/** "Covered quotient" function */
-#define COVQ(v, d) (((v) + (d) - 1) / (d))
-#define SWAPPOINTERS(p1, p2) \
- do { \
- void *SWAPPOINTERS_TEMP = (void *)p1; \
- (void *)(p1) = (void *)(p2); \
- (void *)(p2) = SWAPPOINTERS_TEMP; \
- } while (0)
-
-#define WARNDRV(fmt, args...) LOGWRN(fmt, ## args)
-#define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args)
-
-#define PRINTKDEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args)
-#define TBDDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args)
-#define HUHDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args)
-#define ERRDEV(devname, fmt, args...) LOGERRDEV(devname, fmt, ## args)
-#define ERRDEVX(devno, fmt, args...) LOGERRDEVX(devno, fmt, ## args)
-#define WARNDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args)
-#define SECUREDEV(devname, fmt, args...) LOGWRNDEV(devname, fmt, ## args)
-#define INFODEV(devname, fmt, args...) LOGINFDEV(devname, fmt, ## args)
-#define INFODEVX(devno, fmt, args...) LOGINFDEVX(devno, fmt, ## args)
-
-/** Verifies the consistency of your PRIVATEDEVICEDATA structure using
- * conventional "signature" fields:
- * <p>
- * - sig1 should contain the size of the structure
- * - sig2 should contain a pointer to the beginning of the structure
- */
-#define DDLOOKSVALID(dd) \
- ((dd != NULL) && \
- ((dd)->sig1 == sizeof(PRIVATEDEVICEDATA)) && \
- ((dd)->sig2 == dd))
-
-/** Verifies the consistency of your PRIVATEFILEDATA structure using
- * conventional "signature" fields:
- * <p>
- * - sig1 should contain the size of the structure
- * - sig2 should contain a pointer to the beginning of the structure
- */
-#define FDLOOKSVALID(fd) \
- ((fd != NULL) && \
- ((fd)->sig1 == sizeof(PRIVATEFILEDATA)) && \
- ((fd)->sig2 == fd))
-
-/** Sleep for an indicated number of seconds (for use in kernel mode).
- * x - the number of seconds to sleep.
- */
-#define SLEEP(x) \
- do { __set_current_state(TASK_INTERRUPTIBLE); \
- schedule_timeout((x)*HZ); \
- } while (0)
-
-/** Sleep for an indicated number of jiffies (for use in kernel mode).
- * x - the number of jiffies to sleep.
- */
-#define SLEEPJIFFIES(x) \
- do { __set_current_state(TASK_INTERRUPTIBLE); \
- schedule_timeout(x); \
- } while (0)
-
-static inline struct cdev *cdev_alloc_init(struct module *owner,
- const struct file_operations *fops)
-{
- struct cdev *cdev = NULL;
-
- cdev = cdev_alloc();
- if (!cdev)
- return NULL;
- cdev->ops = fops;
- cdev->owner = owner;
-
- /* Note that the memory allocated for cdev will be deallocated
- * when the usage count drops to 0, because it is controlled
- * by a kobject of type ktype_cdev_dynamic. (This
- * deallocation could very well happen outside of our kernel
- * module, like via the cdev_put in __fput() for example.)
- */
- return cdev;
-}
-
-extern int unisys_spar_platform;
-
-#endif
diff --git a/drivers/staging/unisys/include/uisqueue.h b/drivers/staging/unisys/include/uisqueue.h
deleted file mode 100644
index 08ba16ea8..000000000
--- a/drivers/staging/unisys/include/uisqueue.h
+++ /dev/null
@@ -1,396 +0,0 @@
-/* uisqueue.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 IO Virtualization header NOTE: This file contains only Linux
- * specific structs. All OS-independent structs are in iochannel.h.xx
- */
-
-#ifndef __UISQUEUE_H__
-#define __UISQUEUE_H__
-
-#include "linux/version.h"
-#include "iochannel.h"
-#include <linux/atomic.h>
-#include <linux/semaphore.h>
-#include <linux/uuid.h>
-
-#include "controlvmchannel.h"
-#include "controlvmcompletionstatus.h"
-
-struct uisqueue_info {
- struct channel_header __iomem *chan;
- /* channel containing queues in which scsi commands &
- * responses are queued
- */
- u64 packets_sent;
- u64 packets_received;
- u64 interrupts_sent;
- u64 interrupts_received;
- u64 max_not_empty_cnt;
- u64 total_wakeup_cnt;
- u64 non_empty_wakeup_cnt;
-
- struct {
- struct signal_queue_header reserved1; /* */
- struct signal_queue_header reserved2; /* */
- } safe_uis_queue;
- unsigned int (*send_int_if_needed)(struct uisqueue_info *info,
- unsigned int whichcqueue,
- unsigned char issue_irq_if_empty,
- u64 irq_handle,
- unsigned char io_termination);
-};
-
-/* uisqueue_put_cmdrsp_with_lock_client queues a commmand or response
- * to the specified queue, at the tail if the queue is full but
- * oktowait == 0, then it return 0 indicating failure. otherwise it
- * wait for the queue to become non-full. If command is queued, return
- * 1 for success.
- */
-#define DONT_ISSUE_INTERRUPT 0
-#define ISSUE_INTERRUPT 1
-
-#define DONT_WAIT 0
-#define OK_TO_WAIT 1
-#define UISLIB_LOCK_PREFIX \
- ".section .smp_locks,\"a\"\n" \
- _ASM_ALIGN "\n" \
- _ASM_PTR "661f\n" /* address */ \
- ".previous\n" \
- "661:\n\tlock; "
-
-unsigned long long uisqueue_interlocked_or(unsigned long long __iomem *tgt,
- unsigned long long set);
-unsigned long long uisqueue_interlocked_and(unsigned long long __iomem *tgt,
- unsigned long long set);
-
-int uisqueue_put_cmdrsp_with_lock_client(struct uisqueue_info *queueinfo,
- struct uiscmdrsp *cmdrsp,
- unsigned int queue,
- void *insertlock,
- unsigned char issue_irq_if_empty,
- u64 irq_handle,
- char oktowait,
- u8 *channel_id);
-
-/* uisqueue_get_cmdrsp gets the cmdrsp entry at the head of the queue
- * and copies it to the area pointed by cmdrsp param.
- * returns 0 if queue is empty, 1 otherwise
- */
-int
-
-uisqueue_get_cmdrsp(struct uisqueue_info *queueinfo, void *cmdrsp,
- unsigned int queue);
-
-#define MAX_NAME_SIZE_UISQUEUE 64
-
-struct extport_info {
- u8 valid:1;
- /* if 1, indicates this extport slot is occupied
- * if 0, indicates that extport slot is unoccupied */
-
- u32 num_devs_using;
- /* When extport is added, this is set to 0. For exports
- * located in NETWORK switches:
- * Each time a VNIC, i.e., intport, is added to the switch this
- * is used to assign a pref_pnic for the VNIC and when assigned
- * to a VNIC this counter is incremented. When a VNIC is
- * deleted, the extport corresponding to the VNIC's pref_pnic
- * is located and its num_devs_using is decremented. For VNICs,
- * num_devs_using is basically used to load-balance transmit
- * traffic from VNICs.
- */
-
- struct switch_info *swtch;
- struct pci_id pci_id;
- char name[MAX_NAME_SIZE_UISQUEUE];
- union {
- struct vhba_wwnn wwnn;
- unsigned char macaddr[MAX_MACADDR_LEN];
- };
-};
-
-struct device_info {
- void __iomem *chanptr;
- u64 channel_addr;
- u64 channel_bytes;
- uuid_le channel_uuid;
- uuid_le instance_uuid;
- struct irq_info intr;
- struct switch_info *swtch;
- char devid[30]; /* "vbus<busno>:dev<devno>" */
- u16 polling;
- struct semaphore interrupt_callback_lock;
- u32 bus_no;
- u32 dev_no;
- int (*interrupt)(void *);
- void *interrupt_context;
- void *private_data;
- struct list_head list_polling_device_channels;
- unsigned long long moved_to_tail_cnt;
- unsigned long long first_busy_cnt;
- unsigned long long last_on_list_cnt;
-};
-
-enum switch_type {
- RECOVERY_LAN = 1,
- IB_LAN = 2
-};
-
-struct bus_info {
- u32 bus_no, device_count;
- struct device_info **device;
- u64 guest_handle, recv_bus_irq_handle;
- uuid_le bus_inst_uuid;
- struct ultra_vbus_channel_protocol __iomem *bus_channel;
- int bus_channel_bytes;
- struct proc_dir_entry *proc_dir; /* proc/uislib/vbus/<x> */
- struct proc_dir_entry *proc_info; /* proc/uislib/vbus/<x>/info */
- char name[25];
- char partition_name[99];
- struct bus_info *next;
- u8 local_vnic; /* 1 if local vnic created internally
- * by IOVM; 0 otherwise... */
-};
-
-struct sn_list_entry {
- struct uisscsi_dest pdest; /* scsi bus, target, lun for
- * phys disk */
- u8 sernum[MAX_SERIAL_NUM]; /* serial num of physical
- * disk.. The length is always
- * MAX_SERIAL_NUM, padded with
- * spaces */
- struct sn_list_entry *next;
-};
-
-/*
- * IO messages sent to UisnicControlChanFunc & UissdControlChanFunc by
- * code that processes the ControlVm channel messages.
- */
-
-enum iopart_msg_type {
- IOPART_ADD_VNIC,
- IOPART_DEL_VNIC,
- IOPART_DEL_ALL_VNICS,
- IOPART_ADD_VHBA,
- IOPART_ADD_VDISK,
- IOPART_DEL_VHBA,
- IOPART_DEL_VDISK,
- IOPART_DEL_ALL_VDISKS_FOR_VHBA,
- IOPART_DEL_ALL_VHBAS,
- IOPART_ATTACH_PHBA,
- IOPART_DETACH_PHBA, /* 10 */
- IOPART_ATTACH_PNIC,
- IOPART_DETACH_PNIC,
- IOPART_DETACH_VHBA,
- IOPART_DETACH_VNIC,
- IOPART_PAUSE_VDISK,
- IOPART_RESUME_VDISK,
- IOPART_ADD_DEVICE, /* add generic device */
- IOPART_DEL_DEVICE, /* del generic device */
-};
-
-struct add_virt_iopart {
- void *chanptr; /* pointer to data channel */
- u64 guest_handle; /* used to convert guest physical
- * address to real physical address
- * for DMA, for ex. */
- u64 recv_bus_irq_handle; /* used to register to receive
- * bus level interrupts. */
- struct irq_info intr; /* contains recv & send
- * interrupt info */
- /* recvInterruptHandle is used to register to receive
- * interrupts on the data channel. Used by GuestLinux/Windows
- * IO drivers to connect to interrupt. sendInterruptHandle is
- * used by IOPart drivers as parameter to
- * Issue_VMCALL_IO_QUEUE_TRANSITION to interrupt thread in
- * guest linux/windows IO drivers when data channel queue for
- * vhba/vnic goes from EMPTY to NON-EMPTY. */
- struct switch_info *swtch; /* pointer to the virtual
- * switch to which the vnic is
- * connected */
-
- u8 use_g2g_copy; /* Used to determine if a virtual HBA
- * needs to use G2G copy. */
- u8 filler[7];
-
- u32 bus_no;
- u32 dev_no;
- char *params;
- ulong params_bytes;
-
-};
-
-struct add_vdisk_iopart {
- void *chanptr; /* pointer to data channel */
- int implicit;
- struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */
- struct uisscsi_dest pdest; /* scsi bus, target, lun for phys disk */
- u8 sernum[MAX_SERIAL_NUM]; /* serial num of physical disk */
- u32 serlen; /* length of serial num */
-};
-
-struct del_vdisk_iopart {
- void *chanptr; /* pointer to data channel */
- struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */
-};
-
-struct del_virt_iopart {
- void *chanptr; /* pointer to data channel */
-};
-
-struct det_virt_iopart { /* detach internal port */
- void *chanptr; /* pointer to data channel */
- struct switch_info *swtch;
-};
-
-struct paures_vdisk_iopart {
- void *chanptr; /* pointer to data channel */
- struct uisscsi_dest vdest; /* scsi bus, target, lun for virt disk */
-};
-
-struct add_switch_iopart { /* add switch */
- struct switch_info *swtch;
- char *params;
- ulong params_bytes;
-};
-
-struct del_switch_iopart { /* destroy switch */
- struct switch_info *swtch;
-};
-
-struct io_msgs {
- enum iopart_msg_type msgtype;
-
- /* additional params needed by some messages */
- union {
- struct add_virt_iopart add_vhba;
- struct add_virt_iopart add_vnic;
- struct add_vdisk_iopart add_vdisk;
- struct del_virt_iopart del_vhba;
- struct del_virt_iopart del_vnic;
- struct det_virt_iopart det_vhba;
- struct det_virt_iopart det_vnic;
- struct del_vdisk_iopart del_vdisk;
- struct del_virt_iopart del_all_vdisks_for_vhba;
- struct add_virt_iopart add_device;
- struct del_virt_iopart del_device;
- struct det_virt_iopart det_intport;
- struct add_switch_iopart add_switch;
- struct del_switch_iopart del_switch;
- struct extport_info *ext_port; /* for attach or detach
- * pnic/generic delete all
- * vhbas/allvnics need no
- * parameters */
- struct paures_vdisk_iopart paures_vdisk;
- };
-};
-
-/*
-* Guest messages sent to VirtControlChanFunc by code that processes
-* the ControlVm channel messages.
-*/
-
-enum guestpart_msg_type {
- GUEST_ADD_VBUS,
- GUEST_ADD_VHBA,
- GUEST_ADD_VNIC,
- GUEST_DEL_VBUS,
- GUEST_DEL_VHBA,
- GUEST_DEL_VNIC,
- GUEST_DEL_ALL_VHBAS,
- GUEST_DEL_ALL_VNICS,
- GUEST_DEL_ALL_VBUSES, /* deletes all vhbas & vnics on all
- * buses and deletes all buses */
- GUEST_PAUSE_VHBA,
- GUEST_PAUSE_VNIC,
- GUEST_RESUME_VHBA,
- GUEST_RESUME_VNIC
-};
-
-struct add_vbus_guestpart {
- void __iomem *chanptr; /* pointer to data channel for bus -
- * NOT YET USED */
- u32 bus_no; /* bus number to be created/deleted */
- u32 dev_count; /* max num of devices on bus */
- uuid_le bus_uuid; /* indicates type of bus */
- uuid_le instance_uuid; /* instance guid for device */
-};
-
-struct del_vbus_guestpart {
- u32 bus_no; /* bus number to be deleted */
- /* once we start using the bus's channel, add can dump busNo
- * into the channel header and then delete will need only one
- * parameter, chanptr. */
-};
-
-struct add_virt_guestpart {
- void __iomem *chanptr; /* pointer to data channel */
- u32 bus_no; /* bus number for the operation */
- u32 device_no; /* number of device on the bus */
- uuid_le instance_uuid; /* instance guid for device */
- struct irq_info intr; /* recv/send interrupt info */
- /* recvInterruptHandle contains info needed in order to
- * register to receive interrupts on the data channel.
- * sendInterruptHandle contains handle which is provided to
- * monitor VMCALL that will cause an interrupt to be generated
- * for the other end.
- */
-};
-
-struct pause_virt_guestpart {
- void __iomem *chanptr; /* pointer to data channel */
-};
-
-struct resume_virt_guestpart {
- void __iomem *chanptr; /* pointer to data channel */
-};
-
-struct del_virt_guestpart {
- void __iomem *chanptr; /* pointer to data channel */
-};
-
-struct init_chipset_guestpart {
- u32 bus_count; /* indicates the max number of busses */
- u32 switch_count; /* indicates the max number of switches */
-};
-
-struct guest_msgs {
- enum guestpart_msg_type msgtype;
-
- /* additional params needed by messages */
- union {
- struct add_vbus_guestpart add_vbus;
- struct add_virt_guestpart add_vhba;
- struct add_virt_guestpart add_vnic;
- struct pause_virt_guestpart pause_vhba;
- struct pause_virt_guestpart pause_vnic;
- struct resume_virt_guestpart resume_vhba;
- struct resume_virt_guestpart resume_vnic;
- struct del_vbus_guestpart del_vbus;
- struct del_virt_guestpart del_vhba;
- struct del_virt_guestpart del_vnic;
- struct del_vbus_guestpart del_all_vhbas;
- struct del_vbus_guestpart del_all_vnics;
- /* del_all_vbuses needs no parameters */
- };
- struct init_chipset_guestpart init_chipset;
-
-};
-
-#endif /* __UISQUEUE_H__ */
diff --git a/drivers/staging/unisys/include/uisthread.h b/drivers/staging/unisys/include/uisthread.h
deleted file mode 100644
index 52c3eb4de..000000000
--- a/drivers/staging/unisys/include/uisthread.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* uisthread.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 thread utilities header */
-/*****************************************************************************/
-
-#ifndef __UISTHREAD_H__
-#define __UISTHREAD_H__
-
-#include "linux/completion.h"
-
-struct uisthread_info {
- struct task_struct *task;
- int id;
- struct completion has_stopped;
-};
-
-/* returns 0 for failure, 1 for success */
-int uisthread_start(
- struct uisthread_info *thrinfo,
- int (*threadfn)(void *),
- void *thrcontext,
- char *name);
-
-void uisthread_stop(struct uisthread_info *thrinfo);
-
-#endif /* __UISTHREAD_H__ */
diff --git a/drivers/staging/unisys/include/uisutils.h b/drivers/staging/unisys/include/uisutils.h
deleted file mode 100644
index c7d0ba8aa..000000000
--- a/drivers/staging/unisys/include/uisutils.h
+++ /dev/null
@@ -1,299 +0,0 @@
-/* uisutils.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 utilities header
- */
-
-#ifndef __UISUTILS__H__
-#define __UISUTILS__H__
-#include <linux/string.h>
-#include <linux/io.h>
-#include <linux/sched.h>
-#include <linux/gfp.h>
-#include <linux/uuid.h>
-#include <linux/if_ether.h>
-
-#include "vmcallinterface.h"
-#include "channel.h"
-#include "uisthread.h"
-#include "uisqueue.h"
-#include "diagnostics/appos_subsystems.h"
-#include "vbusdeviceinfo.h"
-#include <linux/atomic.h>
-
-/* This is the MAGIC number stuffed by virthba in host->this_id. Used to
- * identify virtual hbas.
- */
-#define UIS_MAGIC_VHBA 707
-
-/* global function pointers that act as callback functions into
- * uisnicmod, uissdmod, and virtpcimod
- */
-extern int (*uisnic_control_chan_func)(struct io_msgs *);
-extern int (*uissd_control_chan_func)(struct io_msgs *);
-extern int (*virt_control_chan_func)(struct guest_msgs *);
-
-/* Return values of above callback functions: */
-#define CCF_ERROR 0 /* completed and failed */
-#define CCF_OK 1 /* completed successfully */
-#define CCF_PENDING 2 /* operation still pending */
-extern atomic_t uisutils_registered_services;
-
-struct req_handler_info {
- uuid_le switch_uuid;
- int (*controlfunc)(struct io_msgs *);
- unsigned long min_channel_bytes;
- int (*server_channel_ok)(unsigned long channel_bytes);
- int (*server_channel_init)(void *x, unsigned char *client_str,
- u32 client_str_len, u64 bytes);
- char switch_type_name[99];
- struct list_head list_link; /* links into ReqHandlerInfo_list */
-};
-
-struct req_handler_info *req_handler_find(uuid_le switch_uuid);
-
-#define uislib_ioremap_cache(addr, size) \
- dbg_ioremap_cache(addr, size, __FILE__, __LINE__)
-
-static inline void __iomem *
-dbg_ioremap_cache(u64 addr, unsigned long size, char *file, int line)
-{
- void __iomem *new;
-
- new = ioremap_cache(addr, size);
- return new;
-}
-
-#define uislib_ioremap(addr, size) dbg_ioremap(addr, size, __FILE__, __LINE__)
-
-static inline void *
-dbg_ioremap(u64 addr, unsigned long size, char *file, int line)
-{
- void *new;
-
- new = ioremap(addr, size);
- return new;
-}
-
-#define uislib_iounmap(addr) dbg_iounmap(addr, __FILE__, __LINE__)
-
-static inline void
-dbg_iounmap(void __iomem *addr, char *file, int line)
-{
- iounmap(addr);
-}
-
-#define PROC_READ_BUFFER_SIZE 131072 /* size of the buffer to allocate to
- * hold all of /proc/XXX/info */
-int uisutil_add_proc_line_ex(int *total, char **buffer, int *buffer_remaining,
- char *format, ...);
-
-int uisctrl_register_req_handler(int type, void *fptr,
- struct ultra_vbus_deviceinfo *chipset_driver_info);
-
-unsigned char *util_map_virt(struct phys_info *sg);
-void util_unmap_virt(struct phys_info *sg);
-unsigned char *util_map_virt_atomic(struct phys_info *sg);
-void util_unmap_virt_atomic(void *buf);
-int uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid,
- u64 channel_addr, ulong n_channel_bytes);
-int uislib_client_inject_del_bus(u32 bus_no);
-
-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);
-int uislib_client_inject_pause_vhba(u32 bus_no, u32 dev_no);
-int uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no);
-int uislib_client_inject_del_vhba(u32 bus_no, u32 dev_no);
-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);
-int uislib_client_inject_pause_vnic(u32 bus_no, u32 dev_no);
-int uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no);
-int uislib_client_inject_del_vnic(u32 bus_no, u32 dev_no);
-#ifdef STORAGE_CHANNEL
-u64 uislib_storage_channel(int client_id);
-#endif
-int uislib_get_owned_pdest(struct uisscsi_dest *pdest);
-
-int uislib_send_event(enum controlvm_id id,
- struct controlvm_message_packet *event);
-
-/* structure used by vhba & vnic to keep track of queue & thread info */
-struct chaninfo {
- struct uisqueue_info *queueinfo;
- /* this specifies the queue structures for a channel */
- /* ALLOCATED BY THE OTHER END - WE JUST GET A POINTER TO THE MEMORY */
- spinlock_t insertlock;
- /* currently used only in virtnic when sending data to uisnic */
- /* to synchronize the inserts into the signal queue */
- struct uisthread_info threadinfo;
- /* this specifies the thread structures used by the thread that */
- /* handles this channel */
-};
-
-/* this is the wait code for all the threads - it is used to get
-* something from a queue choices: wait_for_completion_interruptible,
-* _timeout, interruptible_timeout
-*/
-#define UIS_THREAD_WAIT_MSEC(x) { \
- set_current_state(TASK_INTERRUPTIBLE); \
- schedule_timeout(msecs_to_jiffies(x)); \
-}
-
-#define UIS_THREAD_WAIT_USEC(x) { \
- set_current_state(TASK_INTERRUPTIBLE); \
- schedule_timeout(usecs_to_jiffies(x)); \
-}
-
-#define UIS_THREAD_WAIT UIS_THREAD_WAIT_MSEC(5)
-
-#define UIS_THREAD_WAIT_SEC(x) { \
- set_current_state(TASK_INTERRUPTIBLE); \
- schedule_timeout((x)*HZ); \
-}
-
-/* This is a hack until we fix IOVM to initialize the channel header
- * correctly at DEVICE_CREATE time, INSTEAD OF waiting until
- * DEVICE_CONFIGURE time.
- */
-static inline void
-wait_for_valid_guid(uuid_le __iomem *guid)
-{
- uuid_le tmpguid;
-
- while (1) {
- memcpy_fromio((void *)&tmpguid,
- (void __iomem *)guid, sizeof(uuid_le));
- if (uuid_le_cmp(tmpguid, NULL_UUID_LE) != 0)
- break;
- UIS_THREAD_WAIT_SEC(5);
- }
-}
-
-static inline unsigned int
-issue_vmcall_io_controlvm_addr(u64 *control_addr, u32 *control_bytes)
-{
- struct vmcall_io_controlvm_addr_params params;
- int result = VMCALL_SUCCESS;
- u64 physaddr;
-
- physaddr = virt_to_phys(&params);
- ISSUE_IO_VMCALL(VMCALL_IO_CONTROLVM_ADDR, physaddr, result);
- if (VMCALL_SUCCESSFUL(result)) {
- *control_addr = params.address;
- *control_bytes = params.channel_bytes;
- }
- return result;
-}
-
-static inline unsigned int issue_vmcall_io_diag_addr(u64 *diag_channel_addr)
-{
- struct vmcall_io_diag_addr_params params;
- int result = VMCALL_SUCCESS;
- u64 physaddr;
-
- physaddr = virt_to_phys(&params);
- ISSUE_IO_VMCALL(VMCALL_IO_DIAG_ADDR, physaddr, result);
- if (VMCALL_SUCCESSFUL(result))
- *diag_channel_addr = params.address;
- return result;
-}
-
-static inline unsigned int issue_vmcall_io_visorserial_addr(u64 *channel_addr)
-{
- struct vmcall_io_visorserial_addr_params params;
- int result = VMCALL_SUCCESS;
- u64 physaddr;
-
- physaddr = virt_to_phys(&params);
- ISSUE_IO_VMCALL(VMCALL_IO_VISORSERIAL_ADDR, physaddr, result);
- if (VMCALL_SUCCESSFUL(result))
- *channel_addr = params.address;
- return result;
-}
-
-static inline s64 issue_vmcall_query_guest_virtual_time_offset(void)
-{
- u64 result = VMCALL_SUCCESS;
- u64 physaddr = 0;
-
- ISSUE_IO_VMCALL(VMCALL_QUERY_GUEST_VIRTUAL_TIME_OFFSET, physaddr,
- result);
- return result;
-}
-
-struct log_info_t {
- unsigned long long last_cycles;
- unsigned long long delta_sum[64];
- unsigned long long delta_cnt[64];
- unsigned long long max_delta[64];
- unsigned long long min_delta[64];
-};
-
-static inline int issue_vmcall_update_physical_time(u64 adjustment)
-{
- int result = VMCALL_SUCCESS;
-
- ISSUE_IO_VMCALL(VMCALL_UPDATE_PHYSICAL_TIME, adjustment, result);
- return result;
-}
-
-static inline unsigned int issue_vmcall_channel_mismatch(const char *chname,
- const char *item_name, u32 line_no,
- const char *path_n_fn)
-{
- struct vmcall_channel_version_mismatch_params params;
- int result = VMCALL_SUCCESS;
- u64 physaddr;
- char *last_slash = NULL;
-
- strlcpy(params.chname, chname, sizeof(params.chname));
- strlcpy(params.item_name, item_name, sizeof(params.item_name));
- params.line_no = line_no;
-
- last_slash = strrchr(path_n_fn, '/');
- if (last_slash != NULL) {
- last_slash++;
- strlcpy(params.file_name, last_slash, sizeof(params.file_name));
- } else
- strlcpy(params.file_name,
- "Cannot determine source filename",
- sizeof(params.file_name));
-
- physaddr = virt_to_phys(&params);
- ISSUE_IO_VMCALL(VMCALL_CHANNEL_VERSION_MISMATCH, physaddr, result);
- return result;
-}
-
-#define UIS_DAEMONIZE(nam)
-void *uislib_cache_alloc(struct kmem_cache *cur_pool, char *fn, int ln);
-#define UISCACHEALLOC(cur_pool) uislib_cache_alloc(cur_pool, __FILE__, __LINE__)
-void uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln);
-#define UISCACHEFREE(cur_pool, p) \
- uislib_cache_free(cur_pool, p, __FILE__, __LINE__)
-
-void uislib_enable_channel_interrupts(u32 bus_no, u32 dev_no,
- int (*interrupt)(void *),
- void *interrupt_context);
-void uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no);
-void uislib_force_channel_interrupt(u32 bus_no, u32 dev_no);
-
-#endif /* __UISUTILS__H__ */
diff --git a/drivers/staging/unisys/include/vbushelper.h b/drivers/staging/unisys/include/vbushelper.h
index 84abe5f99..f272975b2 100644
--- a/drivers/staging/unisys/include/vbushelper.h
+++ b/drivers/staging/unisys/include/vbushelper.h
@@ -18,8 +18,6 @@
#ifndef __VBUSHELPER_H__
#define __VBUSHELPER_H__
-#include "vbusdeviceinfo.h"
-
/* TARGET_HOSTNAME specified as -DTARGET_HOSTNAME=\"thename\" on the
* command line */
diff --git a/drivers/staging/unisys/include/version.h b/drivers/staging/unisys/include/version.h
new file mode 100644
index 000000000..83d1da7a2
--- /dev/null
+++ b/drivers/staging/unisys/include/version.h
@@ -0,0 +1,45 @@
+/* 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.
+ */
+
+/* version.h */
+
+/* Common version/release info needed by all components goes here.
+ * (This file must compile cleanly in all environments.)
+ * Ultimately, this will be combined with defines generated dynamically as
+ * part of the sysgen, and some of the defines below may in fact end up
+ * being replaced with dynamically generated ones.
+ */
+#ifndef __VERSION_H__
+#define __VERSION_H__
+
+#define SPARVER1 "1"
+#define SPARVER2 "0"
+#define SPARVER3 "0"
+#define SPARVER4 "0"
+
+#define VERSION SPARVER1 "." SPARVER2 "." SPARVER3 "." SPARVER4
+
+/* Here are various version forms needed in Windows environments.
+ */
+#define VISOR_PRODUCTVERSION SPARVERCOMMA
+#define VISOR_PRODUCTVERSION_STR SPARVER1 "." SPARVER2 "." SPARVER3 "." \
+ SPARVER4
+#define VISOR_OBJECTVERSION_STR SPARVER1 "," SPARVER2 "," SPARVER3 "," \
+ SPARVER4
+
+#define COPYRIGHT "Unisys Corporation"
+#define COPYRIGHTDATE "2010 - 2013"
+
+#endif
diff --git a/drivers/staging/unisys/include/visorbus.h b/drivers/staging/unisys/include/visorbus.h
new file mode 100644
index 000000000..e4a21e42e
--- /dev/null
+++ b/drivers/staging/unisys/include/visorbus.h
@@ -0,0 +1,222 @@
+/* visorbus.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.
+ */
+
+/*
+ * This header file is to be included by other kernel mode components that
+ * implement a particular kind of visor_device. Each of these other kernel
+ * mode components is called a visor device driver. Refer to visortemplate
+ * for a minimal sample visor device driver.
+ *
+ * There should be nothing in this file that is private to the visorbus
+ * bus implementation itself.
+ *
+ */
+
+#ifndef __VISORBUS_H__
+#define __VISORBUS_H__
+
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/poll.h>
+#include <linux/kernel.h>
+#include <linux/uuid.h>
+
+#include "periodic_work.h"
+#include "channel.h"
+
+struct visor_driver;
+struct visor_device;
+extern struct bus_type visorbus_type;
+
+typedef void (*visorbus_state_complete_func) (struct visor_device *dev,
+ int status);
+struct visorchipset_state {
+ u32 created:1;
+ u32 attached:1;
+ u32 configured:1;
+ u32 running:1;
+ /* Add new fields above. */
+ /* Remaining bits in this 32-bit word are unused. */
+};
+
+/** This struct describes a specific Supervisor channel, by providing its
+ * GUID, name, and sizes.
+ */
+struct visor_channeltype_descriptor {
+ const uuid_le guid;
+ const char *name;
+};
+
+/** Information provided by each visor driver when it registers with the
+ * visorbus driver.
+ */
+struct visor_driver {
+ const char *name;
+ const char *version;
+ const char *vertag;
+ const char *build_date;
+ const char *build_time;
+ struct module *owner;
+
+ /** Types of channels handled by this driver, ending with 0 GUID.
+ * Our specialized BUS.match() method knows about this list, and
+ * uses it to determine whether this driver will in fact handle a
+ * new device that it has detected.
+ */
+ struct visor_channeltype_descriptor *channel_types;
+
+ /** Called when a new device comes online, by our probe() function
+ * specified by driver.probe() (triggered ultimately by some call
+ * to driver_register() / bus_add_driver() / driver_attach()).
+ */
+ int (*probe)(struct visor_device *dev);
+
+ /** Called when a new device is removed, by our remove() function
+ * specified by driver.remove() (triggered ultimately by some call
+ * to device_release_driver()).
+ */
+ void (*remove)(struct visor_device *dev);
+
+ /** Called periodically, whenever there is a possibility that
+ * "something interesting" may have happened to the channel state.
+ */
+ void (*channel_interrupt)(struct visor_device *dev);
+
+ /** Called to initiate a change of the device's state. If the return
+ * valu`e is < 0, there was an error and the state transition will NOT
+ * occur. If the return value is >= 0, then the state transition was
+ * INITIATED successfully, and complete_func() will be called (or was
+ * just called) with the final status when either the state transition
+ * fails or completes successfully.
+ */
+ int (*pause)(struct visor_device *dev,
+ visorbus_state_complete_func complete_func);
+ int (*resume)(struct visor_device *dev,
+ visorbus_state_complete_func complete_func);
+
+ /** These fields are for private use by the bus driver only. */
+ struct device_driver driver;
+ struct driver_attribute version_attr;
+};
+
+#define to_visor_driver(x) container_of(x, struct visor_driver, driver)
+
+/** A device type for things "plugged" into the visorbus bus */
+
+struct visor_device {
+ /** visor driver can use the visorchannel member with the functions
+ * defined in visorchannel.h to access the channel
+ */
+ struct visorchannel *visorchannel;
+ uuid_le channel_type_guid;
+ u64 channel_bytes;
+
+ /** These fields are for private use by the bus driver only.
+ * A notable exception is that the visor driver can use
+ * visor_get_drvdata() and visor_set_drvdata() to retrieve or stash
+ * private visor driver specific data within the device member.
+ */
+ struct device device;
+ struct list_head list_all;
+ struct periodic_work *periodic_work;
+ bool being_removed;
+ bool responded_to_device_create;
+ struct kobject kobjdevmajorminor; /* visorbus<x>/dev<y>/devmajorminor/*/
+ struct {
+ int major, minor;
+ void *attr; /* private use by devmajorminor_attr.c you can
+ * change this constant to whatever you
+ * want; */
+ } devnodes[5];
+ /* the code will detect and behave appropriately) */
+ struct semaphore visordriver_callback_lock;
+ bool pausing;
+ bool resuming;
+ u32 chipset_bus_no;
+ u32 chipset_dev_no;
+ struct visorchipset_state state;
+ uuid_le type;
+ uuid_le inst;
+ u8 *name;
+ u8 *description;
+ struct controlvm_message_header *pending_msg_hdr;
+ void *vbus_hdr_info;
+ u32 switch_no;
+ u32 internal_port_no;
+ uuid_le partition_uuid;
+};
+
+#define to_visor_device(x) container_of(x, struct visor_device, device)
+
+#ifndef STANDALONE_CLIENT
+int visorbus_register_visor_driver(struct visor_driver *);
+void visorbus_unregister_visor_driver(struct visor_driver *);
+int visorbus_read_channel(struct visor_device *dev,
+ unsigned long offset, void *dest,
+ unsigned long nbytes);
+int visorbus_write_channel(struct visor_device *dev,
+ unsigned long offset, void *src,
+ unsigned long nbytes);
+int visorbus_clear_channel(struct visor_device *dev,
+ unsigned long offset, u8 ch, unsigned long nbytes);
+int visorbus_registerdevnode(struct visor_device *dev,
+ const char *name, int major, int minor);
+void visorbus_enable_channel_interrupts(struct visor_device *dev);
+void visorbus_disable_channel_interrupts(struct visor_device *dev);
+#endif
+
+/* Note that for visorchannel_create()
+ * <channel_bytes> and <guid> arguments may be 0 if we are a channel CLIENT.
+ * In this case, the values can simply be read from the channel header.
+ */
+struct visorchannel *visorchannel_create(u64 physaddr,
+ unsigned long channel_bytes,
+ gfp_t gfp, uuid_le guid);
+struct visorchannel *visorchannel_create_with_lock(u64 physaddr,
+ unsigned long channel_bytes,
+ gfp_t gfp, uuid_le guid);
+void visorchannel_destroy(struct visorchannel *channel);
+int visorchannel_read(struct visorchannel *channel, ulong offset,
+ void *local, ulong nbytes);
+int visorchannel_write(struct visorchannel *channel, ulong offset,
+ void *local, ulong nbytes);
+int visorchannel_clear(struct visorchannel *channel, ulong offset,
+ u8 ch, ulong nbytes);
+bool visorchannel_signalremove(struct visorchannel *channel, u32 queue,
+ void *msg);
+bool visorchannel_signalinsert(struct visorchannel *channel, u32 queue,
+ void *msg);
+int visorchannel_signalqueue_slots_avail(struct visorchannel *channel,
+ u32 queue);
+int visorchannel_signalqueue_max_slots(struct visorchannel *channel, u32 queue);
+u64 visorchannel_get_physaddr(struct visorchannel *channel);
+ulong visorchannel_get_nbytes(struct visorchannel *channel);
+char *visorchannel_id(struct visorchannel *channel, char *s);
+char *visorchannel_zoneid(struct visorchannel *channel, char *s);
+u64 visorchannel_get_clientpartition(struct visorchannel *channel);
+int visorchannel_set_clientpartition(struct visorchannel *channel,
+ u64 partition_handle);
+uuid_le visorchannel_get_uuid(struct visorchannel *channel);
+char *visorchannel_uuid_id(uuid_le *guid, char *s);
+void visorchannel_debug(struct visorchannel *channel, int num_queues,
+ struct seq_file *seq, u32 off);
+void __iomem *visorchannel_get_header(struct visorchannel *channel);
+
+#define BUS_ROOT_DEVICE UINT_MAX
+struct visor_device *visorbus_get_device_by_id(u32 bus_no, u32 dev_no,
+ struct visor_device *from);
+#endif