Staging: unisys: Clean multiple sparse warnings
authorKen Cox <jkc@redhat.com>
Thu, 13 Mar 2014 20:39:19 +0000 (15:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Mar 2014 21:45:44 +0000 (14:45 -0700)
Cleaned up multiple sparse warnings, mostly due to improper access of I/O
space.  Also declared functions and variables that were only used locally
as static.

Removed ULTRA_disp_channel_header(), ULTRA_disp_channel(),
ULTRA_disp_vnic_channel() because they were never called.

Signed-off-by: Ken Cox <jkc@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/common-spar/include/channels/channel.h
drivers/staging/unisys/common-spar/include/channels/iochannel.h
drivers/staging/unisys/common-spar/include/channels/vbuschannel.h
drivers/staging/unisys/common-spar/include/vbusdeviceinfo.h
drivers/staging/unisys/common-spar/include/vmcallinterface.h
drivers/staging/unisys/uislib/uislib.c
drivers/staging/unisys/virthba/virthba.c
drivers/staging/unisys/virtpci/virtpci.c

index 284ac68e8efcfaf3669c18c905bc7ec643d00925..aee204172b218fb71bbe730faac9b5fc481b7cec 100644 (file)
@@ -105,7 +105,7 @@ ULTRA_CHANNELCLI_STRING(U32 v)
 
 #define ULTRA_CHANNELSRV_IS_READY(x)     ((x) == CHANNELSRV_READY)
 #define ULTRA_CHANNEL_SERVER_READY(pChannel) \
-       (ULTRA_CHANNELSRV_IS_READY((pChannel)->SrvState))
+       (ULTRA_CHANNELSRV_IS_READY(readl(&(pChannel)->SrvState)))
 
 #define ULTRA_VALID_CHANNELCLI_TRANSITION(o, n)                                \
        (((((o) == CHANNELCLI_DETACHED) && ((n) == CHANNELCLI_DISABLED)) || \
@@ -144,25 +144,30 @@ ULTRA_CHANNELCLI_STRING(U32 v)
                                      line);                            \
        } while (0)
 
-#define ULTRA_CHANNEL_CLIENT_TRANSITION(pChan, chanId, field, \
+#define ULTRA_CHANNEL_CLIENT_TRANSITION(pChan, chanId,                 \
                                        newstate, logCtx)               \
        do {                                                            \
                ULTRA_CHANNEL_CLIENT_CHK_TRANSITION(                    \
-                       (((CHANNEL_HEADER *)(pChan))->field), newstate, \
+                       readl(&(((CHANNEL_HEADER __iomem *) \
+                                (pChan))->CliStateOS)),                \
+                       newstate,                                       \
                        chanId, logCtx, __FILE__, __LINE__);            \
                UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK, \
                        CHANNELSTATE_DIAG_SEVERITY, \
                              CHANNELSTATE_DIAG_SUBSYS,                 \
                              __func__, __LINE__,                       \
                              "%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n", \
-                             chanId, #field,                           \
-                             ULTRA_CHANNELCLI_STRING(((CHANNEL_HEADER *) \
-                                                      (pChan))->field), \
-                             ((CHANNEL_HEADER *)(pChan))->field,       \
+                             chanId, "CliStateOS",                     \
+                             ULTRA_CHANNELCLI_STRING( \
+                                     readl(&((CHANNEL_HEADER __iomem *) \
+                                             (pChan))->CliStateOS)),   \
+                             readl(&((CHANNEL_HEADER __iomem *) \
+                                     (pChan))->CliStateOS),            \
                              ULTRA_CHANNELCLI_STRING(newstate),        \
                              newstate,                                 \
                              PathName_Last_N_Nodes(__FILE__, 4), __LINE__); \
-               ((CHANNEL_HEADER *)(pChan))->field = newstate;          \
+               writel(newstate, &((CHANNEL_HEADER __iomem *) \
+                                  (pChan))->CliStateOS);               \
                MEMORYBARRIER;                                          \
        } while (0)
 
