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) ...@@ -1669,7 +1669,6 @@ static int i2o_block_init(void)
if(i2o_install_handler(&i2o_block_handler)<0) if(i2o_install_handler(&i2o_block_handler)<0)
{ {
unregister_blkdev(MAJOR_NR, "i2o_block"); unregister_blkdev(MAJOR_NR, "i2o_block");
blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
printk(KERN_ERR "i2o_block: unable to register OSM.\n"); printk(KERN_ERR "i2o_block: unable to register OSM.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1682,8 +1681,7 @@ static int i2o_block_init(void) ...@@ -1682,8 +1681,7 @@ static int i2o_block_init(void)
evt_pid = kernel_thread(i2ob_evt, NULL, CLONE_SIGHAND); evt_pid = kernel_thread(i2ob_evt, NULL, CLONE_SIGHAND);
if(evt_pid < 0) if(evt_pid < 0)
{ {
printk(KERN_ERR printk(KERN_ERR "i2o_block: Could not initialize event thread. Aborting\n");
"i2o_block: Could not initialize event thread. Aborting\n");
i2o_remove_handler(&i2o_block_handler); i2o_remove_handler(&i2o_block_handler);
return 0; return 0;
} }
......
...@@ -3344,6 +3344,9 @@ void i2o_report_status(const char *severity, const char *str, u32 *msg) ...@@ -3344,6 +3344,9 @@ void i2o_report_status(const char *severity, const char *str, u32 *msg)
u16 detailed_status = msg[4]&0xFFFF; u16 detailed_status = msg[4]&0xFFFF;
struct i2o_handler *h = i2o_handlers[msg[2] & (MAX_I2O_MODULES-1)]; 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); printk("%s%s: ", severity, str);
if (cmd < 0x1F) // Utility cmd if (cmd < 0x1F) // Utility cmd
......
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
#include <linux/i2o.h> #include <linux/i2o.h>
#include "../../scsi/scsi.h" #include "../../scsi/scsi.h"
#include "../../scsi/hosts.h" #include "../../scsi/hosts.h"
#include "../../scsi/sd.h"
#if BITS_PER_LONG == 64 #if BITS_PER_LONG == 64
#error FIXME: driver does not support 64-bit platforms #error FIXME: driver does not support 64-bit platforms
...@@ -918,6 +917,7 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt) ...@@ -918,6 +917,7 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt)
unsigned long msg; unsigned long msg;
u32 m; u32 m;
int tid; int tid;
unsigned long timeout;
printk(KERN_WARNING "i2o_scsi: Aborting command block.\n"); printk(KERN_WARNING "i2o_scsi: Aborting command block.\n");
...@@ -931,20 +931,20 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt) ...@@ -931,20 +931,20 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt)
} }
c = hostdata->controller; c = hostdata->controller;
/* spin_unlock_irq(host->host_lock);
* 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.
*/
timeout = jiffies+2*HZ;
do do
{ {
mb();
m = le32_to_cpu(I2O_POST_READ32(c)); 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; msg = c->mem_offset + m;
i2o_raw_writel(FIVE_WORD_MSG_SIZE, msg); i2o_raw_writel(FIVE_WORD_MSG_SIZE, msg);
...@@ -955,6 +955,8 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt) ...@@ -955,6 +955,8 @@ int i2o_scsi_abort(Scsi_Cmnd * SCpnt)
wmb(); wmb();
i2o_post_message(c,m); i2o_post_message(c,m);
wmb(); wmb();
spin_lock_irq(host->host_lock);
return SUCCESS; return SUCCESS;
} }
...@@ -977,14 +979,20 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt) ...@@ -977,14 +979,20 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt)
struct i2o_scsi_host *hostdata; struct i2o_scsi_host *hostdata;
u32 m; u32 m;
unsigned long msg; unsigned long msg;
unsigned long timeout;
/* /*
* Find the TID for the bus * Find the TID for the bus
*/ */
printk(KERN_WARNING "i2o_scsi: Attempting to reset the bus.\n");
host = SCpnt->host; 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; hostdata = (struct i2o_scsi_host *)host->hostdata;
tid = hostdata->bus_task; tid = hostdata->bus_task;
c = hostdata->controller; c = hostdata->controller;
...@@ -995,14 +1003,18 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt) ...@@ -995,14 +1003,18 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt)
* possibly ? * possibly ?
*/ */
timeout = jiffies+2*HZ;
do
{
m = le32_to_cpu(I2O_POST_READ32(c)); 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; msg = c->mem_offset + m;
i2o_raw_writel(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0, msg); i2o_raw_writel(FOUR_WORD_MSG_SIZE|SGL_OFFSET_0, msg);
...@@ -1012,7 +1024,12 @@ static int i2o_scsi_bus_reset(Scsi_Cmnd * SCpnt) ...@@ -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 */ /* Now store unit,tid so we can tie the completion back to a specific device */
__raw_writel(c->unit << 16 | tid, msg+12); __raw_writel(c->unit << 16 | tid, msg+12);
wmb(); wmb();
/* We want the command to complete after we return */
spin_lock_irq(host->host_lock);
i2o_post_message(c,m); i2o_post_message(c,m);
/* Should we wait for the reset to complete ? */
return SUCCESS; return SUCCESS;
} }
...@@ -1044,8 +1061,9 @@ static int i2o_scsi_device_reset(Scsi_Cmnd * SCpnt) ...@@ -1044,8 +1061,9 @@ static int i2o_scsi_device_reset(Scsi_Cmnd * SCpnt)
/** /**
* i2o_scsi_bios_param - Invent disk geometry * i2o_scsi_bios_param - Invent disk geometry
* @disk: device * @sdev: scsi device
* @dev: block layer device * @dev: block layer device
* @capacity: size in sectors
* @ip: geometry array * @ip: geometry array
* *
* This is anyones guess quite frankly. We use the same rules everyone * 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