(void *)(p2) = SWAPPOINTERS_TEMP; \
} while (0)
-#define TBDDRV(fmt, args...) LOGERR(fmt, ## args)
-#define HUHDRV(fmt, args...) LOGERR(fmt, ## args)
-#define ERRDRV(fmt, args...) LOGERR(fmt, ## args)
#define WARNDRV(fmt, args...) LOGWRN(fmt, ## args)
#define SECUREDRV(fmt, args...) LOGWRN(fmt, ## args)
(void __iomem *)guid, sizeof(uuid_le));
if (uuid_le_cmp(tmpguid, NULL_UUID_LE) != 0)
break;
- LOGERR("Waiting for non-0 GUID (why???)...\n");
UIS_THREAD_WAIT_SEC(5);
}
- LOGERR("OK... GUID is non-0 now\n");
}
static inline unsigned int
#include <linux/printk.h>
-/*
- * # LOGERR
- *
- * \brief Log error message - logs a message at the LOG_ERR level,
- * including source line number information
- *
- * \param devname the device name of the device reporting this message, or
- * NULL if this message is NOT device-related.
- * \param fmt printf()-style format string containing the message to log.
- * \param args Optional arguments to be formatted and inserted into the format
- * \param string.
- * \return nothing
- *
- * Logs the specified error message at the LOG_ERR level. It will also
- * include the file, line number, and function name of where the error
- * originated in the log message.
- */
-#define LOGERR(fmt, args...) pr_err(fmt, ## args)
-#define LOGERRDEV(devname, fmt, args...) \
- pr_err("%s " fmt, devname, ## args)
-#define LOGERRDEVX(devno, fmt, args...) \
- pr_err("dev%d " fmt, devno, ## args)
-#define LOGERRNAME(vnic, fmt, args...) \
- do { \
- if (vnic != NULL) { \
- pr_err("%s " fmt, vnic->name, ## args); \
- } else { \
- pr_err(fmt, ## args); \
- } \
- } while (0)
-#define LOGORDUMPERR(seqfile, fmt, args...) do { \
- if (seqfile) { \
- seq_printf(seqfile, fmt, ## args); \
- } else { \
- LOGERR(fmt, ## args); \
- } \
- } while (0)
-
/*
* # LOGWRN
*
{
void __iomem *ch = uislib_ioremap_cache(ch_addr, ch_bytes);
- if (!ch) {
- LOGERR("CONTROLVM_BUS_CREATE error: ioremap_cache of channelAddr:%Lx for channelBytes:%llu failed",
- (unsigned long long)ch_addr,
- (unsigned long long)ch_bytes);
+ if (!ch)
return NULL;
- }
+
if (!SPAR_VBUS_CHANNEL_OK_CLIENT(ch)) {
- ERRDRV("%s channel cannot be used", __func__);
uislib_iounmap(ch);
return NULL;
}
size_t size;
if (max_bus_count == bus_list_count) {
- LOGERR("CONTROLVM_BUS_CREATE Failed: max buses:%d already created\n",
- max_bus_count);
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, max_bus_count,
POSTCODE_SEVERITY_ERR);
return CONTROLVM_RESP_ERROR_MAX_BUSES;
/* found a bus already in the list with same bus_no -
* reject add
*/
- LOGERR("CONTROLVM_BUS_CREATE Failed: bus %d already exists.\n",
- bus->bus_no);
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no,
POSTCODE_SEVERITY_ERR);
kfree(bus);
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) {
- LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci callback not registered.");
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no,
POSTCODE_SEVERITY_ERR);
kfree(bus);
return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
}
if (!virt_control_chan_func(&cmd)) {
- LOGERR("CONTROLVM_BUS_CREATE Failed: virtpci GUEST_ADD_VBUS returned error.");
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no,
POSTCODE_SEVERITY_ERR);
kfree(bus);
}
if (!bus) {
- LOGERR("CONTROLVM_BUS_DESTROY Failed: failed to find bus %d.\n",
- bus_no);
read_unlock(&bus_list_lock);
return CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
/* verify that this bus has no devices. */
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, bus_no);
read_unlock(&bus_list_lock);
return CONTROLVM_RESP_ERROR_BUS_DEVICE_ATTACHED;
}
with this bus. */
cmd.msgtype = GUEST_DEL_VBUS;
cmd.del_vbus.bus_no = bus_no;
- if (!virt_control_chan_func) {
- LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci callback not registered.");
+ if (!virt_control_chan_func)
return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
- }
- if (!virt_control_chan_func(&cmd)) {
- LOGERR("CONTROLVM_BUS_DESTROY Failed: virtpci GUEST_DEL_VBUS returned error.");
+
+ if (!virt_control_chan_func(&cmd))
return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
- }
/* finally, remove the bus from the list */
remove:
*/
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)min_size);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
bus_no, POSTCODE_SEVERITY_ERR);
result = CONTROLVM_RESP_ERROR_CHANNEL_SIZE_TOO_SMALL;
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);
result = CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no,
bus_no, POSTCODE_SEVERITY_ERR);
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);
}
/* 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);
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,
dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
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,
dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
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;
}
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;
}
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 =
}
read_unlock(&bus_list_lock);
- 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;
if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
if (dev_no >= bus->device_count) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device(%d) >= deviceCount(%d).",
- dev_no, bus->device_count);
retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else {
/* make sure this device exists */
dev = bus->device[dev_no];
if (!dev) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: device %d does not exist.",
- dev_no);
retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
break;
}
}
- if (!bus) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: bus %d does not exist",
- bus_no);
+ if (!bus)
retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
- }
+
read_unlock(&bus_list_lock);
if (retval == CONTROLVM_RESP_SUCCESS) {
/* the msg is bound for virtpci; send
cmd.msgtype = GUEST_PAUSE_VNIC;
cmd.pause_vnic.chanptr = dev->chanptr;
} else {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: unknown channelTypeGuid.\n");
return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
}
if (!virt_control_chan_func) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered.");
return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
}
if (!virt_control_chan_func(&cmd)) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:pause Failed: virtpci GUEST_PAUSE_[VHBA||VNIC] returned error.");
return
CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
}
if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
if (dev_no >= bus->device_count) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device(%d) >= deviceCount(%d).",
- dev_no, bus->device_count);
retval = CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} else {
/* make sure this device exists */
dev = bus->device[dev_no];
if (!dev) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: device %d does not exist.",
- dev_no);
retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
}
}
- if (!bus) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: bus %d does not exist",
- bus_no);
+ if (!bus)
retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
- }
+
read_unlock(&bus_list_lock);
/* the msg is bound for virtpci; send
* guest_msgs struct to callback
cmd.msgtype = GUEST_RESUME_VNIC;
cmd.resume_vnic.chanptr = dev->chanptr;
} else {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: unknown channelTypeGuid.\n");
return CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
}
if (!virt_control_chan_func) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: virtpci callback not registered.");
return CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
}
if (!virt_control_chan_func(&cmd)) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE:resume Failed: virtpci GUEST_RESUME_[VHBA||VNIC] returned error.");
return
CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
}
if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
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[dev_no];
if (!dev) {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: device %d does not exist.",
- dev_no);
retval =
CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
}
}
- if (!bus) {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: bus %d does not exist",
- bus_no);
+ if (!bus)
retval = CONTROLVM_RESP_ERROR_BUS_INVALID;
- }
read_unlock(&bus_list_lock);
if (retval == CONTROLVM_RESP_SUCCESS) {
/* the msg is bound for virtpci; send
cmd.msgtype = GUEST_DEL_VNIC;
cmd.del_vnic.chanptr = dev->chanptr;
} else {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: unknown channelTypeGuid.\n");
return
CONTROLVM_RESP_ERROR_CHANNEL_TYPE_UNKNOWN;
}
if (!virt_control_chan_func) {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci callback not registered.");
return
CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_FAILURE;
}
if (!virt_control_chan_func(&cmd)) {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: virtpci GUEST_DEL_[VHBA||VNIC] returned error.");
return
CONTROLVM_RESP_ERROR_VIRTPCI_DRIVER_CALLBACK_ERROR;
}
init_msg_header(&msg, CONTROLVM_BUS_DESTROY, 0, 0);
msg.cmd.destroy_bus.bus_no = bus_no;
- if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("destroy_bus failed. bus_no=0x%x\n", bus_no);
+ if (destroy_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
return 0;
- }
return 1;
}
init_msg_header(&msg, CONTROLVM_DEVICE_DESTROY, 0, 0);
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. bus_no=0x%x dev_no=0x%x\n",
- bus_no, dev_no);
+ if (destroy_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
return 0;
- }
return 1;
}
*/
msg.cmd.init_chipset.bus_count = 23;
msg.cmd.init_chipset.switch_count = 0;
- if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("init_chipset failed.\n");
+ if (init_chipset(&msg, NULL) != CONTROLVM_RESP_SUCCESS)
return 0;
- }
POSTCODE_LINUX_3(CHIPSET_INIT_EXIT_PC, bus_no,
POSTCODE_SEVERITY_INFO);
}
msg.cmd.create_bus.channel_addr = channel_addr;
msg.cmd.create_bus.channel_bytes = n_channel_bytes;
if (create_bus(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("create_bus failed.\n");
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
POSTCODE_SEVERITY_ERR);
return 0;
msg.cmd.device_change_state.dev_no = dev_no;
msg.cmd.device_change_state.state = segment_state_standby;
rc = pause_device(&msg);
- if (rc != CONTROLVM_RESP_SUCCESS) {
- LOGERR("VHBA pause_device failed. busNo=0x%x devNo=0x%x\n",
- bus_no, dev_no);
+ if (rc != CONTROLVM_RESP_SUCCESS)
return rc;
- }
return 0;
}
EXPORT_SYMBOL_GPL(uislib_client_inject_pause_vhba);
msg.cmd.device_change_state.dev_no = dev_no;
msg.cmd.device_change_state.state = segment_state_running;
rc = resume_device(&msg);
- if (rc != CONTROLVM_RESP_SUCCESS) {
- LOGERR("VHBA resume_device failed. busNo=0x%x devNo=0x%x\n",
- bus_no, dev_no);
+ if (rc != CONTROLVM_RESP_SUCCESS)
return rc;
- }
return 0;
}
EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vhba);
sizeof(struct irq_info));
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);
POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, chan_bytes,
MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
return 0;
msg.cmd.create_device.channel_bytes = chan_bytes;
msg.cmd.create_device.data_type_uuid = spar_vhba_channel_protocol_uuid;
if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("VHBA create_device failed.\n");
POSTCODE_LINUX_4(VHBA_CREATE_FAILURE_PC, dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
return 0;
sizeof(struct irq_info));
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);
POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, chan_bytes,
MIN_IO_CHANNEL_SIZE, POSTCODE_SEVERITY_ERR);
return 0;
msg.cmd.create_device.channel_bytes = chan_bytes;
msg.cmd.create_device.data_type_uuid = spar_vnic_channel_protocol_uuid;
if (create_device(&msg, NULL) != CONTROLVM_RESP_SUCCESS) {
- LOGERR("VNIC create_device failed.\n");
POSTCODE_LINUX_4(VNIC_CREATE_FAILURE_PC, dev_no, bus_no,
POSTCODE_SEVERITY_ERR);
return 0;
msg.cmd.device_change_state.state = segment_state_standby;
rc = pause_device(&msg);
if (rc != CONTROLVM_RESP_SUCCESS) {
- LOGERR("VNIC pause_device failed. busNo=0x%x devNo=0x%x\n",
- bus_no, dev_no);
return -1;
}
return 0;
msg.cmd.device_change_state.dev_no = dev_no;
msg.cmd.device_change_state.state = segment_state_running;
rc = resume_device(&msg);
- if (rc != CONTROLVM_RESP_SUCCESS) {
- LOGERR("VNIC resume_device failed. busNo=0x%x devNo=0x%x\n",
- bus_no, dev_no);
+ if (rc != CONTROLVM_RESP_SUCCESS)
return -1;
- }
return 0;
}
EXPORT_SYMBOL_GPL(uislib_client_inject_resume_vnic);
*/
void *p = kmem_cache_alloc(cur_pool, GFP_ATOMIC | __GFP_NORETRY);
- if (p == NULL) {
- LOGERR("uislib_malloc failed to alloc uiscmdrsp @%s:%d",
- fn, ln);
+ if (p == NULL)
return NULL;
- }
return p;
}
EXPORT_SYMBOL_GPL(uislib_cache_alloc);
void
uislib_cache_free(struct kmem_cache *cur_pool, void *p, char *fn, int ln)
{
- if (p == NULL) {
- LOGERR("uislib_free NULL pointer @%s:%d", fn, ln);
+ if (p == NULL)
return;
- }
kmem_cache_free(cur_pool, p);
}
EXPORT_SYMBOL_GPL(uislib_cache_free);
if (debug_buf == NULL) {
debug_buf = vmalloc(PROC_READ_BUFFER_SIZE);
- if (debug_buf == NULL) {
- LOGERR("failed to allocate buffer to provide proc data.\n");
+ if (debug_buf == NULL)
return -ENOMEM;
- }
}
temp = debug_buf;
for (bus = bus_list; bus; bus = bus->next) {
if (bus->bus_no == bus_no) {
/* make sure the device number is valid */
- if (dev_no >= bus->device_count) {
- LOGERR("%s bad bus_no, dev_no=%d,%d",
- __func__,
- (int)bus_no, (int)dev_no);
+ if (dev_no >= bus->device_count)
break;
- }
dev = bus->device[dev_no];
- if (!dev)
- LOGERR("%s bad bus_no, dev_no=%d,%d",
- __func__,
- (int)bus_no, (int)dev_no);
break;
}
}
return TRUE;
if (!uisthread_start(&incoming_ti,
&process_incoming, NULL, "dev_incoming")) {
- LOGERR("uisthread_start initialize_incoming_thread ****FAILED");
return FALSE;
}
incoming_started = TRUE;
struct device_info *dev;
dev = find_dev(bus_no, dev_no);
- if (!dev) {
- LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no),
- (int)(dev_no));
+ if (!dev)
return;
- }
+
down(&poll_dev_lock);
initialize_incoming_thread();
dev->interrupt = interrupt;
struct device_info *dev;
dev = find_dev(bus_no, dev_no);
- if (!dev) {
- LOGERR("%s busNo=%d, devNo=%d", __func__, (int)(bus_no),
- (int)(dev_no));
+ if (!dev)
return;
- }
down(&poll_dev_lock);
list_del(&dev->list_polling_device_channels);
dev->polling = FALSE;
while (!do_locked_client_insert(queueinfo, whichqueue, cmdrsp,
(spinlock_t *)insertlock,
channel_id)) {
- if (oktowait != OK_TO_WAIT) {
- LOGERR("****FAILED visor_signal_insert failed; cannot wait; insert aborted\n");
+ if (oktowait != OK_TO_WAIT)
return 0; /* failed to queue */
- }
+
/* try again */
- LOGERR("****FAILED visor_signal_insert failed; waiting to try again\n");
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(10));
}
*buffer += *buffer_remaining;
*total += *buffer_remaining;
*buffer_remaining = 0;
- LOGERR("bytes remaining is too small!\n");
return -1;
}
*buffer_remaining -= len;
break;
default:
- LOGERR("invalid type %d.\n", type);
return 0;
}
if (chipset_driver_info)
while (vhbainfo->pending[insert_location].sent != NULL) {
insert_location = (insert_location + 1) % MAX_PENDING_REQUESTS;
if (insert_location == (int)vhbainfo->nextinsert) {
- LOGERR("Queue should be full. insert_location<<%d>> Unable to find open slot for pending commands.\n",
- insert_location);
spin_unlock_irqrestore(&vhbainfo->privlock, flags);
return -1;
}
int insert_location = add_scsipending_entry(vhbainfo, cmdtype, new);
while (insert_location == -1) {
- LOGERR("Failed to find empty queue slot. Waiting to try again\n");
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(msecs_to_jiffies(10));
insert_location = add_scsipending_entry(vhbainfo, cmdtype, new);
unsigned long flags;
void *sent = NULL;
- if (del >= MAX_PENDING_REQUESTS) {
- LOGERR("Invalid queue position <<%lu>> given to delete. MAX_PENDING_REQUESTS <<%d>>\n",
- (unsigned long)del, MAX_PENDING_REQUESTS);
- } else {
+ if (del < MAX_PENDING_REQUESTS) {
spin_lock_irqsave(&vhbainfo->privlock, flags);
-
- if (vhbainfo->pending[del].sent == NULL)
- LOGERR("Deleting already cleared queue entry at <<%lu>>.\n",
- (unsigned long)del);
-
sent = vhbainfo->pending[del].sent;
vhbainfo->pending[del].cmdtype = 0;
error =
scsi_add_device(dar->shost, dar->channel, dar->id,
dar->lun);
- if (error)
- LOGERR("Failed scsi_add_device: host_no=%d[chan=%d:id=%d:lun=%d]\n",
- dar->shost->host_no, dar->channel, dar->id,
- dar->lun);
- } else
- LOGERR("Failed scsi_device_lookup:[chan=%d:id=%d:lun=%d]\n",
- dar->channel, dar->id, dar->lun);
+ }
kfree(dar);
}
dar->id = cmdrsp->disknotify.id;
dar->lun = cmdrsp->disknotify.lun;
QUEUE_DISKADDREMOVE(dar);
- } else {
- LOGERR("kmalloc failed for dar. host_no=%d[chan=%d:id=%d:lun=%d]\n",
- shost->host_no, cmdrsp->disknotify.channel,
- cmdrsp->disknotify.id, cmdrsp->disknotify.lun);
}
}
*/
error = scsi_add_host(scsihost, &virtpcidev->generic_dev);
if (error) {
- LOGERR("scsi_add_host ****FAILED 0x%x TBD - RECOVER\n", error);
POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
/* decr refcount on scsihost which was incremented by
* scsi_add_host so the scsi_host gets deleted
if (!uisthread_start(&virthbainfo->chinfo.threadinfo,
process_incoming_rsps,
virthbainfo, "vhba_incoming")) {
- LOGERR("uisthread_start rsp ****FAILED\n");
/* decr refcount on scsihost which was incremented by
* scsi_add_host so the scsi_host gets deleted
*/
rsp = request_irq(virthbainfo->interrupt_vector, handler, IRQF_SHARED,
scsihost->hostt->name, virthbainfo);
if (rsp != 0) {
- LOGERR("request_irq(%d) uislib_virthba_ISR request failed with rsp=%d\n",
- virthbainfo->interrupt_vector, rsp);
virthbainfo->interrupt_vector = -1;
POSTCODE_LINUX_2(VHBA_PROBE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
} else {
u64 __iomem *Features_addr =
&virthbainfo->chinfo.queueinfo->chan->features;
- LOGERR("request_irq(%d) uislib_virthba_ISR request succeeded\n",
- virthbainfo->interrupt_vector);
mask = ~(ULTRA_IO_CHANNEL_IS_POLLING |
ULTRA_IO_DRIVER_DISABLES_INTS);
uisqueue_interlocked_and(Features_addr, mask);
virthba_host_reset_handler(struct scsi_cmnd *scsicmd)
{
/* issue TASK_MGMT_TARGET_RESET for each target on each bus for host */
- LOGERR("virthba_host_reset_handler Not yet implemented\n");
return SUCCESS;
}
if (insert_location != -1) {
cmdrsp->scsi.scsicmd = (void *)(uintptr_t)insert_location;
} else {
- LOGERR("Queue is full. Returning busy.\n");
kfree(cmdrsp);
return SCSI_MLQUEUE_DEVICE_BUSY;
}
max_buff_len = cmdrsp->scsi.bufflen;
if (scsi_sg_count(scsicmd) > MAX_PHYS_INFO) {
- LOGERR("scsicmd use_sg:%d greater than MAX:%d\n",
- scsi_sg_count(scsicmd), MAX_PHYS_INFO);
del_scsipending_entry(virthbainfo, (uintptr_t)insert_location);
kfree(cmdrsp);
return 1; /* reject the command */
/* convert buffer to phys information */
if (scsi_sg_count(scsicmd) == 0) {
if (scsi_bufflen(scsicmd) > 0) {
- LOGERR("**** FAILED No scatter list for bufflen > 0\n");
BUG_ON(scsi_sg_count(scsicmd) == 0);
}
} else {
}
if (sg_failed) {
- LOGERR("Start sg_list dump (entries %d, bufflen %d)...\n",
- scsi_sg_count(scsicmd), cmdrsp->scsi.bufflen);
- for_each_sg(sgl, sg, scsi_sg_count(scsicmd), i) {
- LOGERR(" Entry(%d): page->[0x%p], phys->[0x%Lx], off(%d), len(%d)\n",
- i, sg_page(sg),
- (unsigned long long)sg_phys(sg),
- sg->offset, sg->length);
- }
- LOGERR("Done sg_list dump.\n");
/* BUG(); ***** For now, let it fail in uissd
* if it is a problem, as it might just
* work
(u64)NULL, DONT_WAIT, "vhba");
if (i == 0) {
/* queue must be full - and we said don't wait - return busy */
- LOGERR("uisqueue_put_cmdrsp_with_lock ****FAILED\n");
kfree(cmdrsp);
del_scsipending_entry(virthbainfo, (uintptr_t)insert_location);
return SCSI_MLQUEUE_DEVICE_BUSY;
struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host;
virthbainfo = (struct virthba_info *)scsihost->hostdata;
- if (!virthbainfo) {
- LOGERR("Could not find virthba_info for scsihost\n");
+ if (!virthbainfo)
return 0; /* even though we errored, treat as success */
- }
+
for (vdisk = &virthbainfo->head; vdisk->next; vdisk = vdisk->next) {
if (vdisk->next->valid &&
(vdisk->next->channel == scsidev->channel) &&
struct Scsi_Host *scsihost = (struct Scsi_Host *)scsidev->host;
virthbainfo = (struct virthba_info *)scsihost->hostdata;
- if (!virthbainfo)
- LOGERR("Could not find virthba_info for scsihost\n");
for (vdisk = &virthbainfo->head; vdisk->next; vdisk = vdisk->next) {
if (vdisk->next->valid &&
(vdisk->next->channel == scsidev->channel) &&
if (atomic_read(&vdisk->error_count) < VIRTHBA_ERROR_COUNT) {
atomic_inc(&vdisk->error_count);
- LOGERR("SCSICMD ****FAILED scsicmd:0x%p op:0x%x <%d:%d:%d:%llu> 0x%x-0x%x-0x%x-0x%x-0x%x.\n",
- scsicmd, cmdrsp->scsi.cmnd[0],
- scsidev->host->host_no, scsidev->id,
- scsidev->channel, scsidev->lun,
- cmdrsp->scsi.linuxstat, sd->valid, sd->sense_key,
- sd->additional_sense_code,
- sd->additional_sense_code_qualifier);
- if (atomic_read(&vdisk->error_count) ==
- VIRTHBA_ERROR_COUNT) {
- LOGERR("Throtling SCSICMD errors disk <%d:%d:%d:%llu>\n",
- scsidev->host->host_no, scsidev->id,
- scsidev->channel, scsidev->lun);
- }
atomic_set(&vdisk->ios_threshold, IOS_ERROR_THRESHOLD);
}
}
if (scsi_sg_count(scsicmd) == 0) {
if (scsi_bufflen(scsicmd) > 0) {
- LOGERR("**** FAILED No scatter list for bufflen > 0\n");
BUG_ON(scsi_sg_count(scsicmd) ==
0);
}
if (atomic_read(&vdisk->ios_threshold) > 0) {
atomic_dec(&vdisk->ios_threshold);
if (atomic_read(&vdisk->ios_threshold) == 0) {
- LOGERR("Resetting error count for disk\n");
atomic_set(&vdisk->error_count, 0);
}
}
cmdrsp->vdiskmgmt.scsicmd))
break;
complete_vdiskmgmt_command(cmdrsp);
- } else
- LOGERR("Invalid cmdtype %d\n", cmdrsp->cmdtype);
+ }
/* cmdrsp is now available for reuse */
}
}
return -EINVAL;
buf[count] = '\0';
- if (copy_from_user(buf, buffer, count)) {
- LOGERR("copy_from_user failed. buf<<%.*s>> count<<%lu>>\n",
- (int)count, buf, count);
+ if (copy_from_user(buf, buffer, count))
return -EFAULT;
- }
i = kstrtoint(buf, 10, &new_value);
- if (i != 0) {
- LOGERR("Failed to scan value for enable_ints, buf<<%.*s>>",
- (int)count, buf);
+ if (i != 0)
return -EFAULT;
- }
/* set all counts to new_value usually 0 */
for (i = 0; i < VIRTHBASOPENMAX; i++) {
if (!virthbainfo->serverdown)
return 1;
- if (virthbainfo->serverchangingstate) {
- LOGERR("Server already processing change state message\n");
+ if (virthbainfo->serverchangingstate)
return 0;
- }
virthbainfo->serverchangingstate = true;
/* Must transition channel to ATTACHED state BEFORE we
if (!uisthread_start(&virthbainfo->chinfo.threadinfo,
process_incoming_rsps,
virthbainfo, "vhba_incoming")) {
- LOGERR("uisthread_start rsp ****FAILED\n");
return 0;
}
virthbainfo->serverdown = false;
cmdrsp->vdiskmgmt.notify);
break;
default:
- if (pendingdel->sent != NULL)
- LOGERR("Unknown command type: 0x%x. Only freeing list structure.\n",
- pendingdel->cmdtype);
+ break;
}
pendingdel->cmdtype = 0;
pendingdel->sent = NULL;
queue_work(virthba_serverdown_workqueue,
&virthbainfo->serverdown_completion);
} else if (virthbainfo->serverchangingstate) {
- LOGERR("Server already processing change state message\n");
stat = 0;
- } else {
- LOGERR("Server already down, but another server down message received.");
}
return stat;
error = virtpci_register_driver(&virthba_driver);
if (error < 0) {
- LOGERR("register ****FAILED 0x%x\n", error);
POSTCODE_LINUX_3(VHBA_CREATE_FAILURE_PC, error,
POSTCODE_SEVERITY_ERR);
} else {
virthba_serverdown_workqueue =
create_singlethread_workqueue("virthba_serverdown");
if (virthba_serverdown_workqueue == NULL) {
- LOGERR("**** FAILED virthba_serverdown_workqueue creation\n");
POSTCODE_LINUX_2(VHBA_CREATE_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
error = -1;
{
int off;
- if (!chan) {
- LOGERR("vbus channel not present");
+ if (!chan)
return -1;
- }
+
off = sizeof(struct channel_header) + chan->hdr_info.chp_info_offset;
if (chan->hdr_info.chp_info_offset == 0) {
- LOGERR("vbus channel not used, because chp_info_offset == 0");
return -1;
}
memcpy(((u8 *)(chan)) + off, info, sizeof(*info));
{
int off;
- if (!chan) {
- LOGERR("vbus channel not present");
+ if (!chan)
return -1;
- }
+
off = sizeof(struct channel_header) + chan->hdr_info.bus_info_offset;
- if (chan->hdr_info.bus_info_offset == 0) {
- LOGERR("vbus channel not used, because bus_info_offset == 0");
+ if (chan->hdr_info.bus_info_offset == 0)
return -1;
- }
memcpy(((u8 *)(chan)) + off, info, sizeof(*info));
return 0;
}
{
int off;
- if (!chan) {
- LOGERR("vbus channel not present");
+ if (!chan)
return -1;
- }
+
off =
(sizeof(struct channel_header) +
chan->hdr_info.dev_info_offset) +
(chan->hdr_info.device_info_struct_bytes * devix);
- if (chan->hdr_info.dev_info_offset == 0) {
- LOGERR("vbus channel not used, because dev_info_offset == 0");
+ if (chan->hdr_info.dev_info_offset == 0)
return -1;
- }
+
memcpy(((u8 *)(chan)) + off, info, sizeof(*info));
return 0;
}
*/
ret = device_register(vbus);
if (ret) {
- LOGERR("device_register FAILED:%d\n", ret);
POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
return 0;
}
POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
if (!WAIT_FOR_IO_CHANNEL
((struct spar_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;
}
sprintf(busid, "vbus%d", addparams->bus_no);
vbus = bus_find_device(&virtpci_bus_type, NULL,
(void *)busid, match_busid);
- if (!vbus) {
- LOGERR("**** FAILED to find vbus %s\n", busid);
+ if (!vbus)
return 0;
- }
i = virtpci_device_add(vbus, VIRTHBA_TYPE, addparams, &scsi, NULL);
if (i) {
POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
if (!WAIT_FOR_IO_CHANNEL
((struct spar_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;
}
sprintf(busid, "vbus%d", addparams->bus_no);
vbus = bus_find_device(&virtpci_bus_type, NULL,
(void *)busid, match_busid);
- if (!vbus) {
- LOGERR("**** FAILED to find vbus %s\n", busid);
+ if (!vbus)
return 0;
- }
i = virtpci_device_add(vbus, VIRTNIC_TYPE, addparams, NULL, &net);
if (i) {
sprintf(busid, "vbus%d", delparams->bus_no);
vbus = bus_find_device(&virtpci_bus_type, NULL,
(void *)busid, match_busid);
- if (!vbus) {
- LOGERR("**** FAILED to find vbus %s\n", busid);
+ if (!vbus)
return 0;
- }
/* ensure that bus has no devices? -- TBD */
return 1;
sprintf(busid, "vbus%d", delparams->bus_no);
vbus = bus_find_device(&virtpci_bus_type, NULL,
(void *)busid, match_busid);
- if (!vbus) {
- LOGERR("**** FAILED to find vbus %s\n", busid);
+ if (!vbus)
return 0;
- }
- if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) {
- LOGERR("**** FAILED to delete all devices; devtype:%d not vhba:%d or vnic:%d\n",
- devtype, VIRTHBA_TYPE, VIRTNIC_TYPE);
+ if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
return 0;
- }
/* delete all vhbas/vnics */
i = virtpci_device_del(vbus, devtype, NULL, NULL);
case GUEST_RESUME_VNIC:
return resume_vnic(&msg->resume_vnic);
default:
- LOGERR("invalid message type %d.\n", msg->msgtype);
return 0;
}
}
struct ultra_vbus_deviceinfo dev_info;
const char *stype;
- if (!dev) {
- LOGERR("%s dev is NULL", __func__);
+ if (!dev)
return;
- }
- if (!virtpcidrv) {
- LOGERR("%s driver is NULL", __func__);
+ if (!virtpcidrv)
return;
- }
+
vbus = dev->parent;
- if (!vbus) {
- LOGERR("%s dev has no parent bus", __func__);
+ if (!vbus)
return;
- }
+
chan = vbus->platform_data;
- if (!chan) {
- LOGERR("%s dev bus has no channel", __func__);
+ if (!chan)
return;
- }
+
switch (dev_type) {
case PCI_DEVICE_ID_VIRTHBA:
stype = "vHBA";
POSTCODE_LINUX_2(VPCI_CREATE_ENTRY_PC, POSTCODE_SEVERITY_INFO);
if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) {
- LOGERR("**** FAILED to add device; devtype:%d not vhba:%d or vnic:%d\n",
- devtype, VIRTHBA_TYPE, VIRTNIC_TYPE);
POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, devtype,
POSTCODE_SEVERITY_ERR);
return 0;
*/
write_unlock_irqrestore(&vpcidev_list_lock, flags);
kfree(virtpcidev);
- LOGERR("**** FAILED vhba/vnic already exists in the list\n");
POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
return 0;
}
* virtpci_device_probe is successful
*/
if (ret) {
- LOGERR("device_register returned %d\n", ret);
dev = &virtpcidev->generic_dev;
SPAR_CHANNEL_CLIENT_TRANSITION(addparams->chanptr,
BUS_ID(dev),
unsigned long flags;
int rc = 0;
- if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) {
- LOGERR("**** FAILED to pause device; devtype:%d not vhba:%d or vnic:%d\n",
- devtype, VIRTHBA_TYPE, VIRTNIC_TYPE);
+ if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
return 0;
- }
/* find the vhba or vnic in virtpci device list */
write_lock_irqsave(&vpcidev_list_lock, flags);
}
write_unlock_irqrestore(&vpcidev_list_lock, flags);
- if (!found) {
- LOGERR("**** FAILED to find vhba/vnic in the list\n");
+ if (!found)
return 0;
- }
return rc;
}
unsigned long flags;
int rc = 0;
- if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) {
- LOGERR("**** FAILED to resume device; devtype:%d not vhba:%d or vnic:%d\n",
- devtype, VIRTHBA_TYPE, VIRTNIC_TYPE);
+ if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
return 0;
- }
+
/* find the vhba or vnic in virtpci device list */
write_lock_irqsave(&vpcidev_list_lock, flags);
write_unlock_irqrestore(&vpcidev_list_lock, flags);
- if (!found) {
- LOGERR("**** FAILED to find vhba/vnic in the list\n");
+ if (!found)
return 0;
- }
return rc;
}
continue; \
}
- if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE)) {
- LOGERR("**** FAILED to delete device; devtype:%d not vhba:%d or vnic:%d\n",
- devtype, VIRTHBA_TYPE, VIRTNIC_TYPE);
+ if ((devtype != VIRTHBA_TYPE) && (devtype != VIRTNIC_TYPE))
return 0;
- }
/* see if we are to delete all - NOTE: all implies we have a
* valid parentbus
}
write_unlock_irqrestore(&vpcidev_list_lock, flags);
- if (!all && (count == 0)) {
- LOGERR("**** FAILED to find vhba/vnic in the list\n");
+ if (!all && (count == 0))
return 0;
- }
/* now delete each one from delete list */
while (dellist) {
{
int result = 0;
- if (drv->id_table == NULL) {
- LOGERR("id_table missing\n");
+ if (drv->id_table == NULL)
return 1;
- }
+
/* initialize core driver fields needed to call driver_register */
drv->core_driver.name = drv->name; /* name of driver in sysfs */
drv->core_driver.bus = &virtpci_bus_type; /* type of bus this
printparam.len = &len;
if (bus_for_each_dev(&virtpci_bus_type, NULL,
(void *)&printparam, print_vbus))
- LOGERR("Failed to find bus\n");
str_pos += scnprintf(vbuf + str_pos, len - str_pos,
"\n Virtual PCI devices\n");
* drivers directory
*/
if (ret) {
- LOGERR("bus_register ****FAILED:%d\n", ret);
POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, ret,
POSTCODE_SEVERITY_ERR);
return ret;
/* create a root bus used to parent all the virtpci buses. */
ret = device_register(&virtpci_rootbus_device);
if (ret) {
- LOGERR("device_register FAILED:%d\n", ret);
bus_unregister(&virtpci_bus_type);
POSTCODE_LINUX_3(VPCI_CREATE_FAILURE_PC, ret,
POSTCODE_SEVERITY_ERR);
if (!uisctrl_register_req_handler(2, (void *)&virtpci_ctrlchan_func,
&chipset_driver_info)) {
- LOGERR("uisctrl_register_req_handler ****FAILED.\n");
POSTCODE_LINUX_2(VPCI_CREATE_FAILURE_PC, POSTCODE_SEVERITY_ERR);
device_unregister(&virtpci_rootbus_device);
bus_unregister(&virtpci_bus_type);
static void __exit virtpci_mod_exit(void)
{
/* unregister the callback function */
- if (!uisctrl_register_req_handler(2, NULL, NULL))
- LOGERR("uisctrl_register_req_handler ****FAILED.\n");
-
device_unregister(&virtpci_rootbus_device);
bus_unregister(&virtpci_bus_type);
debugfs_remove_recursive(virtpci_debugfs_dir);
visor_memregion_create_overlapped(parent->memregion,
off, sizeof(struct channel_header));
if (p->memregion == NULL) {
- ERRDRV("visor_memregion_create failed failed: (status=0)\n");
rc = NULL;
goto cleanup;
}
if (visor_memregion_read(p->memregion, 0, &p->chan_hdr,
sizeof(struct channel_header)) < 0) {
- ERRDRV("visor_memregion_read failed: (status=0)\n");
rc = NULL;
goto cleanup;
}
/* we had better be a CLIENT of this channel */
guid = p->chan_hdr.chtype;
if (visor_memregion_resize(p->memregion, channel_bytes) < 0) {
- ERRDRV("visor_memregion_resize failed: (status=0)\n");
rc = NULL;
goto cleanup;
}
int written = 0;
u8 *buf = vmalloc(bufsize);
- if (buf == NULL) {
- ERRDRV("%s failed memory allocation", __func__);
+ if (buf == NULL)
goto cleanup;
- }
+
memset(buf, ch, bufsize);
while (nbytes > 0) {
ulong thisbytes = bufsize;
{
BOOL rc = FALSE;
- if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header)) {
- ERRDRV("oChannelSpace too small: (status=%d)\n", rc);
+ if (channel->chan_hdr.ch_space_offset < sizeof(struct channel_header))
goto cleanup;
- }
/* Read the appropriate SIGNAL_QUEUE_HEADER into local memory. */
SIG_QUEUE_OFFSET(&channel->chan_hdr, queue),
sig_hdr,
sizeof(struct signal_queue_header)) < 0) {
- ERRDRV("queue=%d SIG_QUEUE_OFFSET=%d",
- queue, (int)SIG_QUEUE_OFFSET(&channel->chan_hdr, queue));
- ERRDRV("visor_memregion_read of signal queue failed: (status=%d)\n",
- rc);
goto cleanup;
}
rc = TRUE;
if (visor_memregion_write(channel->memregion,
signal_data_offset,
data, sig_hdr->signal_size) < 0) {
- ERRDRV("visor_memregion_write of signal data failed: (status=%d)\n",
- rc);
goto cleanup;
}
} else {
if (visor_memregion_read(channel->memregion, signal_data_offset,
data, sig_hdr->signal_size) < 0) {
- ERRDRV("visor_memregion_read of signal data failed: (status=%d)\n",
- rc);
goto cleanup;
}
}
punsafe_sqh->head = *phead;
punsafe_sqh->tail = *ptail;
- ERRDRV("safe_sig_queue_validate: head = 0x%x, tail = 0x%x, MaxSlots = 0x%x",
- *phead, *ptail, psafe_sqh->max_slots);
return 0;
}
return 1;
sig_hdr.tail = (sig_hdr.tail + 1) % sig_hdr.max_slots;
if (!sig_read_data(channel, queue, &sig_hdr, sig_hdr.tail, msg)) {
- ERRDRV("sig_read_data failed\n");
return FALSE;
}
sig_hdr.num_received++;
* update host memory.
*/
mb(); /* required for channel synch */
- if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail)) {
- ERRDRV("visor_memregion_write of Tail failed\n");
+ if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, tail))
return FALSE;
- }
- if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received)) {
- ERRDRV("visor_memregion_write of NumSignalsReceived failed\n");
+ if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_received))
return FALSE;
- }
return TRUE;
}
sig_hdr.head = ((sig_hdr.head + 1) % sig_hdr.max_slots);
if (sig_hdr.head == sig_hdr.tail) {
sig_hdr.num_overflows++;
- if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_overflows))
- ERRDRV("visor_memregion_write of NumOverflows failed\n");
-
+ visor_memregion_write(channel->memregion,
+ SIG_QUEUE_OFFSET(&channel->chan_hdr,
+ queue) +
+ offsetof(struct signal_queue_header,
+ num_overflows),
+ &(sig_hdr.num_overflows),
+ sizeof(sig_hdr.num_overflows));
return FALSE;
}
- if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg)) {
- ERRDRV("sig_write_data failed\n");
+ if (!sig_write_data(channel, queue, &sig_hdr, sig_hdr.head, msg))
return FALSE;
- }
+
sig_hdr.num_sent++;
/* For each data field in SIGNAL_QUEUE_HEADER that was modified,
* update host memory.
*/
mb(); /* required for channel synch */
- if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head)) {
- ERRDRV("visor_memregion_write of Head failed\n");
+ if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, head))
return FALSE;
- }
if (!SIG_WRITE_FIELD(channel, queue, &sig_hdr, num_sent)) {
- ERRDRV("visor_memregion_write of NumSignalsSent failed\n");
return FALSE;
}
int i = 0;
int errcode = 0;
- if (channel == NULL) {
- ERRDRV("%s no channel", __func__);
+ if (channel == NULL)
return;
- }
+
memregion = channel->memregion;
- if (memregion == NULL) {
- ERRDRV("%s no memregion", __func__);
+ if (memregion == NULL)
return;
- }
+
addr = visor_memregion_get_physaddr(memregion);
nbytes_region = visor_memregion_get_nbytes(memregion);
errcode = visorchannel_read(channel, off,
goto fmt_failed;
errcode = visorchannel_read(chan, off, buf, len);
- if (errcode < 0) {
- ERRDRV("%s failed to read %s from channel errcode=%d",
- s, __func__, errcode);
+ if (errcode < 0)
goto read_failed;
- }
seq_printf(seq, "channel %s:\n", s);
tbuf = buf;
while (len > 0) {
file_cdev.owner = THIS_MODULE;
if (MAJOR(majordev) == 0) {
/* dynamic major device number registration required */
- if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0) {
- ERRDRV("Unable to allocate+register char device %s",
- MYDRVNAME);
+ if (alloc_chrdev_region(&majordev, 0, 1, MYDRVNAME) < 0)
return -1;
- }
registered = TRUE;
} else {
/* static major device number registration required */
- if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0) {
- ERRDRV("Unable to register char device %s", MYDRVNAME);
+ if (register_chrdev_region(majordev, 1, MYDRVNAME) < 0)
return -1;
- }
registered = TRUE;
}
rc = cdev_add(&file_cdev, MKDEV(MAJOR(majordev), 0), 1);
- if (rc < 0) {
- ERRDRV("failed to create char device: (status=%d)\n", rc);
+ if (rc < 0)
return -1;
- }
return 0;
}
GUEST_PHYSICAL_ADDRESS addr = 0;
/* sv_enable_dfp(); */
- if (offset & (PAGE_SIZE - 1)) {
- ERRDRV("%s virtual address NOT page-aligned!", __func__);
+ if (offset & (PAGE_SIZE - 1))
return -ENXIO; /* need aligned offsets */
- }
+
switch (offset) {
case VISORCHIPSET_MMAP_CONTROLCHANOFFSET:
vma->vm_flags |= VM_IO;
if (*file_controlvm_channel == NULL) {
- ERRDRV("%s no controlvm channel yet", __func__);
return -ENXIO;
}
visorchannel_read(*file_controlvm_channel,
gp_control_channel),
&addr, sizeof(addr));
if (addr == 0) {
- ERRDRV("%s control channel address is 0", __func__);
return -ENXIO;
}
physaddr = (ulong)addr;
vma->vm_end - vma->vm_start,
/*pgprot_noncached */
(vma->vm_page_prot))) {
- ERRDRV("%s remap_pfn_range failed", __func__);
return -EAGAIN;
}
break;
}
return issue_vmcall_update_physical_time(adjustment);
default:
- LOGERR("visorchipset_ioctl received invalid command");
return -EFAULT;
}
}
allocbytes++;
if ((Controlvm_Payload_Bytes_Buffered + bytes)
> MAX_CONTROLVM_PAYLOAD_BYTES) {
- ERRDRV("%s (%s:%d) - prevented allocation of %d bytes to prevent exceeding throttling max (%d)",
- __func__, __FILE__, __LINE__, allocbytes,
- MAX_CONTROLVM_PAYLOAD_BYTES);
if (tryAgain)
*tryAgain = TRUE;
rc = NULL;
void *p;
if (addr > virt_to_phys(high_memory - 1)) {
- ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)",
- __func__,
- (unsigned long long) addr, (ulong) bytes);
rc = NULL;
goto Away;
}
}
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
if (phdr->total_length != bytes) {
- ERRDRV("%s - bad total length %lu (should be %lu)",
- __func__,
- (ulong) (phdr->total_length), (ulong) (bytes));
rc = NULL;
goto Away;
}
if (phdr->total_length < phdr->header_length) {
- ERRDRV("%s - total length < header length (%lu < %lu)",
- __func__,
- (ulong) (phdr->total_length),
- (ulong) (phdr->header_length));
rc = NULL;
goto Away;
}
if (phdr->header_length <
sizeof(struct spar_controlvm_parameters_header)) {
- ERRDRV("%s - header is too small (%lu < %lu)",
- __func__,
- (ulong) (phdr->header_length),
- (ulong)(sizeof(
- struct spar_controlvm_parameters_header)));
rc = NULL;
goto Away;
}
{
struct spar_controlvm_parameters_header *phdr = NULL;
- if (ctx == NULL) {
- ERRDRV("%s (%s:%d) - no context",
- __func__, __FILE__, __LINE__);
+ if (ctx == NULL)
return NULL_UUID_LE;
- }
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
return phdr->id;
}
{
struct spar_controlvm_parameters_header *phdr = NULL;
- if (ctx == NULL) {
- ERRDRV("%s (%s:%d) - no context",
- __func__, __FILE__, __LINE__);
+ if (ctx == NULL)
goto Away;
- }
phdr = (struct spar_controlvm_parameters_header *)(ctx->data);
switch (which_string) {
case PARSERSTRING_INITIATOR:
ctx->bytes_remaining = phdr->name_length;
break;
default:
- ERRDRV("%s - bad which_string %d", __func__, which_string);
break;
}
}
while (*pscan != ':') {
- if (namesize <= 0) {
- ERRDRV("%s - name too big", __func__);
+ if (namesize <= 0)
return NULL;
- }
*pnam = toupper(*pscan);
pnam++;
namesize--;
pscan++;
nscan--;
- if (nscan == 0) {
- ERRDRV("%s - unexpected end of input parsing name",
- __func__);
+ if (nscan == 0)
return NULL;
- }
}
- if (namesize <= 0) {
- ERRDRV("%s - name too big", __func__);
+ if (namesize <= 0)
return NULL;
- }
*pnam = '\0';
nam[string_length_no_trail(nam, strlen(nam))] = '\0';
while (isspace(*pscan)) {
pscan++;
nscan--;
- if (nscan == 0) {
- ERRDRV("%s - unexpected end of input looking for value",
- __func__);
+ if (nscan == 0)
return NULL;
- }
}
- if (nscan == 0) {
- ERRDRV("%s - unexpected end of input looking for value",
- __func__);
+ if (nscan == 0)
return NULL;
- }
if (*pscan == '\'' || *pscan == '"') {
closing_quote = *pscan;
pscan++;
nscan--;
- if (nscan == 0) {
- ERRDRV("%s - unexpected end of input after %c",
- __func__, closing_quote);
+ if (nscan == 0)
return NULL;
- }
}
/* look for a separator character, terminator character, or
*/
for (i = 0, value_length = -1; i < nscan; i++) {
if (closing_quote) {
- if (pscan[i] == '\0') {
- ERRDRV("%s - unexpected end of input parsing quoted value", __func__);
+ if (pscan[i] == '\0')
return NULL;
- }
if (pscan[i] == closing_quote) {
value_length = i;
break;
}
}
if (value_length < 0) {
- if (closing_quote) {
- ERRDRV("%s - unexpected end of input parsing quoted value", __func__);
+ if (closing_quote)
return NULL;
- }
value_length = nscan;
}
orig_value_length = value_length;
pscan++;
nscan--;
} else if (*pscan != '\0') {
- ERRDRV("%s - missing separator after quoted string", __func__);
kfree(value);
value = NULL;
return NULL;
POSTCODE_LINUX_2(CHIPSET_INIT_ENTRY_PC, POSTCODE_SEVERITY_INFO);
if (chipset_inited) {
- LOGERR("CONTROLVM_CHIPSET_INIT Failed: Already Done.");
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
goto Away;
}
if (!visorchannel_signalinsert(ControlVm_channel,
CONTROLVM_QUEUE_REQUEST, &outmsg)) {
- LOGERR("signalinsert failed!");
return;
}
}
outmsg.cmd.init_chipset.features = features;
if (!visorchannel_signalinsert(ControlVm_channel,
CONTROLVM_QUEUE_REQUEST, &outmsg)) {
- LOGERR("signalinsert failed!");
return;
}
}
outmsg.cmd.device_change_state.flags.phys_device = 1;
if (!visorchannel_signalinsert(ControlVm_channel,
CONTROLVM_QUEUE_REQUEST, &outmsg)) {
- LOGERR("signalinsert failed!");
return;
}
}
offsetof(struct spar_controlvm_channel_protocol,
saved_crash_message_count),
&localSavedCrashMsgCount, sizeof(u16)) < 0) {
- LOGERR("failed to get Saved Message Count");
POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
}
if (localSavedCrashMsgCount != CONTROLVM_CRASHMSG_MAX) {
- LOGERR("Saved Message Count incorrect %d",
- localSavedCrashMsgCount);
POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC,
localSavedCrashMsgCount,
POSTCODE_SEVERITY_ERR);
offsetof(struct spar_controlvm_channel_protocol,
saved_crash_message_offset),
&localSavedCrashMsgOffset, sizeof(u32)) < 0) {
- LOGERR("failed to get Saved Message Offset");
POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
localSavedCrashMsgOffset,
msg,
sizeof(struct controlvm_message)) < 0) {
- LOGERR("SAVE_MSG_BUS_FAILURE: Failed to write CrashCreateBusMsg!");
POSTCODE_LINUX_2(SAVE_MSG_BUS_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
localSavedCrashMsgOffset +
sizeof(struct controlvm_message), msg,
sizeof(struct controlvm_message)) < 0) {
- LOGERR("SAVE_MSG_DEV_FAILURE: Failed to write CrashCreateDevMsg!");
POSTCODE_LINUX_2(SAVE_MSG_DEV_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
BOOL need_clear = FALSE;
p = findbus(&BusInfoList, busNo);
- if (!p) {
- LOGERR("internal error busNo=%lu", busNo);
+ if (!p)
return;
- }
+
if (response < 0) {
if ((cmdId == CONTROLVM_BUS_CREATE) &&
(response != (-CONTROLVM_RESP_ERROR_ALREADY_DONE)))
need_clear = TRUE;
}
- if (p->pending_msg_hdr.id == CONTROLVM_INVALID) {
- LOGERR("bus_responder no pending msg");
+ if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
return; /* no controlvm response needed */
- }
- if (p->pending_msg_hdr.id != (u32) cmdId) {
- LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id);
+ if (p->pending_msg_hdr.id != (u32) cmdId)
return;
- }
controlvm_respond(&p->pending_msg_hdr, response);
p->pending_msg_hdr.id = CONTROLVM_INVALID;
if (need_clear) {
struct controlvm_message outmsg;
p = finddevice(&DevInfoList, busNo, devNo);
- if (!p) {
- LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo);
+ if (!p)
return;
- }
- if (p->pending_msg_hdr.id == CONTROLVM_INVALID) {
- LOGERR("device_responder no pending msg");
+ if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
return; /* no controlvm response needed */
- }
- if (p->pending_msg_hdr.id != cmdId) {
- LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id);
+ if (p->pending_msg_hdr.id != cmdId)
return;
- }
controlvm_init_response(&outmsg, &p->pending_msg_hdr, response);
outmsg.cmd.device_change_state.state = responseState;
if (!visorchannel_signalinsert(ControlVm_channel,
- CONTROLVM_QUEUE_REQUEST, &outmsg)) {
- LOGERR("signalinsert failed!");
+ CONTROLVM_QUEUE_REQUEST, &outmsg))
return;
- }
p->pending_msg_hdr.id = CONTROLVM_INVALID;
}
BOOL need_clear = FALSE;
p = finddevice(&DevInfoList, busNo, devNo);
- if (!p) {
- LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo);
+ if (!p)
return;
- }
if (response >= 0) {
if (cmdId == CONTROLVM_DEVICE_CREATE)
p->state.created = 1;
need_clear = TRUE;
}
- if (p->pending_msg_hdr.id == CONTROLVM_INVALID) {
- LOGERR("device_responder no pending msg");
+ if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
return; /* no controlvm response needed */
- }
- if (p->pending_msg_hdr.id != (u32) cmdId) {
- LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id);
+
+ if (p->pending_msg_hdr.id != (u32) cmdId)
return;
- }
+
controlvm_respond(&p->pending_msg_hdr, response);
p->pending_msg_hdr.id = CONTROLVM_INVALID;
if (need_clear)
struct visorchipset_bus_info *pBusInfo = findbus(&BusInfoList, busNo);
- if (!pBusInfo) {
- LOGERR("HUH? bad busNo=%d", busNo);
+ if (!pBusInfo)
return;
- }
+
if (needResponse) {
memcpy(&pBusInfo->pending_msg_hdr, msgHdr,
sizeof(struct controlvm_message_header));
NULL
};
- if (!pDevInfo) {
- LOGERR("HUH? bad busNo=%d, devNo=%d", busNo, devNo);
+ if (!pDevInfo)
return;
- }
+
if (for_visorbus)
notifiers = &BusDev_Server_Notifiers;
else
pBusInfo = findbus(&BusInfoList, busNo);
if (pBusInfo && (pBusInfo->state.created == 1)) {
- LOGERR("CONTROLVM_BUS_CREATE Failed: bus %lu already exists",
- busNo);
POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
pBusInfo = findbus(&BusInfoList, busNo);
if (!pBusInfo) {
- LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu invalid", busNo);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
goto Away;
}
if (pBusInfo->state.created == 0) {
- LOGERR("CONTROLVM_BUS_DESTROY Failed: bus %lu already destroyed",
- busNo);
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
goto Away;
}
pBusInfo = findbus(&BusInfoList, busNo);
if (!pBusInfo) {
- LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu invalid",
- busNo);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
goto Away;
}
if (pBusInfo->state.created == 0) {
- LOGERR("CONTROLVM_BUS_CONFIGURE Failed: Invalid bus %lu - not created yet",
- busNo);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
}
/* TBD - add this check to other commands also... */
if (pBusInfo->pending_msg_hdr.id != CONTROLVM_INVALID) {
- LOGERR("CONTROLVM_BUS_CONFIGURE Failed: bus %lu MsgId=%u outstanding",
- busNo, (uint) pBusInfo->pending_msg_hdr.id);
POSTCODE_LINUX_3(BUS_CONFIGURE_FAILURE_PC, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
pDevInfo = finddevice(&DevInfoList, busNo, devNo);
if (pDevInfo && (pDevInfo->state.created == 1)) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu already exists",
- busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
pBusInfo = findbus(&BusInfoList, busNo);
if (!pBusInfo) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - out of range",
- busNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
goto Away;
}
if (pBusInfo->state.created == 0) {
- LOGERR("CONTROLVM_DEVICE_CREATE Failed: Invalid bus %lu - not created yet",
- busNo);
POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
pDevInfo = finddevice(&DevInfoList, busNo, devNo);
if (!pDevInfo) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (doesn't exist)",
- busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
goto Away;
}
if (pDevInfo->state.created == 0) {
- LOGERR("CONTROLVM_DEVICE_CHANGESTATE Failed: busNo=%lu, devNo=%lu invalid (not created)",
- busNo, devNo);
POSTCODE_LINUX_4(DEVICE_CHANGESTATE_FAILURE_PC, devNo, busNo,
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
pDevInfo = finddevice(&DevInfoList, busNo, devNo);
if (!pDevInfo) {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu invalid",
- busNo, devNo);
rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
goto Away;
}
if (pDevInfo->state.created == 0) {
- LOGERR("CONTROLVM_DEVICE_DESTROY Failed: busNo=%lu, devNo=%lu already destroyed",
- busNo, devNo);
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
}
int rc = CONTROLVM_RESP_SUCCESS;
if (info == NULL) {
- LOGERR("HUH ? CONTROLVM_PAYLOAD_INIT Failed : Programmer check at %s:%d",
- __FILE__, __LINE__);
rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID;
goto Away;
}
memset(info, 0, sizeof(struct controlvm_payload_info));
if ((offset == 0) || (bytes == 0)) {
- LOGERR("CONTROLVM_PAYLOAD_INIT Failed: request_payload_offset=%llu request_payload_bytes=%llu!",
- (u64) offset, (u64) bytes);
rc = -CONTROLVM_RESP_ERROR_PAYLOAD_INVALID;
goto Away;
}
payload = ioremap_cache(phys_addr + offset, bytes);
if (payload == NULL) {
- LOGERR("CONTROLVM_PAYLOAD_INIT Failed: ioremap_cache %llu for %llu bytes failed",
- (u64) offset, (u64) bytes);
rc = -CONTROLVM_RESP_ERROR_IOREMAP_FAILED;
goto Away;
}
offsetof(struct spar_controlvm_channel_protocol,
request_payload_offset),
&payloadOffset, sizeof(payloadOffset)) < 0) {
- LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!");
POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
offsetof(struct spar_controlvm_channel_protocol,
request_payload_bytes),
&payloadBytes, sizeof(payloadBytes)) < 0) {
- LOGERR("CONTROLVM_PAYLOAD_INIT Failed to read controlvm channel!");
POSTCODE_LINUX_2(CONTROLVM_INIT_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
if (visorchannel_signalremove(ControlVm_channel,
CONTROLVM_QUEUE_EVENT, msg)) {
/* got a message */
- if (msg->hdr.flags.test_message == 1) {
- LOGERR("ignoring bad CONTROLVM_QUEUE_EVENT msg with controlvm_msg_id=0x%x because Flags.testMessage is nonsensical (=1)",
- msg->hdr.id);
+ if (msg->hdr.flags.test_message == 1)
return FALSE;
- }
return TRUE;
}
return FALSE;
req = parahotplug_request_create(inmsg);
- if (req == NULL) {
- LOGERR("parahotplug_process_message: couldn't allocate request");
+ if (req == NULL)
return;
- }
if (inmsg->cmd.device_change_state.state.active) {
/* For enable messages, just respond with success
/* create parsing context if necessary */
isLocalAddr = (inmsg.hdr.flags.test_message == 1);
- if (channel_addr == 0) {
- LOGERR("HUH? channel_addr is 0!");
+ if (channel_addr == 0)
return TRUE;
- }
parametersAddr = channel_addr + inmsg.hdr.payload_vm_offset;
parametersBytes = inmsg.hdr.payload_bytes;
chipset_notready(&inmsg.hdr);
break;
default:
- LOGERR("unrecognized controlvm cmd=%d", (int) inmsg.hdr.id);
if (inmsg.hdr.flags.response_expected)
controlvm_respond(&inmsg.hdr,
-CONTROLVM_RESP_ERROR_MESSAGE_ID_UNKNOWN);
u64 addr = 0;
u32 size = 0;
- if (!VMCALL_SUCCESSFUL(issue_vmcall_io_controlvm_addr(&addr, &size))) {
- ERRDRV("%s - vmcall to determine controlvm channel addr failed",
- __func__);
+ if (!VMCALL_SUCCESSFUL(issue_vmcall_io_controlvm_addr(&addr, &size)))
return 0;
- }
+
return addr;
}
while (visorchannel_signalremove(ControlVm_channel,
CONTROLVM_QUEUE_RESPONSE,
&inmsg)) {
- if (inmsg.hdr.payload_max_bytes != 0) {
- LOGERR("Payload of size %lu returned @%lu with unexpected message id %d.",
- (ulong) inmsg.hdr.payload_max_bytes,
- (ulong) inmsg.hdr.payload_vm_offset,
- inmsg.hdr.id);
- }
}
if (!gotACommand) {
if (ControlVm_Pending_Msg_Valid) {
offsetof(struct spar_controlvm_channel_protocol,
saved_crash_message_count),
&localSavedCrashMsgCount, sizeof(u16)) < 0) {
- LOGERR("failed to get Saved Message Count");
POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
}
if (localSavedCrashMsgCount != CONTROLVM_CRASHMSG_MAX) {
- LOGERR("Saved Message Count incorrect %d",
- localSavedCrashMsgCount);
POSTCODE_LINUX_3(CRASH_DEV_COUNT_FAILURE_PC,
localSavedCrashMsgCount,
POSTCODE_SEVERITY_ERR);
offsetof(struct spar_controlvm_channel_protocol,
saved_crash_message_offset),
&localSavedCrashMsgOffset, sizeof(u32)) < 0) {
- LOGERR("failed to get Saved Message Offset");
POSTCODE_LINUX_2(CRASH_DEV_CTRL_RD_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
localSavedCrashMsgOffset,
&localCrashCreateBusMsg,
sizeof(struct controlvm_message)) < 0) {
- LOGERR("CRASH_DEV_RD_BUS_FAIULRE: Failed to read CrashCreateBusMsg!");
POSTCODE_LINUX_2(CRASH_DEV_RD_BUS_FAIULRE_PC,
POSTCODE_SEVERITY_ERR);
return;
sizeof(struct controlvm_message),
&localCrashCreateDevMsg,
sizeof(struct controlvm_message)) < 0) {
- LOGERR("CRASH_DEV_RD_DEV_FAIULRE: Failed to read CrashCreateDevMsg!");
POSTCODE_LINUX_2(CRASH_DEV_RD_DEV_FAIULRE_PC,
POSTCODE_SEVERITY_ERR);
return;
if (localCrashCreateBusMsg.cmd.create_bus.channel_addr != 0)
bus_create(&localCrashCreateBusMsg);
else {
- LOGERR("CrashCreateBusMsg is null, no dump will be taken");
POSTCODE_LINUX_2(CRASH_DEV_BUS_NULL_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
if (localCrashCreateDevMsg.cmd.create_device.channel_addr != 0)
my_device_create(&localCrashCreateDevMsg);
else {
- LOGERR("CrashCreateDevMsg is null, no dump will be taken");
POSTCODE_LINUX_2(CRASH_DEV_DEV_NULL_FAILURE_PC,
POSTCODE_SEVERITY_ERR);
return;
{
void *p = findbus(&BusInfoList, bus_no);
- if (!p) {
- LOGERR("(%lu) failed", bus_no);
+ if (!p)
return FALSE;
- }
memcpy(bus_info, p, sizeof(struct visorchipset_bus_info));
return TRUE;
}
{
struct visorchipset_bus_info *p = findbus(&BusInfoList, bus_no);
- if (!p) {
- LOGERR("(%lu) failed", bus_no);
+ if (!p)
return FALSE;
- }
p->bus_driver_context = context;
return TRUE;
}
{
void *p = finddevice(&DevInfoList, bus_no, dev_no);
- if (!p) {
- LOGERR("(%lu,%lu) failed", bus_no, dev_no);
+ if (!p)
return FALSE;
- }
memcpy(dev_info, p, sizeof(struct visorchipset_device_info));
return TRUE;
}
struct visorchipset_device_info *p =
finddevice(&DevInfoList, bus_no, dev_no);
- if (!p) {
- LOGERR("(%lu,%lu) failed", bus_no, dev_no);
+ if (!p)
return FALSE;
- }
p->bus_driver_context = context;
return TRUE;
}
*/
gfp |= __GFP_NORETRY;
p = kmem_cache_alloc(pool, gfp);
- if (!p) {
- LOGERR("kmem_cache_alloc failed early @%s:%d\n", fn, ln);
+ if (!p)
return NULL;
- }
+
atomic_inc(&Visorchipset_cache_buffers_in_use);
return p;
}
void
visorchipset_cache_free(struct kmem_cache *pool, void *p, char *fn, int ln)
{
- if (!p) {
- LOGERR("NULL pointer @%s:%d\n", fn, ln);
+ if (!p)
return;
- }
+
atomic_dec(&Visorchipset_cache_buffers_in_use);
kmem_cache_free(pool, p);
}
atomic_set(&LiveDump_info.buffers_in_use, 0);
if (visorchipset_testvnic) {
- ERRDRV("testvnic option no longer supported: (status = %d)\n",
- x);
POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, x, DIAG_SEVERITY_ERR);
rc = x;
goto Away;
visorchannel_get_header(ControlVm_channel))) {
initialize_controlvm_payload();
} else {
- LOGERR("controlvm channel is invalid");
visorchannel_destroy(ControlVm_channel);
ControlVm_channel = NULL;
return -ENODEV;
}
} else {
- LOGERR("no controlvm channel discovered");
return -ENODEV;
}
MajorDev = MKDEV(visorchipset_major, 0);
rc = visorchipset_file_init(MajorDev, &ControlVm_channel);
if (rc < 0) {
- ERRDRV("visorchipset_file_init(MajorDev, &ControlVm_channel): error (status=%d)\n", rc);
POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR);
goto Away;
}
sizeof(struct putfile_buffer_entry),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!Putfile_buffer_list_pool) {
- ERRDRV("failed to alloc Putfile_buffer_list_pool: (status=-1)\n");
POSTCODE_LINUX_2(CHIPSET_INIT_FAILURE_PC, DIAG_SEVERITY_ERR);
rc = -1;
goto Away;
create_singlethread_workqueue("visorchipset_controlvm");
if (Periodic_controlvm_workqueue == NULL) {
- ERRDRV("cannot create controlvm workqueue: (status=%d)\n",
- -ENOMEM);
POSTCODE_LINUX_2(CREATE_WORKQUEUE_FAILED_PC,
DIAG_SEVERITY_ERR);
rc = -ENOMEM;
rc = queue_delayed_work(Periodic_controlvm_workqueue,
&Periodic_controlvm_work, Poll_jiffies);
if (rc < 0) {
- ERRDRV("queue_delayed_work(Periodic_controlvm_workqueue, &Periodic_controlvm_work, Poll_jiffies): error (status=%d)\n", rc);
POSTCODE_LINUX_2(QUEUE_DELAYED_WORK_PC,
DIAG_SEVERITY_ERR);
goto Away;
Visorchipset_platform_device.dev.devt = MajorDev;
if (platform_device_register(&Visorchipset_platform_device) < 0) {
- ERRDRV("platform_device_register(visorchipset) failed: (status=-1)\n");
POSTCODE_LINUX_2(DEVICE_REGISTER_FAILURE_PC, DIAG_SEVERITY_ERR);
rc = -1;
goto Away;
rc = 0;
Away:
if (rc) {
- LOGERR("visorchipset_init failed");
POSTCODE_LINUX_3(CHIPSET_INIT_FAILURE_PC, rc,
POSTCODE_SEVERITY_ERR);
}
struct charqueue *cq;
cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY);
- if (cq == NULL) {
- ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)",
- alloc_size);
+ if (cq == NULL)
return NULL;
- }
cq->alloc_size = alloc_size;
cq->nslots = nslots;
cq->head = 0;
createProcDir(char *name, struct proc_dir_entry *parent)
{
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
-
- if (p == NULL)
- ERRDRV("failed to create /proc directory %s", name);
return p;
}
{
memset(pdriver, 0, sizeof(struct easyproc_driver_info));
pdriver->ProcId = procId;
- if (pdriver->ProcId == NULL)
- ERRDRV("ProcId cannot be NULL (trouble ahead)!");
pdriver->Show_driver_info = show_driver_info;
pdriver->Show_device_info = show_device_info;
if (pdriver->ProcDir == NULL)
proc_create_data("diag", 0,
pdriver->ProcDriverDir,
&proc_fops_driver, pdriver);
- if (pdriver->ProcDriverDiagFile == NULL)
- ERRDRV("failed to register /proc/%s/driver/diag entry",
- pdriver->ProcId);
}
}
EXPORT_SYMBOL_GPL(visor_easyproc_InitDriver);
p->procDevicexDiagFile =
proc_create_data("diag", 0, p->procDevicexDir,
&proc_fops_device, p);
- if (p->procDevicexDiagFile == NULL)
- ERRDEVX(devno, "failed to register /proc/%s/device/%d/diag entry",
- pdriver->ProcId, devno
- );
}
memset(&(p->device_property_info[0]), 0,
sizeof(p->device_property_info));
size_t i;
struct easyproc_device_property_info *px = NULL;
- if (p->procDevicexDir == NULL) {
- ERRDRV("state error");
+ if (p->procDevicexDir == NULL)
return;
- }
for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) {
if (p->device_property_info[i].procEntry == NULL) {
px = &(p->device_property_info[i]);
break;
}
}
- if (!px) {
- ERRDEVX(p->devno, "too many device properties");
+ if (!px)
return;
- }
+
px->devdata = p->devdata;
px->pdriver = p->pdriver;
px->procEntry = proc_create_data(property_name, 0, p->procDevicexDir,
&proc_fops_device_property, px);
if (strlen(property_name)+1 > sizeof(px->property_name)) {
- ERRDEVX(p->devno, "device property name %s too long",
- property_name);
return;
}
strcpy(px->property_name, property_name);
if (px->procEntry == NULL) {
- ERRDEVX(p->devno,
- "failed to register /proc/%s/device/%d/%s entry",
- p->pdriver->ProcId, p->devno, property_name);
return;
}
px->show_device_property_info = show_property_info;
struct memregion *memregion;
memregion = kzalloc(sizeof(*memregion), GFP_KERNEL | __GFP_NORETRY);
- if (memregion == NULL) {
- ERRDRV("visor_memregion_create allocation failed");
+ if (memregion == NULL)
return NULL;
- }
+
memregion->physaddr = physaddr;
memregion->nbytes = nbytes;
memregion->overlapped = FALSE;
{
struct memregion *memregion = NULL;
- if (parent == NULL) {
- ERRDRV("%s parent is NULL", __func__);
+ if (parent == NULL)
return NULL;
- }
- if (parent->mapped == NULL) {
- ERRDRV("%s parent is not mapped!", __func__);
+
+ if (parent->mapped == NULL)
return NULL;
- }
+
if ((offset >= parent->nbytes) ||
- ((offset + nbytes) >= parent->nbytes)) {
- ERRDRV("%s range (%lu,%lu) out of parent range",
- __func__, offset, nbytes);
+ ((offset + nbytes) >= parent->nbytes))
return NULL;
- }
+
memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY);
if (memregion == NULL)
return NULL;
ulong nbytes = memregion->nbytes;
memregion->requested = FALSE;
- if (!request_mem_region(physaddr, nbytes, MYDRVNAME))
- ERRDRV("cannot reserve channel memory @0x%lx for 0x%lx-- no big deal",
- physaddr, nbytes);
- else
+ if (request_mem_region(physaddr, nbytes, MYDRVNAME))
memregion->requested = TRUE;
memregion->mapped = ioremap_cache(physaddr, nbytes);
- if (memregion->mapped == NULL) {
- ERRDRV("cannot ioremap_cache channel memory @0x%lx for 0x%lx",
- physaddr, nbytes);
+ if (!memregion->mapped)
return FALSE;
- }
return TRUE;
}
struct memregion *memregion, ulong offset,
void *local, ulong nbytes)
{
- if (offset + nbytes > memregion->nbytes) {
- ERRDRV("memregion_readwrite offset out of range!!");
+ if (offset + nbytes > memregion->nbytes)
return -EIO;
- }
+
if (is_write)
memcpy_toio(memregion->mapped + offset, local, nbytes);
else
goto unlock;
} else if (queue_delayed_work(pw->workqueue, &pw->work,
pw->jiffy_interval) < 0) {
- ERRDEV(pw->devnam, "queue_delayed_work failed!");
pw->is_scheduled = FALSE;
rc = FALSE;
goto unlock;
goto unlock;
}
if (pw->want_to_stop) {
- ERRDEV(pw->devnam,
- "dev_start_periodic_work failed!");
rc = FALSE;
goto unlock;
}
INIT_DELAYED_WORK(&pw->work, &periodic_work_func);
if (queue_delayed_work(pw->workqueue, &pw->work,
pw->jiffy_interval) < 0) {
- ERRDEV(pw->devnam, "%s queue_delayed_work failed!", __func__);
rc = FALSE;
goto unlock;
}
{
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
- if (p == NULL)
- ERRDRV("failed to create /proc directory %s", name);
return p;
}
{
struct proc_dir_entry *p = proc_create_data(name, 0, parent,
fops, data);
- if (p == NULL)
- ERRDRV("failed to create /proc file %s", name);
return p;
}
MYPROCTYPE *rc = NULL, *type = NULL;
struct proc_dir_entry *parent = NULL;
- if (procDirRoot == NULL) {
- ERRDRV("procDirRoot cannot be NULL!\n");
+ if (procDirRoot == NULL)
goto Away;
- }
- if (name == NULL || name[0] == NULL) {
- ERRDRV("name must contain at least 1 node name!\n");
+
+ if (name == NULL || name[0] == NULL)
goto Away;
- }
+
type = kzalloc(sizeof(MYPROCTYPE), GFP_KERNEL | __GFP_NORETRY);
if (type == NULL)
goto Away;
+
type->name = name;
type->propertyNames = propertyNames;
type->nProperties = 0;
MYPROCOBJECT *obj = NULL, *rc = NULL;
int i = 0;
- if (type == NULL) {
- ERRDRV("type cannot be NULL\n");
+ if (type == NULL)
goto Away;
- }
+
obj = kzalloc(sizeof(MYPROCOBJECT), GFP_KERNEL | __GFP_NORETRY);
if (obj == NULL)
goto Away;
+
obj->type = type;
obj->context = context;
if (name == NULL) {
{
struct proc_dir_entry_context *ctx = seq->private;
- if (ctx == NULL) {
- ERRDRV("I don't have a freakin' clue...");
+ if (ctx == NULL)
return 0;
- }
(*ctx->show_property)(seq, ctx->procObject->context,
ctx->propertyIndex);
return 0;