Merge tag 'tty-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[cascardo/linux.git] / drivers / staging / unisys / common-spar / include / channels / channel.h
index 8f3aec9..15a8d6b 100644 (file)
@@ -36,7 +36,7 @@
 #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))
+       (SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32))
 
 #ifndef lengthof
 #define lengthof(TYPE, MEMBER) (sizeof(((TYPE *)0)->MEMBER))
@@ -71,7 +71,7 @@ typedef enum {
                                 * access channel anytime */
 } CHANNEL_CLIENTSTATE;
 static inline const u8 *
-ULTRA_CHANNELCLI_STRING(U32 v)
+ULTRA_CHANNELCLI_STRING(u32 v)
 {
        switch (v) {
        case CHANNELCLI_DETACHED:
@@ -209,34 +209,34 @@ ULTRA_CHANNELCLI_STRING(U32 v)
 #pragma pack(push, 1)          /* both GCC and VC now allow this pragma */
 /* Common Channel Header */
 typedef struct _CHANNEL_HEADER {
-       U64 Signature;          /* Signature */
-       U32 LegacyState;        /* DEPRECATED - being replaced by */
+       u64 Signature;          /* Signature */
+       u32 LegacyState;        /* DEPRECATED - being replaced by */
        /* /              SrvState, CliStateBoot, and CliStateOS below */
-       U32 HeaderSize;         /* sizeof(CHANNEL_HEADER) */
-       U64 Size;               /* Total size of this channel in bytes */
-       U64 Features;           /* Flags to modify behavior */
+       u32 HeaderSize;         /* sizeof(CHANNEL_HEADER) */
+       u64 Size;               /* Total size of this channel in bytes */
+       u64 Features;           /* Flags to modify behavior */
        uuid_le Type;           /* Channel type: data, bus, control, etc. */
-       U64 PartitionHandle;    /* ID of guest partition */
-       U64 Handle;             /* Device number of this channel in client */
-       U64 oChannelSpace;      /* Offset in bytes to channel specific area */
-       U32 VersionId;          /* CHANNEL_HEADER Version ID */
-       U32 PartitionIndex;     /* Index of guest partition */
+       u64 PartitionHandle;    /* ID of guest partition */
+       u64 Handle;             /* Device number of this channel in client */
+       u64 oChannelSpace;      /* Offset in bytes to channel specific area */
+       u32 VersionId;          /* CHANNEL_HEADER Version ID */
+       u32 PartitionIndex;     /* Index of guest partition */
        uuid_le ZoneGuid;               /* Guid of Channel's zone */
-       U32 oClientString;      /* offset from channel header to
+       u32 oClientString;      /* offset from channel header to
                                 * nul-terminated ClientString (0 if
                                 * ClientString not present) */
-       U32 CliStateBoot;       /* CHANNEL_CLIENTSTATE of pre-boot
+       u32 CliStateBoot;       /* CHANNEL_CLIENTSTATE of pre-boot
                                 * EFI client of this channel */
-       U32 CmdStateCli;        /* CHANNEL_COMMANDSTATE (overloaded in
+       u32 CmdStateCli;        /* CHANNEL_COMMANDSTATE (overloaded in
                                 * Windows drivers, see ServerStateUp,
                                 * ServerStateDown, etc) */
-       U32 CliStateOS;         /* CHANNEL_CLIENTSTATE of Guest OS
+       u32 CliStateOS;         /* CHANNEL_CLIENTSTATE of Guest OS
                                 * client of this channel */
-       U32 ChannelCharacteristics;     /* CHANNEL_CHARACTERISTIC_<xxx> */
-       U32 CmdStateSrv;        /* CHANNEL_COMMANDSTATE (overloaded in
+       u32 ChannelCharacteristics;     /* CHANNEL_CHARACTERISTIC_<xxx> */
+       u32 CmdStateSrv;        /* CHANNEL_COMMANDSTATE (overloaded in
                                 * Windows drivers, see ServerStateUp,
                                 * ServerStateDown, etc) */
-       U32 SrvState;           /* CHANNEL_SERVERSTATE */
+       u32 SrvState;           /* CHANNEL_SERVERSTATE */
        u8 CliErrorBoot;        /* bits to indicate err states for
                                 * boot clients, so err messages can
                                 * be throttled */
@@ -253,34 +253,34 @@ typedef struct _CHANNEL_HEADER {
 /* Subheader for the Signal Type variation of the Common Channel */
 typedef struct _SIGNAL_QUEUE_HEADER {
        /* 1st cache line */
-       U32 VersionId;          /* SIGNAL_QUEUE_HEADER Version ID */
-       U32 Type;               /* Queue type: storage, network */
-       U64 Size;               /* Total size of this queue in bytes */
-       U64 oSignalBase;        /* Offset to signal queue area */
-       U64 FeatureFlags;       /* Flags to modify behavior */
-       U64 NumSignalsSent;     /* Total # of signals placed in this queue */
-       U64 NumOverflows;       /* Total # of inserts failed due to
+       u32 VersionId;          /* SIGNAL_QUEUE_HEADER Version ID */
+       u32 Type;               /* Queue type: storage, network */
+       u64 Size;               /* Total size of this queue in bytes */
+       u64 oSignalBase;        /* Offset to signal queue area */
+       u64 FeatureFlags;       /* Flags to modify behavior */
+       u64 NumSignalsSent;     /* Total # of signals placed in this queue */
+       u64 NumOverflows;       /* Total # of inserts failed due to
                                 * full queue */
-       U32 SignalSize;         /* Total size of a signal for this queue */
-       U32 MaxSignalSlots;     /* Max # of slots in queue, 1 slot is
+       u32 SignalSize;         /* Total size of a signal for this queue */
+       u32 MaxSignalSlots;     /* Max # of slots in queue, 1 slot is
                                 * always empty */
-       U32 MaxSignals;         /* Max # of signals in queue
+       u32 MaxSignals;         /* Max # of signals in queue
                                 * (MaxSignalSlots-1) */
-       U32 Head;               /* Queue head signal # */
+       u32 Head;               /* Queue head signal # */
        /* 2nd cache line */
-       U64 NumSignalsReceived; /* Total # of signals removed from this queue */
-       U32 Tail;               /* Queue tail signal # (on separate
+       u64 NumSignalsReceived; /* Total # of signals removed from this queue */
+       u32 Tail;               /* Queue tail signal # (on separate
                                 * cache line) */
-       U32 Reserved1;          /* Reserved field */
-       U64 Reserved2;          /* Resrved field */
-       U64 ClientQueue;
-       U64 NumInterruptsReceived;      /* Total # of Interrupts received.  This
+       u32 Reserved1;          /* Reserved field */
+       u64 Reserved2;          /* Resrved field */
+       u64 ClientQueue;
+       u64 NumInterruptsReceived;      /* Total # of Interrupts received.  This
                                         * is incremented by the ISR in the
                                         * guest windows driver */
-       U64 NumEmptyCnt;        /* Number of times that visor_signal_remove
+       u64 NumEmptyCnt;        /* Number of times that visor_signal_remove
                                 * is called and returned Empty
                                 * Status. */
-       U32 ErrorFlags;         /* Error bits set during SignalReinit
+       u32 ErrorFlags;         /* Error bits set during SignalReinit
                                 * to denote trouble with client's
                                 * fields */
        u8 Filler[12];          /* Pad out to 64 byte cacheline */
@@ -290,13 +290,13 @@ typedef struct _SIGNAL_QUEUE_HEADER {
 
 #define SignalInit(chan, QHDRFLD, QDATAFLD, QDATATYPE, ver, typ)       \
        do {                                                            \
-               MEMSET(&chan->QHDRFLD, 0, sizeof(chan->QHDRFLD));       \
+               memset(&chan->QHDRFLD, 0, sizeof(chan->QHDRFLD));       \
                chan->QHDRFLD.VersionId = ver;                          \
                chan->QHDRFLD.Type = typ;                               \
                chan->QHDRFLD.Size = sizeof(chan->QDATAFLD);            \
                chan->QHDRFLD.SignalSize = sizeof(QDATATYPE);           \
-               chan->QHDRFLD.oSignalBase = (UINTN)(chan->QDATAFLD)-    \
-                       (UINTN)(&chan->QHDRFLD);                        \
+               chan->QHDRFLD.oSignalBase = (u64)(chan->QDATAFLD)-      \
+                       (u64)(&chan->QHDRFLD);                          \
                chan->QHDRFLD.MaxSignalSlots =                          \
                        sizeof(chan->QDATAFLD)/sizeof(QDATATYPE);       \
                chan->QHDRFLD.MaxSignals = chan->QHDRFLD.MaxSignalSlots-1; \
@@ -311,15 +311,15 @@ static inline int
 ULTRA_check_channel_client(void __iomem *pChannel,
                           uuid_le expectedTypeGuid,
                           char *channelName,
-                          U64 expectedMinBytes,
-                          U32 expectedVersionId,
-                          U64 expectedSignature,
+                          u64 expectedMinBytes,
+                          u32 expectedVersionId,
+                          u64 expectedSignature,
                           char *fileName, int lineNumber, void *logCtx)
 {
        if (uuid_le_cmp(expectedTypeGuid, NULL_UUID_LE) != 0)
                /* caller wants us to verify type GUID */
-               if (MEMCMP_IO(&(((CHANNEL_HEADER __iomem *) (pChannel))->Type),
-                          &expectedTypeGuid, sizeof(uuid_le)) != 0) {
+               if (uuid_le_cmp((((CHANNEL_HEADER __iomem *)(pChannel))->Type),
+                          expectedTypeGuid) != 0) {
                        CHANNEL_GUID_MISMATCH(expectedTypeGuid, channelName,
                                              "type", expectedTypeGuid,
                                              ((CHANNEL_HEADER __iomem *)
@@ -373,8 +373,8 @@ ULTRA_check_channel_client(void __iomem *pChannel,
 static inline int
 ULTRA_check_channel_server(uuid_le typeGuid,
                           char *channelName,
-                          U64 expectedMinBytes,
-                          U64 actualBytes,
+                          u64 expectedMinBytes,
+                          u64 actualBytes,
                           char *fileName, int lineNumber, void *logCtx)
 {
        if (expectedMinBytes > 0)       /* caller wants us to verify
@@ -588,7 +588,7 @@ ULTRA_channel_client_release_os(void __iomem *pChannel, u8 *chanId,
 * full.
 */
 
-unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
+unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
                                  void *pSignal);
 
 /*
@@ -610,7 +610,7 @@ unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
 * empty.
 */
 
-unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
+unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, u32 Queue,
                                  void *pSignal);
 
 /*
@@ -632,7 +632,7 @@ unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
 * Return value:
 * # of signals copied.
 */
-unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, U32 Queue,
+unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, u32 Queue,
                             void *pSignal);
 
 /*
@@ -647,6 +647,6 @@ unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, U32 Queue,
 * 1 if the signal queue is empty, 0 otherwise.
 */
 unsigned char visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel,
-                                     U32 Queue);
+                                     u32 Queue);
 
 #endif