summaryrefslogtreecommitdiffstats
path: root/drivers/i2o
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-19 22:45:37 +0000
commit6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch)
tree0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /drivers/i2o
parentecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff)
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine status unknown.
Diffstat (limited to 'drivers/i2o')
-rw-r--r--drivers/i2o/Makefile74
-rw-r--r--drivers/i2o/README1
-rw-r--r--drivers/i2o/README.ioctl6
-rw-r--r--drivers/i2o/i2o_block.c2
-rw-r--r--drivers/i2o/i2o_config.c6
-rw-r--r--drivers/i2o/i2o_core.c79
-rw-r--r--drivers/i2o/i2o_lan.c299
-rw-r--r--drivers/i2o/i2o_lan.h8
-rw-r--r--drivers/i2o/i2o_pci.c6
-rw-r--r--drivers/i2o/i2o_scsi.h1
10 files changed, 212 insertions, 270 deletions
diff --git a/drivers/i2o/Makefile b/drivers/i2o/Makefile
index 95207337f..3d16f1ff1 100644
--- a/drivers/i2o/Makefile
+++ b/drivers/i2o/Makefile
@@ -1,75 +1,25 @@
#
# Makefile for the kernel I2O OSM.
#
-# Note! Dependencies are done automagically by 'make dep', which also
-# removes any old dependencies. DON'T put your own dependencies here
-# unless it's something special (ie not a .c file).
-#
-# Note 2! The CFLAGS definition is now inherited from the
-# parent makefile.
-#
-
-#
# Note : at this point, these files are compiled on all systems.
# In the future, some of these should be built conditionally.
#
-SUB_DIRS :=
-MOD_SUB_DIRS := $(SUB_DIRS)
-ALL_SUB_DIRS := $(SUB_DIRS)
-
-
-L_TARGET := i2o.a
-L_OBJS :=
-M_OBJS :=
-
-ifeq ($(CONFIG_I2O_PCI),y)
-L_OBJS += i2o_pci.o
-else
- ifeq ($(CONFIG_I2O_PCI),m)
- MX_OBJS += i2o_pci.o
- endif
-endif
-
-ifeq ($(CONFIG_I2O),y)
-LX_OBJS += i2o_core.o i2o_config.o
-else
- ifeq ($(CONFIG_I2O),m)
- MX_OBJS += i2o_core.o i2o_config.o
- endif
-endif
-
-ifeq ($(CONFIG_I2O_BLOCK),y)
-LX_OBJS += i2o_block.o
-else
- ifeq ($(CONFIG_I2O_BLOCK),m)
- MX_OBJS += i2o_block.o
- endif
-endif
+O_TARGET := i2o.o
-ifeq ($(CONFIG_I2O_LAN),y)
-LX_OBJS += i2o_lan.o
-else
- ifeq ($(CONFIG_I2O_LAN),m)
- MX_OBJS += i2o_lan.o
- endif
-endif
+export-objs := i2o_pci.o i2o_core.o i2o_config.o i2o_block.o i2o_lan.o i2o_scsi.o i2o_proc.o
-ifeq ($(CONFIG_I2O_SCSI),y)
-LX_OBJS += i2o_scsi.o
-else
- ifeq ($(CONFIG_I2O_SCSI),m)
- MX_OBJS += i2o_scsi.o
- endif
-endif
+obj-$(CONFIG_I2O_PCI) += i2o_pci.o
+obj-$(CONFIG_I2O) += i2o_core.o i2o_config.o
+obj-$(CONFIG_I2O_BLOCK) += i2o_block.o
+obj-$(CONFIG_I2O_LAN) += i2o_lan.o
+obj-$(CONFIG_I2O_SCSI) += i2o_scsi.o
+obj-$(CONFIG_I2O_PROC) += i2o_proc.o
-ifeq ($(CONFIG_I2O_PROC),y)
-LX_OBJS += i2o_proc.o
-else
- ifeq ($(CONFIG_I2O_PROC),m)
- MX_OBJS += i2o_proc.o
- endif
-endif
+O_OBJS := $(filter-out $(export-objs), $(obj-y))
+OX_OBJS := $(filter $(export-objs), $(obj-y))
+M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
+MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
include $(TOPDIR)/Rules.make
diff --git a/drivers/i2o/README b/drivers/i2o/README
index cebb79ac5..a81f851f7 100644
--- a/drivers/i2o/README
+++ b/drivers/i2o/README
@@ -92,7 +92,6 @@ o Find the right way to associate drives/luns/busses
Lan:
o Performance tuning
o Test Fibre Channel code
-o Fix lan_set_mc_list()
Tape:
o Anyone seen anything implementing this ?
diff --git a/drivers/i2o/README.ioctl b/drivers/i2o/README.ioctl
index 50537501f..b35ad165f 100644
--- a/drivers/i2o/README.ioctl
+++ b/drivers/i2o/README.ioctl
@@ -25,10 +25,10 @@ deepak@csociety.purdue.edu
II. IOP Access
Access to the I2O subsystem is provided through the device file named
-/dev/i2octl. This file is a character file with major number 10 and minor
+/dev/i2o/ctl. This file is a character file with major number 10 and minor
number 166. It can be created through the following command:
- mknod /dev/i2octl c 10 166
+ mknod /dev/i2o/ctl c 10 166
III. Determining the IOP Count
@@ -373,7 +373,7 @@ XII. Events
In the process of determining this. Current idea is to have use
the select() interface to allow user apps to periodically poll
- the /dev/i2octl device for events. When select() notifies the user
+ the /dev/i2o/ctl device for events. When select() notifies the user
that an event is available, the user would call read() to retrieve
a list of all the events that are pending for the specific device.
diff --git a/drivers/i2o/i2o_block.c b/drivers/i2o/i2o_block.c
index c365b0a12..14281f55f 100644
--- a/drivers/i2o/i2o_block.c
+++ b/drivers/i2o/i2o_block.c
@@ -1575,7 +1575,7 @@ static struct block_device_operations i2ob_fops =
static struct gendisk i2ob_gendisk =
{
MAJOR_NR,
- "i2ohd",
+ "i2o/hd",
4,
1<<4,
i2ob,
diff --git a/drivers/i2o/i2o_config.c b/drivers/i2o/i2o_config.c
index 5f51f6ca1..7a50f64e9 100644
--- a/drivers/i2o/i2o_config.c
+++ b/drivers/i2o/i2o_config.c
@@ -161,8 +161,7 @@ static void i2o_cfg_reply(struct i2o_handler *h, struct i2o_controller *c, struc
// printk(KERN_INFO "File %p w/id %d has %d events\n",
// inf->fp, inf->q_id, inf->q_len);
- if(inf->fasync)
- kill_fasync(inf->fasync, SIGIO, POLL_IN);
+ kill_fasync(&inf->fasync, SIGIO, POLL_IN);
}
return;
@@ -840,7 +839,6 @@ static int cfg_open(struct inode *inode, struct file *file)
open_files = tmp;
spin_unlock_irqrestore(&i2o_config_lock, flags);
- MOD_INC_USE_COUNT;
return 0;
}
@@ -873,7 +871,6 @@ static int cfg_release(struct inode *inode, struct file *file)
}
spin_unlock_irqrestore(&i2o_config_lock, flags);
- MOD_DEC_USE_COUNT;
return 0;
}
@@ -894,6 +891,7 @@ static int cfg_fasync(int fd, struct file *fp, int on)
static struct file_operations config_fops =
{
+ owner: THIS_MODULE,
llseek: cfg_llseek,
read: cfg_read,
write: cfg_write,
diff --git a/drivers/i2o/i2o_core.c b/drivers/i2o/i2o_core.c
index d8cc9b2c0..d39e32529 100644
--- a/drivers/i2o/i2o_core.c
+++ b/drivers/i2o/i2o_core.c
@@ -189,7 +189,8 @@ static int evt_q_len = 0;
* I2O configuration spinlock. This isnt a big deal for contention
* so we have one only
*/
-static struct semaphore i2o_configuration_lock;
+
+static DECLARE_MUTEX(i2o_configuration_lock);
/*
* Event spinlock. Used to keep event queue sane and from
@@ -883,11 +884,11 @@ static int i2o_core_evt(void *reply_data)
switch(msg[4])
{
case I2O_EVT_IND_EXEC_RESOURCE_LIMITS:
- printk(KERN_ERR "iop%d: Out of resources\n", c->unit);
+ printk(KERN_ERR "%s: Out of resources\n", c->name);
break;
case I2O_EVT_IND_EXEC_POWER_FAIL:
- printk(KERN_ERR "iop%d: Power failure\n", c->unit);
+ printk(KERN_ERR "%s: Power failure\n", c->name);
break;
case I2O_EVT_IND_EXEC_HW_FAIL:
@@ -1027,12 +1028,12 @@ static int i2o_dyn_lct(void *foo)
entries -= 3;
entries /= 9;
- dprintk(KERN_INFO "I2O: Dynamic LCT Update\n");
- dprintk(KERN_INFO "I2O: Dynamic LCT contains %d entries\n", entries);
+ dprintk(KERN_INFO "%s: Dynamic LCT Update\n",c->name);
+ dprintk(KERN_INFO "%s: Dynamic LCT contains %d entries\n", c->name, entries);
if(!entries)
{
- printk(KERN_INFO "iop%d: Empty LCT???\n", c->unit);
+ printk(KERN_INFO "%s: Empty LCT???\n", c->name);
continue;
}
@@ -1059,7 +1060,7 @@ static int i2o_dyn_lct(void *foo)
}
if(!found)
{
- dprintk(KERN_INFO "Deleted device!\n");
+ dprintk(KERN_INFO "i2o_core: Deleted device!\n");
spin_lock(&i2o_dev_lock);
i2o_delete_device(d);
spin_unlock(&i2o_dev_lock);
@@ -1111,7 +1112,6 @@ void i2o_run_queue(struct i2o_controller *c)
struct i2o_message *m;
u32 mv;
u32 *msg;
- int count = 0;
/*
* Old 960 steppings had a bug in the I2O unit that caused
@@ -1126,8 +1126,6 @@ void i2o_run_queue(struct i2o_controller *c)
m=(struct i2o_message *)bus_to_virt(mv);
msg=(u32*)m;
- count++;
-
/*
* Temporary Debugging
*/
@@ -1148,7 +1146,6 @@ void i2o_run_queue(struct i2o_controller *c)
/* That 960 bug again... */
if((mv=I2O_REPLY_READ32(c))==0xFFFFFFFF)
mv=I2O_REPLY_READ32(c);
-
}
}
@@ -1281,7 +1278,6 @@ void i2o_report_controller_unit(struct i2o_controller *c, struct i2o_device *d)
}
if((ret=i2o_query_scalar(c, unit, 0xF100, 4, buf, 16))>=0)
{
-
buf[16]=0;
printk(KERN_INFO " Device: %s\n", buf);
}
@@ -1657,7 +1653,8 @@ static int i2o_reset_controller(struct i2o_controller *c)
* time, we assume the IOP could not reboot properly.
*/
- dprintk(KERN_INFO "Reset in progress, waiting for reboot\n");
+ dprintk(KERN_INFO "%s: Reset in progress, waiting for reboot...\n",
+ c->name);
time = jiffies;
m = I2O_POST_READ32(c);
@@ -1733,8 +1730,7 @@ int i2o_status_get(struct i2o_controller *c)
m=i2o_wait_message(c, "StatusGet");
if(m==0xFFFFFFFF)
- return -ETIMEDOUT;
-
+ return -ETIMEDOUT;
msg=(u32 *)(c->mem_offset+m);
msg[0]=NINE_WORD_MSG_SIZE|SGL_OFFSET_0;
@@ -1897,12 +1893,12 @@ static void __init i2o_sys_init(void)
{
struct i2o_controller *iop, *niop = NULL;
- printk(KERN_INFO "Activating I2O controllers\n");
+ printk(KERN_INFO "Activating I2O controllers...\n");
printk(KERN_INFO "This may take a few minutes if there are many devices\n");
/* In INIT state, Activate IOPs */
for (iop = i2o_controller_chain; iop; iop = niop) {
- dprintk(KERN_INFO "Calling i2o_activate_controller for %s\n",
+ dprintk(KERN_INFO "Calling i2o_activate_controller for %s...\n",
iop->name);
niop = iop->next;
if (i2o_activate_controller(iop) < 0)
@@ -1919,7 +1915,7 @@ rebuild_sys_tab:
* If build_sys_table fails, we kill everything and bail
* as we can't init the IOPs w/o a system table
*/
- dprintk(KERN_INFO "calling i2o_build_sys_table\n");
+ dprintk(KERN_INFO "i2o_core: Calling i2o_build_sys_table...\n");
if (i2o_build_sys_table() < 0) {
i2o_sys_shutdown();
return;
@@ -1928,7 +1924,7 @@ rebuild_sys_tab:
/* If IOP don't get online, we need to rebuild the System table */
for (iop = i2o_controller_chain; iop; iop = niop) {
niop = iop->next;
- dprintk(KERN_INFO "Calling i2o_online_controller for %s\n", iop->name);
+ dprintk(KERN_INFO "Calling i2o_online_controller for %s...\n", iop->name);
if (i2o_online_controller(iop) < 0) {
i2o_delete_controller(iop);
goto rebuild_sys_tab;
@@ -1992,7 +1988,8 @@ int i2o_activate_controller(struct i2o_controller *iop)
/* In READY state, Get status */
if (i2o_status_get(iop) < 0) {
- printk(KERN_INFO "Unable to obtain status of IOP, attempting a reset.\n");
+ printk(KERN_INFO "Unable to obtain status of %s, "
+ "attempting a reset.\n", iop->name);
if (i2o_reset_controller(iop) < 0)
return -1;
}
@@ -2002,18 +1999,19 @@ int i2o_activate_controller(struct i2o_controller *iop)
return -1;
}
+ if (iop->status_block->i2o_version > I2OVER15) {
+ printk(KERN_ERR "%s: Not running vrs. 1.5. of the I2O Specification.\n",
+ iop->name);
+ return -1;
+ }
+
if (iop->status_block->iop_state == ADAPTER_STATE_READY ||
iop->status_block->iop_state == ADAPTER_STATE_OPERATIONAL ||
iop->status_block->iop_state == ADAPTER_STATE_HOLD ||
iop->status_block->iop_state == ADAPTER_STATE_FAILED)
{
- u32 m[MSG_FRAME_SIZE];
- dprintk(KERN_INFO "%s: Already running, trying to reset\n",
+ dprintk(KERN_INFO "%s: Already running, trying to reset...\n",
iop->name);
-
- i2o_init_outbound_q(iop);
- I2O_REPLY_WRITE32(iop,virt_to_bus(m));
-
if (i2o_reset_controller(iop) < 0)
return -1;
}
@@ -2048,7 +2046,7 @@ int i2o_init_outbound_q(struct i2o_controller *c)
u32 *msg;
u32 time;
- dprintk(KERN_INFO "%s: Initializing Outbound Queue\n", c->name);
+ dprintk(KERN_INFO "%s: Initializing Outbound Queue...\n", c->name);
m=i2o_wait_message(c, "OutboundInit");
if(m==0xFFFFFFFF)
return -ETIMEDOUT;
@@ -2217,13 +2215,13 @@ int i2o_online_controller(struct i2o_controller *iop)
/* In READY state */
- dprintk(KERN_INFO "Attempting to enable iop%d\n", iop->unit);
+ dprintk(KERN_INFO "%s: Attempting to enable...\n", iop->name);
if (i2o_enable_controller(iop) < 0)
return -1;
/* In OPERATIONAL state */
- dprintk(KERN_INFO "Attempting to get/parse lct iop%d\n", iop->unit);
+ dprintk(KERN_INFO "%s: Attempting to get/parse lct...\n", iop->name);
if (i2o_lct_get(iop) < 0)
return -1;
@@ -2275,7 +2273,7 @@ static int i2o_build_sys_table(void)
*/
if(i2o_status_get(iop)) {
printk(KERN_ERR "%s: Deleting b/c could not get status while"
- "attempting to build system table", iop->name);
+ "attempting to build system table\n", iop->name);
i2o_delete_controller(iop);
sys_tbl->num_entries--;
continue; // try the next one
@@ -2338,7 +2336,6 @@ int i2o_post_this(struct i2o_controller *c, u32 *data, int len)
}
while(m==0xFFFFFFFF && (jiffies-t)<HZ);
-
if(m==0xFFFFFFFF)
{
printk(KERN_ERR "%s: Timeout waiting for message frame!\n",
@@ -2483,7 +2480,7 @@ int i2o_issue_params(int cmd, struct i2o_controller *iop, int tid,
msg[8] = virt_to_bus(reslist);
if((wait_status = i2o_post_wait(iop, msg, sizeof(msg), 10)))
- return wait_status; /* -DetailedStatus */
+ return wait_status; /* -DetailedStatus */
/*
* Calculate number of bytes of Result LIST
@@ -2535,7 +2532,7 @@ int i2o_query_scalar(struct i2o_controller *iop, int tid,
return size;
memcpy(buf, resblk+8, buflen); /* cut off header */
- return buflen < size ? buflen : size;
+ return size;
}
/*
@@ -2585,7 +2582,7 @@ int i2o_set_scalar(struct i2o_controller *iop, int tid,
* else return specific fields
* ibuf contains fieldindexes
*
- * if oper == I2O_PARAMS_LIST_GET, gte form specific rows
+ * if oper == I2O_PARAMS_LIST_GET, get from specific rows
* if fieldcount == -1 return all fields
* ibuf contains rowcount, keyvalues
* else return specific fields
@@ -3053,9 +3050,8 @@ void i2o_report_status(const char *severity, const char *str, u32 *msg)
i2o_report_common_status(req_status);
if (cmd < 0x1F || (cmd >= 0xA0 && cmd <= 0xEF))
- i2o_report_common_dsc(detailed_status);
-
- if (h->class == I2O_CLASS_LAN && cmd >= 0x30 && cmd <= 0x3F)
+ i2o_report_common_dsc(detailed_status);
+ else if (h->class == I2O_CLASS_LAN && cmd >= 0x30 && cmd <= 0x3F)
i2o_report_lan_dsc(detailed_status);
else
printk(" / DetailedStatus = %0#4x.\n", detailed_status);
@@ -3189,7 +3185,7 @@ int init_module(void)
return 0;
}
else
- printk(KERN_INFO "event thread created as pid %d\n", evt_pid);
+ printk(KERN_INFO "I2O: Event thread created as pid %d\n", evt_pid);
if(i2o_num_controllers)
i2o_sys_init();
@@ -3215,7 +3211,7 @@ void cleanup_module(void)
stat = kill_proc(evt_pid, SIGTERM, 1);
if(!stat) {
int count = 10 * 100;
- while(evt_running && count) {
+ while(evt_running && count--) {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(1);
}
@@ -3247,8 +3243,6 @@ int __init i2o_init(void)
{
printk(KERN_INFO "Loading I2O Core - (c) Copyright 1999 Red Hat Software\n");
- init_MUTEX(&i2o_configuration_lock);
-
if (i2o_install_handler(&i2o_core_handler) < 0)
{
printk(KERN_ERR
@@ -3286,9 +3280,6 @@ int __init i2o_init(void)
#ifdef CONFIG_I2O_BLOCK
i2o_block_init();
#endif
-#ifdef CONFIG_I2O_SCSI
- i2o_scsi_init();
-#endif
#ifdef CONFIG_I2O_LAN
i2o_lan_init();
#endif
diff --git a/drivers/i2o/i2o_lan.c b/drivers/i2o/i2o_lan.c
index 90b252041..9bc7d825f 100644
--- a/drivers/i2o/i2o_lan.c
+++ b/drivers/i2o/i2o_lan.c
@@ -1,7 +1,7 @@
/*
* drivers/i2o/i2o_lan.c
*
- * I2O LAN CLASS OSM May 4th 2000
+ * I2O LAN CLASS OSM May 26th 2000
*
* (C) Copyright 1999, 2000 University of Helsinki,
* Department of Computer Science
@@ -68,9 +68,7 @@ static u32 i2o_event_mask = I2O_LAN_EVENT_MASK;
static struct net_device *i2o_landevs[MAX_LAN_CARDS+1];
static int unit = -1; /* device unit number */
-extern rwlock_t dev_mc_lock;
-
-static void i2o_lan_reply(struct i2o_handler *h, struct i2o_controller *iop, struct i2o_message *m);
+static void i2o_lan_reply(struct i2o_handler *h, struct i2o_controller *iop, struct i2o_message *m);
static void i2o_lan_send_post_reply(struct i2o_handler *h, struct i2o_controller *iop, struct i2o_message *m);
static int i2o_lan_receive_post(struct net_device *dev);
static void i2o_lan_receive_post_reply(struct i2o_handler *h, struct i2o_controller *iop, struct i2o_message *m);
@@ -86,7 +84,7 @@ static struct i2o_handler i2o_lan_send_handler = {
NULL,
NULL,
NULL,
- "I2O Lan OSM send",
+ "I2O LAN OSM send",
-1,
I2O_CLASS_LAN
};
@@ -97,7 +95,7 @@ static struct i2o_handler i2o_lan_receive_handler = {
NULL,
NULL,
NULL,
- "I2O Lan OSM receive",
+ "I2O LAN OSM receive",
-1,
I2O_CLASS_LAN
};
@@ -108,7 +106,7 @@ static struct i2o_handler i2o_lan_handler = {
NULL,
NULL,
NULL,
- "I2O Lan OSM",
+ "I2O LAN OSM",
-1,
I2O_CLASS_LAN
};
@@ -133,7 +131,6 @@ static void i2o_lan_handle_failure(struct net_device *dev, u32 *msg)
struct i2o_controller *iop = i2o_dev->controller;
u32 *preserved_msg = (u32*)(iop->mem_offset + msg[7]);
- // FIXME on 64-bit host
u32 *sgl_elem = &preserved_msg[4];
struct sk_buff *skb = NULL;
u8 le_flag;
@@ -259,11 +256,13 @@ static void i2o_lan_send_post_reply(struct i2o_handler *h,
i2o_report_status(KERN_INFO, dev->name, msg);
#endif
- /* DDM has handled transmit request(s), free sk_buffs */
-
+ /* DDM has handled transmit request(s), free sk_buffs.
+ * We get similar single transaction reply also in error cases
+ * (except if msg failure or transaction error).
+ */
while (trl_count) {
dev_kfree_skb_irq((struct sk_buff *)msg[4 + trl_count]);
- dprintk(KERN_INFO "%s: Request skb freed (trl_count=%d).\n",
+ dprintk(KERN_INFO "%s: tx skb freed (trl_count=%d).\n",
dev->name, trl_count);
atomic_dec(&priv->tx_out);
trl_count--;
@@ -296,15 +295,8 @@ static void i2o_lan_receive_post_reply(struct i2o_handler *h,
if (i2o_lan_handle_status(dev, msg))
return;
- /* Getting unused buckets back? */
-
- if (msg[4] & I2O_LAN_DSC_CANCELED ||
- msg[4] & I2O_LAN_DSC_RECEIVE_ABORTED) {
- i2o_lan_release_buckets(dev, msg);
- return;
- }
-
- /* If other DetailedStatusCodes need special code, add it here */
+ i2o_lan_release_buckets(dev, msg);
+ return;
}
#ifdef DRIVERDEBUG
@@ -410,26 +402,43 @@ static void i2o_lan_reply(struct i2o_handler *h, struct i2o_controller *iop,
if (i2o_lan_handle_status(dev, msg))
return;
- /* This should NOT be reached */
+ /* In other error cases just report and continue */
+
+ i2o_report_status(KERN_INFO, dev->name, msg);
}
#ifdef DRIVERDEBUG
i2o_report_status(KERN_INFO, dev->name, msg);
#endif
-
switch (msg[1] >> 24) {
- case LAN_RESET:
- case LAN_SUSPEND:
- /* default reply without payload */
+ case LAN_RESET:
+ case LAN_SUSPEND:
+ /* default reply without payload */
break;
- case I2O_CMD_UTIL_EVT_REGISTER:
- case I2O_CMD_UTIL_EVT_ACK:
- i2o_lan_handle_event(dev, msg);
+
+ case I2O_CMD_UTIL_EVT_REGISTER:
+ case I2O_CMD_UTIL_EVT_ACK:
+ i2o_lan_handle_event(dev, msg);
break;
- default:
- printk(KERN_ERR "%s: No handler for the reply.\n",
- dev->name);
- i2o_report_status(KERN_INFO, dev->name, msg);
+
+ case I2O_CMD_UTIL_PARAMS_SET:
+ /* default reply, results in ReplyPayload (not examined) */
+ switch (msg[3] >> 16) {
+ case 1: dprintk(KERN_INFO "%s: Reply to set MAC filter mask.\n",
+ dev->name);
+ break;
+ case 2: dprintk(KERN_INFO "%s: Reply to set MAC table.\n",
+ dev->name);
+ break;
+ default: printk(KERN_WARNING "%s: Bad group 0x%04X\n",
+ dev->name,msg[3] >> 16);
+ }
+ break;
+
+ default:
+ printk(KERN_ERR "%s: No handler for the reply.\n",
+ dev->name);
+ i2o_report_status(KERN_INFO, dev->name, msg);
}
}
@@ -446,7 +455,7 @@ static void i2o_lan_release_buckets(struct net_device *dev, u32 *msg)
u32 *pskb = &msg[6];
while (trl_count--) {
- dprintk(KERN_DEBUG "%s: Releasing unused sk_buff %p (trl_count=%d).\n",
+ dprintk(KERN_DEBUG "%s: Releasing unused rx skb %p (trl_count=%d).\n",
dev->name, (struct sk_buff*)(*pskb),trl_count+1);
dev_kfree_skb_irq((struct sk_buff *)(*pskb));
pskb += 1 + trl_elem_size;
@@ -464,22 +473,15 @@ static void i2o_lan_handle_event(struct net_device *dev, u32 *msg)
struct i2o_controller *iop = i2o_dev->controller;
u32 max_evt_data_size =iop->status_block->inbound_frame_size-5;
struct i2o_reply {
- u8 version_offset;
- u8 msg_flags;
- u16 msg_size;
- u32 tid:12;
- u32 initiator:12;
- u32 function:8;
- u32 initiator_context;
- u32 transaction_context;
+ u32 header[4];
u32 evt_indicator;
- u32 data[max_evt_data_size]; /* max */
+ u32 data[max_evt_data_size];
} *evt = (struct i2o_reply *)msg;
- int evt_data_len = (evt->msg_size - 5) * 4; /* real */
+ int evt_data_len = ((msg[0]>>16) - 5) * 4; /* real size*/
printk(KERN_INFO "%s: I2O event - ", dev->name);
- if (evt->function == I2O_CMD_UTIL_EVT_ACK) {
+ if (msg[1]>>24 == I2O_CMD_UTIL_EVT_ACK) {
printk("Event acknowledgement reply.\n");
return;
}
@@ -505,17 +507,19 @@ static void i2o_lan_handle_event(struct net_device *dev, u32 *msg)
break;
}
- case I2O_EVT_IND_GENERAL_WARNING:
- printk("General warning 0x%04x.\n", evt->data[0]);
- break;
-
- case I2O_EVT_IND_CONFIGURATION_FLAG:
- printk("Configuration requested.\n");
+ case I2O_EVT_IND_FIELD_MODIFIED: {
+ u16 *work16 = (u16 *)evt->data;
+ printk("Group 0x%04x, field %d changed.\n", work16[0], work16[1]);
break;
+ }
- case I2O_EVT_IND_CAPABILITY_CHANGE:
- printk("Capability change 0x%04x.\n", evt->data[0]);
+ case I2O_EVT_IND_VENDOR_EVT: {
+ int i;
+ printk("Vendor event:\n");
+ for (i = 0; i < evt_data_len / 4; i++)
+ printk(" 0x%08x\n", evt->data[i]);
break;
+ }
case I2O_EVT_IND_DEVICE_RESET:
/* Spec 2.0 p. 6-121:
@@ -526,48 +530,43 @@ static void i2o_lan_handle_event(struct net_device *dev, u32 *msg)
printk("%s: Event Acknowledge timeout.\n", dev->name);
break;
+#if 0
case I2O_EVT_IND_EVT_MASK_MODIFIED:
printk("Event mask modified, 0x%08x.\n", evt->data[0]);
break;
- case I2O_EVT_IND_FIELD_MODIFIED: {
- u16 *work16 = (u16 *)evt->data;
- printk("Group 0x%04x, field %d changed.\n", work16[0], work16[1]);
+ case I2O_EVT_IND_GENERAL_WARNING:
+ printk("General warning 0x%04x.\n", evt->data[0]);
+ break;
+ case I2O_EVT_IND_CONFIGURATION_FLAG:
+ printk("Configuration requested.\n");
break;
- }
- case I2O_EVT_IND_VENDOR_EVT: {
- int i;
- printk("Vendor event:\n");
- for (i = 0; i < evt_data_len / 4; i++)
- printk(" 0x%08x\n", evt->data[i]);
+ case I2O_EVT_IND_CAPABILITY_CHANGE:
+ printk("Capability change 0x%04x.\n", evt->data[0]);
break;
- }
case I2O_EVT_IND_DEVICE_STATE:
printk("Device state changed 0x%08x.\n", evt->data[0]);
break;
-
+#endif
case I2O_LAN_EVT_LINK_DOWN:
+ netif_carrier_off(dev);
printk("Link to the physical device is lost.\n");
break;
case I2O_LAN_EVT_LINK_UP:
+ netif_carrier_on(dev);
printk("Link to the physical device is (re)established.\n");
break;
case I2O_LAN_EVT_MEDIA_CHANGE:
printk("Media change.\n");
break;
-
default:
printk("0x%08x. No handler.\n", evt->evt_indicator);
}
-
- /* Note: EventAck necessary only for events that cause the device to
- * syncronize with the user.
- */
}
/*
@@ -722,7 +721,7 @@ static void i2o_set_ddm_parameters(struct net_device *dev)
printk(KERN_WARNING "%s: Unable to set RxMaxPacketsBucket.\n",
dev->name);
else
- dprintk(KERN_INFO "%s: RxMaxPacketsBucket set to &d.\n",
+ dprintk(KERN_INFO "%s: RxMaxPacketsBucket set to %d.\n",
dev->name, val);
return;
}
@@ -739,6 +738,7 @@ static int i2o_lan_open(struct net_device *dev)
struct i2o_lan_local *priv = (struct i2o_lan_local *)dev->priv;
struct i2o_device *i2o_dev = priv->i2o_dev;
struct i2o_controller *iop = i2o_dev->controller;
+ u32 mc_addr_group[64];
MOD_INC_USE_COUNT;
@@ -756,6 +756,18 @@ static int i2o_lan_open(struct net_device *dev)
i2o_lan_reset(dev);
+ /* Get the max number of multicast addresses */
+
+ if (i2o_query_scalar(iop, i2o_dev->lct_data.tid, 0x0001, -1,
+ &mc_addr_group, sizeof(mc_addr_group)) < 0 ) {
+ printk(KERN_WARNING "%s: Unable to query LAN_MAC_ADDRESS group.\n", dev->name);
+ MOD_DEC_USE_COUNT;
+ return -EAGAIN;
+ }
+ priv->max_size_mc_table = mc_addr_group[8];
+
+ /* Malloc space for free bucket list to resuse reveive post buckets */
+
priv->i2o_fbl = kmalloc(priv->max_buckets_out * sizeof(struct sk_buff *),
GFP_KERNEL);
if (priv->i2o_fbl == NULL) {
@@ -819,9 +831,6 @@ static void i2o_lan_tx_timeout(struct net_device *dev)
/*
* i2o_lan_batch_send(): Send packets in batch.
* Both i2o_lan_sdu_send and i2o_lan_packet_send use this.
- *
- * This is a coarse first approximation for the tx_batching.
- * If you come up with something better, please tell me. -taneli
*/
static void i2o_lan_batch_send(struct net_device *dev)
{
@@ -864,7 +873,7 @@ static int i2o_lan_sdu_send(struct sk_buff *skb, struct net_device *dev)
* If tx_batch_mode = 0x01 forced to batch mode
* If tx_batch_mode = 0x10 switch automatically, current mode immediate
* If tx_batch_mode = 0x11 switch automatically, current mode batch
- * If gap between two packets is > 2 ticks, switch to immediate
+ * If gap between two packets is > 0 ticks, switch to immediate
*/
if (priv->tx_batch_mode >> 1) // switch automatically
priv->tx_batch_mode = tickssofar ? 0x02 : 0x03;
@@ -996,7 +1005,7 @@ static int i2o_lan_packet_send(struct sk_buff *skb, struct net_device *dev)
if (!(priv->tx_batch_mode & 0x01) || priv->tx_count == priv->sgl_max) {
dev->trans_start = jiffies;
i2o_post_message(iop, priv->m);
- dprintk(KERN_DEBUG"%s: %d packets sent.\n", dev->name, priv->tx_count);
+ dprintk(KERN_DEBUG "%s: %d packets sent.\n", dev->name, priv->tx_count);
priv->tx_count = 0;
}
@@ -1134,100 +1143,90 @@ static struct net_device_stats *i2o_lan_get_stats(struct net_device *dev)
return (struct net_device_stats *)&priv->stats;
}
-/*
- * i2o_lan_set_mc_list(): Enable a network device to receive packets
- * not send to the protocol address.
+/*
+ * i2o_lan_set_mc_filter(): Post a request to set multicast filter.
*/
-
-static void i2o_lan_set_mc_list(struct net_device *dev)
+int i2o_lan_set_mc_filter(struct net_device *dev, u32 filter_mask)
{
- struct i2o_lan_local *priv = (struct i2o_lan_local *)dev->priv;
+ struct i2o_lan_local *priv = (struct i2o_lan_local *)dev->priv;
struct i2o_device *i2o_dev = priv->i2o_dev;
struct i2o_controller *iop = i2o_dev->controller;
- u32 filter_mask;
- u32 max_size_mc_table;
- u32 mc_addr_group[64];
-
-// This isn't safe yet in SMP. Needs to be async.
-// Seems to work in uniprocessor environment.
-
-return;
-
-// read_lock_bh(&dev_mc_lock);
- spin_lock(&dev->xmit_lock);
- dev->xmit_lock_owner = smp_processor_id();
+ u32 msg[10];
+
+ msg[0] = TEN_WORD_MSG_SIZE | SGL_OFFSET_5;
+ msg[1] = I2O_CMD_UTIL_PARAMS_SET << 24 | HOST_TID << 12 | i2o_dev->lct_data.tid;
+ msg[2] = priv->unit << 16 | lan_context;
+ msg[3] = 0x0001 << 16 | 3 ; // TransactionContext: group&field
+ msg[4] = 0;
+ msg[5] = 0xCC000000 | 16; // Immediate data SGL
+ msg[6] = 1; // OperationCount
+ msg[7] = 0x0001<<16 | I2O_PARAMS_FIELD_SET; // Group, Operation
+ msg[8] = 3 << 16 | 1; // FieldIndex, FieldCount
+ msg[9] = filter_mask; // Value
+
+ return i2o_post_this(iop, msg, sizeof(msg));
+}
- if (i2o_query_scalar(iop, i2o_dev->lct_data.tid, 0x0001, -1,
- &mc_addr_group, sizeof(mc_addr_group)) < 0 ) {
- printk(KERN_WARNING "%s: Unable to query LAN_MAC_ADDRESS group.\n", dev->name);
- return;
+/*
+ * i2o_lan_set_mc_table(): Post a request to set LAN_MULTICAST_MAC_ADDRESS table.
+ */
+int i2o_lan_set_mc_table(struct net_device *dev)
+{
+ struct i2o_lan_local *priv = (struct i2o_lan_local *)dev->priv;
+ struct i2o_device *i2o_dev = priv->i2o_dev;
+ struct i2o_controller *iop = i2o_dev->controller;
+ struct dev_mc_list *mc;
+ u32 msg[10 + 2 * dev->mc_count];
+ u8 *work8 = (u8 *)(msg + 10);
+
+ msg[0] = I2O_MESSAGE_SIZE(10 + 2 * dev->mc_count) | SGL_OFFSET_5;
+ msg[1] = I2O_CMD_UTIL_PARAMS_SET << 24 | HOST_TID << 12 | i2o_dev->lct_data.tid;
+ msg[2] = priv->unit << 16 | lan_context; // InitiatorContext
+ msg[3] = 0x0002 << 16 | (u16)-1; // TransactionContext
+ msg[4] = 0; // OperationFlags
+ msg[5] = 0xCC000000 | (16 + 8 * dev->mc_count); // Immediate data SGL
+ msg[6] = 2; // OperationCount
+ msg[7] = 0x0002 << 16 | I2O_PARAMS_TABLE_CLEAR; // Group, Operation
+ msg[8] = 0x0002 << 16 | I2O_PARAMS_ROW_ADD; // Group, Operation
+ msg[9] = dev->mc_count << 16 | (u16)-1; // RowCount, FieldCount
+
+ for (mc = dev->mc_list; mc ; mc = mc->next, work8 += 8) {
+ memset(work8, 0, 8);
+ memcpy(work8, mc->dmi_addr, mc->dmi_addrlen); // Values
}
- max_size_mc_table = mc_addr_group[8];
+ return i2o_post_this(iop, msg, sizeof(msg));
+}
+
+/*
+ * i2o_lan_set_multicast_list(): Enable a network device to receive packets
+ * not send to the protocol address.
+ */
+static void i2o_lan_set_multicast_list(struct net_device *dev)
+{
+ struct i2o_lan_local *priv = (struct i2o_lan_local *)dev->priv;
+ u32 filter_mask;
if (dev->flags & IFF_PROMISC) {
filter_mask = 0x00000002;
- printk(KERN_INFO "%s: Enabling promiscuous mode...\n", dev->name);
- } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > max_size_mc_table) {
+ dprintk(KERN_INFO "%s: Enabling promiscuous mode...\n", dev->name);
+ } else if ((dev->flags & IFF_ALLMULTI) || dev->mc_count > priv->max_size_mc_table) {
filter_mask = 0x00000004;
- printk(KERN_INFO "%s: Enabling all multicast mode...\n", dev->name);
+ dprintk(KERN_INFO "%s: Enabling all multicast mode...\n", dev->name);
} else if (dev->mc_count) {
- struct dev_mc_list *mc;
- u8 mc_table[2 + 8 * dev->mc_count]; // RowCount, Addresses
- u64 *work64 = (u64 *)(mc_table + 2);
-
filter_mask = 0x00000000;
- printk(KERN_INFO "%s: Enabling multicast mode...\n", dev->name);
-
- /* Fill multicast addr table */
-
- memset(mc_table, 0, sizeof(mc_table));
- memcpy(mc_table, &dev->mc_count, 2);
- for (mc = dev->mc_list; mc ; mc = mc->next, work64++ )
- memcpy(work64, mc->dmi_addr, mc->dmi_addrlen);
-
- /* Clear old mc table, copy new table to <iop,tid> */
-
- if (i2o_clear_table(iop, i2o_dev->lct_data.tid, 0x0002) < 0)
- printk(KERN_INFO "%s: Unable to clear LAN_MULTICAST_MAC_ADDRESS table.\n", dev->name);
-
- if ((i2o_row_add_table(iop, i2o_dev->lct_data.tid, 0x0002, -1,
- mc_table, sizeof(mc_table))) < 0)
- printk(KERN_INFO "%s: Unable to set LAN_MULTICAST_MAC_ADDRESS table.\n", dev->name);
+ dprintk(KERN_INFO "%s: Enabling multicast mode...\n", dev->name);
+ if (i2o_lan_set_mc_table(dev) < 0)
+ printk(KERN_WARNING "%s: Unable to send MAC table.\n", dev->name);
} else {
filter_mask = 0x00000300; // Broadcast, Multicast disabled
- printk(KERN_INFO "%s: Enabling unicast mode...\n", dev->name);
+ dprintk(KERN_INFO "%s: Enabling unicast mode...\n", dev->name);
}
- /* Finally copy new FilterMask to <iop,tid> */
-
- if (i2o_set_scalar(iop, i2o_dev->lct_data.tid, 0x0001, 3,
- &filter_mask, sizeof(filter_mask)) <0)
- printk(KERN_WARNING "%s: Unable to set MAC FilterMask.\n", dev->name);
-
- dev->xmit_lock_owner = -1;
- spin_unlock(&dev->xmit_lock);
-// read_unlock_bh(&dev_mc_lock);
-
- return;
-}
-
-static struct tq_struct i2o_lan_set_mc_list_task = {
- 0, 0, (void (*)(void *))i2o_lan_set_mc_list, (void *) 0
-};
+ /* Finally copy new FilterMask to DDM */
-/*
- * i2o_lan_set_multicast_list():
- * Queue routine i2o_lan_set_mc_list() to be called later.
- * Needs to be async.
- */
-static void i2o_lan_set_multicast_list(struct net_device *dev)
-{
- if (in_interrupt()) {
- i2o_lan_set_mc_list_task.data = (void *)dev;
- queue_task(&i2o_lan_set_mc_list_task, &tq_scheduler);
- } else
- i2o_lan_set_mc_list(dev);
+ if (i2o_lan_set_mc_filter(dev, filter_mask) < 0)
+ printk(KERN_WARNING "%s: Unable to send MAC FilterMask.\n", dev->name);
}
/*
diff --git a/drivers/i2o/i2o_lan.h b/drivers/i2o/i2o_lan.h
index 17064a29a..075f6438d 100644
--- a/drivers/i2o/i2o_lan.h
+++ b/drivers/i2o/i2o_lan.h
@@ -1,7 +1,7 @@
/*
* i2o_lan.h I2O LAN Class definitions
*
- * I2O LAN CLASS OSM April 3rd 2000
+ * I2O LAN CLASS OSM May 26th 2000
*
* (C) Copyright 1999, 2000 University of Helsinki,
* Department of Computer Science
@@ -23,7 +23,7 @@
#define I2O_LAN_RX_COPYBREAK 200
#define I2O_LAN_TX_TIMEOUT (1*HZ)
#define I2O_LAN_TX_BATCH_MODE 2 /* 2=automatic, 1=on, 0=off */
-#define I2O_LAN_EVENT_MASK 0; /* 0=None, 0xFFC00002=All */
+#define I2O_LAN_EVENT_MASK 0 /* 0=None, 0xFFC00002=All */
/* LAN types */
#define I2O_LAN_ETHERNET 0x0030
@@ -100,7 +100,7 @@
#define I2O_LAN_DSC_DEST_ADDRESS_DETECTED 0x0E
#define I2O_LAN_DSC_DEST_ADDRESS_OMITTED 0x0F
#define I2O_LAN_DSC_PARTIAL_PACKET_RETURNED 0x10
-#define I2O_LAN_DSC_TEMP_SUSPENDED_STATE 0x11
+#define I2O_LAN_DSC_SUSPENDED 0x11
struct i2o_packet_info {
u32 offset : 24;
@@ -144,6 +144,8 @@ struct i2o_lan_local {
spinlock_t tx_lock;
+ u32 max_size_mc_table; /* max number of multicast addresses */
+
/* LAN OSM configurable parameters are here: */
u16 max_buckets_out; /* max nbr of buckets to send to DDM */
diff --git a/drivers/i2o/i2o_pci.c b/drivers/i2o/i2o_pci.c
index 0961d5624..6b646a1d8 100644
--- a/drivers/i2o/i2o_pci.c
+++ b/drivers/i2o/i2o_pci.c
@@ -132,9 +132,9 @@ int __init i2o_pci_install(struct pci_dev *dev)
for(i=0; i<6; i++)
{
/* Skip I/O spaces */
- if(!(dev->resource[i].flags&PCI_BASE_ADDRESS_SPACE))
+ if(!(pci_resource_flags(dev, i) & IORESOURCE_IO))
{
- memptr=dev->resource[i].start;
+ memptr = pci_resource_start(dev, i);
break;
}
}
@@ -256,6 +256,8 @@ int __init i2o_pci_scan(void)
printk(KERN_INFO "i2o: I2O Controller found but does not support I2O 1.5 (skipping).\n");
continue;
}
+ if (pci_enable_device(dev))
+ continue;
printk(KERN_INFO "i2o: I2O controller on bus %d at %d.\n",
dev->bus->number, dev->devfn);
pci_set_master(dev);
diff --git a/drivers/i2o/i2o_scsi.h b/drivers/i2o/i2o_scsi.h
index c059c05f4..c62d2849b 100644
--- a/drivers/i2o/i2o_scsi.h
+++ b/drivers/i2o/i2o_scsi.h
@@ -22,6 +22,7 @@ extern int i2o_scsi_abort(Scsi_Cmnd *);
extern int i2o_scsi_reset(Scsi_Cmnd *, unsigned int);
extern int i2o_scsi_bios_param(Disk *, kdev_t, int *);
extern void i2o_scsi_setup(char *str, int *ints);
+extern int i2o_scsi_release(struct Scsi_Host *host);
#define I2OSCSI { \
next: NULL, \