aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/uislib/uislib.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/unisys/uislib/uislib.c')
-rw-r--r--drivers/staging/unisys/uislib/uislib.c755
1 files changed, 363 insertions, 392 deletions
diff --git a/drivers/staging/unisys/uislib/uislib.c b/drivers/staging/unisys/uislib/uislib.c
index 7c87452a9f14..a9eeddeba735 100644
--- a/drivers/staging/unisys/uislib/uislib.c
+++ b/drivers/staging/unisys/uislib/uislib.c
@@ -41,7 +41,6 @@
#include "sparstop.h"
#include "visorchipset.h"
-#include "chanstub.h"
#include "version.h"
#include "guestlinuxdebug.h"
@@ -59,8 +58,8 @@
/* global function pointers that act as callback functions into virtpcimod */
int (*virt_control_chan_func)(struct guest_msgs *);
-static int ProcReadBufferValid;
-static char *ProcReadBuffer; /* Note this MUST be global,
+static int debug_buf_valid;
+static char *debug_buf; /* Note this MUST be global,
* because the contents must */
static unsigned int chipset_inited;
@@ -71,24 +70,24 @@ static unsigned int chipset_inited;
UIS_THREAD_WAIT; \
} while (1)
-static struct bus_info *BusListHead;
-static rwlock_t BusListLock;
-static int BusListCount; /* number of buses in the list */
-static int MaxBusCount; /* maximum number of buses expected */
-static u64 PhysicalDataChan;
-static int PlatformNumber;
+static struct bus_info *bus_list;
+static rwlock_t bus_list_lock;
+static int bus_list_count; /* number of buses in the list */
+static int max_bus_count; /* maximum number of buses expected */
+static u64 phys_data_chan;
+static int platform_no;
-static struct uisthread_info Incoming_ThreadInfo;
-static BOOL Incoming_Thread_Started = FALSE;
-static LIST_HEAD(List_Polling_Device_Channels);
+static struct uisthread_info incoming_ti;
+static BOOL incoming_started = FALSE;
+static LIST_HEAD(poll_dev_chan);
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 */
-static DECLARE_WAIT_QUEUE_HEAD(Wakeup_Polling_Device_Channels);
-static int Go_Polling_Device_Channels;
+static DEFINE_SEMAPHORE(poll_dev_lock); /* unlocked */
+static DECLARE_WAIT_QUEUE_HEAD(poll_dev_wake_q);
+static int poll_dev_start;
#define CALLHOME_PROC_ENTRY_FN "callhome"
#define CALLHOME_THROTTLED_PROC_ENTRY_FN "callhome_throttled"
@@ -115,7 +114,7 @@ static unsigned long long cycles_before_wait, wait_cycles;
/*****************************************************/
static ssize_t info_debugfs_read(struct file *file, char __user *buf,
- size_t len, loff_t *offset);
+ size_t len, loff_t *offset);
static const struct file_operations debugfs_info_fops = {
.read = info_debugfs_read,
};
@@ -129,58 +128,52 @@ init_msg_header(struct controlvm_message *msg, u32 id, uint rsp, uint svr)
msg->hdr.flags.server = svr;
}
-static __iomem void *
-init_vbus_channel(u64 channelAddr, u32 channelBytes)
+static __iomem void *init_vbus_channel(u64 ch_addr, u32 ch_bytes)
{
- void __iomem *rc = NULL;
- void __iomem *pChan = uislib_ioremap_cache(channelAddr, channelBytes);
+ void __iomem *ch = uislib_ioremap_cache(ch_addr, ch_bytes);
- if (!pChan) {
+ if (!ch) {
LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
- (unsigned long long) channelAddr,
- (unsigned long long) channelBytes);
- rc = NULL;
- goto Away;
+ (unsigned long long)ch_addr,
+ (unsigned long long)ch_bytes);
+ return NULL;
}
- if (!SPAR_VBUS_CHANNEL_OK_CLIENT(pChan)) {
+ if (!SPAR_VBUS_CHANNEL_OK_CLIENT(ch)) {
ERRDRV("%s channel cannot be used", __func__);
- uislib_iounmap(pChan);
- rc = NULL;
- goto Away;
+ uislib_iounmap(ch);
+ return NULL;
}
- rc = pChan;
-Away:
- return rc;
+ return ch;
}
static int
create_bus(struct controlvm_message *msg, char *buf)
{
- u32 busNo, deviceCount;
+ u32 bus_no, dev_count;
struct bus_info *tmp, *bus;
size_t size;
- if (MaxBusCount == BusListCount) {
+ if (max_bus_count == bus_list_count) {
LOGERR("CONTROLVM_BUS_CREATE Failed: max buses:%d already created\n",
- MaxBusCount);
- POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, MaxBusCount,
+ max_bus_count);
+ POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, max_bus_count,
POSTCODE_SEVERITY_ERR);
return CONTROLVM_RESP_ERROR_MAX_BUSES;
}
- busNo = msg->cmd.create_bus.bus_no;
- deviceCount = msg->cmd.create_bus.dev_count;
+ bus_no = msg->cmd.create_bus.bus_no;
+ dev_count = msg->cmd.create_bus.dev_count;
- POSTCODE_LINUX_4(BUS_CREATE_ENTRY_PC, busNo, deviceCount,
+ POSTCODE_LINUX_4(BUS_CREATE_ENTRY_PC, bus_no, dev_count,
POSTCODE_SEVERITY_INFO);
size =
sizeof(struct bus_info) +
- (deviceCount * sizeof(struct device_info *));
+ (dev_count * sizeof(struct device_info *));
bus = kzalloc(size, GFP_ATOMIC);
if (!bus) {
LOGERR("CONTROLVM_BUS_CREATE Failed: kmalloc for bus failed.\n");
- POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo,
+ POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
POSTCODE_SEVERITY_ERR);
return CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
}
@@ -191,27 +184,29 @@ create_bus(struct controlvm_message *msg, char *buf)
if (msg->hdr.flags.test_message) {
/* This implies we're the IOVM so set guest handle to 0... */
bus->guest_handle = 0;
- bus->bus_no = busNo;
+ bus->bus_no = bus_no;
bus->local_vnic = 1;
- } else
- bus->bus_no = bus->guest_handle = busNo;
- sprintf(bus->name, "%d", (int) bus->bus_no);
- bus->device_count = deviceCount;
+ } else {
+ bus->bus_no = bus_no;
+ bus->guest_handle = bus_no;
+ }
+ sprintf(bus->name, "%d", (int)bus->bus_no);
+ bus->device_count = dev_count;
bus->device =
- (struct device_info **) ((char *) bus + sizeof(struct bus_info));
+ (struct device_info **)((char *)bus + sizeof(struct bus_info));
bus->bus_inst_uuid = msg->cmd.create_bus.bus_inst_uuid;
bus->bus_channel_bytes = 0;
bus->bus_channel = NULL;
/* add bus to our bus list - but check for duplicates first */
- read_lock(&BusListLock);
- for (tmp = BusListHead; tmp; tmp = tmp->next) {
+ read_lock(&bus_list_lock);
+ for (tmp = bus_list; tmp; tmp = tmp->next) {
if (tmp->bus_no == bus->bus_no)
break;
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
if (tmp) {
- /* found a bus already in the list with same busNo -
+ /* found a bus already in the list with same bus_no -
* reject add
*/
LOGERR("CONTROLVM_BUS_CREATE Failed: bus %d already exists.\n",
@@ -221,8 +216,8 @@ create_bus(struct controlvm_message *msg, char *buf)
kfree(bus);
return CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
- if ((msg->cmd.create_bus.channel_addr != 0)
- && (msg->cmd.create_bus.channel_bytes != 0)) {
+ if ((msg->cmd.create_bus.channel_addr != 0) &&
+ (msg->cmd.create_bus.channel_bytes != 0)) {
bus->bus_channel_bytes = msg->cmd.create_bus.channel_bytes;
bus->bus_channel =
init_vbus_channel(msg->cmd.create_bus.channel_addr,
@@ -233,9 +228,9 @@ create_bus(struct controlvm_message *msg, char *buf)
struct guest_msgs cmd;
cmd.msgtype = GUEST_ADD_VBUS;
- cmd.add_vbus.bus_no = busNo;
+ cmd.add_vbus.bus_no = bus_no;
cmd.add_vbus.chanptr = bus->bus_channel;
- cmd.add_vbus.dev_count = deviceCount;
+ cmd.add_vbus.dev_count = dev_count;
cmd.add_vbus.bus_uuid = msg->cmd.create_bus.bus_data_type_uuid;
cmd.add_vbus.instance_uuid = msg->cmd.create_bus.bus_inst_uuid;
if (!virt_control_chan_func) {
@@ -256,15 +251,15 @@ create_bus(struct controlvm_message *msg, char *buf)
}
/* add bus at the head of our list */
- write_lock(&BusListLock);
- if (!BusListHead)
- BusListHead = bus;
- else {
- bus->next = BusListHead;
- BusListHead = bus;
+ write_lock(&bus_list_lock);
+ if (!bus_list) {
+ bus_list = bus;
+ } else {
+ bus->next = bus_list;
+ bus_list = bus;
}
- BusListCount++;
- write_unlock(&BusListLock);
+ bus_list_count++;
+ write_unlock(&bus_list_lock);
POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus->bus_no,
POSTCODE_SEVERITY_INFO);
@@ -277,15 +272,15 @@ destroy_bus(struct controlvm_message *msg, char *buf)
int i;
struct bus_info *bus, *prev = NULL;
struct guest_msgs cmd;
- u32 busNo;
+ u32 bus_no;
- busNo = msg->cmd.destroy_bus.bus_no;
+ bus_no = msg->cmd.destroy_bus.bus_no;
- read_lock(&BusListLock);
+ read_lock(&bus_list_lock);
- bus = BusListHead;
+ bus = bus_list;
while (bus) {
- if (bus->bus_no == busNo)
+ if (bus->bus_no == bus_no)
break;
prev = bus;
bus = bus->next;
@@ -293,8 +288,8 @@ destroy_bus(struct controlvm_message *msg, char *buf)
if (!bus) {
LOGERR("CONTROLVM_BUS_DESTROY Failed: failed to find bus %d.\n",
- busNo);
- read_unlock(&BusListLock);
+ bus_no);
+ read_unlock(&bus_list_lock);
return CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
@@ -302,12 +297,12 @@ destroy_bus(struct controlvm_message *msg, char *buf)
for (i = 0; i < bus->device_count; i++) {
if (bus->device[i] != NULL) {
LOGERR("CONTROLVM_BUS_DESTROY Failed: device %i attached to bus %d.",
- i, busNo);
- read_unlock(&BusListLock);
+ i, bus_no);
+ read_unlock(&bus_list_lock);
return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED;
}
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
if (msg->hdr.flags.server)
goto remove;
@@ -315,7 +310,7 @@ destroy_bus(struct controlvm_message *msg, char *buf)
/* client messages require us to call the virtpci callback associated
with this bus. */
cmd.msgtype = GUEST_DEL_VBUS;
- cmd.del_vbus.bus_no = busNo;
+ cmd.del_vbus.bus_no = bus_no;
if (!virt_control_chan_func) {
LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci callback not registered.");
return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
@@ -327,13 +322,13 @@ destroy_bus(struct controlvm_message *msg, char *buf)
/* finally, remove the bus from the list */
remove:
- write_lock(&BusListLock);
+ write_lock(&bus_list_lock);
if (prev) /* not at head */
prev->next = bus->next;
else
- BusListHead = bus->next;
- BusListCount--;
- write_unlock(&BusListLock);
+ bus_list = bus->next;
+ bus_list_count--;
+ write_unlock(&bus_list_lock);
if (bus->bus_channel) {
uislib_iounmap(bus->bus_channel);
@@ -344,26 +339,26 @@ remove:
return CONTROLVM_RESP_SUCCESS;
}
-static int
-create_device(struct controlvm_message *msg, char *buf)
+static int create_device(struct controlvm_message *msg, char *buf)
{
struct device_info *dev;
struct bus_info *bus;
- u32 busNo, devNo;
+ struct guest_msgs cmd;
+ u32 bus_no, dev_no;
int result = CONTROLVM_RESP_SUCCESS;
- u64 minSize = MIN_IO_CHANNEL_SIZE;
- struct req_handler_info *pReqHandler;
+ u64 min_size = MIN_IO_CHANNEL_SIZE;
+ struct req_handler_info *req_handler;
- busNo = msg->cmd.create_device.bus_no;
- devNo = msg->cmd.create_device.dev_no;
+ bus_no = msg->cmd.create_device.bus_no;
+ dev_no = msg->cmd.create_device.dev_no;
- POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo,
+ POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
POSTCODE_SEVERITY_INFO);
- dev = kzalloc(sizeof(struct device_info), GFP_ATOMIC);
+ dev = kzalloc(sizeof(*dev), GFP_ATOMIC);
if (!dev) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: kmalloc for dev failed.\n");
- POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
return CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
}
@@ -371,169 +366,157 @@ create_device(struct controlvm_message *msg, char *buf)
dev->channel_uuid = msg->cmd.create_device.data_type_uuid;
dev->intr = msg->cmd.create_device.intr;
dev->channel_addr = msg->cmd.create_device.channel_addr;
- dev->bus_no = busNo;
- dev->dev_no = devNo;
+ dev->bus_no = bus_no;
+ dev->dev_no = dev_no;
sema_init(&dev->interrupt_callback_lock, 1); /* unlocked */
- sprintf(dev->devid, "vbus%u:dev%u", (unsigned) busNo, (unsigned) devNo);
+ sprintf(dev->devid, "vbus%u:dev%u", (unsigned)bus_no, (unsigned)dev_no);
/* map the channel memory for the device. */
- if (msg->hdr.flags.test_message)
+ if (msg->hdr.flags.test_message) {
dev->chanptr = (void __iomem *)__va(dev->channel_addr);
- else {
- pReqHandler = req_handler_find(dev->channel_uuid);
- if (pReqHandler)
+ } else {
+ req_handler = req_handler_find(dev->channel_uuid);
+ if (req_handler)
/* generic service handler registered for this
* channel
*/
- minSize = pReqHandler->min_channel_bytes;
- if (minSize > msg->cmd.create_device.channel_bytes) {
+ min_size = req_handler->min_channel_bytes;
+ if (min_size > msg->cmd.create_device.channel_bytes) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: channel size is too small, channel size:0x%lx, required size:0x%lx",
- (ulong) msg->cmd.create_device.channel_bytes,
- (ulong) minSize);
- POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
- POSTCODE_SEVERITY_ERR);
+ (ulong)msg->cmd.create_device.channel_bytes,
+ (ulong)min_size);
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_ERR);
result = CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL;
- goto Away;
+ goto cleanup;
}
dev->chanptr =
uislib_ioremap_cache(dev->channel_addr,
msg->cmd.create_device.channel_bytes);
if (!dev->chanptr) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
- dev->channel_addr,
- msg->cmd.create_device.channel_bytes);
+ dev->channel_addr,
+ msg->cmd.create_device.channel_bytes);
result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
- POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
- POSTCODE_SEVERITY_ERR);
- goto Away;
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_ERR);
+ goto cleanup;
}
}
dev->instance_uuid = msg->cmd.create_device.dev_inst_uuid;
dev->channel_bytes = msg->cmd.create_device.channel_bytes;
- read_lock(&BusListLock);
- for (bus = BusListHead; bus; bus = bus->next) {
- if (bus->bus_no == busNo) {
- /* make sure the device number is valid */
- if (devNo >= bus->device_count) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: device (%d) >= deviceCount (%d).",
- devNo, bus->device_count);
- result = CONTROLVM_RESP_ERROR_MAX_DEVICES;
+ read_lock(&bus_list_lock);
+ for (bus = bus_list; bus; bus = bus->next) {
+ if (bus->bus_no != bus_no)
+ continue;
+ /* make sure the device number is valid */
+ if (dev_no >= bus->device_count) {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: device (%d) >= deviceCount (%d).",
+ dev_no, bus->device_count);
+ result = CONTROLVM_RESP_ERROR_MAX_DEVICES;
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_ERR);
+ read_unlock(&bus_list_lock);
+ goto cleanup;
+ }
+ /* make sure this device is not already set */
+ if (bus->device[dev_no]) {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: device %d is already exists.",
+ dev_no);
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC,
+ dev_no, bus_no,
+ POSTCODE_SEVERITY_ERR);
+ result = CONTROLVM_RESP_ERROR_ALREADY_DONE;
+ read_unlock(&bus_list_lock);
+ goto cleanup;
+ }
+ read_unlock(&bus_list_lock);
+ /* the msg is bound for virtpci; send
+ * guest_msgs struct to callback
+ */
+ if (msg->hdr.flags.server) {
+ bus->device[dev_no] = dev;
+ POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_INFO);
+ return CONTROLVM_RESP_SUCCESS;
+ }
+ if (uuid_le_cmp(dev->channel_uuid,
+ spar_vhba_channel_protocol_uuid) == 0) {
+ wait_for_valid_guid(&((struct channel_header __iomem *)
+ (dev->chanptr))->chtype);
+ if (!SPAR_VHBA_CHANNEL_OK_CLIENT(dev->chanptr)) {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.",
+ dev_no);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC,
- devNo, busNo,
+ dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
- read_unlock(&BusListLock);
- goto Away;
+ result = CONTROLVM_RESP_ERROR_CHANNEL_INVALID;
+ goto cleanup;
}
- /* make sure this device is not already set */
- if (bus->device[devNo]) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: device %d is already exists.",
- devNo);
+ cmd.msgtype = GUEST_ADD_VHBA;
+ cmd.add_vhba.chanptr = dev->chanptr;
+ cmd.add_vhba.bus_no = bus_no;
+ cmd.add_vhba.device_no = dev_no;
+ cmd.add_vhba.instance_uuid = dev->instance_uuid;
+ cmd.add_vhba.intr = dev->intr;
+ } else if (uuid_le_cmp(dev->channel_uuid,
+ spar_vnic_channel_protocol_uuid) == 0) {
+ wait_for_valid_guid(&((struct channel_header __iomem *)
+ (dev->chanptr))->chtype);
+ if (!SPAR_VNIC_CHANNEL_OK_CLIENT(dev->chanptr)) {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.",
+ dev_no);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC,
- devNo, busNo,
+ dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
- result = CONTROLVM_RESP_ERROR_ALREADY_DONE;
- read_unlock(&BusListLock);
- goto Away;
+ result = CONTROLVM_RESP_ERROR_CHANNEL_INVALID;
+ goto cleanup;
}
- read_unlock(&BusListLock);
- /* the msg is bound for virtpci; send
- * guest_msgs struct to callback
- */
- if (!msg->hdr.flags.server) {
- struct guest_msgs cmd;
-
- if (!uuid_le_cmp(dev->channel_uuid,
- spar_vhba_channel_protocol_uuid)) {
- wait_for_valid_guid(&((
- struct channel_header
- __iomem *) (dev->
- chanptr))->
- chtype);
- if (!SPAR_VHBA_CHANNEL_OK_CLIENT
- (dev->chanptr)) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed:[CLIENT]VHBA dev %d chan invalid.",
- devNo);
- POSTCODE_LINUX_4
- (DEVICE_CREATE_FAILURE_PC,
- devNo, busNo,
- POSTCODE_SEVERITY_ERR);
- result = CONTROLVM_RESP_ERROR_CHANNEL_INVALID;
- goto Away;
- }
- cmd.msgtype = GUEST_ADD_VHBA;
- cmd.add_vhba.chanptr = dev->chanptr;
- cmd.add_vhba.bus_no = busNo;
- cmd.add_vhba.device_no = devNo;
- cmd.add_vhba.instance_uuid =
- dev->instance_uuid;
- cmd.add_vhba.intr = dev->intr;
- } else
- if (!uuid_le_cmp(dev->channel_uuid,
- spar_vnic_channel_protocol_uuid)) {
- wait_for_valid_guid(&((
- struct channel_header
- __iomem *) (dev->
- chanptr))->
- chtype);
- if (!SPAR_VNIC_CHANNEL_OK_CLIENT
- (dev->chanptr)) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: VNIC[CLIENT] dev %d chan invalid.",
- devNo);
- POSTCODE_LINUX_4
- (DEVICE_CREATE_FAILURE_PC,
- devNo, busNo,
- POSTCODE_SEVERITY_ERR);
- result = CONTROLVM_RESP_ERROR_CHANNEL_INVALID;
- goto Away;
- }
- cmd.msgtype = GUEST_ADD_VNIC;
- cmd.add_vnic.chanptr = dev->chanptr;
- cmd.add_vnic.bus_no = busNo;
- cmd.add_vnic.device_no = devNo;
- cmd.add_vnic.instance_uuid =
- dev->instance_uuid;
- cmd.add_vhba.intr = dev->intr;
- } else {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: unknown channelTypeGuid.\n");
- POSTCODE_LINUX_4
- (DEVICE_CREATE_FAILURE_PC, devNo,
- busNo, POSTCODE_SEVERITY_ERR);
- result = CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
- goto Away;
- }
+ cmd.msgtype = GUEST_ADD_VNIC;
+ cmd.add_vnic.chanptr = dev->chanptr;
+ cmd.add_vnic.bus_no = bus_no;
+ cmd.add_vnic.device_no = dev_no;
+ cmd.add_vnic.instance_uuid = dev->instance_uuid;
+ cmd.add_vhba.intr = dev->intr;
+ } else {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: unknown channelTypeGuid.\n");
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_ERR);
+ result = CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
+ goto cleanup;
+ }
- if (!virt_control_chan_func) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci callback not registered.");
- POSTCODE_LINUX_4
- (DEVICE_CREATE_FAILURE_PC, devNo,
- busNo, POSTCODE_SEVERITY_ERR);
- result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
- goto Away;
- }
+ if (!virt_control_chan_func) {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci callback not registered.");
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_ERR);
+ result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
+ goto cleanup;
+ }
- if (!virt_control_chan_func(&cmd)) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci GUEST_ADD_[VHBA||VNIC] returned error.");
- POSTCODE_LINUX_4
- (DEVICE_CREATE_FAILURE_PC, devNo,
- busNo, POSTCODE_SEVERITY_ERR);
- result = CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
- goto Away;
- }
- }
- bus->device[devNo] = dev;
- POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, devNo, busNo,
- POSTCODE_SEVERITY_INFO);
- return CONTROLVM_RESP_SUCCESS;
+ if (!virt_control_chan_func(&cmd)) {
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: virtpci GUEST_ADD_[VHBA||VNIC] returned error.");
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_ERR);
+ result =
+ CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
+ goto cleanup;
}
+
+ bus->device[dev_no] = dev;
+ POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no,
+ bus_no, POSTCODE_SEVERITY_INFO);
+ return CONTROLVM_RESP_SUCCESS;
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: failed to find bus %d.", busNo);
- POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
+ LOGERR("CONTROLVM_DEVICE_CREATE Failed: failed to find bus %d.",
+ bus_no);
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
result = CONTROLVM_RESP_ERROR_BUS_INVALID;
-Away:
+cleanup:
if (!msg->hdr.flags.test_message) {
uislib_iounmap(dev->chanptr);
dev->chanptr = NULL;
@@ -543,32 +526,31 @@ Away:
return result;
}
-static int
-pause_device(struct controlvm_message *msg)
+static int pause_device(struct controlvm_message *msg)
{
- u32 busNo, devNo;
+ u32 bus_no, dev_no;
struct bus_info *bus;
struct device_info *dev;
struct guest_msgs cmd;
int retval = CONTROLVM_RESP_SUCCESS;
- busNo = msg->cmd.device_change_state.bus_no;
- devNo = msg->cmd.device_change_state.dev_no;
+ bus_no = msg->cmd.device_change_state.bus_no;
+ dev_no = msg->cmd.device_change_state.dev_no;
- read_lock(&BusListLock);
- for (bus = BusListHead; bus; bus = bus->next) {
- if (bus->bus_no == busNo) {
+ read_lock(&bus_list_lock);
+ for (bus = bus_list; bus; bus = bus->next) {
+ if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
- if (devNo >= bus->device_count) {
+ if (dev_no >= bus->device_count) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).",
- devNo, bus->device_count);
+ dev_no, bus->device_count);
retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else {
/* make sure this device exists */
- dev = bus->device[devNo];
+ dev = bus->device[dev_no];
if (!dev) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.",
- devNo);
+ dev_no);
retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
@@ -578,20 +560,20 @@ pause_device(struct controlvm_message *msg)
}
if (!bus) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist",
- busNo);
+ bus_no);
retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
if (retval == CONTROLVM_RESP_SUCCESS) {
/* the msg is bound for virtpci; send
* guest_msgs struct to callback
*/
- if (!uuid_le_cmp(dev->channel_uuid,
- spar_vhba_channel_protocol_uuid)) {
+ if (uuid_le_cmp(dev->channel_uuid,
+ spar_vhba_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_PAUSE_VHBA;
cmd.pause_vhba.chanptr = dev->chanptr;
- } else if (!uuid_le_cmp(dev->channel_uuid,
- spar_vnic_channel_protocol_uuid)) {
+ } else if (uuid_le_cmp(dev->channel_uuid,
+ spar_vnic_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_PAUSE_VNIC;
cmd.pause_vnic.chanptr = dev->chanptr;
} else {
@@ -611,32 +593,31 @@ pause_device(struct controlvm_message *msg)
return retval;
}
-static int
-resume_device(struct controlvm_message *msg)
+static int resume_device(struct controlvm_message *msg)
{
- u32 busNo, devNo;
+ u32 bus_no, dev_no;
struct bus_info *bus;
struct device_info *dev;
struct guest_msgs cmd;
int retval = CONTROLVM_RESP_SUCCESS;
- busNo = msg->cmd.device_change_state.bus_no;
- devNo = msg->cmd.device_change_state.dev_no;
+ bus_no = msg->cmd.device_change_state.bus_no;
+ dev_no = msg->cmd.device_change_state.dev_no;
- read_lock(&BusListLock);
- for (bus = BusListHead; bus; bus = bus->next) {
- if (bus->bus_no == busNo) {
+ read_lock(&bus_list_lock);
+ for (bus = bus_list; bus; bus = bus->next) {
+ if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
- if (devNo >= bus->device_count) {
+ if (dev_no >= bus->device_count) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device(%d) >= deviceCount(%d).",
- devNo, bus->device_count);
+ dev_no, bus->device_count);
retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else {
/* make sure this device exists */
- dev = bus->device[devNo];
+ dev = bus->device[dev_no];
if (!dev) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device %d does not exist.",
- devNo);
+ dev_no);
retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
@@ -647,20 +628,20 @@ resume_device(struct controlvm_message *msg)
if (!bus) {
LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: bus %d does not exist",
- busNo);
+ bus_no);
retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
/* the msg is bound for virtpci; send
* guest_msgs struct to callback
*/
if (retval == CONTROLVM_RESP_SUCCESS) {
- if (!uuid_le_cmp(dev->channel_uuid,
- spar_vhba_channel_protocol_uuid)) {
+ if (uuid_le_cmp(dev->channel_uuid,
+ spar_vhba_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_RESUME_VHBA;
cmd.resume_vhba.chanptr = dev->chanptr;
- } else if (!uuid_le_cmp(dev->channel_uuid,
- spar_vnic_channel_protocol_uuid)) {
+ } else if (uuid_le_cmp(dev->channel_uuid,
+ spar_vnic_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_RESUME_VNIC;
cmd.resume_vnic.chanptr = dev->chanptr;
} else {
@@ -680,33 +661,33 @@ resume_device(struct controlvm_message *msg)
return retval;
}
-static int
-destroy_device(struct controlvm_message *msg, char *buf)
+static int destroy_device(struct controlvm_message *msg, char *buf)
{
- u32 busNo, devNo;
+ u32 bus_no, dev_no;
struct bus_info *bus;
struct device_info *dev;
struct guest_msgs cmd;
int retval = CONTROLVM_RESP_SUCCESS;
- busNo = msg->cmd.destroy_device.bus_no;
- devNo = msg->cmd.destroy_device.bus_no;
+ bus_no = msg->cmd.destroy_device.bus_no;
+ dev_no = msg->cmd.destroy_device.bus_no;
- read_lock(&BusListLock);
- LOGINF("destroy_device called for busNo=%u, devNo=%u", busNo, devNo);
- for (bus = BusListHead; bus; bus = bus->next) {
- if (bus->bus_no == busNo) {
+ read_lock(&bus_list_lock);
+ LOGINF("destroy_device called for bus_no=%u, dev_no=%u", bus_no,
+ dev_no);
+ for (bus = bus_list; bus; bus = bus->next) {
+ if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
- if (devNo >= bus->device_count) {
- LOGERR("CONTROLVM_DEVICE_DESTORY Failed: device(%d) >= deviceCount(%d).",
- devNo, bus->device_count);
+ if (dev_no >= bus->device_count) {
+ LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device(%d) >= device_count(%d).",
+ dev_no, bus->device_count);
retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else {
/* make sure this device exists */
- dev = bus->device[devNo];
+ dev = bus->device[dev_no];
if (!dev) {
LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device %d does not exist.",
- devNo);
+ dev_no);
retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
@@ -717,20 +698,20 @@ destroy_device(struct controlvm_message *msg, char *buf)
if (!bus) {
LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist",
- busNo);
+ bus_no);
retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
if (retval == CONTROLVM_RESP_SUCCESS) {
/* the msg is bound for virtpci; send
* guest_msgs struct to callback
*/
- if (!uuid_le_cmp(dev->channel_uuid,
- spar_vhba_channel_protocol_uuid)) {
+ if (uuid_le_cmp(dev->channel_uuid,
+ spar_vhba_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_DEL_VHBA;
cmd.del_vhba.chanptr = dev->chanptr;
- } else if (!uuid_le_cmp(dev->channel_uuid,
- spar_vnic_channel_protocol_uuid)) {
+ } else if (uuid_le_cmp(dev->channel_uuid,
+ spar_vnic_channel_protocol_uuid) == 0) {
cmd.msgtype = GUEST_DEL_VNIC;
cmd.del_vnic.chanptr = dev->chanptr;
} else {
@@ -739,7 +720,7 @@ destroy_device(struct controlvm_message *msg, char *buf)
CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
}
if (!virt_control_chan_func) {
- LOGERR("CONTROLVM_DEVICE_DESTORY Failed: virtpci callback not registered.");
+ LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci callback not registered.");
return
CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
}
@@ -755,7 +736,7 @@ destroy_device(struct controlvm_message *msg, char *buf)
*/
if (dev->polling) {
LOGINF("calling uislib_disable_channel_interrupts");
- uislib_disable_channel_interrupts(busNo, devNo);
+ uislib_disable_channel_interrupts(bus_no, dev_no);
}
/* unmap the channel memory for the device. */
if (!msg->hdr.flags.test_message) {
@@ -763,7 +744,7 @@ destroy_device(struct controlvm_message *msg, char *buf)
uislib_iounmap(dev->chanptr);
}
kfree(dev);
- bus->device[devNo] = NULL;
+ bus->device[dev_no] = NULL;
}
return retval;
}
@@ -773,9 +754,9 @@ init_chipset(struct controlvm_message *msg, char *buf)
{
POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO);
- MaxBusCount = msg->cmd.init_chipset.bus_count;
- PlatformNumber = msg->cmd.init_chipset.platform_number;
- PhysicalDataChan = 0;
+ max_bus_count = msg->cmd.init_chipset.bus_count;
+ platform_no = msg->cmd.init_chipset.platform_number;
+ phys_data_chan = 0;
/* We need to make sure we have our functions registered
* before processing messages. If we are a test vehicle the
@@ -793,31 +774,29 @@ init_chipset(struct controlvm_message *msg, char *buf)
return CONTROLVM_RESP_SUCCESS;
}
-static int
-delete_bus_glue(u32 busNo)
+static int delete_bus_glue(u32 bus_no)
{
struct controlvm_message msg;
init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0);
- msg.cmd.destroy_bus.bus_no = busNo;
+ msg.cmd.destroy_bus.bus_no = bus_no;
if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("destroy_bus failed. busNo=0x%x\n", busNo);
+ LOGERR("destroy_bus failed. bus_no=0x%x\n", bus_no);
return 0;
}
return 1;
}
-static int
-delete_device_glue(u32 busNo, u32 devNo)
+static int delete_device_glue(u32 bus_no, u32 dev_no)
{
struct controlvm_message msg;
init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0);
- msg.cmd.destroy_device.bus_no = busNo;
- msg.cmd.destroy_device.dev_no = devNo;
+ msg.cmd.destroy_device.bus_no = bus_no;
+ msg.cmd.destroy_device.dev_no = dev_no;
if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("destroy_device failed. busNo=0x%x devNo=0x%x\n", busNo,
- devNo);
+ LOGERR("destroy_device failed. bus_no=0x%x dev_no=0x%x\n",
+ bus_no, dev_no);
return 0;
}
return 1;
@@ -874,7 +853,6 @@ uislib_client_inject_add_bus(u32 bus_no, uuid_le inst_uuid,
}
EXPORT_SYMBOL_GPL(uislib_client_inject_add_bus);
-
int
uislib_client_inject_del_bus(u32 bus_no)
{
@@ -919,7 +897,6 @@ uislib_client_inject_resume_vhba(u32 bus_no, u32 dev_no)
return rc;
}
return 0;
-
}
EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba);
@@ -956,7 +933,7 @@ uislib_client_inject_add_vhba(u32 bus_no, u32 dev_no,
msg.cmd.create_device.channel_addr = phys_chan_addr;
if (chan_bytes < MIN_IO_CHANNEL_SIZE) {
LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n",
- chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE);
+ chan_bytes, (unsigned int)MIN_IO_CHANNEL_SIZE);
POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, chan_bytes,
MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
return 0;
@@ -1015,7 +992,7 @@ uislib_client_inject_add_vnic(u32 bus_no, u32 dev_no,
msg.cmd.create_device.channel_addr = phys_chan_addr;
if (chan_bytes < MIN_IO_CHANNEL_SIZE) {
LOGERR("wrong channel size.chan_bytes = 0x%x IO_CHANNEL_SIZE= 0x%x\n",
- chan_bytes, (unsigned int) MIN_IO_CHANNEL_SIZE);
+ chan_bytes, (unsigned int)MIN_IO_CHANNEL_SIZE);
POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, chan_bytes,
MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
return 0;
@@ -1072,7 +1049,6 @@ uislib_client_inject_resume_vnic(u32 bus_no, u32 dev_no)
return -1;
}
return 0;
-
}
EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic);
@@ -1129,14 +1105,12 @@ info_debugfs_read_helper(char **buff, int *buff_len)
if (PLINE("\nBuses:\n") < 0)
goto err_done;
- read_lock(&BusListLock);
- for (bus = BusListHead; bus; bus = bus->next) {
-
+ read_lock(&bus_list_lock);
+ for (bus = bus_list; bus; bus = bus->next) {
if (PLINE(" bus=0x%p, busNo=%d, deviceCount=%d\n",
bus, bus->bus_no, bus->device_count) < 0)
goto err_done_unlock;
-
if (PLINE(" Devices:\n") < 0)
goto err_done_unlock;
@@ -1156,7 +1130,7 @@ info_debugfs_read_helper(char **buff, int *buff_len)
}
}
}
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
if (PLINE("UisUtils_Registered_Services: %d\n",
atomic_read(&uisutils_registered_services)) < 0)
@@ -1175,70 +1149,68 @@ info_debugfs_read_helper(char **buff, int *buff_len)
return tot;
err_done_unlock:
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
err_done:
return -1;
}
-static ssize_t
-info_debugfs_read(struct file *file, char __user *buf,
- size_t len, loff_t *offset)
+static ssize_t info_debugfs_read(struct file *file, char __user *buf,
+ size_t len, loff_t *offset)
{
char *temp;
- int totalBytes = 0;
+ int total_bytes = 0;
int remaining_bytes = PROC_READ_BUFFER_SIZE;
/* *start = buf; */
- if (ProcReadBuffer == NULL) {
- DBGINF("ProcReadBuffer == NULL; allocating buffer.\n.");
- ProcReadBuffer = vmalloc(PROC_READ_BUFFER_SIZE);
+ if (debug_buf == NULL) {
+ DBGINF("debug_buf == NULL; allocating buffer.\n.");
+ debug_buf = vmalloc(PROC_READ_BUFFER_SIZE);
- if (ProcReadBuffer == NULL) {
+ if (debug_buf == NULL) {
LOGERR("failed to allocate buffer to provide proc data.\n");
return -ENOMEM;
}
}
- temp = ProcReadBuffer;
+ temp = debug_buf;
- if ((*offset == 0) || (!ProcReadBufferValid)) {
+ if ((*offset == 0) || (!debug_buf_valid)) {
DBGINF("calling info_debugfs_read_helper.\n");
/* if the read fails, then -1 will be returned */
- totalBytes = info_debugfs_read_helper(&temp, &remaining_bytes);
- ProcReadBufferValid = 1;
- } else
- totalBytes = strlen(ProcReadBuffer);
+ total_bytes = info_debugfs_read_helper(&temp, &remaining_bytes);
+ debug_buf_valid = 1;
+ } else {
+ total_bytes = strlen(debug_buf);
+ }
return simple_read_from_buffer(buf, len, offset,
- ProcReadBuffer, totalBytes);
+ debug_buf, total_bytes);
}
-static struct device_info *
-find_dev(u32 busNo, u32 devNo)
+static struct device_info *find_dev(u32 bus_no, u32 dev_no)
{
struct bus_info *bus;
struct device_info *dev = NULL;
- read_lock(&BusListLock);
- for (bus = BusListHead; bus; bus = bus->next) {
- if (bus->bus_no == busNo) {
+ read_lock(&bus_list_lock);
+ for (bus = bus_list; bus; bus = bus->next) {
+ if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
- if (devNo >= bus->device_count) {
- LOGERR("%s bad busNo, devNo=%d,%d",
+ if (dev_no >= bus->device_count) {
+ LOGERR("%s bad bus_no, dev_no=%d,%d",
__func__,
- (int) (busNo), (int) (devNo));
- goto Away;
+ (int)bus_no, (int)dev_no);
+ break;
}
- dev = bus->device[devNo];
+ dev = bus->device[dev_no];
if (!dev)
- LOGERR("%s bad busNo, devNo=%d,%d",
+ LOGERR("%s bad bus_no, dev_no=%d,%d",
__func__,
- (int) (busNo), (int) (devNo));
- goto Away;
+ (int)bus_no, (int)dev_no);
+ break;
}
}
-Away:
- read_unlock(&BusListLock);
+ read_unlock(&bus_list_lock);
return dev;
}
@@ -1262,8 +1234,7 @@ Away:
* less-busy ones.
*
*/
-static int
-Process_Incoming(void *v)
+static int process_incoming(void *v)
{
unsigned long long cur_cycles, old_cycles, idle_cycles, delta_cycles;
struct list_head *new_tail = NULL;
@@ -1272,7 +1243,7 @@ Process_Incoming(void *v)
UIS_DAEMONIZE("dev_incoming");
for (i = 0; i < 16; i++) {
old_cycles = get_cycles();
- wait_event_timeout(Wakeup_Polling_Device_Channels,
+ wait_event_timeout(poll_dev_wake_q,
0, POLLJIFFIES_NORMAL);
cur_cycles = get_cycles();
if (wait_cycles == 0) {
@@ -1285,15 +1256,15 @@ Process_Incoming(void *v)
LOGINF("wait_cycles=%llu", wait_cycles);
cycles_before_wait = wait_cycles;
idle_cycles = 0;
- Go_Polling_Device_Channels = 0;
+ poll_dev_start = 0;
while (1) {
struct list_head *lelt, *tmp;
struct device_info *dev = NULL;
/* poll each channel for input */
- down(&Lock_Polling_Device_Channels);
+ down(&poll_dev_lock);
new_tail = NULL;
- list_for_each_safe(lelt, tmp, &List_Polling_Device_Channels) {
+ list_for_each_safe(lelt, tmp, &poll_dev_chan) {
int rc = 0;
dev = list_entry(lelt, struct device_info,
@@ -1315,22 +1286,22 @@ Process_Incoming(void *v)
if (!
(list_is_last
(lelt,
- &List_Polling_Device_Channels))) {
+ &poll_dev_chan))) {
new_tail = lelt;
dev->moved_to_tail_cnt++;
- } else
+ } else {
dev->last_on_list_cnt++;
+ }
}
-
}
- if (Incoming_ThreadInfo.should_stop)
+ if (incoming_ti.should_stop)
break;
}
if (new_tail != NULL) {
tot_moved_to_tail_cnt++;
- list_move_tail(new_tail, &List_Polling_Device_Channels);
+ list_move_tail(new_tail, &poll_dev_chan);
}
- up(&Lock_Polling_Device_Channels);
+ up(&poll_dev_lock);
cur_cycles = get_cycles();
delta_cycles = cur_cycles - old_cycles;
old_cycles = cur_cycles;
@@ -1340,24 +1311,24 @@ Process_Incoming(void *v)
* - there is no input waiting on any of the channels
* - we have received a signal to stop this thread
*/
- if (Incoming_ThreadInfo.should_stop)
+ if (incoming_ti.should_stop)
break;
if (en_smart_wakeup == 0xFF) {
LOGINF("en_smart_wakeup set to 0xff, to force exiting process_incoming");
break;
}
/* wait for POLLJIFFIES_NORMAL jiffies, or until
- * someone wakes up Wakeup_Polling_Device_Channels,
+ * someone wakes up poll_dev_wake_q,
* whichever comes first only do a wait when we have
* been idle for cycles_before_wait cycles.
*/
if (idle_cycles > cycles_before_wait) {
- Go_Polling_Device_Channels = 0;
+ poll_dev_start = 0;
tot_wait_cnt++;
- wait_event_timeout(Wakeup_Polling_Device_Channels,
- Go_Polling_Device_Channels,
+ wait_event_timeout(poll_dev_wake_q,
+ poll_dev_start,
POLLJIFFIES_NORMAL);
- Go_Polling_Device_Channels = 1;
+ poll_dev_start = 1;
} else {
tot_schedule_cnt++;
schedule();
@@ -1365,25 +1336,25 @@ Process_Incoming(void *v)
}
}
DBGINF("exiting.\n");
- complete_and_exit(&Incoming_ThreadInfo.has_stopped, 0);
+ complete_and_exit(&incoming_ti.has_stopped, 0);
}
static BOOL
-Initialize_incoming_thread(void)
+initialize_incoming_thread(void)
{
- if (Incoming_Thread_Started)
+ if (incoming_started)
return TRUE;
- if (!uisthread_start(&Incoming_ThreadInfo,
- &Process_Incoming, NULL, "dev_incoming")) {
- LOGERR("uisthread_start Initialize_incoming_thread ****FAILED");
+ if (!uisthread_start(&incoming_ti,
+ &process_incoming, NULL, "dev_incoming")) {
+ LOGERR("uisthread_start initialize_incoming_thread ****FAILED");
return FALSE;
}
- Incoming_Thread_Started = TRUE;
+ incoming_started = TRUE;
return TRUE;
}
/* Add a new device/channel to the list being processed by
- * Process_Incoming().
+ * process_incoming().
* <interrupt> - indicates the function to call periodically.
* <interrupt_context> - indicates the data to pass to the <interrupt>
* function.
@@ -1397,23 +1368,23 @@ uislib_enable_channel_interrupts(u32 bus_no, u32 dev_no,
dev = find_dev(bus_no, dev_no);
if (!dev) {
- LOGERR("%s busNo=%d, devNo=%d", __func__, (int) (bus_no),
- (int) (dev_no));
+ LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no),
+ (int)(dev_no));
return;
}
- down(&Lock_Polling_Device_Channels);
- Initialize_incoming_thread();
+ down(&poll_dev_lock);
+ initialize_incoming_thread();
dev->interrupt = interrupt;
dev->interrupt_context = interrupt_context;
dev->polling = TRUE;
- list_add_tail(&(dev->list_polling_device_channels),
- &List_Polling_Device_Channels);
- up(&Lock_Polling_Device_Channels);
+ list_add_tail(&dev->list_polling_device_channels,
+ &poll_dev_chan);
+ up(&poll_dev_lock);
}
EXPORT_SYMBOL_GPL(uislib_enable_channel_interrupts);
/* Remove a device/channel from the list being processed by
- * Process_Incoming().
+ * process_incoming().
*/
void
uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no)
@@ -1422,31 +1393,31 @@ uislib_disable_channel_interrupts(u32 bus_no, u32 dev_no)
dev = find_dev(bus_no, dev_no);
if (!dev) {
- LOGERR("%s busNo=%d, devNo=%d", __func__, (int) (bus_no),
- (int) (dev_no));
+ LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no),
+ (int)(dev_no));
return;
}
- down(&Lock_Polling_Device_Channels);
+ down(&poll_dev_lock);
list_del(&dev->list_polling_device_channels);
dev->polling = FALSE;
dev->interrupt = NULL;
- up(&Lock_Polling_Device_Channels);
+ up(&poll_dev_lock);
}
EXPORT_SYMBOL_GPL(uislib_disable_channel_interrupts);
static void
do_wakeup_polling_device_channels(struct work_struct *dummy)
{
- if (!Go_Polling_Device_Channels) {
- Go_Polling_Device_Channels = 1;
- wake_up(&Wakeup_Polling_Device_Channels);
+ if (!poll_dev_start) {
+ poll_dev_start = 1;
+ wake_up(&poll_dev_wake_q);
}
}
-static DECLARE_WORK(Work_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
+/* Call this function when you want to send a hint to process_incoming() that
* your device might have more requests.
*/
void
@@ -1454,14 +1425,14 @@ uislib_force_channel_interrupt(u32 bus_no, u32 dev_no)
{
if (en_smart_wakeup == 0)
return;
- if (Go_Polling_Device_Channels)
+ if (poll_dev_start)
return;
/* The point of using schedule_work() instead of just doing
* the work inline is to force a slight delay before waking up
- * the Process_Incoming() thread.
+ * the process_incoming() thread.
*/
tot_wakeup_cnt++;
- schedule_work(&Work_wakeup_polling_device_channels);
+ schedule_work(&work_wakeup_polling_device_channels);
}
EXPORT_SYMBOL_GPL(uislib_force_channel_interrupt);
@@ -1472,35 +1443,35 @@ EXPORT_SYMBOL_GPL(uislib_force_channel_interrupt);
static int __init
uislib_mod_init(void)
{
-
if (!unisys_spar_platform)
return -ENODEV;
LOGINF("MONITORAPIS");
LOGINF("sizeof(struct uiscmdrsp):%lu bytes\n",
- (ulong) sizeof(struct uiscmdrsp));
+ (ulong)sizeof(struct uiscmdrsp));
LOGINF("sizeof(struct phys_info):%lu\n",
- (ulong) sizeof(struct phys_info));
+ (ulong)sizeof(struct phys_info));
LOGINF("sizeof(uiscmdrsp_scsi):%lu\n",
- (ulong) sizeof(struct uiscmdrsp_scsi));
+ (ulong)sizeof(struct uiscmdrsp_scsi));
LOGINF("sizeof(uiscmdrsp_net):%lu\n",
- (ulong) sizeof(struct uiscmdrsp_net));
+ (ulong)sizeof(struct uiscmdrsp_net));
LOGINF("sizeof(CONTROLVM_MESSAGE):%lu bytes\n",
- (ulong) sizeof(struct controlvm_message));
+ (ulong)sizeof(struct controlvm_message));
LOGINF("sizeof(struct spar_controlvm_channel_protocol):%lu bytes\n",
- (ulong) sizeof(struct spar_controlvm_channel_protocol));
+ (ulong)sizeof(struct spar_controlvm_channel_protocol));
LOGINF("sizeof(CHANNEL_HEADER):%lu bytes\n",
- (ulong) sizeof(struct channel_header));
+ (ulong)sizeof(struct channel_header));
LOGINF("sizeof(struct spar_io_channel_protocol):%lu bytes\n",
- (ulong) sizeof(struct spar_io_channel_protocol));
+ (ulong)sizeof(struct spar_io_channel_protocol));
LOGINF("SIZEOF_CMDRSP:%lu bytes\n", SIZEOF_CMDRSP);
LOGINF("SIZEOF_PROTOCOL:%lu bytes\n", SIZEOF_PROTOCOL);
/* initialize global pointers to NULL */
- BusListHead = NULL;
- BusListCount = MaxBusCount = 0;
- rwlock_init(&BusListLock);
+ bus_list = NULL;
+ bus_list_count = 0;
+ max_bus_count = 0;
+ rwlock_init(&bus_list_lock);
virt_control_chan_func = NULL;
/* Issue VMCALL_GET_CONTROLVM_ADDR to get CtrlChanPhysAddr and
@@ -1515,7 +1486,7 @@ uislib_mod_init(void)
platformnumber_debugfs_read = debugfs_create_u32(
PLATFORMNUMBER_DEBUGFS_ENTRY_FN, 0444, dir_debugfs,
- &PlatformNumber);
+ &platform_no);
cycles_before_wait_debugfs_read = debugfs_create_u64(
CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN, 0666, dir_debugfs,
@@ -1533,9 +1504,9 @@ uislib_mod_init(void)
static void __exit
uislib_mod_exit(void)
{
- if (ProcReadBuffer) {
- vfree(ProcReadBuffer);
- ProcReadBuffer = NULL;
+ if (debug_buf) {
+ vfree(debug_buf);
+ debug_buf = NULL;
}
debugfs_remove(info_debugfs_entry);