@@ -314,7 +319,7 @@ typedef struct _SIGNAL_QUEUE_HEADER {
  * is used to pass the EFI_DIAG_CAPTURE_PROTOCOL needed to log messages.
  */
 static inline int
-ULTRA_check_channel_client(void *pChannel,
+ULTRA_check_channel_client(void __iomem *pChannel,
                           GUID expectedTypeGuid,
                           char *channelName,
                           U64 expectedMinBytes,
@@ -324,43 +329,44 @@ ULTRA_check_channel_client(void *pChannel,
 {
        if (MEMCMP(&expectedTypeGuid, &Guid0, sizeof(GUID)) != 0)
                /* caller wants us to verify type GUID */
-               if (MEMCMP(&(((CHANNEL_HEADER *) (pChannel))->Type),
+               if (MEMCMP_IO(&(((CHANNEL_HEADER __iomem *) (pChannel))->Type),
                           &expectedTypeGuid, sizeof(GUID)) != 0) {
                        CHANNEL_GUID_MISMATCH(expectedTypeGuid, channelName,
                                              "type", expectedTypeGuid,
-                                             ((CHANNEL_HEADER *)
+                                             ((CHANNEL_HEADER __iomem *)
                                               (pChannel))->Type, fileName,
                                              lineNumber, logCtx);
                        return 0;
                }
        if (expectedMinBytes > 0)       /* caller wants us to verify
                                         * channel size */
-               if (((CHANNEL_HEADER *) (pChannel))->Size < expectedMinBytes) {
+               if (readq(&((CHANNEL_HEADER __iomem *)
+                          (pChannel))->Size) < expectedMinBytes) {
                        CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName,
                                             "size", expectedMinBytes,
-                                            ((CHANNEL_HEADER *)
+                                            ((CHANNEL_HEADER __iomem *)
                                              (pChannel))->Size, fileName,
                                             lineNumber, logCtx);
                        return 0;
                }
        if (expectedVersionId > 0)      /* caller wants us to verify
                                         * channel version */
-               if (((CHANNEL_HEADER *) (pChannel))->VersionId !=
-                   expectedVersionId) {
+               if (readl(&((CHANNEL_HEADER __iomem *) (pChannel))->VersionId)
+                   != expectedVersionId) {
                        CHANNEL_U32_MISMATCH(expectedTypeGuid, channelName,
                                             "version", expectedVersionId,
-                                            ((CHANNEL_HEADER *)
+                                            ((CHANNEL_HEADER __iomem *)
                                              (pChannel))->VersionId, fileName,
                                             lineNumber, logCtx);
                        return 0;
                }
        if (expectedSignature > 0)      /* caller wants us to verify
                                         * channel signature */
-               if (((CHANNEL_HEADER *) (pChannel))->Signature !=
-                   expectedSignature) {
+               if (readq(&((CHANNEL_HEADER __iomem *) (pChannel))->Signature)
+                   != expectedSignature) {
                        CHANNEL_U64_MISMATCH(expectedTypeGuid, channelName,
                                             "signature", expectedSignature,
-                                            ((CHANNEL_HEADER *)
+                                            ((CHANNEL_HEADER __iomem *)
                                              (pChannel))->Signature, fileName,
                                             lineNumber, logCtx);
                        return 0;
@@ -422,17 +428,18 @@ PathName_Last_N_Nodes(U8 *s, unsigned int n)
 }
 
 static inline int
-ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
-                               char *file, int line, char *func)
+ULTRA_channel_client_acquire_os(void __iomem *pChannel, U8 *chanId,
+                               void *logCtx, char *file, int line, char *func)
 {
-       CHANNEL_HEADER *pChan = (CHANNEL_HEADER *) (pChannel);
+       CHANNEL_HEADER __iomem *pChan = pChannel;
 
-       if (pChan->CliStateOS == CHANNELCLI_DISABLED) {
-               if ((pChan->
-                    CliErrorOS & ULTRA_CLIERROROS_THROTTLEMSG_DISABLED) == 0) {
+       if (readl(&pChan->CliStateOS) == CHANNELCLI_DISABLED) {
+               if ((readb(&pChan->CliErrorOS)
+                    & ULTRA_CLIERROROS_THROTTLEMSG_DISABLED) == 0) {
                        /* we are NOT throttling this message */
-                       pChan->CliErrorOS |=
-                               ULTRA_CLIERROROS_THROTTLEMSG_DISABLED;
+                       writeb(readb(&pChan->CliErrorOS) |
+                              ULTRA_CLIERROROS_THROTTLEMSG_DISABLED,
+                              &pChan->CliErrorOS);
                        /* throttle until acquire successful */
 
                        UltraLogEvent(logCtx,
@@ -445,24 +452,25 @@ ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
                }
                return 0;
        }
-       if ((pChan->CliStateOS != CHANNELCLI_OWNED)
-           && (pChan->CliStateBoot == CHANNELCLI_DISABLED)) {
+       if ((readl(&pChan->CliStateOS) != CHANNELCLI_OWNED)
+           && (readl(&pChan->CliStateBoot) == CHANNELCLI_DISABLED)) {
                /* Our competitor is DISABLED, so we can transition to OWNED */
                UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK,
                              CHANNELSTATE_DIAG_SEVERITY,
                              CHANNELSTATE_DIAG_SUBSYS, func, line,
                              "%s Channel StateTransition (%s) %s(%d)-->%s(%d) @%s:%d\n",
                              chanId, "CliStateOS",
-                             ULTRA_CHANNELCLI_STRING(pChan->CliStateOS),
-                             pChan->CliStateOS,
+                             ULTRA_CHANNELCLI_STRING(
+                                     readl(&pChan->CliStateOS)),
+                             readl(&pChan->CliStateOS),
                              ULTRA_CHANNELCLI_STRING(CHANNELCLI_OWNED),
                              CHANNELCLI_OWNED,
                              PathName_Last_N_Nodes((U8 *) file, 4), line);
-               pChan->CliStateOS = CHANNELCLI_OWNED;
+               writel(CHANNELCLI_OWNED, &pChan->CliStateOS);
                MEMORYBARRIER;
        }
-       if (pChan->CliStateOS == CHANNELCLI_OWNED) {
-               if (pChan->CliErrorOS != 0) {
+       if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED) {
+               if (readb(&pChan->CliErrorOS) != 0) {
                        /* we are in an error msg throttling state;
                         * come out of it */
                        UltraLogEvent(logCtx,
@@ -472,7 +480,7 @@ ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
                                      "%s Channel OS client acquire now successful @%s:%d\n",
                                      chanId, PathName_Last_N_Nodes((U8 *) file,
                                                                    4), line);
-                       pChan->CliErrorOS = 0;
+                       writeb(0, &pChan->CliErrorOS);
                }
                return 1;
        }
@@ -480,13 +488,13 @@ ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
        /* 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 (pChan->CliStateOS != CHANNELCLI_ATTACHED) {
-               if ((pChan->
-                    CliErrorOS & ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) ==
-                   0) {
+       if (readl(&pChan->CliStateOS) != CHANNELCLI_ATTACHED) {
+               if ((readb(&pChan->CliErrorOS)
+                    & ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED) == 0) {
                        /* we are NOT throttling this message */
-                       pChan->CliErrorOS |=
-                               ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED;
+                       writeb(readb(&pChan->CliErrorOS) |
+                              ULTRA_CLIERROROS_THROTTLEMSG_NOTATTACHED,
+                              &pChan->CliErrorOS);
                        /* throttle until acquire successful */
                        UltraLogEvent(logCtx,
                                      CHANNELSTATE_DIAG_EVENTID_TRANSITERR,
@@ -494,20 +502,23 @@ ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
                                      CHANNELSTATE_DIAG_SUBSYS, func, line,
                                      "%s Channel StateTransition INVALID! - acquire failed because OS client NOT ATTACHED (state=%s(%d)) @%s:%d\n",
                                      chanId,
-                                     ULTRA_CHANNELCLI_STRING(pChan->CliStateOS),
-                                     pChan->CliStateOS,
+                                     ULTRA_CHANNELCLI_STRING(
+                                             readl(&pChan->CliStateOS)),
+                                     readl(&pChan->CliStateOS),
                                      PathName_Last_N_Nodes((U8 *) file, 4),
                                      line);
                }
                return 0;
        }
-       pChan->CliStateOS = CHANNELCLI_BUSY;
+       writel(CHANNELCLI_BUSY, &pChan->CliStateOS);
        MEMORYBARRIER;
-       if (pChan->CliStateBoot == CHANNELCLI_BUSY) {
-               if ((pChan->CliErrorOS & ULTRA_CLIERROROS_THROTTLEMSG_BUSY) ==
-                   0) {
+       if (readl(&pChan->CliStateBoot) == CHANNELCLI_BUSY) {
+               if ((readb(&pChan->CliErrorOS)
+                    & ULTRA_CLIERROROS_THROTTLEMSG_BUSY) == 0) {
                        /* we are NOT throttling this message */
-                       pChan->CliErrorOS |= ULTRA_CLIERROROS_THROTTLEMSG_BUSY;
+                       writeb(readb(&pChan->CliErrorOS) |
+                              ULTRA_CLIERROROS_THROTTLEMSG_BUSY,
+                              &pChan->CliErrorOS);
                        /* throttle until acquire successful */
                        UltraLogEvent(logCtx,
                                      CHANNELSTATE_DIAG_EVENTID_TRANSITBUSY,
@@ -517,11 +528,12 @@ ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
                                      chanId, PathName_Last_N_Nodes((U8 *) file,
                                                                    4), line);
                }
-               pChan->CliStateOS = CHANNELCLI_ATTACHED;        /* reset busy */
+               /* reset busy */
+               writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS);
                MEMORYBARRIER;
                return 0;
        }
-       if (pChan->CliErrorOS != 0) {
+       if (readb(&pChan->CliErrorOS) != 0) {
                /* we are in an error msg throttling state; come out of it */
                UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK,
                              CHANNELSTATE_DIAG_SEVERITY,
@@ -529,17 +541,17 @@ ULTRA_channel_client_acquire_os(void *pChannel, U8 *chanId, void *logCtx,
                              "%s Channel OS client acquire now successful @%s:%d\n",
                              chanId, PathName_Last_N_Nodes((U8 *) file, 4),
                              line);
-               pChan->CliErrorOS = 0;
+               writeb(0, &pChan->CliErrorOS);
        }
        return 1;
 }
 
 static inline void
-ULTRA_channel_client_release_os(void *pChannel, U8 *chanId, void *logCtx,
-                               char *file, int line, char *func)
+ULTRA_channel_client_release_os(void __iomem *pChannel, U8 *chanId,
+                               void *logCtx, char *file, int line, char *func)
 {
-       CHANNEL_HEADER *pChan = (CHANNEL_HEADER *) (pChannel);
-       if (pChan->CliErrorOS != 0) {
+       CHANNEL_HEADER __iomem *pChan = pChannel;
+       if (readb(&pChan->CliErrorOS) != 0) {
                /* we are in an error msg throttling state; come out of it */
                UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITOK,
                              CHANNELSTATE_DIAG_SEVERITY,
@@ -547,22 +559,23 @@ ULTRA_channel_client_release_os(void *pChannel, U8 *chanId, void *logCtx,
                              "%s Channel OS client error state cleared @%s:%d\n",
                              chanId, PathName_Last_N_Nodes((U8 *) file, 4),
                              line);
-               pChan->CliErrorOS = 0;
+               writeb(0, &pChan->CliErrorOS);
        }
-       if (pChan->CliStateOS == CHANNELCLI_OWNED)
+       if (readl(&pChan->CliStateOS) == CHANNELCLI_OWNED)
                return;
-       if (pChan->CliStateOS != CHANNELCLI_BUSY) {
+       if (readl(&pChan->CliStateOS) != CHANNELCLI_BUSY) {
                UltraLogEvent(logCtx, CHANNELSTATE_DIAG_EVENTID_TRANSITERR,
                              CHANNELSTATE_DIAG_SEVERITY,
                              CHANNELSTATE_DIAG_SUBSYS, func, line,
                              "%s Channel StateTransition INVALID! - release failed because OS client NOT BUSY (state=%s(%d)) @%s:%d\n",
                              chanId,
-                             ULTRA_CHANNELCLI_STRING(pChan->CliStateOS),
-                             pChan->CliStateOS,
+                             ULTRA_CHANNELCLI_STRING(
+                                     readl(&pChan->CliStateOS)),
+                             readl(&pChan->CliStateOS),
                              PathName_Last_N_Nodes((U8 *) file, 4), line);
                /* return; */
        }
-       pChan->CliStateOS = CHANNELCLI_ATTACHED;        /* release busy */
+       writel(CHANNELCLI_ATTACHED, &pChan->CliStateOS); /* release busy */
 }
 
 /*
@@ -584,7 +597,7 @@ ULTRA_channel_client_release_os(void *pChannel, U8 *chanId, void *logCtx,
 * full.
 */
 
-unsigned char visor_signal_insert(pCHANNEL_HEADER pChannel, U32 Queue,
+unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
                                  void *pSignal);
 
 /*
@@ -606,7 +619,7 @@ unsigned char visor_signal_insert(pCHANNEL_HEADER pChannel, U32 Queue,
 * empty.
 */
 
-unsigned char visor_signal_remove(pCHANNEL_HEADER pChannel, U32 Queue,
+unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
                                  void *pSignal);
 
 /*
@@ -642,6 +655,7 @@ unsigned int SignalRemoveAll(pCHANNEL_HEADER pChannel, U32 Queue,
 * Return value:
 * 1 if the signal queue is empty, 0 otherwise.
 */
-unsigned char visor_signalqueue_empty(pCHANNEL_HEADER pChannel, U32 Queue);
+unsigned char visor_signalqueue_empty(CHANNEL_HEADER __iomem *pChannel,
+                                     U32 Queue);
 
 #endif
index 94e4b2afd55fadf22ef2d66feb54e0afc562ef4e..8de1d249d55f455ac9e80f1299cb654a92cad5cc 100644 (file)
@@ -33,6 +33,7 @@
 #include "vmcallinterface.h"
 
 #define _ULTRA_CONTROLVM_CHANNEL_INLINE_
+#include <linux/dma-direction.h>
 #include "controlvmchannel.h"
 #include "vbuschannel.h"
 #undef _ULTRA_CONTROLVM_CHANNEL_INLINE_
 
 /* size of cdb - i.e., scsi cmnd */
 #define MAX_CMND_SIZE 16
-enum dma_data_dir {
-       DMA_DIR_BIDIR = 0,
-       DMA_DIR_TO_DEV,
-       DMA_DIR_FROM_DEV,
-       DMA_DIR_NONE
-};
 
 #define MAX_SENSE_SIZE 64
 
@@ -297,7 +292,7 @@ struct uiscmdrsp_scsi {
        struct guest_phys_info gpi_list[MAX_PHYS_INFO]; /* physical address
                                                         * information for each
                                                         * fragment */
-       enum dma_data_dir data_dir;     /* direction of the data, if any */
+       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 */
 
index ec5a8c0fd5045d5b2ad866b81f85f68430a8abb3..99dbbcf3d11ed5c5d30d6e5519d5c6ef3d83834c 100644 (file)
@@ -94,32 +94,40 @@ typedef struct _ULTRA_VBUS_CHANNEL_PROTOCOL {
 #define VBUS_CH_SIZE(MAXDEVICES) COVER(VBUS_CH_SIZE_EXACT(MAXDEVICES), 4096)
 
 static INLINE void
-ULTRA_VBUS_init_channel(ULTRA_VBUS_CHANNEL_PROTOCOL *x, int bytesAllocated)
+ULTRA_VBUS_init_channel(ULTRA_VBUS_CHANNEL_PROTOCOL __iomem *x,
+                       int bytesAllocated)
 {
        /* Please note that the memory at <x> does NOT necessarily have space
        * for DevInfo structs allocated at the end, which is why we do NOT use
        * <bytesAllocated> to clear. */
-       MEMSET(x, 0, sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL));
+       memset_io(x, 0, sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL));
        if (bytesAllocated < (int) sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL))
                return;
-       x->ChannelHeader.VersionId = ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID;
-       x->ChannelHeader.Signature = ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE;
-       x->ChannelHeader.SrvState = CHANNELSRV_READY;
-       x->ChannelHeader.HeaderSize = sizeof(x->ChannelHeader);
-       x->ChannelHeader.Size = bytesAllocated;
-       x->ChannelHeader.Type = UltraVbusChannelProtocolGuid;
-       x->ChannelHeader.ZoneGuid = Guid0;
-       x->HdrInfo.structBytes = sizeof(ULTRA_VBUS_HEADERINFO);
-       x->HdrInfo.chpInfoByteOffset = sizeof(ULTRA_VBUS_HEADERINFO);
-       x->HdrInfo.busInfoByteOffset = x->HdrInfo.chpInfoByteOffset
-           + sizeof(ULTRA_VBUS_DEVICEINFO);
-       x->HdrInfo.devInfoByteOffset = x->HdrInfo.busInfoByteOffset
-           + sizeof(ULTRA_VBUS_DEVICEINFO);
-       x->HdrInfo.deviceInfoStructBytes = sizeof(ULTRA_VBUS_DEVICEINFO);
+       writel(ULTRA_VBUS_CHANNEL_PROTOCOL_VERSIONID,
+              &x->ChannelHeader.VersionId);
+       writeq(ULTRA_VBUS_CHANNEL_PROTOCOL_SIGNATURE,
+              &x->ChannelHeader.Signature);
+       writel(CHANNELSRV_READY, &x->ChannelHeader.SrvState);
+       writel(sizeof(x->ChannelHeader), &x->ChannelHeader.HeaderSize);
+       writeq(bytesAllocated, &x->ChannelHeader.Size);
+       memcpy_toio(&x->ChannelHeader.Type, &UltraVbusChannelProtocolGuid,
+                   sizeof(x->ChannelHeader.Type));
+       memcpy_toio(&x->ChannelHeader.ZoneGuid, &Guid0,
+                   sizeof(x->ChannelHeader.ZoneGuid));
+       writel(sizeof(ULTRA_VBUS_HEADERINFO), &x->HdrInfo.structBytes);
+       writel(sizeof(ULTRA_VBUS_HEADERINFO), &x->HdrInfo.chpInfoByteOffset);
+       writel(readl(&x->HdrInfo.chpInfoByteOffset) +
+              sizeof(ULTRA_VBUS_DEVICEINFO),
+              &x->HdrInfo.busInfoByteOffset);
+       writel(readl(&x->HdrInfo.busInfoByteOffset)
+              + sizeof(ULTRA_VBUS_DEVICEINFO),
+              &x->HdrInfo.devInfoByteOffset);
+       writel(sizeof(ULTRA_VBUS_DEVICEINFO),
+              &x->HdrInfo.deviceInfoStructBytes);
        bytesAllocated -= (sizeof(ULTRA_CHANNEL_PROTOCOL)
-                          + x->HdrInfo.devInfoByteOffset);
-       x->HdrInfo.devInfoCount =
-           bytesAllocated / x->HdrInfo.deviceInfoStructBytes;
+                          + readl(&x->HdrInfo.devInfoByteOffset));
+       writel(bytesAllocated / readl(&x->HdrInfo.deviceInfoStructBytes),
+              &x->HdrInfo.devInfoCount);
 }
 
 #pragma pack(pop)
index 373677908915ba3a8a7512065e7037a936783c1c..ae708faaa94dc918286e1395be2e5f4ca7cc93a2 100644 (file)
@@ -50,12 +50,12 @@ typedef struct _ULTRA_VBUS_DEVICEINFO {
  * to a buffer at <p>, had it been infinitely big.
  */
 static inline int
-VBUSCHANNEL_sanitize_buffer(char *p, int remain, char *src, int srcmax)
+VBUSCHANNEL_sanitize_buffer(char *p, int remain, char __iomem *src, int srcmax)
 {
        int chars = 0;
        int nonprintable_streak = 0;
        while (srcmax > 0) {
-               if ((*src >= ' ') && (*src < 0x7f)) {
+               if ((readb(src) >= ' ') && (readb(src) < 0x7f)) {
                        if (nonprintable_streak) {
                                if (remain > 0) {
                                        *p = ' ';
@@ -67,7 +67,7 @@ VBUSCHANNEL_sanitize_buffer(char *p, int remain, char *src, int srcmax)
                                nonprintable_streak = 0;
                        }
                        if (remain > 0) {
-                               *p = *src;
+                               *p = readb(src);
                                p++;
                                remain--;
                                chars++;
@@ -146,15 +146,15 @@ VBUSCHANNEL_itoa(char *p, int remain, int num)
  * Returns the number of bytes written to <p>.
  */
 static inline int
-VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO devInfo,
+VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO __iomem *devInfo,
                                  char *p, int remain, int devix)
 {
-       char *psrc;
+       char __iomem *psrc;
        int nsrc, x, i, pad;
        int chars = 0;
 
-       psrc = &(devInfo.devType[0]);
-       nsrc = sizeof(devInfo.devType);
+       psrc = &(devInfo->devType[0]);
+       nsrc = sizeof(devInfo->devType);
        if (VBUSCHANNEL_sanitize_buffer(NULL, 0, psrc, nsrc) <= 0)
                return 0;
 
@@ -183,8 +183,8 @@ VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO devInfo,
        VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
 
        /* emit driver name */
-       psrc = &(devInfo.drvName[0]);
-       nsrc = sizeof(devInfo.drvName);
+       psrc = &(devInfo->drvName[0]);
+       nsrc = sizeof(devInfo->drvName);
        x = VBUSCHANNEL_sanitize_buffer(p, remain, psrc, nsrc);
        p += x;
        remain -= x;
@@ -195,8 +195,8 @@ VBUSCHANNEL_devInfoToStringBuffer(ULTRA_VBUS_DEVICEINFO devInfo,
        VBUSCHANNEL_ADDACHAR(' ', p, remain, chars);
 
        /* emit strings */
-       psrc = &(devInfo.infoStrings[0]);
-       nsrc = sizeof(devInfo.infoStrings);
+       psrc = &(devInfo->infoStrings[0]);
+       nsrc = sizeof(devInfo->infoStrings);
        x = VBUSCHANNEL_sanitize_buffer(p, remain, psrc, nsrc);
        p += x;
        remain -= x;
index bd8944abd09221d6eebb4886d3517e18b657627f..14c404367fa7ea3ad8df219dbed38c8c5984abb7 100644 (file)
@@ -32,7 +32,7 @@
 #endif /*  */
 
 /* define subsystem number for AppOS, used in uislib driver  */
-#define MDS_APPOS 0x4000000000000000   /* subsystem = 62 - AppOS */
+#define MDS_APPOS 0x4000000000000000L  /* subsystem = 62 - AppOS */
 typedef enum {         /* VMCALL identification tuples  */
            /* Note: when a new VMCALL is added:
             * - the 1st 2 hex digits correspond to one of the
index 8d7ff94996185d20de148e794a28e32ee8f590cc..1737f3ad007b7ab44668e37589493319c37af82f 100644 (file)
@@ -62,7 +62,7 @@ static int ProcReadBufferValid;
 static char *ProcReadBuffer;   /* Note this MUST be global,
                                         * because the contents must */
 static unsigned int chipset_inited;
-int callback_count = 0;
+
 #define WAIT_ON_CALLBACK(handle)       \
        do {                    \
                if (handle)             \
@@ -77,31 +77,16 @@ static int MaxBusCount;             /* maximum number of buses expected */
 static U64 PhysicalDataChan;
 static int PlatformNumber;
 
-/* This is a list of controlvm messages which could not complete
- * immediately, but instead must be occasionally retried until they
- * ultimately succeed/fail.  When this happens,
- * msg->hdr.Flags.responseExpected determines whether or not we will
- * send a controlvm response.
- */
-struct controlvm_retry_entry {
-       CONTROLVM_MESSAGE msg;
-       struct io_msgs cmd;
-       void *obj;
-       int (*controlChanFunc)(struct io_msgs *);
-       struct list_head list_link;
-};
-LIST_HEAD(ControlVmRetryQHead);
-
 static struct uisthread_info Incoming_ThreadInfo;
 static BOOL Incoming_Thread_Started = FALSE;
-LIST_HEAD(List_Polling_Device_Channels);
-unsigned long long tot_moved_to_tail_cnt = 0;
-unsigned long long tot_wait_cnt = 0;
-unsigned long long tot_wakeup_cnt = 0;
-unsigned long long tot_schedule_cnt = 0;
-int en_smart_wakeup = 1;
+static LIST_HEAD(List_Polling_Device_Channels);
+static unsigned long long tot_moved_to_tail_cnt;
+static unsigned long long tot_wait_cnt;
+static unsigned long long tot_wakeup_cnt;
+static unsigned long long tot_schedule_cnt;
+static int en_smart_wakeup = 1;
 static DEFINE_SEMAPHORE(Lock_Polling_Device_Channels); /* unlocked */
-DECLARE_WAIT_QUEUE_HEAD(Wakeup_Polling_Device_Channels);
+static DECLARE_WAIT_QUEUE_HEAD(Wakeup_Polling_Device_Channels);
 static int Go_Polling_Device_Channels;
 
 static struct proc_dir_entry *uislib_proc_dir;
@@ -144,7 +129,7 @@ static struct proc_dir_entry *disable_proc_entry;
 static struct proc_dir_entry *test_proc_entry;
 #define TEST_PROC_ENTRY_FN "test"
 #endif
-unsigned long long cycles_before_wait, wait_cycles;
+static unsigned long long cycles_before_wait, wait_cycles;
 
 /*****************************************************/
 /* local functions                                   */
@@ -276,11 +261,11 @@ create_bus_proc_entries(struct bus_info *bus)
 
 }
 
-static void *
+static __iomem void *
 init_vbus_channel(U64 channelAddr, U32 channelBytes, int isServer)
 {
        void *rc = NULL;
-       void *pChan = uislib_ioremap_cache(channelAddr, channelBytes);
+       void __iomem *pChan = uislib_ioremap_cache(channelAddr, channelBytes);
        if (!pChan) {
                LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
                     (unsigned long long) channelAddr,
@@ -288,7 +273,7 @@ init_vbus_channel(U64 channelAddr, U32 channelBytes, int isServer)
                RETPTR(NULL);
        }
        if (isServer) {
-               memset(pChan, 0, channelBytes);
+               memset_io(pChan, 0, channelBytes);
                if (!ULTRA_VBUS_CHANNEL_OK_SERVER(channelBytes, NULL)) {
                        ERRDRV("%s channel cannot be used", __func__);
                        uislib_iounmap(pChan);
@@ -540,7 +525,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
        sprintf(dev->devid, "vbus%u:dev%u", (unsigned) busNo, (unsigned) devNo);
        /* map the channel memory for the device. */
        if (msg->hdr.Flags.testMessage)
-               dev->chanptr = __va(dev->channelAddr);
+               dev->chanptr = (void __iomem *)__va(dev->channelAddr);
        else {
                pReqHandler = ReqHandlerFind(dev->channelTypeGuid);
                if (pReqHandler)
@@ -609,7 +594,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
                                     &UltraVhbaChannelProtocolGuid,
                                     sizeof(GUID))) {
                                        WAIT_FOR_VALID_GUID(((CHANNEL_HEADER
-                                                             *) (dev->
+                                                             __iomem *) (dev->
                                                                  chanptr))->
                                                            Type);
                                        if (!ULTRA_VHBA_CHANNEL_OK_CLIENT
@@ -636,7 +621,7 @@ create_device(CONTROLVM_MESSAGE *msg, char *buf)
                                         &UltraVnicChannelProtocolGuid,
                                         sizeof(GUID))) {
                                        WAIT_FOR_VALID_GUID(((CHANNEL_HEADER
-                                                             *) (dev->
+                                                             __iomem *) (dev->
                                                                  chanptr))->
                                                            Type);
                                        if (!ULTRA_VNIC_CHANNEL_OK_CLIENT
@@ -948,55 +933,6 @@ destroy_device(CONTROLVM_MESSAGE *msg, char *buf)
        return CONTROLVM_RESP_SUCCESS;
 }
 
-void
-ULTRA_disp_channel_header(CHANNEL_HEADER *x)
-{
-       LOGINF("Sig=%llx, HdrSz=%lx, Sz=%llx, Feat=%llx, hPart=%llx, Hndl=%llx, ChSpace=%llx, Ver=%lx, PartIdx=%lx\n",
-            x->Signature, (long unsigned int) x->HeaderSize, x->Size,
-            x->Features, x->PartitionHandle, x->Handle, x->oChannelSpace,
-            (long unsigned int) x->VersionId,
-            (long unsigned int) x->PartitionIndex);
-
-       LOGINF("ClientStr=%lx, CliStBoot=%lx, CmdStCli=%lx, CliStOS=%lx, ChCharistics=%lx, CmdStSrv=%lx, SrvSt=%lx\n",
-            (long unsigned int) x->oClientString,
-            (long unsigned int) x->CliStateBoot,
-            (long unsigned int) x->CmdStateCli,
-            (long unsigned int) x->CliStateOS,
-            (long unsigned int) x->ChannelCharacteristics,
-            (long unsigned int) x->CmdStateSrv,
-            (long unsigned int) x->SrvState);
-
-}
-
-void
-ULTRA_disp_channel(ULTRA_IO_CHANNEL_PROTOCOL *x)
-{
-       ULTRA_disp_channel_header(&x->ChannelHeader);
-       LOGINF("cmdQ.Type=%lx\n", (long unsigned int) x->cmdQ.Type);
-       LOGINF("cmdQ.Size=%llx\n", x->cmdQ.Size);
-       LOGINF("cmdQ.oSignalBase=%llx\n", x->cmdQ.oSignalBase);
-       LOGINF("cmdQ.SignalSize=%lx\n", (long unsigned int) x->cmdQ.SignalSize);
-       LOGINF("cmdQ.MaxSignalSlots=%lx\n",
-              (long unsigned int) x->cmdQ.MaxSignalSlots);
-       LOGINF("cmdQ.MaxSignals=%lx\n", (long unsigned int) x->cmdQ.MaxSignals);
-       LOGINF("rspQ.Type=%lx\n", (long unsigned int) x->rspQ.Type);
-       LOGINF("rspQ.Size=%llx\n", x->rspQ.Size);
-       LOGINF("rspQ.oSignalBase=%llx\n", x->rspQ.oSignalBase);
-       LOGINF("rspQ.SignalSize=%lx\n", (long unsigned int) x->rspQ.SignalSize);
-       LOGINF("rspQ.MaxSignalSlots=%lx\n",
-              (long unsigned int) x->rspQ.MaxSignalSlots);
-       LOGINF("rspQ.MaxSignals=%lx\n", (long unsigned int) x->rspQ.MaxSignals);
-       LOGINF("SIZEOF_CMDRSP=%lx\n", SIZEOF_CMDRSP);
-       LOGINF("SIZEOF_PROTOCOL=%lx\n", SIZEOF_PROTOCOL);
-}
-
-void
-ULTRA_disp_vnic_channel(ULTRA_IO_CHANNEL_PROTOCOL *x)
-{
-       LOGINF("num_rcv_bufs=%lx\n", (long unsigned int) x->vnic.num_rcv_bufs);
-       LOGINF("mtu=%lx\n", (long unsigned int) x->vnic.mtu);
-}
-
 static int
 init_chipset(CONTROLVM_MESSAGE *msg, char *buf)
 {
@@ -1332,7 +1268,7 @@ uislib_client_inject_del_vnic(U32 busNo, U32 devNo)
 }
 EXPORT_SYMBOL_GPL(uislib_client_inject_del_vnic);
 
-int
+static int
 uislib_client_add_vnic(U32 busNo)
 {
        BOOL busCreated = FALSE;
@@ -1382,7 +1318,7 @@ AwayCleanup:
 }                              /* end uislib_client_add_vnic */
 EXPORT_SYMBOL_GPL(uislib_client_add_vnic);
 
-int
+static int
 uislib_client_delete_vnic(U32 busNo)
 {
        int devNo = 0;          /* Default to 0, since only one device
@@ -1791,16 +1727,16 @@ proc_info_vbus_show(struct seq_file *m, void *v)
            (bus->busChannelBytes -
             sizeof(ULTRA_VBUS_CHANNEL_PROTOCOL)) /
            sizeof(ULTRA_VBUS_DEVICEINFO);
-       x = VBUSCHANNEL_devInfoToStringBuffer(bus->pBusChannel->ChpInfo, buf,
+       x = VBUSCHANNEL_devInfoToStringBuffer(&bus->pBusChannel->ChpInfo, buf,
                                              sizeof(buf) - 1, -1);
        buf[x] = '\0';
        seq_printf(m, "%s", buf);
-       x = VBUSCHANNEL_devInfoToStringBuffer(bus->pBusChannel->BusInfo,
+       x = VBUSCHANNEL_devInfoToStringBuffer(&bus->pBusChannel->BusInfo,
                                              buf, sizeof(buf) - 1, -1);
        buf[x] = '\0';
        seq_printf(m, "%s", buf);
        for (i = 0; i < devInfoCount; i++) {
-               x = VBUSCHANNEL_devInfoToStringBuffer(bus->pBusChannel->
+               x = VBUSCHANNEL_devInfoToStringBuffer(&bus->pBusChannel->
                                                      DevInfo[i], buf,
                                                      sizeof(buf) - 1, i);
                if (x > 0) {
@@ -2393,8 +2329,8 @@ do_wakeup_polling_device_channels(struct work_struct *dummy)
        }
 }
 
-DECLARE_WORK(Work_wakeup_polling_device_channels,
-            do_wakeup_polling_device_channels);
+static DECLARE_WORK(Work_wakeup_polling_device_channels,
+                   do_wakeup_polling_device_channels);
 
 /*  Call this function when you want to send a hint to Process_Incoming() that
  *  your device might have more requests.
@@ -2561,13 +2497,6 @@ uislib_mod_exit(void)
 module_init(uislib_mod_init);
 module_exit(uislib_mod_exit);
 
-int uis_mandatory_services = -1;
-
-module_param_named(mandatory_services, uis_mandatory_services,
-                  int, S_IRUGO);
-MODULE_PARM_DESC(uis_mandatory_services,
-                "number of server drivers we expect to register (default=-1 for legacy behavior)");
-
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Usha Srinivasan");
 MODULE_ALIAS("uislib");
index b82d0c0fd482d8ee61a5f529505d89a8f3d2ddfe..8aefaa8d36bf17ff14da787e6673aa69aa484269 100644 (file)
@@ -81,11 +81,14 @@ static const char *virthba_get_info(struct Scsi_Host *shp);
 static int virthba_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 static int virthba_queue_command_lck(struct scsi_cmnd *scsicmd,
                                     void (*virthba_cmnd_done)(struct scsi_cmnd *));
+
 #ifdef DEF_SCSI_QCMD
 DEF_SCSI_QCMD(virthba_queue_command)
 #else
 #define virthba_queue_command virthba_queue_command_lck
 #endif
+
+
 static int virthba_slave_alloc(struct scsi_device *scsidev);
 static int virthba_slave_configure(struct scsi_device *scsidev);
 static void virthba_slave_destroy(struct scsi_device *scsidev);
@@ -108,11 +111,11 @@ static ssize_t enable_ints_write(struct file *file, const char __user *buffer,
 /* Globals                                           */
 /*****************************************************/
 
-int rsltq_wait_usecs = 4000;   /* Default 4ms */
+static int rsltq_wait_usecs = 4000;    /* Default 4ms */
 static unsigned int MaxBuffLen;
 
 /* Module options */
-char *virthba_options = "NONE";
+static char *virthba_options = "NONE";
 
 static const struct pci_device_id virthba_id_table[] = {
        {PCI_DEVICE(PCI_VENDOR_ID_UNISYS, PCI_DEVICE_ID_VIRTHBA)},
@@ -179,7 +182,7 @@ struct virthba_info {
        unsigned long long interrupts_notme;
        unsigned long long interrupts_disabled;
        struct work_struct serverdown_completion;
-       U64 *flags_addr;
+       U64 __iomem *flags_addr;
        atomic_t interrupt_rcvd;
        wait_queue_head_t rsp_queue;
        struct virtdisk_info head;
@@ -322,9 +325,9 @@ del_scsipending_entry(struct virthba_info *vhbainfo, uintptr_t del)
 
 /* DARWorkQ (Disk Add/Remove) */
 static struct work_struct DARWorkQ;
-struct diskaddremove *DARWorkQHead = NULL;
-spinlock_t DARWorkQLock;
-unsigned short DARWorkQSched = 0;
+static struct diskaddremove *DARWorkQHead;
+static spinlock_t DARWorkQLock;
+static unsigned short DARWorkQSched;
 #define QUEUE_DISKADDREMOVE(dar) { \
        spin_lock_irqsave(&DARWorkQLock, flags); \
        if (!DARWorkQHead) { \
@@ -418,12 +421,12 @@ process_disk_notify(struct Scsi_Host *shost, struct uiscmdrsp *cmdrsp)
 /*****************************************************/
 /* Probe Remove Functions                            */
 /*****************************************************/
-irqreturn_t
+static irqreturn_t
 virthba_ISR(int irq, void *dev_id)
 {
        struct virthba_info *virthbainfo = (struct virthba_info *) dev_id;
-       pCHANNEL_HEADER pChannelHeader;
-       pSIGNAL_QUEUE_HEADER pqhdr;
+       CHANNEL_HEADER __iomem *pChannelHeader;
+       SIGNAL_QUEUE_HEADER __iomem *pqhdr;
        U64 mask;
        unsigned long long rc1;
 
@@ -431,9 +434,10 @@ virthba_ISR(int irq, void *dev_id)
                return IRQ_NONE;
        virthbainfo->interrupts_rcvd++;
        pChannelHeader = virthbainfo->chinfo.queueinfo->chan;
-       if (((pChannelHeader->Features
+       if (((readq(&pChannelHeader->Features)
              & ULTRA_IO_IOVM_IS_OK_WITH_DRIVER_DISABLING_INTS) != 0)
-           && ((pChannelHeader->Features & ULTRA_IO_DRIVER_DISABLES_INTS) !=
+           && ((readq(&pChannelHeader->Features) &
+                ULTRA_IO_DRIVER_DISABLES_INTS) !=
                0)) {
                virthbainfo->interrupts_disabled++;
                mask = ~ULTRA_CHANNEL_ENABLE_INTS;
@@ -443,10 +447,11 @@ virthba_ISR(int irq, void *dev_id)
                virthbainfo->interrupts_notme++;
                return IRQ_NONE;
        }
-       pqhdr = (pSIGNAL_QUEUE_HEADER) ((char *) pChannelHeader +
-                                       pChannelHeader->oChannelSpace) +
-                                       IOCHAN_FROM_IOPART;
-       pqhdr->NumInterruptsReceived++;
+       pqhdr = (SIGNAL_QUEUE_HEADER __iomem *)
+               ((char __iomem *) pChannelHeader +
+                readq(&pChannelHeader->oChannelSpace)) + IOCHAN_FROM_IOPART;
+       writeq(readq(&pqhdr->NumInterruptsReceived) + 1,
+              &pqhdr->NumInterruptsReceived);
        atomic_set(&virthbainfo->interrupt_rcvd, 1);
        wake_up_interruptible(&virthbainfo->rsp_queue);
        return IRQ_HANDLED;
@@ -461,8 +466,8 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id)
        int rsp;
        int i;
        irq_handler_t handler = virthba_ISR;
-       pCHANNEL_HEADER pChannelHeader;
-       pSIGNAL_QUEUE_HEADER pqhdr;
+       CHANNEL_HEADER __iomem *pChannelHeader;
+       SIGNAL_QUEUE_HEADER __iomem *pqhdr;
        U64 mask;
 
        LOGVER("entering virthba_probe...\n");
@@ -578,16 +583,17 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id)
        INIT_WORK(&virthbainfo->serverdown_completion,
                  virthba_serverdown_complete);
 
-       virthbainfo->chinfo.queueinfo->chan->Features |=
-           ULTRA_IO_CHANNEL_IS_POLLING;
+       writeq(readq(&virthbainfo->chinfo.queueinfo->chan->Features) |
+              ULTRA_IO_CHANNEL_IS_POLLING,
+              &virthbainfo->chinfo.queueinfo->chan->Features);
        /* start thread that will receive scsicmnd responses */
        DBGINF("starting rsp thread -- queueinfo: 0x%p, threadinfo: 0x%p.\n",
               virthbainfo->chinfo.queueinfo, &virthbainfo->chinfo.threadinfo);
 
        pChannelHeader = virthbainfo->chinfo.queueinfo->chan;
-       pqhdr = (pSIGNAL_QUEUE_HEADER) ((char *) pChannelHeader +
-                                       pChannelHeader->oChannelSpace) +
-                                       IOCHAN_FROM_IOPART;
+       pqhdr = (SIGNAL_QUEUE_HEADER __iomem *)
+               ((char __iomem *)pChannelHeader +
+                readq(&pChannelHeader->oChannelSpace)) + IOCHAN_FROM_IOPART;
        virthbainfo->flags_addr = &pqhdr->FeatureFlags;
 
        if (!uisthread_start(&virthbainfo->chinfo.threadinfo,
@@ -620,7 +626,7 @@ virthba_probe(struct virtpci_dev *virtpcidev, const struct pci_device_id *id)
                virthbainfo->interrupt_vector = -1;
                POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
        } else {
-               U64 *Features_addr =
+               U64 __iomem *Features_addr =
                    &virthbainfo->chinfo.queueinfo->chan->Features;
                LOGERR("request_irq(%d) uislib_virthba_ISR request succeeded\n",
                       virthbainfo->interrupt_vector);
@@ -1408,14 +1414,13 @@ info_proc_read(struct file *file, char __user *buf, size_t len, loff_t *offset)
                                  virthbainfo->interrupts_disabled);
                length += sprintf(vbuf + length, "\ninterrupts_notme = %llu,\n",
                                  virthbainfo->interrupts_notme);
-               phys_flags_addr = virt_to_phys(virthbainfo->flags_addr);
-
+               phys_flags_addr = virt_to_phys((__force  void *)
+                                              virthbainfo->flags_addr);
                length += sprintf(vbuf + length, "flags_addr = %p, phys_flags_addr=0x%016llx, FeatureFlags=%llu\n",
                          virthbainfo->flags_addr, phys_flags_addr,
-                         *virthbainfo->flags_addr);
+                                 (__le64)readq(virthbainfo->flags_addr));
                length += sprintf(vbuf + length, "acquire_failed_cnt:%llu\n",
                                  virthbainfo->acquire_failed_cnt);
-
                length += sprintf(vbuf + length, "\n");
        }
        if (copy_to_user(buf, vbuf, length)) {
@@ -1442,7 +1447,7 @@ enable_ints_write(struct file *file, const char __user *buffer,
        char buf[4];
        int i, new_value;
        struct virthba_info *virthbainfo;
-       U64 *Features_addr;
+       U64 __iomem *Features_addr;
        U64 mask;
 
        if (count >= ARRAY_SIZE(buf))
@@ -1544,7 +1549,6 @@ virthba_serverup(struct virtpci_dev *virtpcidev)
         */
        ULTRA_CHANNEL_CLIENT_TRANSITION(virthbainfo->chinfo.queueinfo->chan,
                                        dev_name(&virtpcidev->generic_dev),
-                                       CliStateOS,
                                        CHANNELCLI_ATTACHED, NULL);
 
        /* Start Processing the IOVM Response Queue Again */
index 6886293c347350e0381d5970c4663889c36bf894..1b646328839e788f68963892b36d305d576027ea 100644 (file)
@@ -173,7 +173,8 @@ struct virtpci_busdev {
 /* Local functions                                   */
 /*****************************************************/
 
-static inline int WAIT_FOR_IO_CHANNEL(ULTRA_IO_CHANNEL_PROTOCOL *chanptr)
+static inline
+int WAIT_FOR_IO_CHANNEL(ULTRA_IO_CHANNEL_PROTOCOL __iomem  *chanptr)
 {
        int count = 120;
        while (count > 0) {
@@ -264,7 +265,7 @@ static int add_vbus(struct add_vbus_guestpart *addparams)
        vbus->release = virtpci_bus_release;
        vbus->parent = &virtpci_rootbus_device; /* root bus is parent */
        vbus->bus = &virtpci_bus_type;  /* bus type */
-       vbus->platform_data = addparams->chanptr;
+       vbus->platform_data = (__force void *)addparams->chanptr;
 
        /* register a virt bus device -
         * this bus shows up under /sys/devices with .name value
@@ -289,10 +290,16 @@ static int add_vbus(struct add_vbus_guestpart *addparams)
 /* for CHANSOCK wwwnn/max are AUTO-GENERATED; for normal channels,
  * wwnn/max are in the channel header.
  */
-#define GET_SCSIADAPINFO_FROM_CHANPTR(chanptr) { \
-       scsi.wwnn = ((ULTRA_IO_CHANNEL_PROTOCOL *) chanptr)->vhba.wwnn; \
-       scsi.max = ((ULTRA_IO_CHANNEL_PROTOCOL *) chanptr)->vhba.max; \
-}
+#define GET_SCSIADAPINFO_FROM_CHANPTR(chanptr) {                       \
+       memcpy_fromio(&scsi.wwnn,                                       \
+                     &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)           \
+                       chanptr)->vhba.wwnn,                            \
+                     sizeof(struct vhba_wwnn));                        \
+       memcpy_fromio(&scsi.max,                                        \
+                     &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)           \
+                       chanptr)->vhba.max,                             \
+                     sizeof(struct vhba_config_max));                  \
+       }
 
 /* find bus device with the busid that matches - match_busid matches bus_id */
 #define GET_BUS_DEV(busno) { \
@@ -317,7 +324,7 @@ static int add_vhba(struct add_virt_guestpart *addparams)
 
        POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
        if (!WAIT_FOR_IO_CHANNEL
-           ((ULTRA_IO_CHANNEL_PROTOCOL *) addparams->chanptr)) {
+           ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) addparams->chanptr)) {
                LOGERR("Timed out.  Channel not ready\n");
                POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
                return 0;
@@ -345,11 +352,20 @@ static int add_vhba(struct add_virt_guestpart *addparams)
 /* for CHANSOCK macaddr is AUTO-GENERATED; for normal channels,
  * macaddr is in the channel header.
  */
-#define GET_NETADAPINFO_FROM_CHANPTR(chanptr) { \
-       memcpy(net.mac_addr, ((ULTRA_IO_CHANNEL_PROTOCOL *) chanptr)->vnic.macaddr, MAX_MACADDR_LEN); \
-       net.num_rcv_bufs = ((ULTRA_IO_CHANNEL_PROTOCOL *) chanptr)->vnic.num_rcv_bufs; \
-       net.mtu = ((ULTRA_IO_CHANNEL_PROTOCOL *) chanptr)->vnic.mtu; \
-       net.zoneGuid = ((ULTRA_IO_CHANNEL_PROTOCOL *) chanptr)->vnic.zoneGuid; \
+#define GET_NETADAPINFO_FROM_CHANPTR(chanptr) {                                \
+               memcpy_fromio(net.mac_addr,                             \
+                      ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)           \
+                       chanptr)->vnic.macaddr,                         \
+                      MAX_MACADDR_LEN);                                \
+               net.num_rcv_bufs =                                      \
+                       readl(&((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)   \
+                               chanptr)->vnic.num_rcv_bufs);           \
+               net.mtu = readl(&((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) \
+                                 chanptr)->vnic.mtu);                  \
+               memcpy_fromio(&net.zoneGuid, \
+                             &((ULTRA_IO_CHANNEL_PROTOCOL __iomem *)   \
+                               chanptr)->vnic.zoneGuid,                \
+                             sizeof(GUID));                            \
 }
 
 /* adds a vnic
@@ -365,7 +381,7 @@ add_vnic(struct add_virt_guestpart *addparams)
 
        POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
        if (!WAIT_FOR_IO_CHANNEL
-           ((ULTRA_IO_CHANNEL_PROTOCOL *) addparams->chanptr)) {
+           ((ULTRA_IO_CHANNEL_PROTOCOL __iomem *) addparams->chanptr)) {
                LOGERR("Timed out, channel not ready\n");
                POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
                return 0;
@@ -675,7 +691,7 @@ static int match_busid(struct device *dev, void *data)
 /*  Bus functions                                    */
 /*****************************************************/
 
-const struct pci_device_id *
+static const struct pci_device_id *
 virtpci_match_device(const struct pci_device_id *ids,
                     const struct virtpci_dev *dev)
 {
@@ -892,7 +908,7 @@ static int virtpci_device_add(struct device *parentbus, int devtype,
        struct virtpci_dev *tmpvpcidev = NULL, *prev;
        unsigned long flags;
        int ret;
-       ULTRA_IO_CHANNEL_PROTOCOL *pIoChan = NULL;
+       ULTRA_IO_CHANNEL_PROTOCOL __iomem *pIoChan = NULL;
        struct device *pDev;
 
        LOGINF("virtpci_device_add parentbus:%p chanptr:%p\n", parentbus,
@@ -933,7 +949,8 @@ static int virtpci_device_add(struct device *parentbus, int devtype,
        virtpcidev->queueinfo.send_int_if_needed = NULL;
 
        /* Set up safe queue... */
-       pIoChan = (ULTRA_IO_CHANNEL_PROTOCOL *) virtpcidev->queueinfo.chan;
+       pIoChan = (ULTRA_IO_CHANNEL_PROTOCOL __iomem *)
+               virtpcidev->queueinfo.chan;
 
        virtpcidev->intr = addparams->intr;
 
@@ -997,7 +1014,7 @@ static int virtpci_device_add(struct device *parentbus, int devtype,
        pDev = &virtpcidev->generic_dev;
        ULTRA_CHANNEL_CLIENT_TRANSITION(addparams->chanptr,
                                        BUS_ID(pDev),
-                                       CliStateOS, CHANNELCLI_ATTACHED, NULL);
+                                       CHANNELCLI_ATTACHED, NULL);
 
        /* don't register until device has been added to
        * list. Otherwise, a device_unregister from this function can
@@ -1020,7 +1037,6 @@ static int virtpci_device_add(struct device *parentbus, int devtype,
                pDev = &virtpcidev->generic_dev;
                ULTRA_CHANNEL_CLIENT_TRANSITION(addparams->chanptr,
                                                BUS_ID(pDev),
-                                               CliStateOS,
                                                CHANNELCLI_DETACHED, NULL);
                /* remove virtpcidev, the one we just added, from the list */
                write_lock_irqsave(&VpcidevListLock, flags);
@@ -1489,7 +1505,7 @@ static ssize_t virt_proc_write(struct file *file, const char __user *buffer,
        char buf[16];
        int type, i, action = 0xffff;
        unsigned int busno, deviceno;
-       void *chanptr;
+       void __iomem *chanptr;
        struct add_vbus_guestpart busaddparams;
        struct add_virt_guestpart addparams;
        struct del_vbus_guestpart busdelparams;