Commit 846ca6b2 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] bring i2o back into sync, clean up oddments

parent 898249f3
......@@ -1669,7 +1669,6 @@ static int i2o_block_init(void)
if(i2o_install_handler(&i2o_block_handler)<0)
{
unregister_blkdev(MAJOR_NR, "i2o_block");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
printk(KERN_ERR "i2o_block: unable to register OSM.\n");
return -EINVAL;
}
......@@ -1682,8 +1681,7 @@ static int i2o_block_init(void)
evt_pid = kernel_thread(i2ob_evt, NULL, CLONE_SIGHAND);
if(evt_pid < 0)
{
printk(KERN_ERR
"i2o_block: Could not initialize event thread. Aborting\n");
printk(KERN_ERR "i2o_block: Could not initialize event thread. Aborting\n");
i2o_remove_handler(&i2o_block_handler);
return 0;
}
......
......@@ -3344,6 +3344,9 @@ void i2o_report_status(const char *severity, const char *str, u32 *msg)
u16 detailed_status = msg[4]&0xFFFF;
struct i2o_handler *h = i2o_handlers[msg[2] & (MAX_I2O_MODULES-1)];
if (cmd == I2O_CMD_UTIL_EVT_REGISTER)
return; // No status in this reply
printk("%s%s: ", severity, str);
if (cmd < 0x1F) // Utility cmd
......
......@@ -57,7 +57,6 @@
#include <linux/i2o.h>
#include "../../scsi/scsi.h"
#include "../../scsi/hosts.h"
#include "../../scsi/sd.h"
#if BITS_PER_LONG == 64
#error FIXME: driver does not support 64-bit platforms
......@@ -918,6 +917,7 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt)
unsigned long msg;
u32 m;
int tid;
unsigned long timeout;
printk(KERN_WARNING "i2o_scsi: Aborting command block.\n");
......@@ -930,21 +930,21 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt)
return FAILED;
}
c = hostdata->controller;
/*
* Obtain an I2O message. Right now we _have_ to obtain one
* until the scsi layer stuff is cleaned up.
*
* FIXME: we are in error context so we could sleep retry
* a bit and then bail in the improved scsi layer.
*/
spin_unlock_irq(host->host_lock);
timeout = jiffies+2*HZ;
do
{
mb();
m = le32_to_cpu(I2O_POST_READ32(c));
if(m != 0xFFFFFFFF)
break;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
mb();
}
while(m==0xFFFFFFFF);
while(time_before(jiffies, timeout));
msg = c->mem_offset + m;
i2o_raw_writel(FIVE_WORD_MSG_SIZE, msg);
......@@ -955,6 +955,8 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt)
wmb();
i2o_post_message(c,m);
wmb();
spin_lock_irq(host->host_lock);
return SUCCESS;
}
......@@ -977,14 +979,20 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt)
struct i2o_scsi_host *hostdata;
u32 m;
unsigned long msg;
unsigned long timeout;
/*
* Find the TID for the bus
*/
printk(KERN_WARNING "i2o_scsi: Attempting to reset the bus.\n");
host = SCpnt->host;
spin_unlock_irq(host->host_lock);
printk(KERN_WARNING "i2o_scsi: Attempting to reset the bus.\n");
hostdata = (struct i2o_scsi_host *)host->hostdata;
tid = hostdata->bus_task;
c = hostdata->controller;
......@@ -994,15 +1002,19 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt)
* will be aborted by the IOP. We need to catch the reply
* possibly ?
*/
m = le32_to_cpu(I2O_POST_READ32(c));
timeout = jiffies+2*HZ;
do
{
m = le32_to_cpu(I2O_POST_READ32(c));
if(m != 0xFFFFFFFF)
break;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
mb();
}
while(time_before(jiffies, timeout));
/*
* No free messages, try again next time - no big deal
*/
if(m == 0xFFFFFFFF)
return SCSI_RESET_PUNT;
msg = c->mem_offset + m;
i2o_raw_writel(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0, msg);
......@@ -1012,7 +1024,12 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt)
/* Now store unit,tid so we can tie the completion back to a specific device */
__raw_writel(c->unit << 16 | tid, msg+12);
wmb();
/* We want the command to complete after we return */
spin_lock_irq(host->host_lock);
i2o_post_message(c,m);
/* Should we wait for the reset to complete ? */
return SUCCESS;
}
......@@ -1044,8 +1061,9 @@ static int i2o_scsi_device_reset(Scsi_Cmnd * SCpnt)
/**
* i2o_scsi_bios_param - Invent disk geometry
* @disk: device
* @sdev: scsi device
* @dev: block layer device
* @capacity: size in sectors
* @ip: geometry array
*
* This is anyones guess quite frankly. We use the same rules everyone
......
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