#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)) || \
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)
* 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,
{
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;
}
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,
}
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,
"%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;
}
/* 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,
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,
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,
"%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,
"%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 */
}
/*
* full.
*/
-unsigned char visor_signal_insert(pCHANNEL_HEADER pChannel, U32 Queue,
+unsigned char visor_signal_insert(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
void *pSignal);
/*
* empty.
*/
-unsigned char visor_signal_remove(pCHANNEL_HEADER pChannel, U32 Queue,
+unsigned char visor_signal_remove(CHANNEL_HEADER __iomem *pChannel, U32 Queue,
void *pSignal);
/*
* 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
#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
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 */
#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)
* 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 = ' ';
nonprintable_streak = 0;
}
if (remain > 0) {
- *p = *src;
+ *p = readb(src);
p++;
remain--;
chars++;
* 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;
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;
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;
#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
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) \
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;
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 */
}
-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,
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);
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)
&UltraVhbaChannelProtocolGuid,
sizeof(GUID))) {
WAIT_FOR_VALID_GUID(((CHANNEL_HEADER
- *) (dev->
+ __iomem *) (dev->
chanptr))->
Type);
if (!ULTRA_VHBA_CHANNEL_OK_CLIENT
&UltraVnicChannelProtocolGuid,
sizeof(GUID))) {
WAIT_FOR_VALID_GUID(((CHANNEL_HEADER
- *) (dev->
+ __iomem *) (dev->
chanptr))->
Type);
if (!ULTRA_VNIC_CHANNEL_OK_CLIENT
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)
{
}
EXPORT_SYMBOL_GPL(uislib_client_inject_del_vnic);
-int
+static int
uislib_client_add_vnic(U32 busNo)
{
BOOL busCreated = FALSE;
} /* 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
(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) {
}
}
-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.
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");
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);
/* 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)},
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;
/* 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) { \
/*****************************************************/
/* 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;
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;
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;
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");
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,
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);
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)) {
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))
*/
ULTRA_CHANNEL_CLIENT_TRANSITION(virthbainfo->chinfo.queueinfo->chan,
dev_name(&virtpcidev->generic_dev),
- CliStateOS,
CHANNELCLI_ATTACHED, NULL);
/* Start Processing the IOVM Response Queue Again */
/* 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) {
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
/* 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) { \
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;
/* 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
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;
/* 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)
{
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,
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;
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
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);
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;