Commit 12b29a3a authored by Markus Lidel's avatar Markus Lidel Committed by Linus Torvalds

[PATCH] I2O: printk cleanup and unnecessary code removal

- removed commented part in header which is not used anymore
- added wrappers for printk to make code more readable
- cleaned up logging output and removed unneccessary output
Signed-off-by: default avatarMarkus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b4d71a31
......@@ -66,10 +66,11 @@ int i2o_device_claim(struct i2o_device *dev)
rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY);
if (!rc)
pr_debug("claim of device %d succeded\n", dev->lct_data.tid);
pr_debug("i2o: claim of device %d succeded\n",
dev->lct_data.tid);
else
pr_debug("claim of device %d failed %d\n", dev->lct_data.tid,
rc);
pr_debug("i2o: claim of device %d failed %d\n",
dev->lct_data.tid, rc);
up(&dev->lock);
......@@ -111,10 +112,10 @@ int i2o_device_claim_release(struct i2o_device *dev)
}
if (!rc)
pr_debug("claim release of device %d succeded\n",
pr_debug("i2o: claim release of device %d succeded\n",
dev->lct_data.tid);
else
pr_debug("claim release of device %d failed %d\n",
pr_debug("i2o: claim release of device %d failed %d\n",
dev->lct_data.tid, rc);
up(&dev->lock);
......@@ -133,7 +134,7 @@ static void i2o_device_release(struct device *dev)
{
struct i2o_device *i2o_dev = to_i2o_device(dev);
pr_debug("Release I2O device %s\n", dev->bus_id);
pr_debug("i2o: device %s released\n", dev->bus_id);
kfree(i2o_dev);
};
......@@ -241,7 +242,7 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
i2o_driver_notify_device_add_all(dev);
pr_debug("I2O device %s added\n", dev->device.bus_id);
pr_debug("i2o: device %s added\n", dev->device.bus_id);
return dev;
};
......@@ -304,7 +305,8 @@ int i2o_device_parse_lct(struct i2o_controller *c)
max = (lct->table_size - 3) / 9;
pr_debug("LCT has %d entries (LCT size: %d)\n", max, lct->table_size);
pr_debug("%s: LCT has %d entries (LCT size: %d)\n", c->name, max,
lct->table_size);
/* remove devices, which are not in the LCT anymore */
list_for_each_entry_safe(dev, tmp, &c->devices, list) {
......
......@@ -76,7 +76,7 @@ int i2o_driver_register(struct i2o_driver *drv)
int rc = 0;
unsigned long flags;
pr_debug("Register driver %s\n", drv->name);
pr_debug("i2o: Register driver %s\n", drv->name);
if (drv->event) {
drv->event_queue = create_workqueue(drv->name);
......@@ -85,7 +85,8 @@ int i2o_driver_register(struct i2o_driver *drv)
"for driver %s\n", drv->name);
return -EFAULT;
}
pr_debug("Event queue initialized for driver %s\n", drv->name);
pr_debug("i2o: Event queue initialized for driver %s\n",
drv->name);
} else
drv->event_queue = NULL;
......@@ -107,7 +108,8 @@ int i2o_driver_register(struct i2o_driver *drv)
spin_unlock_irqrestore(&i2o_drivers_lock, flags);
pr_debug("driver %s gets context id %d\n", drv->name, drv->context);
pr_debug("i2o: driver %s gets context id %d\n", drv->name,
drv->context);
list_for_each_entry(c, &i2o_controllers, list) {
struct i2o_device *i2o_dev;
......@@ -137,7 +139,7 @@ void i2o_driver_unregister(struct i2o_driver *drv)
struct i2o_controller *c;
unsigned long flags;
pr_debug("unregister driver %s\n", drv->name);
pr_debug("i2o: unregister driver %s\n", drv->name);
driver_unregister(&drv->driver);
......@@ -157,7 +159,7 @@ void i2o_driver_unregister(struct i2o_driver *drv)
if (drv->event_queue) {
destroy_workqueue(drv->event_queue);
drv->event_queue = NULL;
pr_debug("event queue removed for %s\n", drv->name);
pr_debug("i2o: event queue removed for %s\n", drv->name);
}
};
......@@ -186,8 +188,8 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
spin_unlock(&i2o_drivers_lock);
if (unlikely(!drv)) {
printk(KERN_WARNING "i2o: Spurious reply to unknown "
"driver %d\n", context);
printk(KERN_WARNING "%s: Spurious reply to unknown "
"driver %d\n", c->name, context);
return -EIO;
}
......@@ -233,8 +235,8 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
" defined!\n", c->name, drv->name);
return -EIO;
} else
printk(KERN_WARNING "i2o: Spurious reply to unknown driver "
"%d\n", readl(&msg->u.s.icntxt));
printk(KERN_WARNING "%s: Spurious reply to unknown driver "
"%d\n", c->name, readl(&msg->u.s.icntxt));
return -EIO;
}
......@@ -336,7 +338,7 @@ int __init i2o_driver_init(void)
">=2 and <= 64 and a power of 2\n", i2o_max_drivers);
i2o_max_drivers = I2O_MAX_DRIVERS;
}
printk(KERN_INFO "i2o: max_drivers=%d\n", i2o_max_drivers);
printk(KERN_INFO "i2o: max drivers = %d\n", i2o_max_drivers);
i2o_drivers =
kmalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL);
......
......@@ -31,6 +31,8 @@
#include <linux/i2o.h>
#include <linux/delay.h>
#define OSM_NAME "exec-osm"
struct i2o_driver i2o_exec_driver;
static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind);
......@@ -236,7 +238,8 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
dev = &c->pdev->dev;
pr_debug("timedout reply received!\n");
pr_debug("%s: timedout reply received!\n",
c->name);
i2o_dma_free(dev, &wait->dma);
i2o_exec_wait_free(wait);
rc = -1;
......@@ -250,7 +253,7 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
spin_unlock(&lock);
pr_debug("i2o: Bogus reply in POST WAIT (tr-context: %08x)!\n",
pr_debug("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name,
context);
return -1;
......@@ -378,7 +381,7 @@ static int i2o_exec_reply(struct i2o_controller *c, u32 m,
*/
static void i2o_exec_event(struct i2o_event *evt)
{
printk(KERN_INFO "Event received from device: %d\n",
osm_info("Event received from device: %d\n",
evt->i2o_dev->lct_data.tid);
kfree(evt);
};
......@@ -468,7 +471,7 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
/* Exec OSM driver struct */
struct i2o_driver i2o_exec_driver = {
.name = "exec-osm",
.name = OSM_NAME,
.reply = i2o_exec_reply,
.event = i2o_exec_event,
.classes = i2o_exec_class_id,
......
This diff is collapsed.
......@@ -48,6 +48,10 @@
#include <asm/uaccess.h>
#include <asm/io.h>
#define OSM_NAME "config-osm"
#define OSM_VERSION "$Rev$"
#define OSM_DESCRIPTION "I2O Configuration OSM"
extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
static spinlock_t i2o_config_lock;
......@@ -79,7 +83,7 @@ static ulong i2o_cfg_info_id = 0;
*/
static struct i2o_driver i2o_config_driver = {
.name = "Config-OSM"
.name = OSM_NAME
};
static int i2o_cfg_getiops(unsigned long arg)
......@@ -296,7 +300,7 @@ static int i2o_cfg_swdl(unsigned long arg)
writel(0xD0000000 | fragsize, &msg->body[3]);
writel(buffer.phys, &msg->body[4]);
// printk(KERN_INFO "i2o_config: swdl frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
osm_debug("swdl frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
status = i2o_msg_post_wait_mem(c, m, 60, &buffer);
if (status != -ETIMEDOUT)
......@@ -305,9 +309,7 @@ static int i2o_cfg_swdl(unsigned long arg)
if (status != I2O_POST_WAIT_OK) {
// it fails if you try and send frags out of order
// and for some yet unknown reasons too
printk(KERN_INFO
"i2o_config: swdl failed, DetailedStatus = %d\n",
status);
osm_info("swdl failed, DetailedStatus = %d\n", status);
return status;
}
......@@ -370,16 +372,14 @@ static int i2o_cfg_swul(unsigned long arg)
writel(0xD0000000 | fragsize, &msg->body[3]);
writel(buffer.phys, &msg->body[4]);
// printk(KERN_INFO "i2o_config: swul frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
osm_debug("swul frag %d/%d (size %d)\n", curfrag, maxfrag, fragsize);
status = i2o_msg_post_wait_mem(c, m, 60, &buffer);
if (status != I2O_POST_WAIT_OK) {
if (status != -ETIMEDOUT)
i2o_dma_free(&c->pdev->dev, &buffer);
printk(KERN_INFO
"i2o_config: swul failed, DetailedStatus = %d\n",
status);
osm_info("swul failed, DetailedStatus = %d\n", status);
return status;
}
......@@ -432,9 +432,7 @@ static int i2o_cfg_swdel(unsigned long arg)
token = i2o_msg_post_wait(c, m, 10);
if (token != I2O_POST_WAIT_OK) {
printk(KERN_INFO
"i2o_config: swdel failed, DetailedStatus = %d\n",
token);
osm_info("swdel failed, DetailedStatus = %d\n", token);
return -ETIMEDOUT;
}
......@@ -466,8 +464,8 @@ static int i2o_cfg_validate(unsigned long arg)
token = i2o_msg_post_wait(c, m, 10);
if (token != I2O_POST_WAIT_OK) {
printk(KERN_INFO "Can't validate configuration, ErrorStatus = "
"%d\n", token);
osm_info("Can't validate configuration, ErrorStatus = %d\n",
token);
return -ETIMEDOUT;
}
......@@ -569,7 +567,7 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
c = i2o_find_iop(iop);
if (!c) {
pr_debug("controller %d not found\n", iop);
osm_debug("controller %d not found\n", iop);
return -ENXIO;
}
......@@ -578,13 +576,13 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
sb = c->status_block.virt;
if (get_user(size, &user_msg[0])) {
printk(KERN_WARNING "unable to get size!\n");
osm_warn("unable to get size!\n");
return -EFAULT;
}
size = size >> 16;
if (size > sb->inbound_frame_size) {
pr_debug("size of message > inbound_frame_size");
osm_warn("size of message > inbound_frame_size");
return -EFAULT;
}
......@@ -594,7 +592,7 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
/* Copy in the user's I2O command */
if (copy_from_user(msg, user_msg, size)) {
printk(KERN_WARNING "unable to copy user message\n");
osm_warn("unable to copy user message\n");
return -EFAULT;
}
i2o_dump_message(msg);
......@@ -692,7 +690,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
// TODO 64bit fix
struct sg_simple_element *sg;
int sg_size;
printk(KERN_INFO "sg_offset\n");
// re-acquire the original message to handle correctly the sg copy operation
memset(&msg, 0, MSG_FRAME_SIZE * 4);
......@@ -737,7 +734,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
/* Copy back the reply to user space */
if (reply_size) {
// we wrote our own values for context - now restore the user supplied ones
printk(KERN_INFO "reply_size\n");
if (copy_from_user(reply + 2, user_msg + 2, sizeof(u32) * 2)) {
printk(KERN_WARNING
"%s: Could not copy message context FROM user\n",
......@@ -753,7 +749,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
cleanup:
kfree(reply);
printk(KERN_INFO "rcode: %d\n", rcode);
return rcode;
}
......@@ -786,7 +781,7 @@ static int i2o_cfg_passthru(unsigned long arg)
c = i2o_find_iop(iop);
if (!c) {
pr_debug("controller %d not found\n", iop);
osm_warn("controller %d not found\n", iop);
return -ENXIO;
}
......@@ -799,7 +794,7 @@ static int i2o_cfg_passthru(unsigned long arg)
size = size >> 16;
if (size > sb->inbound_frame_size) {
pr_debug("size of message > inbound_frame_size");
osm_warn("size of message > inbound_frame_size");
return -EFAULT;
}
......@@ -902,7 +897,6 @@ static int i2o_cfg_passthru(unsigned long arg)
// TODO 64bit fix
struct sg_simple_element *sg;
int sg_size;
printk(KERN_INFO "sg_offset\n");
// re-acquire the original message to handle correctly the sg copy operation
memset(&msg, 0, MSG_FRAME_SIZE * 4);
......@@ -947,7 +941,6 @@ static int i2o_cfg_passthru(unsigned long arg)
/* Copy back the reply to user space */
if (reply_size) {
// we wrote our own values for context - now restore the user supplied ones
printk(KERN_INFO "reply_size\n");
if (copy_from_user(reply + 2, user_msg + 2, sizeof(u32) * 2)) {
printk(KERN_WARNING
"%s: Could not copy message context FROM user\n",
......@@ -1027,7 +1020,7 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
#endif
default:
pr_debug("i2o_config: unknown ioctl called!\n");
osm_debug("unknown ioctl called!\n");
ret = -EINVAL;
}
......@@ -1125,20 +1118,19 @@ static struct miscdevice i2o_miscdev = {
static int __init i2o_config_init(void)
{
printk(KERN_INFO "I2O configuration manager v 0.04.\n");
printk(KERN_INFO " (C) Copyright 1999 Red Hat Software\n");
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
spin_lock_init(&i2o_config_lock);
if (misc_register(&i2o_miscdev) < 0) {
printk(KERN_ERR "i2o_config: can't register device.\n");
osm_err("can't register device.\n");
return -EBUSY;
}
/*
* Install our handler
*/
if (i2o_driver_register(&i2o_config_driver)) {
printk(KERN_ERR "i2o_config: handler register failed.\n");
osm_err("handler register failed.\n");
misc_deregister(&i2o_miscdev);
return -EBUSY;
}
......@@ -1160,8 +1152,9 @@ static void i2o_config_exit(void)
}
MODULE_AUTHOR("Red Hat Software");
MODULE_DESCRIPTION("I2O Configuration");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_config_init);
module_exit(i2o_config_exit);
......@@ -27,6 +27,10 @@
* Changes for new I2O API
*/
#define OSM_NAME "proc-osm"
#define OSM_VERSION "$Rev$"
#define OSM_DESCRIPTION "I2O ProcFS OSM"
#define I2O_MAX_MODULES 4
// FIXME!
#define FMT_U64_HEX "0x%08x%08x"
......@@ -60,7 +64,7 @@ static struct proc_dir_entry *i2o_proc_dir_root;
/* proc OSM driver struct */
static struct i2o_driver i2o_proc_driver = {
.name = "proc-osm",
.name = OSM_NAME,
};
static int print_serial_number(struct seq_file *seq, u8 * serialno, int max_len)
......@@ -1938,11 +1942,11 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir,
sprintf(buff, "%03x", dev->lct_data.tid);
pr_debug("Adding device /proc/i2o/iop%d/%s\n", dev->iop->unit, buff);
osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
devdir = proc_mkdir(buff, dir);
if (!devdir) {
printk(KERN_WARNING "i2o: Could not allocate procdir!\n");
osm_warn("Could not allocate procdir!\n");
return;
}
......@@ -1978,13 +1982,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
{
struct proc_dir_entry *iopdir;
struct i2o_device *dev;
char buff[10];
snprintf(buff, 10, "iop%d", c->unit);
osm_debug("adding IOP /proc/i2o/%s\n", c->name);
pr_debug("Adding IOP /proc/i2o/%s\n", buff);
iopdir = proc_mkdir(buff, dir);
iopdir = proc_mkdir(c->name, dir);
if (!iopdir)
return -1;
......@@ -2018,7 +2019,7 @@ static void i2o_proc_iop_remove(struct proc_dir_entry *dir,
i2o_proc_subdir_remove(pe);
remove_proc_entry(pe->name, dir);
}
pr_debug("Removing IOP /proc/i2o/iop%d\n", c->unit);
osm_debug("removing IOP /proc/i2o/%s\n", c->name);
pe = tmp;
}
}
......@@ -2076,6 +2077,8 @@ static int __init i2o_proc_init(void)
{
int rc;
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
rc = i2o_driver_register(&i2o_proc_driver);
if (rc)
return rc;
......@@ -2101,8 +2104,9 @@ static void __exit i2o_proc_exit(void)
};
MODULE_AUTHOR("Deepak Saxena");
MODULE_DESCRIPTION("I2O procfs Handler");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_proc_init);
module_exit(i2o_proc_exit);
......@@ -65,7 +65,9 @@
#include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h>
#define VERSION_STRING "Version 0.1.2"
#define OSM_NAME "scsi-osm"
#define OSM_VERSION "$Rev$"
#define OSM_DESCRIPTION "I2O SCSI Peripheral OSM"
static struct i2o_driver i2o_scsi_driver;
......@@ -106,8 +108,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c)
}
if (!max_channel) {
printk(KERN_WARNING "scsi-osm: no channels found on %s\n",
c->name);
osm_warn("no channels found on %s\n", c->name);
return ERR_PTR(-EFAULT);
}
......@@ -116,7 +117,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c)
scsi_host = scsi_host_alloc(&i2o_scsi_host_template, size);
if (!scsi_host) {
printk(KERN_WARNING "scsi-osm: Could not allocate SCSI host\n");
osm_warn("Could not allocate SCSI host\n");
return ERR_PTR(-ENOMEM);
}
......@@ -221,24 +222,23 @@ static int i2o_scsi_probe(struct device *dev)
return -EFAULT;
if (id >= scsi_host->max_id) {
printk(KERN_WARNING "scsi-osm: SCSI device id (%d) >= max_id "
"of I2O host (%d)", id, scsi_host->max_id);
osm_warn("SCSI device id (%d) >= max_id of I2O host (%d)", id,
scsi_host->max_id);
return -EFAULT;
}
if (i2o_parm_field_get(i2o_dev, 0, 4, &lun, 8) < 0)
return -EFAULT;
if (lun >= scsi_host->max_lun) {
printk(KERN_WARNING "scsi-osm: SCSI device id (%d) >= max_lun "
"of I2O host (%d)", (unsigned int)lun,
scsi_host->max_lun);
osm_warn("SCSI device id (%d) >= max_lun of I2O host (%d)",
(unsigned int)lun, scsi_host->max_lun);
return -EFAULT;
}
parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid);
if (!parent) {
printk(KERN_WARNING "scsi-osm: can not find parent of device "
"%03x\n", i2o_dev->lct_data.tid);
osm_warn("can not find parent of device %03x\n",
i2o_dev->lct_data.tid);
return -EFAULT;
}
......@@ -247,8 +247,8 @@ static int i2o_scsi_probe(struct device *dev)
channel = i;
if (channel == -1) {
printk(KERN_WARNING "scsi-osm: can not find channel of device "
"%03x\n", i2o_dev->lct_data.tid);
osm_warn("can not find channel of device %03x\n",
i2o_dev->lct_data.tid);
return -EFAULT;
}
......@@ -256,12 +256,12 @@ static int i2o_scsi_probe(struct device *dev)
__scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev);
if (!scsi_dev) {
printk(KERN_WARNING "scsi-osm: can not add SCSI device "
"%03x\n", i2o_dev->lct_data.tid);
osm_warn("can not add SCSI device %03x\n",
i2o_dev->lct_data.tid);
return -EFAULT;
}
pr_debug("Added new SCSI device %03x (cannel: %d, id: %d, lun: %d)\n",
osm_debug("added new SCSI device %03x (cannel: %d, id: %d, lun: %d)\n",
i2o_dev->lct_data.tid, channel, id, (unsigned int)lun);
return 0;
......@@ -307,24 +307,24 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
pmsg = i2o_msg_in_to_virt(c, pm);
printk(KERN_ERR "IOP fail.\n");
printk(KERN_ERR "From %d To %d Cmd %d.\n",
osm_err("IOP fail.\n");
osm_err("From %d To %d Cmd %d.\n",
(msg->u.head[1] >> 12) & 0xFFF,
msg->u.head[1] & 0xFFF, msg->u.head[1] >> 24);
printk(KERN_ERR "Failure Code %d.\n", msg->body[0] >> 24);
osm_err("Failure Code %d.\n", msg->body[0] >> 24);
if (msg->body[0] & (1 << 16))
printk(KERN_ERR "Format error.\n");
osm_err("Format error.\n");
if (msg->body[0] & (1 << 17))
printk(KERN_ERR "Path error.\n");
osm_err("Path error.\n");
if (msg->body[0] & (1 << 18))
printk(KERN_ERR "Path State.\n");
osm_err("Path State.\n");
if (msg->body[0] & (1 << 18))
{
printk(KERN_ERR "Congestion.\n");
osm_err("Congestion.\n");
err = DID_BUS_BUSY;
}
printk(KERN_DEBUG "Failing message is %p.\n", pmsg);
osm_debug("Failing message is %p.\n", pmsg);
cmd = i2o_cntxt_list_get(c, readl(&pmsg->u.s.tcntxt));
if (!cmd)
......@@ -353,13 +353,12 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
if (!cmd) {
if (st)
printk(KERN_WARNING "SCSI abort: %08X",
le32_to_cpu(msg->body[0]));
printk(KERN_INFO "SCSI abort completed.\n");
osm_warn("SCSI abort: %08X", le32_to_cpu(msg->body[0]));
osm_info("SCSI abort completed.\n");
return -EFAULT;
}
pr_debug("Completed %ld\n", cmd->serial_number);
osm_debug("Completed %ld\n", cmd->serial_number);
if (st) {
u32 count, error;
......@@ -370,13 +369,13 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
count = le32_to_cpu(msg->body[1]);
if (count < cmd->underflow) {
int i;
printk(KERN_ERR "SCSI: underflow 0x%08X 0x%08X"
"\n", count, cmd->underflow);
printk(KERN_DEBUG "Cmd: ");
osm_err("SCSI underflow 0x%08X 0x%08X\n", count,
cmd->underflow);
osm_debug("Cmd: ");
for (i = 0; i < 15; i++)
printk(KERN_DEBUG "%02X ",
cmd->cmnd[i]);
printk(KERN_DEBUG ".\n");
pr_debug("%02X ", cmd->cmnd[i]);
pr_debug(".\n");
cmd->result = (DID_ERROR << 16);
}
break;
......@@ -384,7 +383,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
default:
error = le32_to_cpu(msg->body[0]);
printk(KERN_ERR "scsi-osm: SCSI error %08x\n", error);
osm_err("SCSI error %08x\n", error);
if ((error & 0xff) == 0x02 /*CHECK_CONDITION */ ) {
int i;
......@@ -394,7 +393,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
memcpy(cmd->sense_buffer, (void *)&msg->body[3],
len);
for (i = 0; i <= len; i++)
printk(KERN_INFO "%02x\n",
osm_info("%02x\n",
cmd->sense_buffer[i]);
if (cmd->sense_buffer[0] == 0x70
&& cmd->sense_buffer[2] == DATA_PROTECT) {
......@@ -467,21 +466,20 @@ static void i2o_scsi_notify_controller_add(struct i2o_controller *c)
i2o_shost = i2o_scsi_host_alloc(c);
if (IS_ERR(i2o_shost)) {
printk(KERN_ERR "scsi-osm: Could not initialize"
" SCSI host\n");
osm_err("Could not initialize SCSI host\n");
return;
}
rc = scsi_add_host(i2o_shost->scsi_host, &c->device);
if (rc) {
printk(KERN_ERR "scsi-osm: Could not add SCSI " "host\n");
osm_err("Could not add SCSI host\n");
scsi_host_put(i2o_shost->scsi_host);
return;
}
c->driver_data[i2o_scsi_driver.context] = i2o_shost;
pr_debug("new I2O SCSI host added\n");
osm_debug("new I2O SCSI host added\n");
};
/**
......@@ -503,12 +501,12 @@ static void i2o_scsi_notify_controller_remove(struct i2o_controller *c)
scsi_remove_host(i2o_shost->scsi_host);
scsi_host_put(i2o_shost->scsi_host);
pr_debug("I2O SCSI host removed\n");
pr_info("I2O SCSI host removed\n");
};
/* SCSI OSM driver struct */
static struct i2o_driver i2o_scsi_driver = {
.name = "scsi-osm",
.name = OSM_NAME,
.reply = i2o_scsi_reply,
.classes = i2o_scsi_class_id,
.notify_controller_add = i2o_scsi_notify_controller_add,
......@@ -561,7 +559,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
SCpnt->scsi_done = done;
if (unlikely(!i2o_dev)) {
printk(KERN_WARNING "scsi-osm: no I2O device in request\n");
osm_warn("no I2O device in request\n");
SCpnt->result = DID_NO_CONNECT << 16;
done(SCpnt);
return 0;
......@@ -569,8 +567,8 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
tid = i2o_dev->lct_data.tid;
pr_debug("qcmd: Tid = %03x\n", tid);
pr_debug("Real scsi messages.\n");
osm_debug("qcmd: Tid = %03x\n", tid);
osm_debug("Real scsi messages.\n");
/*
* Obtain an I2O message. If there are none free then
......@@ -702,7 +700,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
/* Queue the message */
i2o_msg_post(c, m);
pr_debug("Issued %ld\n", SCpnt->serial_number);
osm_debug("Issued %ld\n", SCpnt->serial_number);
return 0;
};
......@@ -727,7 +725,7 @@ static int i2o_scsi_abort(struct scsi_cmnd *SCpnt)
int tid;
int status = FAILED;
printk(KERN_WARNING "i2o_scsi: Aborting command block.\n");
osm_warn("Aborting command block.\n");
i2o_dev = SCpnt->device->hostdata;
c = i2o_dev->iop;
......@@ -777,8 +775,8 @@ static int i2o_scsi_bios_param(struct scsi_device *sdev,
}
static struct scsi_host_template i2o_scsi_host_template = {
.proc_name = "SCSI-OSM",
.name = "I2O SCSI Peripheral OSM",
.proc_name = OSM_NAME,
.name = OSM_DESCRIPTION,
.info = i2o_scsi_info,
.queuecommand = i2o_scsi_queuecommand,
.eh_abort_handler = i2o_scsi_abort,
......@@ -789,15 +787,6 @@ static struct scsi_host_template i2o_scsi_host_template = {
.use_clustering = ENABLE_CLUSTERING,
};
/*
int
i2o_scsi_queuecommand(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd *))
{
printk(KERN_INFO "queuecommand\n");
return SCSI_MLQUEUE_HOST_BUSY;
};
*/
/**
* i2o_scsi_init - SCSI OSM initialization function
*
......@@ -809,12 +798,12 @@ static int __init i2o_scsi_init(void)
{
int rc;
printk(KERN_INFO "I2O SCSI Peripheral OSM\n");
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
/* Register SCSI OSM into I2O core */
rc = i2o_driver_register(&i2o_scsi_driver);
if (rc) {
printk(KERN_ERR "scsi-osm: Could not register SCSI driver\n");
osm_err("Could not register SCSI driver\n");
return rc;
}
......@@ -834,6 +823,8 @@ static void __exit i2o_scsi_exit(void)
MODULE_AUTHOR("Red Hat Software");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_scsi_init);
module_exit(i2o_scsi_exit);
......@@ -29,6 +29,9 @@
#include <linux/i2o.h>
#include <linux/delay.h>
#define OSM_VERSION "$Rev$"
#define OSM_DESCRIPTION "I2O subsystem"
/* global I2O controller list */
LIST_HEAD(i2o_controllers);
......@@ -126,12 +129,13 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
unsigned long flags;
if (!ptr)
printk(KERN_ERR "NULL pointer found!\n");
printk(KERN_ERR "%s: couldn't add NULL pointer to context list!"
"\n", c->name);
entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
if (!entry) {
printk(KERN_ERR "i2o: Could not allocate memory for context "
"list element\n");
printk(KERN_ERR "%s: Could not allocate memory for context "
"list element\n", c->name);
return 0;
}
......@@ -150,7 +154,7 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
spin_unlock_irqrestore(&c->context_list_lock, flags);
pr_debug("Add context to list %p -> %d\n", ptr, context);
pr_debug("%s: Add context to list %p -> %d\n", c->name, ptr, context);
return entry->context;
};
......@@ -182,10 +186,11 @@ u32 i2o_cntxt_list_remove(struct i2o_controller * c, void *ptr)
spin_unlock_irqrestore(&c->context_list_lock, flags);
if (!context)
printk(KERN_WARNING "i2o: Could not remove nonexistent ptr "
"%p\n", ptr);
printk(KERN_WARNING "%s: Could not remove nonexistent ptr "
"%p\n", c->name, ptr);
pr_debug("remove ptr from context list %d -> %p\n", context, ptr);
pr_debug("%s: remove ptr from context list %d -> %p\n", c->name,
context, ptr);
return context;
};
......@@ -215,9 +220,11 @@ void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context)
spin_unlock_irqrestore(&c->context_list_lock, flags);
if (!ptr)
printk(KERN_WARNING "i2o: context id %d not found\n", context);
printk(KERN_WARNING "%s: context id %d not found\n", c->name,
context);
pr_debug("get ptr from context list %d -> %p\n", context, ptr);
pr_debug("%s: get ptr from context list %d -> %p\n", c->name, context,
ptr);
return ptr;
};
......@@ -245,10 +252,11 @@ u32 i2o_cntxt_list_get_ptr(struct i2o_controller * c, void *ptr)
spin_unlock_irqrestore(&c->context_list_lock, flags);
if (!context)
printk(KERN_WARNING "i2o: Could not find nonexistent ptr "
"%p\n", ptr);
printk(KERN_WARNING "%s: Could not find nonexistent ptr "
"%p\n", c->name, ptr);
pr_debug("get context id from context list %p -> %d\n", ptr, context);
pr_debug("%s: get context id from context list %p -> %d\n", c->name,
ptr, context);
return context;
};
......@@ -467,7 +475,7 @@ static int i2o_iop_reset(struct i2o_controller *c)
i2o_status_block *sb = c->status_block.virt;
int rc = 0;
pr_debug("Resetting controller\n");
pr_debug("%s: Resetting controller\n", c->name);
m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
if (m == I2O_QUEUE_EMPTY)
......@@ -494,7 +502,7 @@ static int i2o_iop_reset(struct i2o_controller *c)
timeout = jiffies + I2O_TIMEOUT_RESET * HZ;
while (!*status) {
if (time_after(jiffies, timeout)) {
printk(KERN_ERR "IOP reset timeout.\n");
printk(KERN_ERR "%s: IOP reset timeout.\n", c->name);
rc = -ETIMEDOUT;
goto exit;
}
......@@ -526,7 +534,8 @@ static int i2o_iop_reset(struct i2o_controller *c)
m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);
while (m == I2O_QUEUE_EMPTY) {
if (time_after(jiffies, timeout)) {
printk(KERN_ERR "IOP reset timeout.\n");
printk(KERN_ERR "%s: IOP reset timeout.\n",
c->name);
rc = -ETIMEDOUT;
goto exit;
}
......@@ -676,14 +685,14 @@ static int i2o_iop_activate(struct i2o_controller *c)
rc = i2o_status_get(c);
if (rc) {
printk(KERN_INFO "Unable to obtain status of %s, "
printk(KERN_INFO "%s: Unable to obtain status, "
"attempting a reset.\n", c->name);
if (i2o_iop_reset(c))
return rc;
}
if (sb->i2o_version > I2OVER15) {
printk(KERN_ERR "%s: Not running vrs. 1.5. of the I2O "
printk(KERN_ERR "%s: Not running version 1.5 of the I2O "
"Specification.\n", c->name);
return -ENODEV;
}
......@@ -697,7 +706,7 @@ static int i2o_iop_activate(struct i2o_controller *c)
case ADAPTER_STATE_OPERATIONAL:
case ADAPTER_STATE_HOLD:
case ADAPTER_STATE_FAILED:
pr_debug("already running, trying to reset...\n");
pr_debug("%s: already running, trying to reset...\n", c->name);
if (i2o_iop_reset(c))
return -ENODEV;
}
......@@ -751,15 +760,16 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
c->name);
root = pci_find_parent_resource(c->pdev, res);
if (root == NULL)
printk(KERN_WARNING "Can't find parent resource!\n");
printk(KERN_WARNING "%s: Can't find parent resource!\n",
c->name);
if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
NULL, NULL) >= 0) {
c->mem_alloc = 1;
sb->current_mem_size = 1 + res->end - res->start;
sb->current_mem_base = res->start;
printk(KERN_INFO
"%s: allocated %ld bytes of PCI memory at 0x%08lX.\n",
c->name, 1 + res->end - res->start, res->start);
printk(KERN_INFO "%s: allocated %ld bytes of PCI memory"
" at 0x%08lX.\n", c->name,
1 + res->end - res->start, res->start);
}
}
......@@ -773,15 +783,16 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
c->name);
root = pci_find_parent_resource(c->pdev, res);
if (root == NULL)
printk(KERN_WARNING "Can't find parent resource!\n");
printk(KERN_WARNING "%s: Can't find parent resource!\n",
c->name);
if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
NULL, NULL) >= 0) {
c->io_alloc = 1;
sb->current_io_size = 1 + res->end - res->start;
sb->current_mem_base = res->start;
printk(KERN_INFO
"%s: allocated %ld bytes of PCI I/O at 0x%08lX.\n",
c->name, 1 + res->end - res->start, res->start);
printk(KERN_INFO "%s: allocated %ld bytes of PCI I/O at"
" 0x%08lX.\n", c->name,
1 + res->end - res->start, res->start);
}
}
......@@ -871,7 +882,7 @@ void i2o_iop_remove(struct i2o_controller *c)
{
struct i2o_device *dev, *tmp;
pr_debug("Deleting controller %s\n", c->name);
pr_debug("%s: deleting controller\n", c->name);
i2o_driver_notify_controller_remove_all(c);
......@@ -1114,7 +1125,7 @@ struct i2o_controller *i2o_iop_alloc(void)
c = kmalloc(sizeof(*c), GFP_KERNEL);
if (!c) {
printk(KERN_ERR "i2o: Insufficient memory to allocate the "
printk(KERN_ERR "i2o: Insufficient memory to allocate a I2O "
"controller.\n");
return ERR_PTR(-ENOMEM);
}
......@@ -1162,27 +1173,27 @@ int i2o_iop_add(struct i2o_controller *c)
"devices\n", c->name);
if ((rc = i2o_iop_activate(c))) {
printk(KERN_ERR "%s: controller could not activated\n",
printk(KERN_ERR "%s: could not activate controller\n",
c->name);
i2o_iop_reset(c);
return rc;
}
pr_debug("building sys table %s...\n", c->name);
pr_debug("%s: building sys table...\n", c->name);
if ((rc = i2o_systab_build())) {
i2o_iop_reset(c);
return rc;
}
pr_debug("online controller %s...\n", c->name);
pr_debug("%s: online controller...\n", c->name);
if ((rc = i2o_iop_online(c))) {
i2o_iop_reset(c);
return rc;
}
pr_debug("getting LCT %s...\n", c->name);
pr_debug("%s: getting LCT...\n", c->name);
if ((rc = i2o_exec_lct_get(c))) {
i2o_iop_reset(c);
......@@ -1247,7 +1258,7 @@ static int __init i2o_iop_init(void)
{
int rc = 0;
printk(KERN_INFO "I2O Core - (C) Copyright 1999 Red Hat Software\n");
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
rc = i2o_device_init();
if (rc)
......@@ -1297,8 +1308,9 @@ module_init(i2o_iop_init);
module_exit(i2o_iop_exit);
MODULE_AUTHOR("Red Hat Software");
MODULE_DESCRIPTION("I2O Core");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
#if BITS_PER_LONG == 64
EXPORT_SYMBOL(i2o_cntxt_list_add);
......
......@@ -159,34 +159,36 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
}
if (i == 6) {
printk(KERN_ERR "i2o: I2O controller has no memory regions"
" defined.\n");
printk(KERN_ERR "%s: I2O controller has no memory regions"
" defined.\n", c->name);
i2o_pci_free(c);
return -EINVAL;
}
/* Map the I2O controller */
if (c->raptor) {
printk(KERN_INFO "i2o: PCI I2O controller\n");
printk(KERN_INFO "%s: PCI I2O controller\n", c->name);
printk(KERN_INFO " BAR0 at 0x%08lX size=%ld\n",
(unsigned long)c->base.phys, (unsigned long)c->base.len);
printk(KERN_INFO " BAR1 at 0x%08lX size=%ld\n",
(unsigned long)c->in_queue.phys,
(unsigned long)c->in_queue.len);
} else
printk(KERN_INFO "i2o: PCI I2O controller at %08lX size=%ld\n",
(unsigned long)c->base.phys, (unsigned long)c->base.len);
printk(KERN_INFO "%s: PCI I2O controller at %08lX size=%ld\n",
c->name, (unsigned long)c->base.phys,
(unsigned long)c->base.len);
c->base.virt = ioremap(c->base.phys, c->base.len);
if (!c->base.virt) {
printk(KERN_ERR "i2o: Unable to map controller.\n");
printk(KERN_ERR "%s: Unable to map controller.\n", c->name);
return -ENOMEM;
}
if (c->raptor) {
c->in_queue.virt = ioremap(c->in_queue.phys, c->in_queue.len);
if (!c->in_queue.virt) {
printk(KERN_ERR "i2o: Unable to map controller.\n");
printk(KERN_ERR "%s: Unable to map controller.\n",
c->name);
i2o_pci_free(c);
return -ENOMEM;
}
......@@ -204,10 +206,10 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
c->mtrr_reg1 = -1;
if (c->mtrr_reg0 < 0)
printk(KERN_WARNING "i2o: could not enable write combining "
"MTRR\n");
printk(KERN_WARNING "%s: could not enable write combining "
"MTRR\n", c->name);
else
printk(KERN_INFO "i2o: using write combining MTRR\n");
printk(KERN_INFO "%s: using write combining MTRR\n", c->name);
/*
* If it is an INTEL i960 I/O processor then set the first 64K to
......@@ -216,14 +218,14 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
*/
if ((pdev->vendor == PCI_VENDOR_ID_INTEL ||
pdev->vendor == PCI_VENDOR_ID_DPT) && !c->raptor) {
printk(KERN_INFO "i2o: MTRR workaround for Intel i960 processor"
"\n");
printk(KERN_INFO "%s: MTRR workaround for Intel i960 processor"
"\n", c->name);
c->mtrr_reg1 = mtrr_add(c->base.phys, 0x10000,
MTRR_TYPE_UNCACHABLE, 1);
if (c->mtrr_reg1 < 0) {
printk(KERN_WARNING "i2o_pci: Error in setting "
"MTRR_TYPE_UNCACHABLE\n");
printk(KERN_WARNING "%s: Error in setting "
"MTRR_TYPE_UNCACHABLE\n", c->name);
mtrr_del(c->mtrr_reg0, c->in_queue.phys,
c->in_queue.len);
c->mtrr_reg0 = -1;
......@@ -288,7 +290,7 @@ static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r)
if (unlikely(mv == I2O_QUEUE_EMPTY)) {
return IRQ_NONE;
} else
pr_debug("960 bug detected\n");
pr_debug("%s: 960 bug detected\n", c->name);
}
while (mv != I2O_QUEUE_EMPTY) {
......@@ -425,12 +427,14 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
/* Cards that fall apart if you hit them with large I/O loads... */
if (pdev->vendor == PCI_VENDOR_ID_NCR && pdev->device == 0x0630) {
c->short_req = 1;
printk(KERN_INFO "i2o: Symbios FC920 workarounds activated.\n");
printk(KERN_INFO "%s: Symbios FC920 workarounds activated.\n",
c->name);
}
if (pdev->subsystem_vendor == PCI_VENDOR_ID_PROMISE) {
c->promise = 1;
printk(KERN_INFO "i2o: Promise workarounds activated.\n");
printk(KERN_INFO "%s: Promise workarounds activated.\n",
c->name);
}
/* Cards that go bananas if you quiesce them before you reset them. */
......@@ -441,14 +445,14 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
}
if ((rc = i2o_pci_alloc(c))) {
printk(KERN_ERR "i2o: DMA / IO allocation for I2O controller "
" failed\n");
printk(KERN_ERR "%s: DMA / IO allocation for I2O controller "
" failed\n", c->name);
goto free_controller;
}
if (i2o_pci_irq_enable(c)) {
printk(KERN_ERR "i2o: unable to enable interrupts for I2O "
"controller\n");
printk(KERN_ERR "%s: unable to enable interrupts for I2O "
"controller\n", c->name);
goto free_pci;
}
......
......@@ -631,15 +631,25 @@ static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr)
extern int i2o_parm_field_get(struct i2o_device *, int, int, void *, int);
extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
void *, int);
/* FIXME: remove
extern int i2o_query_table(int, struct i2o_controller *, int, int, int,
void *, int, void *, int);
extern int i2o_clear_table(struct i2o_controller *, int, int);
extern int i2o_row_add_table(struct i2o_controller *, int, int, int,
void *, int);
extern int i2o_issue_params(int, struct i2o_controller *, int, void *, int,
void *, int);
*/
/* debugging and troubleshooting/diagnostic helpers. */
#define osm_printk(level, format, arg...) \
printk(level "%s: " format, OSM_NAME , ## arg)
#ifdef DEBUG
#define osm_debug(format, arg...) \
osm_printk(KERN_DEBUG, format , ## arg)
#else
#define osm_debug(format, arg...) \
do { } while (0)
#endif
#define osm_err(format, arg...) \
osm_printk(KERN_ERR, format , ## arg)
#define osm_info(format, arg...) \
osm_printk(KERN_INFO, format , ## arg)
#define osm_warn(format, arg...) \
osm_printk(KERN_WARNING, format , ## arg)
/* debugging functions */
extern void i2o_report_status(const char *, const char *, struct i2o_message *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment