} 
static int i2o_iop_reset(struct i2o_controller *c){	u8 *status = c->status.virt;	struct i2o_message __iomem *msg;	u32 m;	unsigned long timeout;	i2o_status_block *sb = c->status_block.virt;	int rc = 0;	pr_debug("%s: Resetting controller\n", c->name);	m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);	if (m == I2O_QUEUE_EMPTY)		return -ETIMEDOUT;	memset(status, 0, 8);	/* Quiesce all IOPs first */	i2o_iop_quiesce_all();	writel(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);	writel(I2O_CMD_ADAPTER_RESET << 24 | HOST_TID << 12 | ADAPTER_TID,	       &msg->u.head[1]);	writel(i2o_exec_driver.context, &msg->u.s.icntxt);	writel(0, &msg->u.s.tcntxt);	//FIXME: use reasonable transaction context	writel(0, &msg->body[0]);	writel(0, &msg->body[1]);	writel(i2o_ptr_low((void *)c->status.phys), &msg->body[2]);	writel(i2o_ptr_high((void *)c->status.phys), &msg->body[3]);	i2o_msg_post(c, m);	/* Wait for a reply */	timeout = jiffies + I2O_TIMEOUT_RESET * HZ;	while (!*status) {		if (time_after(jiffies, timeout)) {			printk(KERN_ERR "%s: IOP reset timeout.\n", c->name);			rc = -ETIMEDOUT;			goto exit;		}		/* Promise bug */		if (status[1] || status[4]) {			*status = 0;			break;		}		set_current_state(TASK_UNINTERRUPTIBLE);		schedule_timeout(1);		rmb();	}	if (*status == I2O_CMD_IN_PROGRESS) {		/*		 * Once the reset is sent, the IOP goes into the INIT state		 * which is indeterminate.  We need to wait until the IOP		 * has rebooted before we can let the system talk to		 * it. We read the inbound Free_List until a message is		 * available. If we can't read one in the given ammount of		 * time, we assume the IOP could not reboot properly.		 */		pr_debug("%s: Reset in progress, waiting for reboot...\n",			 c->name);		m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);		while (m == I2O_QUEUE_EMPTY) {			if (time_after(jiffies, timeout)) {				printk(KERN_ERR "%s: IOP reset timeout.\n",				       c->name);				rc = -ETIMEDOUT;				goto exit;			}			set_current_state(TASK_UNINTERRUPTIBLE);			schedule_timeout(1);			m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_RESET);		}		i2o_msg_nop(c, m);	}	/* from here all quiesce commands are safe */	c->no_quiesce = 0;	/* If IopReset was rejected or didn't perform reset, try IopClear */	i2o_status_get(c);	if (*status == I2O_CMD_REJECTED || sb->iop_state != ADAPTER_STATE_RESET) {		printk(KERN_WARNING "%s: Reset rejected, trying to clear\n",		       c->name);		i2o_iop_clear(c);	} else		pr_debug("%s: Reset completed.\n", c->name);      exit:	/* Enable all IOPs */	i2o_iop_enable_all();	return rc;};
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f10378fff658f61307496e0ae00095041725cf07/iop.c/buggy/drivers/message/i2o/iop.c