summaryrefslogtreecommitdiffstats
path: root/drivers/i2o
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-04 07:40:19 +0000
commit33263fc5f9ac8e8cb2b22d06af3ce5ac1dd815e4 (patch)
tree2d1b86a40bef0958a68cf1a2eafbeb0667a70543 /drivers/i2o
parent216f5f51aa02f8b113aa620ebc14a9631a217a00 (diff)
Merge with Linux 2.3.32.
Diffstat (limited to 'drivers/i2o')
-rw-r--r--drivers/i2o/i2o_block.c69
-rw-r--r--drivers/i2o/i2o_core.c110
-rw-r--r--drivers/i2o/i2o_pci.c1
-rw-r--r--drivers/i2o/i2o_proc.c6
-rw-r--r--drivers/i2o/i2o_scsi.c12
5 files changed, 98 insertions, 100 deletions
diff --git a/drivers/i2o/i2o_block.c b/drivers/i2o/i2o_block.c
index fadb17a02..f83ecbe9b 100644
--- a/drivers/i2o/i2o_block.c
+++ b/drivers/i2o/i2o_block.c
@@ -118,7 +118,7 @@ static int i2ob_timer_started = 0;
static int i2ob_install_device(struct i2o_controller *, struct i2o_device *, int);
static void i2ob_end_request(struct request *);
-static void i2ob_request(void);
+static void i2ob_request(request_queue_t * q);
/*
* Dump messages.
@@ -135,7 +135,6 @@ static void i2ob_dump_msg(struct i2ob_device *dev,u32 *msg,int size)
printk(KERN_INFO "\n");
}
-
/*
* Get a message
*/
@@ -154,8 +153,8 @@ static int i2ob_send(u32 m, struct i2ob_device *dev, struct i2ob_request *ireq,
{
struct i2o_controller *c = dev->controller;
int tid = dev->tid;
- u32 *msg;
- u32 *mptr;
+ unsigned long msg;
+ unsigned long mptr;
u64 offset;
struct request *req = ireq->req;
struct buffer_head *bh = req->bh;
@@ -167,22 +166,22 @@ static int i2ob_send(u32 m, struct i2ob_device *dev, struct i2ob_request *ireq,
/*
* Build the message based on the request.
*/
- __raw_writel(i2ob_context|(unit<<8), &msg[2]);
- __raw_writel(ireq->num, &msg[3]);
- __raw_writel(req->nr_sectors << 9, &msg[5]);
+ __raw_writel(i2ob_context|(unit<<8), msg+8);
+ __raw_writel(ireq->num, msg+12);
+ __raw_writel(req->nr_sectors << 9, msg+20);
/* This can be optimised later - just want to be sure its right for
starters */
offset = ((u64)(req->sector+base)) << 9;
- __raw_writel( offset & 0xFFFFFFFF, &msg[6]);
- __raw_writel(offset>>32, &msg[7]);
+ __raw_writel( offset & 0xFFFFFFFF, msg+24);
+ __raw_writel(offset>>32, msg+28);
mptr=msg+8;
if(req->cmd == READ)
{
- __raw_writel(I2O_CMD_BLOCK_READ<<24|HOST_TID<<12|tid, &msg[1]);
+ __raw_writel(I2O_CMD_BLOCK_READ<<24|HOST_TID<<12|tid, msg+4);
/* We don't yet do cache/readahead and other magic */
- __raw_writel(1<<16, &msg[4]);
+ __raw_writel(1<<16, msg+16);
while(bh!=NULL)
{
/*
@@ -191,31 +190,33 @@ static int i2ob_send(u32 m, struct i2ob_device *dev, struct i2ob_request *ireq,
* sucky to read.
*/
if(bh->b_reqnext)
- __raw_writel(0x10000000|(bh->b_size), mptr++);
+ __raw_writel(0x10000000|(bh->b_size), mptr);
else
- __raw_writel(0xD0000000|(bh->b_size), mptr++);
+ __raw_writel(0xD0000000|(bh->b_size), mptr);
- __raw_writel(virt_to_bus(bh->b_data), mptr++);
+ __raw_writel(virt_to_bus(bh->b_data), mptr+4);
+ mptr+=8;
count -= bh->b_size;
bh = bh->b_reqnext;
}
}
else if(req->cmd == WRITE)
{
- __raw_writel(I2O_CMD_BLOCK_WRITE<<24|HOST_TID<<12|tid, &msg[1]);
- __raw_writel(1<<16, &msg[4]);
+ __raw_writel(I2O_CMD_BLOCK_WRITE<<24|HOST_TID<<12|tid, msg+4);
+ __raw_writel(1<<16, msg+16);
while(bh!=NULL)
{
if(bh->b_reqnext)
- __raw_writel(0x14000000|(bh->b_size), mptr++);
+ __raw_writel(0x14000000|(bh->b_size), mptr);
else
- __raw_writel(0xD4000000|(bh->b_size), mptr++);
+ __raw_writel(0xD4000000|(bh->b_size), mptr);
count -= bh->b_size;
- __raw_writel(virt_to_bus(bh->b_data), mptr++);
+ __raw_writel(virt_to_bus(bh->b_data), mptr+4);
+ mptr+=8;
bh = bh->b_reqnext;
}
}
- __raw_writel(I2O_MESSAGE_SIZE(mptr-msg) | SGL_OFFSET_8, &msg[0]);
+ __raw_writel(I2O_MESSAGE_SIZE(mptr-msg) | SGL_OFFSET_8, msg);
if(req->current_nr_sectors > 8)
printk("Gathered sectors %ld.\n",
@@ -223,8 +224,7 @@ static int i2ob_send(u32 m, struct i2ob_device *dev, struct i2ob_request *ireq,
if(count != 0)
{
- printk("Request count botched by %d.\n", count);
- msg[5] -= count;
+ printk(KERN_ERR "Request count botched by %d.\n", count);
}
i2o_post_message(c,m);
@@ -316,7 +316,7 @@ static void i2o_block_reply(struct i2o_handler *h, struct i2o_controller *c, str
}
else
{
- if(m[2]&0x80000000)
+ if(m[2]&0x40000000)
{
int * ptr = (int *)m[3];
if(m[4]>>24)
@@ -399,7 +399,7 @@ static void i2o_block_reply(struct i2o_handler *h, struct i2o_controller *c, str
*/
atomic_dec(&queue_depth);
- i2ob_request();
+ i2ob_request(NULL);
spin_unlock_irqrestore(&io_request_lock, flags);
}
@@ -437,7 +437,7 @@ static void i2ob_timer_handler(unsigned long dummy)
/*
* Restart any requests.
*/
- i2ob_request();
+ i2ob_request(NULL);
/*
* Free the lock.
@@ -453,7 +453,7 @@ static void i2ob_timer_handler(unsigned long dummy)
* we use it.
*/
-static void i2ob_request(void)
+static void i2ob_request(request_queue_t * q)
{
struct request *req;
struct i2ob_request *ireq;
@@ -527,7 +527,6 @@ static void i2ob_request(void)
}
}
-
/*
* SCSI-CAM for ioctl geometry mapping
* Duplicated with SCSI - this should be moved into somewhere common
@@ -700,7 +699,7 @@ static int i2ob_release(struct inode *inode, struct file *file)
int *query_done = &dev->done_flag;
msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = I2O_CMD_BLOCK_CFLUSH<<24|HOST_TID<<12|dev->tid;
- msg[2] = i2ob_context|0x80000000;
+ msg[2] = i2ob_context|0x40000000;
msg[3] = (u32)query_done;
msg[4] = 60<<16;
i2o_post_wait(dev->controller, msg, 20, 2);
@@ -709,7 +708,7 @@ static int i2ob_release(struct inode *inode, struct file *file)
*/
msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = I2O_CMD_BLOCK_MUNLOCK<<24|HOST_TID<<12|dev->tid;
- msg[2] = i2ob_context|0x80000000;
+ msg[2] = i2ob_context|0x40000000;
msg[3] = (u32)query_done;
msg[4] = -1;
i2o_post_wait(dev->controller, msg, 20, 2);
@@ -762,7 +761,7 @@ static int i2ob_open(struct inode *inode, struct file *file)
*/
msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = I2O_CMD_BLOCK_MMOUNT<<24|HOST_TID<<12|dev->tid;
- msg[2] = i2ob_context|0x80000000;
+ msg[2] = i2ob_context|0x40000000;
msg[3] = (u32)query_done;
msg[4] = -1;
msg[5] = 0;
@@ -772,7 +771,7 @@ static int i2ob_open(struct inode *inode, struct file *file)
*/
msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = I2O_CMD_BLOCK_MLOCK<<24|HOST_TID<<12|dev->tid;
- msg[2] = i2ob_context|0x80000000;
+ msg[2] = i2ob_context|0x40000000;
msg[3] = (u32)query_done;
msg[4] = -1;
i2o_post_wait(dev->controller, msg, 20, 2);
@@ -982,7 +981,7 @@ static int i2ob_reboot_event(struct notifier_block *n, unsigned long code, void
int *query_done = &dev->done_flag;
msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = I2O_CMD_BLOCK_CFLUSH<<24|HOST_TID<<12|dev->tid;
- msg[2] = i2ob_context|0x80000000;
+ msg[2] = i2ob_context|0x40000000;
msg[3] = (u32)query_done;
msg[4] = 60<<16;
i2o_post_wait(dev->controller, msg, 20, 2);
@@ -991,7 +990,7 @@ static int i2ob_reboot_event(struct notifier_block *n, unsigned long code, void
*/
msg[0] = FIVE_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = I2O_CMD_BLOCK_MUNLOCK<<24|HOST_TID<<12|dev->tid;
- msg[2] = i2ob_context|0x80000000;
+ msg[2] = i2ob_context|0x40000000;
msg[3] = (u32)query_done;
msg[4] = -1;
i2o_post_wait(dev->controller, msg, 20, 2);
@@ -1086,7 +1085,9 @@ int i2o_block_init(void)
blk_size[MAJOR_NR] = i2ob_sizes;
max_sectors[MAJOR_NR] = i2ob_max_sectors;
- blk_dev[MAJOR_NR].request_fn = i2ob_request;
+ blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), i2ob_request);
+ blk_queue_headactive(BLK_DEFAULT_QUEUE(MAJOR_NR), 0);
+
for (i = 0; i < MAX_I2OB << 4; i++) {
i2ob_dev[i].refcnt = 0;
i2ob_dev[i].flags = 0;
diff --git a/drivers/i2o/i2o_core.c b/drivers/i2o/i2o_core.c
index 8642540c0..8bd701ad7 100644
--- a/drivers/i2o/i2o_core.c
+++ b/drivers/i2o/i2o_core.c
@@ -42,7 +42,7 @@
#include "i2o_lan.h"
-#define DRIVERDEBUG
+// #define DRIVERDEBUG
// #define DEBUG_IRQ
/*
@@ -175,7 +175,9 @@ void i2o_core_reply(struct i2o_handler *h, struct i2o_controller *c,
{
if (msg[4] >> 24)
{
- i2o_report_status(KERN_WARNING, "i2o_core: post_wait reply", msg);
+ /* 0x40000000 is used as an error report supress bit */
+ if((msg[2]&0x40000000)==0)
+ i2o_report_status(KERN_WARNING, "i2o_core: post_wait reply", msg);
status = -(msg[4] & 0xFFFF);
}
else
@@ -308,8 +310,8 @@ int i2o_install_controller(struct i2o_controller *c)
c->hrt = NULL;
c->lct = NULL;
c->status_block = NULL;
- printk(KERN_INFO "lct @ %p hrt @ %p status @ %p",
- c->lct, c->hrt, c->status_block);
+// printk(KERN_INFO "lct @ %p hrt @ %p status @ %p",
+// c->lct, c->hrt, c->status_block);
sprintf(c->name, "i2o/iop%d", i);
i2o_num_controllers++;
spin_unlock(&i2o_configuration_lock);
@@ -363,8 +365,8 @@ int i2o_delete_controller(struct i2o_controller *c)
*p=c->next;
spin_unlock(&i2o_configuration_lock);
- printk(KERN_INFO "hrt %p lct %p page_frame %p status_block %p\n",
- c->hrt, c->lct, c->page_frame, c->status_block);
+// printk(KERN_INFO "hrt %p lct %p page_frame %p status_block %p\n",
+// c->hrt, c->lct, c->page_frame, c->status_block);
if(c->page_frame)
kfree(c->page_frame);
if(c->hrt)
@@ -790,30 +792,29 @@ static int i2o_query_scalar_polled(struct i2o_controller *c, int tid, void *buf,
void i2o_report_controller_unit(struct i2o_controller *c, int unit)
{
char buf[64];
- return;
- if(i2o_query_scalar(c, unit, 0xF100, 3, buf, 16))
+ if(i2o_query_scalar(c, unit, 0xF100, 3, buf, 16)>=0)
{
buf[16]=0;
- printk(KERN_INFO " Vendor: %s\n", buf);
+ printk(KERN_INFO " Vendor: %s", buf);
}
- if(i2o_query_scalar(c, unit, 0xF100, 4, buf, 16))
+ if(i2o_query_scalar(c, unit, 0xF100, 4, buf, 16)>=0)
{
buf[16]=0;
- printk(KERN_INFO " Device: %s\n", buf);
+ printk(" Device: %s", buf);
}
#if 0
- if(i2o_query_scalar(c, unit, 0xF100, 5, buf, 16))
+ if(i2o_query_scalar(c, unit, 0xF100, 5, buf, 16)>=0)
{
buf[16]=0;
printk(KERN_INFO "Description: %s\n", buf);
}
#endif
- if(i2o_query_scalar(c, unit, 0xF100, 6, buf, 8))
+ if(i2o_query_scalar(c, unit, 0xF100, 6, buf, 8)>=0)
{
buf[8]=0;
- printk(KERN_INFO " Rev: %s\n", buf);
+ printk(" Rev: %s\n", buf);
}
}
@@ -969,18 +970,18 @@ static int i2o_parse_lct(struct i2o_controller *c)
d->flags = 0;
tid = d->lct_data->tid;
- printk(KERN_INFO "TID %d.\n", tid);
+ printk(KERN_INFO "Task ID %d.\n", tid);
i2o_report_controller_unit(c, tid);
i2o_install_device(c, d);
- printk(KERN_INFO " Class: ");
+ printk(KERN_INFO " Class: ");
sprintf(str, "%-21s", i2o_get_class_name(d->lct_data->class_id));
printk("%s", str);
- printk(" Subclass: 0x%03X Flags: ",
+ printk(" Subclass: 0x%04X Flags: ",
d->lct_data->sub_class);
if(d->lct_data->device_flags&(1<<0))
@@ -1254,52 +1255,46 @@ int i2o_status_get(struct i2o_controller *c)
status_block = (u8*)c->status_block;
- for(i=0;i<5;i++)
- {
- m=i2o_wait_message(c, "StatusGet");
- if(m==0xFFFFFFFF)
- return -ETIMEDOUT;
-
- memset(status_block, 0, sizeof(i2o_status_block));
+ m=i2o_wait_message(c, "StatusGet");
+ if(m==0xFFFFFFFF)
+ return -ETIMEDOUT;
- msg=(u32 *)(c->mem_offset+m);
+ memset(status_block, 0, sizeof(i2o_status_block));
+ msg=(u32 *)(c->mem_offset+m);
__raw_writel(NINE_WORD_MSG_SIZE|SGL_OFFSET_0, &msg[0]);
- __raw_writel(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID, &msg[1]);
- __raw_writel(0, &msg[2]);
- __raw_writel(0, &msg[3]);
- __raw_writel(0, &msg[4]);
- __raw_writel(0, &msg[5]);
- __raw_writel(virt_to_bus(c->status_block), &msg[6]);
- __raw_writel(0, &msg[7]); /* 64bit host FIXME */
- __raw_writel(sizeof(i2o_status_block), &msg[8]);
-
- printk("SB is %d bytes.\n", sizeof(i2o_status_block));
-
- i2o_post_message(c,m);
-
- /* DPT work around */
- mdelay(5);
+ __raw_writel(I2O_CMD_STATUS_GET<<24|HOST_TID<<12|ADAPTER_TID, &msg[1]);
+ __raw_writel(0, &msg[2]);
+ __raw_writel(0, &msg[3]);
+ __raw_writel(0, &msg[4]);
+ __raw_writel(0, &msg[5]);
+ __raw_writel(virt_to_bus(c->status_block), &msg[6]);
+ __raw_writel(0, &msg[7]); /* 64bit host FIXME */
+ __raw_writel(sizeof(i2o_status_block), &msg[8]);
+
+ i2o_post_message(c,m);
+
+ /* DPT work around */
+ mdelay(5);
- /* Wait for a reply */
- time=jiffies;
+ /* Wait for a reply */
+ time=jiffies;
- while((jiffies-time)<=HZ)
+ while((jiffies-time)<=HZ)
+ {
+ if(status_block[87]!=0)
{
- if(status_block[87]!=0)
- {
- /* Ok the reply has arrived. Fill in the important stuff */
- c->inbound_size = (status_block[12]|(status_block[13]<<8))*4;
- return 0;
- }
- schedule();
- barrier();
+ /* Ok the reply has arrived. Fill in the important stuff */
+ c->inbound_size = (status_block[12]|(status_block[13]<<8))*4;
+ return 0;
}
+ schedule();
+ barrier();
+ }
#ifdef DRIVERDEBUG
- printk(KERN_ERR "IOP get status timeout.\n");
+ printk(KERN_ERR "IOP get status timeout.\n");
#endif
- }
- return 0;//-ETIMEDOUT;
+ return -ETIMEDOUT;
}
@@ -1520,7 +1515,7 @@ static void __init i2o_sys_init()
{
niop = iop->next;
#ifdef DRIVERDEBUG
- printk(KERN_INFO "Enableing iop%d\n", iop->unit);
+ printk(KERN_INFO "Enabling iop%d\n", iop->unit);
#endif
if(i2o_enable_controller(iop))
{
@@ -1687,7 +1682,7 @@ int i2o_init_outbound_q(struct i2o_controller *c)
memset(workspace, 0, 88);
- printk(KERN_INFO "i2o/iop%d: Initializing Outbound Queue\n", c->unit);
+// printk(KERN_INFO "i2o/iop%d: Initializing Outbound Queue\n", c->unit);
m=i2o_wait_message(c, "OutboundInit");
if(m==0xFFFFFFFF)
{
@@ -2146,7 +2141,7 @@ int i2o_query_scalar(struct i2o_controller *iop, int tid,
size = i2o_issue_params(I2O_CMD_UTIL_PARAMS_GET, iop, tid,
opblk, sizeof(opblk), resblk, sizeof(resblk));
-
+
if (size < 0)
return size;
@@ -2685,6 +2680,7 @@ EXPORT_SYMBOL(i2o_report_controller_unit);
EXPORT_SYMBOL(i2o_activate_controller);
EXPORT_SYMBOL(i2o_online_controller);
EXPORT_SYMBOL(i2o_get_class_name);
+EXPORT_SYMBOL(i2o_status_get);
EXPORT_SYMBOL(i2o_query_scalar);
EXPORT_SYMBOL(i2o_set_scalar);
diff --git a/drivers/i2o/i2o_pci.c b/drivers/i2o/i2o_pci.c
index da3748797..d44f801df 100644
--- a/drivers/i2o/i2o_pci.c
+++ b/drivers/i2o/i2o_pci.c
@@ -16,6 +16,7 @@
* Support polled I2O PCI controllers.
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/pci.h>
diff --git a/drivers/i2o/i2o_proc.c b/drivers/i2o/i2o_proc.c
index 2636b089d..2d1c06ddc 100644
--- a/drivers/i2o/i2o_proc.c
+++ b/drivers/i2o/i2o_proc.c
@@ -3181,7 +3181,7 @@ static int i2o_proc_add_controller(struct i2o_controller *pctrl,
sprintf(buff, "iop%d", pctrl->unit);
- dir = create_proc_entry(buff, S_IFDIR, root);
+ dir = proc_mkdir(buff, root);
if(!dir)
return -1;
@@ -3193,7 +3193,7 @@ static int i2o_proc_add_controller(struct i2o_controller *pctrl,
{
sprintf(buff, "%0#5x", dev->lct_data->tid);
- dir1 = create_proc_entry(buff, S_IFDIR, dir);
+ dir1 = proc_mkdir(buff, dir);
dev->proc_entry = dir1;
if(!dir1)
@@ -3295,7 +3295,7 @@ static int create_i2o_procfs(void)
struct i2o_controller *pctrl = NULL;
int i;
- i2o_proc_dir_root = create_proc_entry("i2o", S_IFDIR, 0);
+ i2o_proc_dir_root = proc_mkdir("i2o", 0);
if(!i2o_proc_dir_root)
return -1;
diff --git a/drivers/i2o/i2o_scsi.c b/drivers/i2o/i2o_scsi.c
index 7e5342181..f74b300e5 100644
--- a/drivers/i2o/i2o_scsi.c
+++ b/drivers/i2o/i2o_scsi.c
@@ -297,12 +297,12 @@ static int i2o_find_lun(struct i2o_controller *c, struct i2o_device *d, int *tar
{
u8 reply[8];
- if(i2o_query_scalar(c, d->lct_data->tid, 0, 3, reply, 4))
+ if(i2o_query_scalar(c, d->lct_data->tid, 0, 3, reply, 4)<0)
return -1;
*target=reply[0];
- if(i2o_query_scalar(c, d->lct_data->tid, 0, 4, reply, 8))
+ if(i2o_query_scalar(c, d->lct_data->tid, 0, 4, reply, 8)<0)
return -1;
*lun=reply[1];
@@ -328,7 +328,7 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H
for(unit=c->devices;unit!=NULL;unit=unit->next)
{
dprintk(("Class %03X, parent %d, want %d.\n",
- unit->lct_data->class_id, unit->lct_data->parent, d->lct_data->tid));
+ unit->lct_data->class_id, unit->lct_data->parent_tid, d->lct_data->tid));
/* Only look at scsi and fc devices */
if ( (unit->lct_data->class_id != I2O_CLASS_SCSI_PERIPHERAL)
@@ -337,7 +337,7 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H
continue;
/* On our bus ? */
- dprintk(("Found a disk.\n"));
+ dprintk(("Found a disk (%d).\n", unit->lct_data->tid));
if ((unit->lct_data->parent_tid == d->lct_data->tid)
|| (unit->lct_data->parent_tid == d->lct_data->parent_tid)
)
@@ -346,7 +346,7 @@ void i2o_scsi_init(struct i2o_controller *c, struct i2o_device *d, struct Scsi_H
dprintk(("Its ours.\n"));
if(i2o_find_lun(c, unit, &target, &lun)==-1)
{
- printk(KERN_ERR "i2o_scsi: Unable to get lun for tid %d.\n", d->lct_data->tid);
+ printk(KERN_ERR "i2o_scsi: Unable to get lun for tid %d.\n", unit->lct_data->tid);
continue;
}
dprintk(("Found disk %d %d.\n", target, lun));
@@ -429,7 +429,7 @@ int i2o_scsi_detect(Scsi_Host_Template * tpnt)
* bus_adapter, SCSI (obsolete), or FibreChannel busses only
*/
if( (d->lct_data->class_id!=I2O_CLASS_BUS_ADAPTER_PORT) // bus_adapter
- && (d->lct_data->class_id!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT
+// && (d->lct_data->class_id!=I2O_CLASS_FIBRE_CHANNEL_PORT) // FC_PORT
)
continue;