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) ...@@ -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); rc = i2o_device_issue_claim(dev, I2O_CMD_UTIL_CLAIM, I2O_CLAIM_PRIMARY);
if (!rc) 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 else
pr_debug("claim of device %d failed %d\n", dev->lct_data.tid, pr_debug("i2o: claim of device %d failed %d\n",
rc); dev->lct_data.tid, rc);
up(&dev->lock); up(&dev->lock);
...@@ -111,10 +112,10 @@ int i2o_device_claim_release(struct i2o_device *dev) ...@@ -111,10 +112,10 @@ int i2o_device_claim_release(struct i2o_device *dev)
} }
if (!rc) 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); dev->lct_data.tid);
else 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); dev->lct_data.tid, rc);
up(&dev->lock); up(&dev->lock);
...@@ -133,7 +134,7 @@ static void i2o_device_release(struct device *dev) ...@@ -133,7 +134,7 @@ static void i2o_device_release(struct device *dev)
{ {
struct i2o_device *i2o_dev = to_i2o_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); kfree(i2o_dev);
}; };
...@@ -241,7 +242,7 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c, ...@@ -241,7 +242,7 @@ static struct i2o_device *i2o_device_add(struct i2o_controller *c,
i2o_driver_notify_device_add_all(dev); 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; return dev;
}; };
...@@ -304,7 +305,8 @@ int i2o_device_parse_lct(struct i2o_controller *c) ...@@ -304,7 +305,8 @@ int i2o_device_parse_lct(struct i2o_controller *c)
max = (lct->table_size - 3) / 9; 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 */ /* remove devices, which are not in the LCT anymore */
list_for_each_entry_safe(dev, tmp, &c->devices, list) { list_for_each_entry_safe(dev, tmp, &c->devices, list) {
......
...@@ -76,7 +76,7 @@ int i2o_driver_register(struct i2o_driver *drv) ...@@ -76,7 +76,7 @@ int i2o_driver_register(struct i2o_driver *drv)
int rc = 0; int rc = 0;
unsigned long flags; unsigned long flags;
pr_debug("Register driver %s\n", drv->name); pr_debug("i2o: Register driver %s\n", drv->name);
if (drv->event) { if (drv->event) {
drv->event_queue = create_workqueue(drv->name); drv->event_queue = create_workqueue(drv->name);
...@@ -85,7 +85,8 @@ int i2o_driver_register(struct i2o_driver *drv) ...@@ -85,7 +85,8 @@ int i2o_driver_register(struct i2o_driver *drv)
"for driver %s\n", drv->name); "for driver %s\n", drv->name);
return -EFAULT; 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 } else
drv->event_queue = NULL; drv->event_queue = NULL;
...@@ -107,7 +108,8 @@ int i2o_driver_register(struct i2o_driver *drv) ...@@ -107,7 +108,8 @@ int i2o_driver_register(struct i2o_driver *drv)
spin_unlock_irqrestore(&i2o_drivers_lock, flags); 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) { list_for_each_entry(c, &i2o_controllers, list) {
struct i2o_device *i2o_dev; struct i2o_device *i2o_dev;
...@@ -137,7 +139,7 @@ void i2o_driver_unregister(struct i2o_driver *drv) ...@@ -137,7 +139,7 @@ void i2o_driver_unregister(struct i2o_driver *drv)
struct i2o_controller *c; struct i2o_controller *c;
unsigned long flags; unsigned long flags;
pr_debug("unregister driver %s\n", drv->name); pr_debug("i2o: unregister driver %s\n", drv->name);
driver_unregister(&drv->driver); driver_unregister(&drv->driver);
...@@ -157,7 +159,7 @@ void i2o_driver_unregister(struct i2o_driver *drv) ...@@ -157,7 +159,7 @@ void i2o_driver_unregister(struct i2o_driver *drv)
if (drv->event_queue) { if (drv->event_queue) {
destroy_workqueue(drv->event_queue); destroy_workqueue(drv->event_queue);
drv->event_queue = NULL; 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, ...@@ -186,8 +188,8 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
spin_unlock(&i2o_drivers_lock); spin_unlock(&i2o_drivers_lock);
if (unlikely(!drv)) { if (unlikely(!drv)) {
printk(KERN_WARNING "i2o: Spurious reply to unknown " printk(KERN_WARNING "%s: Spurious reply to unknown "
"driver %d\n", context); "driver %d\n", c->name, context);
return -EIO; return -EIO;
} }
...@@ -233,8 +235,8 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m, ...@@ -233,8 +235,8 @@ int i2o_driver_dispatch(struct i2o_controller *c, u32 m,
" defined!\n", c->name, drv->name); " defined!\n", c->name, drv->name);
return -EIO; return -EIO;
} else } else
printk(KERN_WARNING "i2o: Spurious reply to unknown driver " printk(KERN_WARNING "%s: Spurious reply to unknown driver "
"%d\n", readl(&msg->u.s.icntxt)); "%d\n", c->name, readl(&msg->u.s.icntxt));
return -EIO; return -EIO;
} }
...@@ -336,7 +338,7 @@ int __init i2o_driver_init(void) ...@@ -336,7 +338,7 @@ int __init i2o_driver_init(void)
">=2 and <= 64 and a power of 2\n", i2o_max_drivers); ">=2 and <= 64 and a power of 2\n", i2o_max_drivers);
i2o_max_drivers = 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 = i2o_drivers =
kmalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL); kmalloc(i2o_max_drivers * sizeof(*i2o_drivers), GFP_KERNEL);
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <linux/i2o.h> #include <linux/i2o.h>
#include <linux/delay.h> #include <linux/delay.h>
#define OSM_NAME "exec-osm"
struct i2o_driver i2o_exec_driver; struct i2o_driver i2o_exec_driver;
static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind); 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, ...@@ -236,7 +238,8 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
dev = &c->pdev->dev; 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_dma_free(dev, &wait->dma);
i2o_exec_wait_free(wait); i2o_exec_wait_free(wait);
rc = -1; rc = -1;
...@@ -250,7 +253,7 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m, ...@@ -250,7 +253,7 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
spin_unlock(&lock); 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); context);
return -1; return -1;
...@@ -378,7 +381,7 @@ static int i2o_exec_reply(struct i2o_controller *c, u32 m, ...@@ -378,7 +381,7 @@ static int i2o_exec_reply(struct i2o_controller *c, u32 m,
*/ */
static void i2o_exec_event(struct i2o_event *evt) 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); evt->i2o_dev->lct_data.tid);
kfree(evt); kfree(evt);
}; };
...@@ -468,7 +471,7 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) ...@@ -468,7 +471,7 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
/* Exec OSM driver struct */ /* Exec OSM driver struct */
struct i2o_driver i2o_exec_driver = { struct i2o_driver i2o_exec_driver = {
.name = "exec-osm", .name = OSM_NAME,
.reply = i2o_exec_reply, .reply = i2o_exec_reply,
.event = i2o_exec_event, .event = i2o_exec_event,
.classes = i2o_exec_class_id, .classes = i2o_exec_class_id,
......
...@@ -61,6 +61,10 @@ ...@@ -61,6 +61,10 @@
#include "i2o_block.h" #include "i2o_block.h"
#define OSM_NAME "block-osm"
#define OSM_VERSION "$Rev$"
#define OSM_DESCRIPTION "I2O Block Device OSM"
static struct i2o_driver i2o_block_driver; static struct i2o_driver i2o_block_driver;
/* global Block OSM request mempool */ /* global Block OSM request mempool */
...@@ -100,8 +104,7 @@ static int i2o_block_remove(struct device *dev) ...@@ -100,8 +104,7 @@ static int i2o_block_remove(struct device *dev)
struct i2o_device *i2o_dev = to_i2o_device(dev); struct i2o_device *i2o_dev = to_i2o_device(dev);
struct i2o_block_device *i2o_blk_dev = dev_get_drvdata(dev); struct i2o_block_device *i2o_blk_dev = dev_get_drvdata(dev);
printk(KERN_INFO "block-osm: Device removed %s\n", osm_info("Device removed %s\n", i2o_blk_dev->gd->disk_name);
i2o_blk_dev->gd->disk_name);
i2o_event_register(i2o_dev, &i2o_block_driver, 0, 0); i2o_event_register(i2o_dev, &i2o_block_driver, 0, 0);
...@@ -137,7 +140,7 @@ static int i2o_block_device_flush(struct i2o_device *dev) ...@@ -137,7 +140,7 @@ static int i2o_block_device_flush(struct i2o_device *dev)
writel(I2O_CMD_BLOCK_CFLUSH << 24 | HOST_TID << 12 | dev->lct_data.tid, writel(I2O_CMD_BLOCK_CFLUSH << 24 | HOST_TID << 12 | dev->lct_data.tid,
&msg->u.head[1]); &msg->u.head[1]);
writel(60 << 16, &msg->body[0]); writel(60 << 16, &msg->body[0]);
pr_debug("Flushing...\n"); osm_debug("Flushing...\n");
return i2o_msg_post_wait(dev->iop, m, 60); return i2o_msg_post_wait(dev->iop, m, 60);
}; };
...@@ -166,7 +169,7 @@ static int i2o_block_device_mount(struct i2o_device *dev, u32 media_id) ...@@ -166,7 +169,7 @@ static int i2o_block_device_mount(struct i2o_device *dev, u32 media_id)
&msg->u.head[1]); &msg->u.head[1]);
writel(-1, &msg->body[0]); writel(-1, &msg->body[0]);
writel(0, &msg->body[1]); writel(0, &msg->body[1]);
pr_debug("Mounting...\n"); osm_debug("Mounting...\n");
return i2o_msg_post_wait(dev->iop, m, 2); return i2o_msg_post_wait(dev->iop, m, 2);
}; };
...@@ -194,7 +197,7 @@ static int i2o_block_device_lock(struct i2o_device *dev, u32 media_id) ...@@ -194,7 +197,7 @@ static int i2o_block_device_lock(struct i2o_device *dev, u32 media_id)
writel(I2O_CMD_BLOCK_MLOCK << 24 | HOST_TID << 12 | dev->lct_data.tid, writel(I2O_CMD_BLOCK_MLOCK << 24 | HOST_TID << 12 | dev->lct_data.tid,
&msg->u.head[1]); &msg->u.head[1]);
writel(-1, &msg->body[0]); writel(-1, &msg->body[0]);
pr_debug("Locking...\n"); osm_debug("Locking...\n");
return i2o_msg_post_wait(dev->iop, m, 2); return i2o_msg_post_wait(dev->iop, m, 2);
}; };
...@@ -222,7 +225,7 @@ static int i2o_block_device_unlock(struct i2o_device *dev, u32 media_id) ...@@ -222,7 +225,7 @@ static int i2o_block_device_unlock(struct i2o_device *dev, u32 media_id)
writel(I2O_CMD_BLOCK_MUNLOCK << 24 | HOST_TID << 12 | dev->lct_data.tid, writel(I2O_CMD_BLOCK_MUNLOCK << 24 | HOST_TID << 12 | dev->lct_data.tid,
&msg->u.head[1]); &msg->u.head[1]);
writel(media_id, &msg->body[0]); writel(media_id, &msg->body[0]);
pr_debug("Unlocking...\n"); osm_debug("Unlocking...\n");
return i2o_msg_post_wait(dev->iop, m, 2); return i2o_msg_post_wait(dev->iop, m, 2);
}; };
...@@ -252,7 +255,7 @@ static int i2o_block_device_power(struct i2o_block_device *dev, u8 op) ...@@ -252,7 +255,7 @@ static int i2o_block_device_power(struct i2o_block_device *dev, u8 op)
writel(I2O_CMD_BLOCK_POWER << 24 | HOST_TID << 12 | i2o_dev->lct_data. writel(I2O_CMD_BLOCK_POWER << 24 | HOST_TID << 12 | i2o_dev->lct_data.
tid, &msg->u.head[1]); tid, &msg->u.head[1]);
writel(op << 24, &msg->body[0]); writel(op << 24, &msg->body[0]);
pr_debug("Power...\n"); osm_debug("Power...\n");
rc = i2o_msg_post_wait(c, m, 60); rc = i2o_msg_post_wait(c, m, 60);
if (!rc) if (!rc)
...@@ -350,7 +353,7 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req) ...@@ -350,7 +353,7 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
/* request is already processed by us, so return */ /* request is already processed by us, so return */
if (req->flags & REQ_SPECIAL) { if (req->flags & REQ_SPECIAL) {
pr_debug("REQ_SPECIAL already set!\n"); osm_debug("REQ_SPECIAL already set!\n");
req->flags |= REQ_DONTPREP; req->flags |= REQ_DONTPREP;
return BLKPREP_OK; return BLKPREP_OK;
} }
...@@ -359,7 +362,7 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req) ...@@ -359,7 +362,7 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req)
if (!req->special) { if (!req->special) {
ireq = i2o_block_request_alloc(); ireq = i2o_block_request_alloc();
if (unlikely(IS_ERR(ireq))) { if (unlikely(IS_ERR(ireq))) {
pr_debug("unable to allocate i2o_block_request!\n"); osm_debug("unable to allocate i2o_block_request!\n");
return BLKPREP_DEFER; return BLKPREP_DEFER;
} }
...@@ -435,7 +438,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m, ...@@ -435,7 +438,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
req = i2o_cntxt_list_get(c, le32_to_cpu(pmsg->u.s.tcntxt)); req = i2o_cntxt_list_get(c, le32_to_cpu(pmsg->u.s.tcntxt));
if (unlikely(!req)) { if (unlikely(!req)) {
printk(KERN_ERR "block-osm: NULL reply received!\n"); osm_err("NULL reply received!\n");
return -1; return -1;
} }
...@@ -465,7 +468,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m, ...@@ -465,7 +468,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
req = i2o_cntxt_list_get(c, le32_to_cpu(msg->u.s.tcntxt)); req = i2o_cntxt_list_get(c, le32_to_cpu(msg->u.s.tcntxt));
if (unlikely(!req)) { if (unlikely(!req)) {
printk(KERN_ERR "block-osm: NULL reply received!\n"); osm_err("NULL reply received!\n");
return -1; return -1;
} }
...@@ -482,8 +485,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m, ...@@ -482,8 +485,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
* goes kaput... * goes kaput...
*/ */
req->errors++; req->errors++;
printk(KERN_WARNING osm_warn("Data transfer to deleted device!\n");
"I2O Block: Data transfer to deleted device!\n");
spin_lock_irqsave(q->queue_lock, flags); spin_lock_irqsave(q->queue_lock, flags);
while (end_that_request_chunk while (end_that_request_chunk
(req, !req->errors, le32_to_cpu(msg->body[1]))) ; (req, !req->errors, le32_to_cpu(msg->body[1]))) ;
...@@ -537,7 +539,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m, ...@@ -537,7 +539,7 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
* Don't stick a supertrak100 into cache aggressive modes * Don't stick a supertrak100 into cache aggressive modes
*/ */
printk(KERN_ERR "/dev/%s error: %s", dev->gd->disk_name, osm_err("block-osm: /dev/%s error: %s", dev->gd->disk_name,
bsa_errors[le32_to_cpu(msg->body[0]) & 0xffff]); bsa_errors[le32_to_cpu(msg->body[0]) & 0xffff]);
if (le32_to_cpu(msg->body[0]) & 0x00ff0000) if (le32_to_cpu(msg->body[0]) & 0x00ff0000)
printk(KERN_ERR " - DDM attempted %d retries", printk(KERN_ERR " - DDM attempted %d retries",
...@@ -563,14 +565,14 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m, ...@@ -563,14 +565,14 @@ static int i2o_block_reply(struct i2o_controller *c, u32 m,
i2o_block_sglist_free(ireq); i2o_block_sglist_free(ireq);
i2o_block_request_free(ireq); i2o_block_request_free(ireq);
} else } else
printk(KERN_ERR "i2o_block: still remaining chunks\n"); osm_err("still remaining chunks\n");
return 1; return 1;
}; };
static void i2o_block_event(struct i2o_event *evt) static void i2o_block_event(struct i2o_event *evt)
{ {
printk(KERN_INFO "block-osm: event received\n"); osm_info("block-osm: event received\n");
}; };
/* /*
...@@ -648,7 +650,7 @@ static int i2o_block_open(struct inode *inode, struct file *file) ...@@ -648,7 +650,7 @@ static int i2o_block_open(struct inode *inode, struct file *file)
i2o_block_device_lock(dev->i2o_dev, -1); i2o_block_device_lock(dev->i2o_dev, -1);
pr_debug("Ready.\n"); osm_debug("Ready.\n");
return 0; return 0;
}; };
...@@ -936,7 +938,7 @@ static void i2o_block_request_fn(struct request_queue *q) ...@@ -936,7 +938,7 @@ static void i2o_block_request_fn(struct request_queue *q)
INIT_WORK(&dreq->work, i2o_block_delayed_request_fn, INIT_WORK(&dreq->work, i2o_block_delayed_request_fn,
dreq); dreq);
printk(KERN_INFO "block-osm: transfer error\n"); osm_info("transfer error\n");
if (!queue_delayed_work(i2o_block_driver.event_queue, if (!queue_delayed_work(i2o_block_driver.event_queue,
&dreq->work, &dreq->work,
I2O_BLOCK_RETRY_TIME)) I2O_BLOCK_RETRY_TIME))
...@@ -977,8 +979,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void) ...@@ -977,8 +979,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void)
dev = kmalloc(sizeof(*dev), GFP_KERNEL); dev = kmalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) { if (!dev) {
printk(KERN_ERR "block-osm: Insufficient memory to allocate " osm_err("Insufficient memory to allocate I2O Block disk.\n");
"I2O Block disk.\n");
rc = -ENOMEM; rc = -ENOMEM;
goto exit; goto exit;
} }
...@@ -992,8 +993,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void) ...@@ -992,8 +993,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void)
/* allocate a gendisk with 16 partitions */ /* allocate a gendisk with 16 partitions */
gd = alloc_disk(16); gd = alloc_disk(16);
if (!gd) { if (!gd) {
printk(KERN_ERR "block-osm: Insufficient memory to allocate " osm_err("Insufficient memory to allocate gendisk.\n");
"gendisk.\n");
rc = -ENOMEM; rc = -ENOMEM;
goto cleanup_dev; goto cleanup_dev;
} }
...@@ -1001,8 +1001,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void) ...@@ -1001,8 +1001,7 @@ static struct i2o_block_device *i2o_block_device_alloc(void)
/* initialize the request queue */ /* initialize the request queue */
queue = blk_init_queue(i2o_block_request_fn, &dev->lock); queue = blk_init_queue(i2o_block_request_fn, &dev->lock);
if (!queue) { if (!queue) {
printk(KERN_ERR "block-osm: Insufficient memory to allocate " osm_err("Insufficient memory to allocate request queue.\n");
"request queue.\n");
rc = -ENOMEM; rc = -ENOMEM;
goto cleanup_queue; goto cleanup_queue;
} }
...@@ -1054,24 +1053,21 @@ static int i2o_block_probe(struct device *dev) ...@@ -1054,24 +1053,21 @@ static int i2o_block_probe(struct device *dev)
/* skip devices which are used by IOP */ /* skip devices which are used by IOP */
if (i2o_dev->lct_data.user_tid != 0xfff) { if (i2o_dev->lct_data.user_tid != 0xfff) {
pr_debug("skipping used device %03x\n", i2o_dev->lct_data.tid); osm_debug("skipping used device %03x\n", i2o_dev->lct_data.tid);
return -ENODEV; return -ENODEV;
} }
printk(KERN_INFO "block-osm: New device detected (TID: %03x)\n", osm_info("New device detected (TID: %03x)\n", i2o_dev->lct_data.tid);
i2o_dev->lct_data.tid);
if (i2o_device_claim(i2o_dev)) { if (i2o_device_claim(i2o_dev)) {
printk(KERN_WARNING "block-osm: Unable to claim device. " osm_warn("Unable to claim device. Installation aborted\n");
"Installation aborted\n");
rc = -EFAULT; rc = -EFAULT;
goto exit; goto exit;
} }
i2o_blk_dev = i2o_block_device_alloc(); i2o_blk_dev = i2o_block_device_alloc();
if (IS_ERR(i2o_blk_dev)) { if (IS_ERR(i2o_blk_dev)) {
printk(KERN_ERR "block-osm: could not alloc a new I2O block" osm_err("could not alloc a new I2O block device");
"device");
rc = PTR_ERR(i2o_blk_dev); rc = PTR_ERR(i2o_blk_dev);
goto claim_release; goto claim_release;
} }
...@@ -1106,9 +1102,9 @@ static int i2o_block_probe(struct device *dev) ...@@ -1106,9 +1102,9 @@ static int i2o_block_probe(struct device *dev)
blk_queue_max_hw_segments(queue, segments); blk_queue_max_hw_segments(queue, segments);
pr_debug("max sectors: %d\n", I2O_MAX_SECTORS); osm_debug("max sectors = %d\n", I2O_MAX_SECTORS);
pr_debug("phys segments: %d\n", I2O_MAX_SEGMENTS); osm_debug("phys segments = %d\n", I2O_MAX_SEGMENTS);
pr_debug("hw segments: %d\n", segments); osm_debug("hw segments = %d\n", segments);
/* /*
* Ask for the current media data. If that isn't supported * Ask for the current media data. If that isn't supported
...@@ -1119,7 +1115,7 @@ static int i2o_block_probe(struct device *dev) ...@@ -1119,7 +1115,7 @@ static int i2o_block_probe(struct device *dev)
i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4); i2o_parm_field_get(i2o_dev, 0x0000, 3, &blocksize, 4);
i2o_parm_field_get(i2o_dev, 0x0000, 4, &size, 8); i2o_parm_field_get(i2o_dev, 0x0000, 4, &size, 8);
} }
pr_debug("blocksize: %d\n", blocksize); osm_debug("blocksize = %d\n", blocksize);
if (i2o_parm_field_get(i2o_dev, 0x0000, 2, &power, 2)) if (i2o_parm_field_get(i2o_dev, 0x0000, 2, &power, 2))
power = 0; power = 0;
...@@ -1145,7 +1141,7 @@ static int i2o_block_probe(struct device *dev) ...@@ -1145,7 +1141,7 @@ static int i2o_block_probe(struct device *dev)
/* Block OSM driver struct */ /* Block OSM driver struct */
static struct i2o_driver i2o_block_driver = { static struct i2o_driver i2o_block_driver = {
.name = "block-osm", .name = OSM_NAME,
.event = i2o_block_event, .event = i2o_block_event,
.reply = i2o_block_reply, .reply = i2o_block_reply,
.classes = i2o_block_class_id, .classes = i2o_block_class_id,
...@@ -1168,8 +1164,7 @@ static int __init i2o_block_init(void) ...@@ -1168,8 +1164,7 @@ static int __init i2o_block_init(void)
int rc; int rc;
int size; int size;
printk(KERN_INFO "I2O Block Storage OSM v0.9\n"); printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
printk(KERN_INFO " (c) Copyright 1999-2001 Red Hat Software.\n");
/* Allocate request mempool and slab */ /* Allocate request mempool and slab */
size = sizeof(struct i2o_block_request); size = sizeof(struct i2o_block_request);
...@@ -1177,7 +1172,7 @@ static int __init i2o_block_init(void) ...@@ -1177,7 +1172,7 @@ static int __init i2o_block_init(void)
SLAB_HWCACHE_ALIGN, NULL, SLAB_HWCACHE_ALIGN, NULL,
NULL); NULL);
if (!i2o_blk_req_pool.slab) { if (!i2o_blk_req_pool.slab) {
printk(KERN_ERR "block-osm: can't init request slab\n"); osm_err("can't init request slab\n");
rc = -ENOMEM; rc = -ENOMEM;
goto exit; goto exit;
} }
...@@ -1187,7 +1182,7 @@ static int __init i2o_block_init(void) ...@@ -1187,7 +1182,7 @@ static int __init i2o_block_init(void)
mempool_free_slab, mempool_free_slab,
i2o_blk_req_pool.slab); i2o_blk_req_pool.slab);
if (!i2o_blk_req_pool.pool) { if (!i2o_blk_req_pool.pool) {
printk(KERN_ERR "block-osm: can't init request mempool\n"); osm_err("can't init request mempool\n");
rc = -ENOMEM; rc = -ENOMEM;
goto free_slab; goto free_slab;
} }
...@@ -1195,18 +1190,17 @@ static int __init i2o_block_init(void) ...@@ -1195,18 +1190,17 @@ static int __init i2o_block_init(void)
/* Register the block device interfaces */ /* Register the block device interfaces */
rc = register_blkdev(I2O_MAJOR, "i2o_block"); rc = register_blkdev(I2O_MAJOR, "i2o_block");
if (rc) { if (rc) {
printk(KERN_ERR "block-osm: unable to register block device\n"); osm_err("unable to register block device\n");
goto free_mempool; goto free_mempool;
} }
#ifdef MODULE #ifdef MODULE
printk(KERN_INFO "block-osm: registered device at major %d\n", osm_info("registered device at major %d\n", I2O_MAJOR);
I2O_MAJOR);
#endif #endif
/* Register Block OSM into I2O core */ /* Register Block OSM into I2O core */
rc = i2o_driver_register(&i2o_block_driver); rc = i2o_driver_register(&i2o_block_driver);
if (rc) { if (rc) {
printk(KERN_ERR "block-osm: Could not register Block driver\n"); osm_err("Could not register Block driver\n");
goto unregister_blkdev; goto unregister_blkdev;
} }
...@@ -1245,8 +1239,9 @@ static void __exit i2o_block_exit(void) ...@@ -1245,8 +1239,9 @@ static void __exit i2o_block_exit(void)
}; };
MODULE_AUTHOR("Red Hat"); MODULE_AUTHOR("Red Hat");
MODULE_DESCRIPTION("I2O Block Device OSM");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_block_init); module_init(i2o_block_init);
module_exit(i2o_block_exit); module_exit(i2o_block_exit);
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.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); extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
static spinlock_t i2o_config_lock; static spinlock_t i2o_config_lock;
...@@ -79,7 +83,7 @@ static ulong i2o_cfg_info_id = 0; ...@@ -79,7 +83,7 @@ static ulong i2o_cfg_info_id = 0;
*/ */
static struct i2o_driver i2o_config_driver = { static struct i2o_driver i2o_config_driver = {
.name = "Config-OSM" .name = OSM_NAME
}; };
static int i2o_cfg_getiops(unsigned long arg) static int i2o_cfg_getiops(unsigned long arg)
...@@ -296,7 +300,7 @@ static int i2o_cfg_swdl(unsigned long arg) ...@@ -296,7 +300,7 @@ static int i2o_cfg_swdl(unsigned long arg)
writel(0xD0000000 | fragsize, &msg->body[3]); writel(0xD0000000 | fragsize, &msg->body[3]);
writel(buffer.phys, &msg->body[4]); 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); status = i2o_msg_post_wait_mem(c, m, 60, &buffer);
if (status != -ETIMEDOUT) if (status != -ETIMEDOUT)
...@@ -305,9 +309,7 @@ static int i2o_cfg_swdl(unsigned long arg) ...@@ -305,9 +309,7 @@ static int i2o_cfg_swdl(unsigned long arg)
if (status != I2O_POST_WAIT_OK) { if (status != I2O_POST_WAIT_OK) {
// it fails if you try and send frags out of order // it fails if you try and send frags out of order
// and for some yet unknown reasons too // and for some yet unknown reasons too
printk(KERN_INFO osm_info("swdl failed, DetailedStatus = %d\n", status);
"i2o_config: swdl failed, DetailedStatus = %d\n",
status);
return status; return status;
} }
...@@ -370,16 +372,14 @@ static int i2o_cfg_swul(unsigned long arg) ...@@ -370,16 +372,14 @@ static int i2o_cfg_swul(unsigned long arg)
writel(0xD0000000 | fragsize, &msg->body[3]); writel(0xD0000000 | fragsize, &msg->body[3]);
writel(buffer.phys, &msg->body[4]); 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); status = i2o_msg_post_wait_mem(c, m, 60, &buffer);
if (status != I2O_POST_WAIT_OK) { if (status != I2O_POST_WAIT_OK) {
if (status != -ETIMEDOUT) if (status != -ETIMEDOUT)
i2o_dma_free(&c->pdev->dev, &buffer); i2o_dma_free(&c->pdev->dev, &buffer);
printk(KERN_INFO osm_info("swul failed, DetailedStatus = %d\n", status);
"i2o_config: swul failed, DetailedStatus = %d\n",
status);
return status; return status;
} }
...@@ -432,9 +432,7 @@ static int i2o_cfg_swdel(unsigned long arg) ...@@ -432,9 +432,7 @@ static int i2o_cfg_swdel(unsigned long arg)
token = i2o_msg_post_wait(c, m, 10); token = i2o_msg_post_wait(c, m, 10);
if (token != I2O_POST_WAIT_OK) { if (token != I2O_POST_WAIT_OK) {
printk(KERN_INFO osm_info("swdel failed, DetailedStatus = %d\n", token);
"i2o_config: swdel failed, DetailedStatus = %d\n",
token);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -466,8 +464,8 @@ static int i2o_cfg_validate(unsigned long arg) ...@@ -466,8 +464,8 @@ static int i2o_cfg_validate(unsigned long arg)
token = i2o_msg_post_wait(c, m, 10); token = i2o_msg_post_wait(c, m, 10);
if (token != I2O_POST_WAIT_OK) { if (token != I2O_POST_WAIT_OK) {
printk(KERN_INFO "Can't validate configuration, ErrorStatus = " osm_info("Can't validate configuration, ErrorStatus = %d\n",
"%d\n", token); token);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -569,7 +567,7 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, ...@@ -569,7 +567,7 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
c = i2o_find_iop(iop); c = i2o_find_iop(iop);
if (!c) { if (!c) {
pr_debug("controller %d not found\n", iop); osm_debug("controller %d not found\n", iop);
return -ENXIO; return -ENXIO;
} }
...@@ -578,13 +576,13 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, ...@@ -578,13 +576,13 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
sb = c->status_block.virt; sb = c->status_block.virt;
if (get_user(size, &user_msg[0])) { if (get_user(size, &user_msg[0])) {
printk(KERN_WARNING "unable to get size!\n"); osm_warn("unable to get size!\n");
return -EFAULT; return -EFAULT;
} }
size = size >> 16; size = size >> 16;
if (size > sb->inbound_frame_size) { if (size > sb->inbound_frame_size) {
pr_debug("size of message > inbound_frame_size"); osm_warn("size of message > inbound_frame_size");
return -EFAULT; return -EFAULT;
} }
...@@ -594,7 +592,7 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, ...@@ -594,7 +592,7 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
/* Copy in the user's I2O command */ /* Copy in the user's I2O command */
if (copy_from_user(msg, user_msg, size)) { 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; return -EFAULT;
} }
i2o_dump_message(msg); i2o_dump_message(msg);
...@@ -692,7 +690,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, ...@@ -692,7 +690,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
// TODO 64bit fix // TODO 64bit fix
struct sg_simple_element *sg; struct sg_simple_element *sg;
int sg_size; int sg_size;
printk(KERN_INFO "sg_offset\n");
// re-acquire the original message to handle correctly the sg copy operation // re-acquire the original message to handle correctly the sg copy operation
memset(&msg, 0, MSG_FRAME_SIZE * 4); memset(&msg, 0, MSG_FRAME_SIZE * 4);
...@@ -737,7 +734,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg, ...@@ -737,7 +734,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
/* Copy back the reply to user space */ /* Copy back the reply to user space */
if (reply_size) { if (reply_size) {
// we wrote our own values for context - now restore the user supplied ones // 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)) { if (copy_from_user(reply + 2, user_msg + 2, sizeof(u32) * 2)) {
printk(KERN_WARNING printk(KERN_WARNING
"%s: Could not copy message context FROM user\n", "%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, ...@@ -753,7 +749,6 @@ static int i2o_cfg_passthru32(unsigned fd, unsigned cmnd, unsigned long arg,
cleanup: cleanup:
kfree(reply); kfree(reply);
printk(KERN_INFO "rcode: %d\n", rcode);
return rcode; return rcode;
} }
...@@ -786,7 +781,7 @@ static int i2o_cfg_passthru(unsigned long arg) ...@@ -786,7 +781,7 @@ static int i2o_cfg_passthru(unsigned long arg)
c = i2o_find_iop(iop); c = i2o_find_iop(iop);
if (!c) { if (!c) {
pr_debug("controller %d not found\n", iop); osm_warn("controller %d not found\n", iop);
return -ENXIO; return -ENXIO;
} }
...@@ -799,7 +794,7 @@ static int i2o_cfg_passthru(unsigned long arg) ...@@ -799,7 +794,7 @@ static int i2o_cfg_passthru(unsigned long arg)
size = size >> 16; size = size >> 16;
if (size > sb->inbound_frame_size) { if (size > sb->inbound_frame_size) {
pr_debug("size of message > inbound_frame_size"); osm_warn("size of message > inbound_frame_size");
return -EFAULT; return -EFAULT;
} }
...@@ -902,7 +897,6 @@ static int i2o_cfg_passthru(unsigned long arg) ...@@ -902,7 +897,6 @@ static int i2o_cfg_passthru(unsigned long arg)
// TODO 64bit fix // TODO 64bit fix
struct sg_simple_element *sg; struct sg_simple_element *sg;
int sg_size; int sg_size;
printk(KERN_INFO "sg_offset\n");
// re-acquire the original message to handle correctly the sg copy operation // re-acquire the original message to handle correctly the sg copy operation
memset(&msg, 0, MSG_FRAME_SIZE * 4); memset(&msg, 0, MSG_FRAME_SIZE * 4);
...@@ -947,7 +941,6 @@ static int i2o_cfg_passthru(unsigned long arg) ...@@ -947,7 +941,6 @@ static int i2o_cfg_passthru(unsigned long arg)
/* Copy back the reply to user space */ /* Copy back the reply to user space */
if (reply_size) { if (reply_size) {
// we wrote our own values for context - now restore the user supplied ones // 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)) { if (copy_from_user(reply + 2, user_msg + 2, sizeof(u32) * 2)) {
printk(KERN_WARNING printk(KERN_WARNING
"%s: Could not copy message context FROM user\n", "%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, ...@@ -1027,7 +1020,7 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
#endif #endif
default: default:
pr_debug("i2o_config: unknown ioctl called!\n"); osm_debug("unknown ioctl called!\n");
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -1125,20 +1118,19 @@ static struct miscdevice i2o_miscdev = { ...@@ -1125,20 +1118,19 @@ static struct miscdevice i2o_miscdev = {
static int __init i2o_config_init(void) static int __init i2o_config_init(void)
{ {
printk(KERN_INFO "I2O configuration manager v 0.04.\n"); printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
printk(KERN_INFO " (C) Copyright 1999 Red Hat Software\n");
spin_lock_init(&i2o_config_lock); spin_lock_init(&i2o_config_lock);
if (misc_register(&i2o_miscdev) < 0) { 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; return -EBUSY;
} }
/* /*
* Install our handler * Install our handler
*/ */
if (i2o_driver_register(&i2o_config_driver)) { 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); misc_deregister(&i2o_miscdev);
return -EBUSY; return -EBUSY;
} }
...@@ -1160,8 +1152,9 @@ static void i2o_config_exit(void) ...@@ -1160,8 +1152,9 @@ static void i2o_config_exit(void)
} }
MODULE_AUTHOR("Red Hat Software"); MODULE_AUTHOR("Red Hat Software");
MODULE_DESCRIPTION("I2O Configuration");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_config_init); module_init(i2o_config_init);
module_exit(i2o_config_exit); module_exit(i2o_config_exit);
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
* Changes for new I2O API * 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 #define I2O_MAX_MODULES 4
// FIXME! // FIXME!
#define FMT_U64_HEX "0x%08x%08x" #define FMT_U64_HEX "0x%08x%08x"
...@@ -60,7 +64,7 @@ static struct proc_dir_entry *i2o_proc_dir_root; ...@@ -60,7 +64,7 @@ static struct proc_dir_entry *i2o_proc_dir_root;
/* proc OSM driver struct */ /* proc OSM driver struct */
static struct i2o_driver i2o_proc_driver = { 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) 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, ...@@ -1938,11 +1942,11 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir,
sprintf(buff, "%03x", dev->lct_data.tid); 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); devdir = proc_mkdir(buff, dir);
if (!devdir) { if (!devdir) {
printk(KERN_WARNING "i2o: Could not allocate procdir!\n"); osm_warn("Could not allocate procdir!\n");
return; return;
} }
...@@ -1978,13 +1982,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir, ...@@ -1978,13 +1982,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
{ {
struct proc_dir_entry *iopdir; struct proc_dir_entry *iopdir;
struct i2o_device *dev; 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(c->name, dir);
iopdir = proc_mkdir(buff, dir);
if (!iopdir) if (!iopdir)
return -1; return -1;
...@@ -2018,7 +2019,7 @@ static void i2o_proc_iop_remove(struct proc_dir_entry *dir, ...@@ -2018,7 +2019,7 @@ static void i2o_proc_iop_remove(struct proc_dir_entry *dir,
i2o_proc_subdir_remove(pe); i2o_proc_subdir_remove(pe);
remove_proc_entry(pe->name, dir); 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; pe = tmp;
} }
} }
...@@ -2076,6 +2077,8 @@ static int __init i2o_proc_init(void) ...@@ -2076,6 +2077,8 @@ static int __init i2o_proc_init(void)
{ {
int rc; int rc;
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
rc = i2o_driver_register(&i2o_proc_driver); rc = i2o_driver_register(&i2o_proc_driver);
if (rc) if (rc)
return rc; return rc;
...@@ -2101,8 +2104,9 @@ static void __exit i2o_proc_exit(void) ...@@ -2101,8 +2104,9 @@ static void __exit i2o_proc_exit(void)
}; };
MODULE_AUTHOR("Deepak Saxena"); MODULE_AUTHOR("Deepak Saxena");
MODULE_DESCRIPTION("I2O procfs Handler");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_proc_init); module_init(i2o_proc_init);
module_exit(i2o_proc_exit); module_exit(i2o_proc_exit);
...@@ -65,7 +65,9 @@ ...@@ -65,7 +65,9 @@
#include <scsi/scsi_device.h> #include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.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; static struct i2o_driver i2o_scsi_driver;
...@@ -106,8 +108,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c) ...@@ -106,8 +108,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c)
} }
if (!max_channel) { if (!max_channel) {
printk(KERN_WARNING "scsi-osm: no channels found on %s\n", osm_warn("no channels found on %s\n", c->name);
c->name);
return ERR_PTR(-EFAULT); return ERR_PTR(-EFAULT);
} }
...@@ -116,7 +117,7 @@ static struct i2o_scsi_host *i2o_scsi_host_alloc(struct i2o_controller *c) ...@@ -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); scsi_host = scsi_host_alloc(&i2o_scsi_host_template, size);
if (!scsi_host) { 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); return ERR_PTR(-ENOMEM);
} }
...@@ -221,24 +222,23 @@ static int i2o_scsi_probe(struct device *dev) ...@@ -221,24 +222,23 @@ static int i2o_scsi_probe(struct device *dev)
return -EFAULT; return -EFAULT;
if (id >= scsi_host->max_id) { if (id >= scsi_host->max_id) {
printk(KERN_WARNING "scsi-osm: SCSI device id (%d) >= max_id " osm_warn("SCSI device id (%d) >= max_id of I2O host (%d)", id,
"of I2O host (%d)", id, scsi_host->max_id); scsi_host->max_id);
return -EFAULT; return -EFAULT;
} }
if (i2o_parm_field_get(i2o_dev, 0, 4, &lun, 8) < 0) if (i2o_parm_field_get(i2o_dev, 0, 4, &lun, 8) < 0)
return -EFAULT; return -EFAULT;
if (lun >= scsi_host->max_lun) { if (lun >= scsi_host->max_lun) {
printk(KERN_WARNING "scsi-osm: SCSI device id (%d) >= max_lun " osm_warn("SCSI device id (%d) >= max_lun of I2O host (%d)",
"of I2O host (%d)", (unsigned int)lun, (unsigned int)lun, scsi_host->max_lun);
scsi_host->max_lun);
return -EFAULT; return -EFAULT;
} }
parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid); parent = i2o_iop_find_device(c, i2o_dev->lct_data.parent_tid);
if (!parent) { if (!parent) {
printk(KERN_WARNING "scsi-osm: can not find parent of device " osm_warn("can not find parent of device %03x\n",
"%03x\n", i2o_dev->lct_data.tid); i2o_dev->lct_data.tid);
return -EFAULT; return -EFAULT;
} }
...@@ -247,8 +247,8 @@ static int i2o_scsi_probe(struct device *dev) ...@@ -247,8 +247,8 @@ static int i2o_scsi_probe(struct device *dev)
channel = i; channel = i;
if (channel == -1) { if (channel == -1) {
printk(KERN_WARNING "scsi-osm: can not find channel of device " osm_warn("can not find channel of device %03x\n",
"%03x\n", i2o_dev->lct_data.tid); i2o_dev->lct_data.tid);
return -EFAULT; return -EFAULT;
} }
...@@ -256,12 +256,12 @@ static int i2o_scsi_probe(struct device *dev) ...@@ -256,12 +256,12 @@ static int i2o_scsi_probe(struct device *dev)
__scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev); __scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev);
if (!scsi_dev) { if (!scsi_dev) {
printk(KERN_WARNING "scsi-osm: can not add SCSI device " osm_warn("can not add SCSI device %03x\n",
"%03x\n", i2o_dev->lct_data.tid); i2o_dev->lct_data.tid);
return -EFAULT; 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); i2o_dev->lct_data.tid, channel, id, (unsigned int)lun);
return 0; return 0;
...@@ -307,24 +307,24 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, ...@@ -307,24 +307,24 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
pmsg = i2o_msg_in_to_virt(c, pm); pmsg = i2o_msg_in_to_virt(c, pm);
printk(KERN_ERR "IOP fail.\n"); osm_err("IOP fail.\n");
printk(KERN_ERR "From %d To %d Cmd %d.\n", osm_err("From %d To %d Cmd %d.\n",
(msg->u.head[1] >> 12) & 0xFFF, (msg->u.head[1] >> 12) & 0xFFF,
msg->u.head[1] & 0xFFF, msg->u.head[1] >> 24); 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)) if (msg->body[0] & (1 << 16))
printk(KERN_ERR "Format error.\n"); osm_err("Format error.\n");
if (msg->body[0] & (1 << 17)) if (msg->body[0] & (1 << 17))
printk(KERN_ERR "Path error.\n"); osm_err("Path error.\n");
if (msg->body[0] & (1 << 18)) if (msg->body[0] & (1 << 18))
printk(KERN_ERR "Path State.\n"); osm_err("Path State.\n");
if (msg->body[0] & (1 << 18)) if (msg->body[0] & (1 << 18))
{ {
printk(KERN_ERR "Congestion.\n"); osm_err("Congestion.\n");
err = DID_BUS_BUSY; 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)); cmd = i2o_cntxt_list_get(c, readl(&pmsg->u.s.tcntxt));
if (!cmd) if (!cmd)
...@@ -353,13 +353,12 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, ...@@ -353,13 +353,12 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
if (!cmd) { if (!cmd) {
if (st) if (st)
printk(KERN_WARNING "SCSI abort: %08X", osm_warn("SCSI abort: %08X", le32_to_cpu(msg->body[0]));
le32_to_cpu(msg->body[0])); osm_info("SCSI abort completed.\n");
printk(KERN_INFO "SCSI abort completed.\n");
return -EFAULT; return -EFAULT;
} }
pr_debug("Completed %ld\n", cmd->serial_number); osm_debug("Completed %ld\n", cmd->serial_number);
if (st) { if (st) {
u32 count, error; u32 count, error;
...@@ -370,13 +369,13 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, ...@@ -370,13 +369,13 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
count = le32_to_cpu(msg->body[1]); count = le32_to_cpu(msg->body[1]);
if (count < cmd->underflow) { if (count < cmd->underflow) {
int i; int i;
printk(KERN_ERR "SCSI: underflow 0x%08X 0x%08X"
"\n", count, cmd->underflow); osm_err("SCSI underflow 0x%08X 0x%08X\n", count,
printk(KERN_DEBUG "Cmd: "); cmd->underflow);
osm_debug("Cmd: ");
for (i = 0; i < 15; i++) for (i = 0; i < 15; i++)
printk(KERN_DEBUG "%02X ", pr_debug("%02X ", cmd->cmnd[i]);
cmd->cmnd[i]); pr_debug(".\n");
printk(KERN_DEBUG ".\n");
cmd->result = (DID_ERROR << 16); cmd->result = (DID_ERROR << 16);
} }
break; break;
...@@ -384,7 +383,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, ...@@ -384,7 +383,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
default: default:
error = le32_to_cpu(msg->body[0]); 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 */ ) { if ((error & 0xff) == 0x02 /*CHECK_CONDITION */ ) {
int i; int i;
...@@ -394,7 +393,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m, ...@@ -394,7 +393,7 @@ static int i2o_scsi_reply(struct i2o_controller *c, u32 m,
memcpy(cmd->sense_buffer, (void *)&msg->body[3], memcpy(cmd->sense_buffer, (void *)&msg->body[3],
len); len);
for (i = 0; i <= len; i++) for (i = 0; i <= len; i++)
printk(KERN_INFO "%02x\n", osm_info("%02x\n",
cmd->sense_buffer[i]); cmd->sense_buffer[i]);
if (cmd->sense_buffer[0] == 0x70 if (cmd->sense_buffer[0] == 0x70
&& cmd->sense_buffer[2] == DATA_PROTECT) { && cmd->sense_buffer[2] == DATA_PROTECT) {
...@@ -467,21 +466,20 @@ static void i2o_scsi_notify_controller_add(struct i2o_controller *c) ...@@ -467,21 +466,20 @@ static void i2o_scsi_notify_controller_add(struct i2o_controller *c)
i2o_shost = i2o_scsi_host_alloc(c); i2o_shost = i2o_scsi_host_alloc(c);
if (IS_ERR(i2o_shost)) { if (IS_ERR(i2o_shost)) {
printk(KERN_ERR "scsi-osm: Could not initialize" osm_err("Could not initialize SCSI host\n");
" SCSI host\n");
return; return;
} }
rc = scsi_add_host(i2o_shost->scsi_host, &c->device); rc = scsi_add_host(i2o_shost->scsi_host, &c->device);
if (rc) { 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); scsi_host_put(i2o_shost->scsi_host);
return; return;
} }
c->driver_data[i2o_scsi_driver.context] = i2o_shost; 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) ...@@ -503,12 +501,12 @@ static void i2o_scsi_notify_controller_remove(struct i2o_controller *c)
scsi_remove_host(i2o_shost->scsi_host); scsi_remove_host(i2o_shost->scsi_host);
scsi_host_put(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 */ /* SCSI OSM driver struct */
static struct i2o_driver i2o_scsi_driver = { static struct i2o_driver i2o_scsi_driver = {
.name = "scsi-osm", .name = OSM_NAME,
.reply = i2o_scsi_reply, .reply = i2o_scsi_reply,
.classes = i2o_scsi_class_id, .classes = i2o_scsi_class_id,
.notify_controller_add = i2o_scsi_notify_controller_add, .notify_controller_add = i2o_scsi_notify_controller_add,
...@@ -561,7 +559,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, ...@@ -561,7 +559,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
SCpnt->scsi_done = done; SCpnt->scsi_done = done;
if (unlikely(!i2o_dev)) { 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; SCpnt->result = DID_NO_CONNECT << 16;
done(SCpnt); done(SCpnt);
return 0; return 0;
...@@ -569,8 +567,8 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, ...@@ -569,8 +567,8 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
tid = i2o_dev->lct_data.tid; tid = i2o_dev->lct_data.tid;
pr_debug("qcmd: Tid = %03x\n", tid); osm_debug("qcmd: Tid = %03x\n", tid);
pr_debug("Real scsi messages.\n"); osm_debug("Real scsi messages.\n");
/* /*
* Obtain an I2O message. If there are none free then * Obtain an I2O message. If there are none free then
...@@ -702,7 +700,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt, ...@@ -702,7 +700,7 @@ static int i2o_scsi_queuecommand(struct scsi_cmnd *SCpnt,
/* Queue the message */ /* Queue the message */
i2o_msg_post(c, m); i2o_msg_post(c, m);
pr_debug("Issued %ld\n", SCpnt->serial_number); osm_debug("Issued %ld\n", SCpnt->serial_number);
return 0; return 0;
}; };
...@@ -727,7 +725,7 @@ static int i2o_scsi_abort(struct scsi_cmnd *SCpnt) ...@@ -727,7 +725,7 @@ static int i2o_scsi_abort(struct scsi_cmnd *SCpnt)
int tid; int tid;
int status = FAILED; int status = FAILED;
printk(KERN_WARNING "i2o_scsi: Aborting command block.\n"); osm_warn("Aborting command block.\n");
i2o_dev = SCpnt->device->hostdata; i2o_dev = SCpnt->device->hostdata;
c = i2o_dev->iop; c = i2o_dev->iop;
...@@ -777,8 +775,8 @@ static int i2o_scsi_bios_param(struct scsi_device *sdev, ...@@ -777,8 +775,8 @@ static int i2o_scsi_bios_param(struct scsi_device *sdev,
} }
static struct scsi_host_template i2o_scsi_host_template = { static struct scsi_host_template i2o_scsi_host_template = {
.proc_name = "SCSI-OSM", .proc_name = OSM_NAME,
.name = "I2O SCSI Peripheral OSM", .name = OSM_DESCRIPTION,
.info = i2o_scsi_info, .info = i2o_scsi_info,
.queuecommand = i2o_scsi_queuecommand, .queuecommand = i2o_scsi_queuecommand,
.eh_abort_handler = i2o_scsi_abort, .eh_abort_handler = i2o_scsi_abort,
...@@ -789,15 +787,6 @@ static struct scsi_host_template i2o_scsi_host_template = { ...@@ -789,15 +787,6 @@ static struct scsi_host_template i2o_scsi_host_template = {
.use_clustering = ENABLE_CLUSTERING, .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 * i2o_scsi_init - SCSI OSM initialization function
* *
...@@ -809,12 +798,12 @@ static int __init i2o_scsi_init(void) ...@@ -809,12 +798,12 @@ static int __init i2o_scsi_init(void)
{ {
int rc; 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 */ /* Register SCSI OSM into I2O core */
rc = i2o_driver_register(&i2o_scsi_driver); rc = i2o_driver_register(&i2o_scsi_driver);
if (rc) { if (rc) {
printk(KERN_ERR "scsi-osm: Could not register SCSI driver\n"); osm_err("Could not register SCSI driver\n");
return rc; return rc;
} }
...@@ -834,6 +823,8 @@ static void __exit i2o_scsi_exit(void) ...@@ -834,6 +823,8 @@ static void __exit i2o_scsi_exit(void)
MODULE_AUTHOR("Red Hat Software"); MODULE_AUTHOR("Red Hat Software");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
module_init(i2o_scsi_init); module_init(i2o_scsi_init);
module_exit(i2o_scsi_exit); module_exit(i2o_scsi_exit);
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
#include <linux/i2o.h> #include <linux/i2o.h>
#include <linux/delay.h> #include <linux/delay.h>
#define OSM_VERSION "$Rev$"
#define OSM_DESCRIPTION "I2O subsystem"
/* global I2O controller list */ /* global I2O controller list */
LIST_HEAD(i2o_controllers); LIST_HEAD(i2o_controllers);
...@@ -126,12 +129,13 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr) ...@@ -126,12 +129,13 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
unsigned long flags; unsigned long flags;
if (!ptr) 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); entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
if (!entry) { if (!entry) {
printk(KERN_ERR "i2o: Could not allocate memory for context " printk(KERN_ERR "%s: Could not allocate memory for context "
"list element\n"); "list element\n", c->name);
return 0; return 0;
} }
...@@ -150,7 +154,7 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr) ...@@ -150,7 +154,7 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
spin_unlock_irqrestore(&c->context_list_lock, flags); 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; return entry->context;
}; };
...@@ -182,10 +186,11 @@ u32 i2o_cntxt_list_remove(struct i2o_controller * c, void *ptr) ...@@ -182,10 +186,11 @@ u32 i2o_cntxt_list_remove(struct i2o_controller * c, void *ptr)
spin_unlock_irqrestore(&c->context_list_lock, flags); spin_unlock_irqrestore(&c->context_list_lock, flags);
if (!context) if (!context)
printk(KERN_WARNING "i2o: Could not remove nonexistent ptr " printk(KERN_WARNING "%s: Could not remove nonexistent ptr "
"%p\n", 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; return context;
}; };
...@@ -215,9 +220,11 @@ void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context) ...@@ -215,9 +220,11 @@ void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context)
spin_unlock_irqrestore(&c->context_list_lock, flags); spin_unlock_irqrestore(&c->context_list_lock, flags);
if (!ptr) 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; return ptr;
}; };
...@@ -245,10 +252,11 @@ u32 i2o_cntxt_list_get_ptr(struct i2o_controller * c, void *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); spin_unlock_irqrestore(&c->context_list_lock, flags);
if (!context) if (!context)
printk(KERN_WARNING "i2o: Could not find nonexistent ptr " printk(KERN_WARNING "%s: Could not find nonexistent ptr "
"%p\n", 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; return context;
}; };
...@@ -467,7 +475,7 @@ static int i2o_iop_reset(struct i2o_controller *c) ...@@ -467,7 +475,7 @@ static int i2o_iop_reset(struct i2o_controller *c)
i2o_status_block *sb = c->status_block.virt; i2o_status_block *sb = c->status_block.virt;
int rc = 0; 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); m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
if (m == I2O_QUEUE_EMPTY) if (m == I2O_QUEUE_EMPTY)
...@@ -494,7 +502,7 @@ static int i2o_iop_reset(struct i2o_controller *c) ...@@ -494,7 +502,7 @@ static int i2o_iop_reset(struct i2o_controller *c)
timeout = jiffies + I2O_TIMEOUT_RESET * HZ; timeout = jiffies + I2O_TIMEOUT_RESET * HZ;
while (!*status) { while (!*status) {
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
printk(KERN_ERR "IOP reset timeout.\n"); printk(KERN_ERR "%s: IOP reset timeout.\n", c->name);
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
goto exit; goto exit;
} }
...@@ -526,7 +534,8 @@ static int i2o_iop_reset(struct i2o_controller *c) ...@@ -526,7 +534,8 @@ static int i2o_iop_reset(struct i2o_controller *c)
m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET); m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);
while (m == I2O_QUEUE_EMPTY) { while (m == I2O_QUEUE_EMPTY) {
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
printk(KERN_ERR "IOP reset timeout.\n"); printk(KERN_ERR "%s: IOP reset timeout.\n",
c->name);
rc = -ETIMEDOUT; rc = -ETIMEDOUT;
goto exit; goto exit;
} }
...@@ -676,14 +685,14 @@ static int i2o_iop_activate(struct i2o_controller *c) ...@@ -676,14 +685,14 @@ static int i2o_iop_activate(struct i2o_controller *c)
rc = i2o_status_get(c); rc = i2o_status_get(c);
if (rc) { 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); "attempting a reset.\n", c->name);
if (i2o_iop_reset(c)) if (i2o_iop_reset(c))
return rc; return rc;
} }
if (sb->i2o_version > I2OVER15) { 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); "Specification.\n", c->name);
return -ENODEV; return -ENODEV;
} }
...@@ -697,7 +706,7 @@ static int i2o_iop_activate(struct i2o_controller *c) ...@@ -697,7 +706,7 @@ static int i2o_iop_activate(struct i2o_controller *c)
case ADAPTER_STATE_OPERATIONAL: case ADAPTER_STATE_OPERATIONAL:
case ADAPTER_STATE_HOLD: case ADAPTER_STATE_HOLD:
case ADAPTER_STATE_FAILED: 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)) if (i2o_iop_reset(c))
return -ENODEV; return -ENODEV;
} }
...@@ -751,15 +760,16 @@ static int i2o_iop_systab_set(struct i2o_controller *c) ...@@ -751,15 +760,16 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
c->name); c->name);
root = pci_find_parent_resource(c->pdev, res); root = pci_find_parent_resource(c->pdev, res);
if (root == NULL) 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 */ 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) { NULL, NULL) >= 0) {
c->mem_alloc = 1; c->mem_alloc = 1;
sb->current_mem_size = 1 + res->end - res->start; sb->current_mem_size = 1 + res->end - res->start;
sb->current_mem_base = res->start; sb->current_mem_base = res->start;
printk(KERN_INFO printk(KERN_INFO "%s: allocated %ld bytes of PCI memory"
"%s: allocated %ld bytes of PCI memory at 0x%08lX.\n", " at 0x%08lX.\n", c->name,
c->name, 1 + res->end - res->start, res->start); 1 + res->end - res->start, res->start);
} }
} }
...@@ -773,15 +783,16 @@ static int i2o_iop_systab_set(struct i2o_controller *c) ...@@ -773,15 +783,16 @@ static int i2o_iop_systab_set(struct i2o_controller *c)
c->name); c->name);
root = pci_find_parent_resource(c->pdev, res); root = pci_find_parent_resource(c->pdev, res);
if (root == NULL) 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 */ 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) { NULL, NULL) >= 0) {
c->io_alloc = 1; c->io_alloc = 1;
sb->current_io_size = 1 + res->end - res->start; sb->current_io_size = 1 + res->end - res->start;
sb->current_mem_base = res->start; sb->current_mem_base = res->start;
printk(KERN_INFO printk(KERN_INFO "%s: allocated %ld bytes of PCI I/O at"
"%s: allocated %ld bytes of PCI I/O at 0x%08lX.\n", " 0x%08lX.\n", c->name,
c->name, 1 + res->end - res->start, res->start); 1 + res->end - res->start, res->start);
} }
} }
...@@ -871,7 +882,7 @@ void i2o_iop_remove(struct i2o_controller *c) ...@@ -871,7 +882,7 @@ void i2o_iop_remove(struct i2o_controller *c)
{ {
struct i2o_device *dev, *tmp; 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); i2o_driver_notify_controller_remove_all(c);
...@@ -1114,7 +1125,7 @@ struct i2o_controller *i2o_iop_alloc(void) ...@@ -1114,7 +1125,7 @@ struct i2o_controller *i2o_iop_alloc(void)
c = kmalloc(sizeof(*c), GFP_KERNEL); c = kmalloc(sizeof(*c), GFP_KERNEL);
if (!c) { if (!c) {
printk(KERN_ERR "i2o: Insufficient memory to allocate the " printk(KERN_ERR "i2o: Insufficient memory to allocate a I2O "
"controller.\n"); "controller.\n");
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -1162,27 +1173,27 @@ int i2o_iop_add(struct i2o_controller *c) ...@@ -1162,27 +1173,27 @@ int i2o_iop_add(struct i2o_controller *c)
"devices\n", c->name); "devices\n", c->name);
if ((rc = i2o_iop_activate(c))) { 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); c->name);
i2o_iop_reset(c); i2o_iop_reset(c);
return rc; 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())) { if ((rc = i2o_systab_build())) {
i2o_iop_reset(c); i2o_iop_reset(c);
return rc; return rc;
} }
pr_debug("online controller %s...\n", c->name); pr_debug("%s: online controller...\n", c->name);
if ((rc = i2o_iop_online(c))) { if ((rc = i2o_iop_online(c))) {
i2o_iop_reset(c); i2o_iop_reset(c);
return rc; 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))) { if ((rc = i2o_exec_lct_get(c))) {
i2o_iop_reset(c); i2o_iop_reset(c);
...@@ -1247,7 +1258,7 @@ static int __init i2o_iop_init(void) ...@@ -1247,7 +1258,7 @@ static int __init i2o_iop_init(void)
{ {
int rc = 0; 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(); rc = i2o_device_init();
if (rc) if (rc)
...@@ -1297,8 +1308,9 @@ module_init(i2o_iop_init); ...@@ -1297,8 +1308,9 @@ module_init(i2o_iop_init);
module_exit(i2o_iop_exit); module_exit(i2o_iop_exit);
MODULE_AUTHOR("Red Hat Software"); MODULE_AUTHOR("Red Hat Software");
MODULE_DESCRIPTION("I2O Core");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION(OSM_DESCRIPTION);
MODULE_VERSION(OSM_VERSION);
#if BITS_PER_LONG == 64 #if BITS_PER_LONG == 64
EXPORT_SYMBOL(i2o_cntxt_list_add); EXPORT_SYMBOL(i2o_cntxt_list_add);
......
...@@ -159,34 +159,36 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c) ...@@ -159,34 +159,36 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
} }
if (i == 6) { if (i == 6) {
printk(KERN_ERR "i2o: I2O controller has no memory regions" printk(KERN_ERR "%s: I2O controller has no memory regions"
" defined.\n"); " defined.\n", c->name);
i2o_pci_free(c); i2o_pci_free(c);
return -EINVAL; return -EINVAL;
} }
/* Map the I2O controller */ /* Map the I2O controller */
if (c->raptor) { 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", printk(KERN_INFO " BAR0 at 0x%08lX size=%ld\n",
(unsigned long)c->base.phys, (unsigned long)c->base.len); (unsigned long)c->base.phys, (unsigned long)c->base.len);
printk(KERN_INFO " BAR1 at 0x%08lX size=%ld\n", printk(KERN_INFO " BAR1 at 0x%08lX size=%ld\n",
(unsigned long)c->in_queue.phys, (unsigned long)c->in_queue.phys,
(unsigned long)c->in_queue.len); (unsigned long)c->in_queue.len);
} else } else
printk(KERN_INFO "i2o: PCI I2O controller at %08lX size=%ld\n", printk(KERN_INFO "%s: PCI I2O controller at %08lX size=%ld\n",
(unsigned long)c->base.phys, (unsigned long)c->base.len); c->name, (unsigned long)c->base.phys,
(unsigned long)c->base.len);
c->base.virt = ioremap(c->base.phys, c->base.len); c->base.virt = ioremap(c->base.phys, c->base.len);
if (!c->base.virt) { 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; return -ENOMEM;
} }
if (c->raptor) { if (c->raptor) {
c->in_queue.virt = ioremap(c->in_queue.phys, c->in_queue.len); c->in_queue.virt = ioremap(c->in_queue.phys, c->in_queue.len);
if (!c->in_queue.virt) { 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); i2o_pci_free(c);
return -ENOMEM; return -ENOMEM;
} }
...@@ -204,10 +206,10 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c) ...@@ -204,10 +206,10 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
c->mtrr_reg1 = -1; c->mtrr_reg1 = -1;
if (c->mtrr_reg0 < 0) if (c->mtrr_reg0 < 0)
printk(KERN_WARNING "i2o: could not enable write combining " printk(KERN_WARNING "%s: could not enable write combining "
"MTRR\n"); "MTRR\n", c->name);
else 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 * 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) ...@@ -216,14 +218,14 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
*/ */
if ((pdev->vendor == PCI_VENDOR_ID_INTEL || if ((pdev->vendor == PCI_VENDOR_ID_INTEL ||
pdev->vendor == PCI_VENDOR_ID_DPT) && !c->raptor) { pdev->vendor == PCI_VENDOR_ID_DPT) && !c->raptor) {
printk(KERN_INFO "i2o: MTRR workaround for Intel i960 processor" printk(KERN_INFO "%s: MTRR workaround for Intel i960 processor"
"\n"); "\n", c->name);
c->mtrr_reg1 = mtrr_add(c->base.phys, 0x10000, c->mtrr_reg1 = mtrr_add(c->base.phys, 0x10000,
MTRR_TYPE_UNCACHABLE, 1); MTRR_TYPE_UNCACHABLE, 1);
if (c->mtrr_reg1 < 0) { if (c->mtrr_reg1 < 0) {
printk(KERN_WARNING "i2o_pci: Error in setting " printk(KERN_WARNING "%s: Error in setting "
"MTRR_TYPE_UNCACHABLE\n"); "MTRR_TYPE_UNCACHABLE\n", c->name);
mtrr_del(c->mtrr_reg0, c->in_queue.phys, mtrr_del(c->mtrr_reg0, c->in_queue.phys,
c->in_queue.len); c->in_queue.len);
c->mtrr_reg0 = -1; c->mtrr_reg0 = -1;
...@@ -288,7 +290,7 @@ static irqreturn_t i2o_pci_interrupt(int irq, void *dev_id, struct pt_regs *r) ...@@ -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)) { if (unlikely(mv == I2O_QUEUE_EMPTY)) {
return IRQ_NONE; return IRQ_NONE;
} else } else
pr_debug("960 bug detected\n"); pr_debug("%s: 960 bug detected\n", c->name);
} }
while (mv != I2O_QUEUE_EMPTY) { while (mv != I2O_QUEUE_EMPTY) {
...@@ -425,12 +427,14 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, ...@@ -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... */ /* Cards that fall apart if you hit them with large I/O loads... */
if (pdev->vendor == PCI_VENDOR_ID_NCR && pdev->device == 0x0630) { if (pdev->vendor == PCI_VENDOR_ID_NCR && pdev->device == 0x0630) {
c->short_req = 1; 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) { if (pdev->subsystem_vendor == PCI_VENDOR_ID_PROMISE) {
c->promise = 1; 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. */ /* 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, ...@@ -441,14 +445,14 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
} }
if ((rc = i2o_pci_alloc(c))) { if ((rc = i2o_pci_alloc(c))) {
printk(KERN_ERR "i2o: DMA / IO allocation for I2O controller " printk(KERN_ERR "%s: DMA / IO allocation for I2O controller "
" failed\n"); " failed\n", c->name);
goto free_controller; goto free_controller;
} }
if (i2o_pci_irq_enable(c)) { if (i2o_pci_irq_enable(c)) {
printk(KERN_ERR "i2o: unable to enable interrupts for I2O " printk(KERN_ERR "%s: unable to enable interrupts for I2O "
"controller\n"); "controller\n", c->name);
goto free_pci; goto free_pci;
} }
......
...@@ -631,15 +631,25 @@ static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr) ...@@ -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_field_get(struct i2o_device *, int, int, void *, int);
extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int, extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
void *, int); void *, int);
/* FIXME: remove
extern int i2o_query_table(int, struct i2o_controller *, int, int, int, /* debugging and troubleshooting/diagnostic helpers. */
void *, int, void *, int); #define osm_printk(level, format, arg...) \
extern int i2o_clear_table(struct i2o_controller *, int, int); printk(level "%s: " format, OSM_NAME , ## arg)
extern int i2o_row_add_table(struct i2o_controller *, int, int, int,
void *, int); #ifdef DEBUG
extern int i2o_issue_params(int, struct i2o_controller *, int, void *, int, #define osm_debug(format, arg...) \
void *, int); 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 */ /* debugging functions */
extern void i2o_report_status(const char *, const char *, struct i2o_message *); 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