Commit a8d7f21d authored by Ken Cox's avatar Ken Cox Committed by Greg Kroah-Hartman

Staging: unisys: Clean multiple sparse warnings

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: default avatarKen Cox <jkc@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a1d842e8
......@@ -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_
......@@ -142,12 +143,6 @@
/* 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 */
......
......@@ -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)
......
......@@ -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;
......
......@@ -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
......
......@@ -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 @@ uislib_client_add_vnic(U32 busNo)
} /* 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");
......
......@@ -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 */
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment