#include <linux/module.h>
#include <linux/i2o.h>
-#include <linux/delay.h>
/* global I2O controller list */
LIST_HEAD(i2o_controllers);
*/
static struct i2o_dma i2o_systab;
-static int i2o_hrt_get(struct i2o_controller *c);
-
/* Module internal functions from other sources */
extern struct i2o_driver i2o_exec_driver;
extern int i2o_exec_lct_get(struct i2o_controller *);
*/
void i2o_msg_nop(struct i2o_controller *c, u32 m)
{
- struct i2o_message __iomem *msg = c->in_queue.virt + m;
+ struct i2o_message *msg = c->in_queue.virt + m;
writel(THREE_WORD_MSG_SIZE | SGL_OFFSET_0, &msg->u.head[0]);
writel(I2O_CMD_UTIL_NOP << 24 | HOST_TID << 12 | ADAPTER_TID,
* address from the read port (see the i2o spec). If no message is
* available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
*/
-u32 i2o_msg_get_wait(struct i2o_controller *c, struct i2o_message __iomem **msg,
+u32 i2o_msg_get_wait(struct i2o_controller *c, struct i2o_message **msg,
int wait)
{
unsigned long timeout = jiffies + wait * HZ;
*
* Returns context id > 0 on success or 0 on failure.
*/
-u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
+u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr)
{
struct i2o_context_list_element *entry;
unsigned long flags;
*
* Returns context id on succes or 0 on failure.
*/
-u32 i2o_cntxt_list_remove(struct i2o_controller * c, void *ptr)
+u32 i2o_cntxt_list_remove(struct i2o_controller *c, void *ptr)
{
struct i2o_context_list_element *entry;
u32 context = 0;
*/
static int i2o_iop_quiesce(struct i2o_controller *c)
{
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
i2o_status_block *sb = c->status_block.virt;
int rc;
*/
static int i2o_iop_enable(struct i2o_controller *c)
{
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
i2o_status_block *sb = c->status_block.virt;
int rc;
*/
static int i2o_iop_clear(struct i2o_controller *c)
{
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
int rc;
static int i2o_iop_reset(struct i2o_controller *c)
{
u8 *status = c->status.virt;
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
unsigned long timeout;
i2o_status_block *sb = c->status_block.virt;
if (m == I2O_QUEUE_EMPTY)
return -ETIMEDOUT;
- memset(status, 0, 8);
+ memset(status, 0, 4);
/* Quiesce all IOPs first */
i2o_iop_quiesce_all();
rc = -ETIMEDOUT;
goto exit;
}
-
- /* Promise bug */
- if (status[1] || status[4]) {
- *status = 0;
- break;
- }
-
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(1);
*
* Returns 0 on success or a negative errno code on failure.
*/
-static int i2o_iop_init_outbound_queue(struct i2o_controller *c)
+int i2o_iop_init_outbound_queue(struct i2o_controller *c)
{
u8 *status = c->status.virt;
u32 m;
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
ulong timeout;
int i;
/* Post frames */
for (i = 0; i < NMBR_MSG_FRAMES; i++) {
i2o_flush_reply(c, m);
- udelay(1); /* Promise */
m += MSG_FRAME_SIZE * 4;
}
return 0;
}
-/**
- * i2o_iop_send_nop - send a core NOP message
- * @c: controller
- *
- * Send a no-operation message with a reply set to cause no
- * action either. Needed for bringing up promise controllers.
- */
-static int i2o_iop_send_nop(struct i2o_controller *c)
-{
- struct i2o_message __iomem *msg;
- u32 m = i2o_msg_get_wait(c, &msg, HZ);
- if (m == I2O_QUEUE_EMPTY)
- return -ETIMEDOUT;
- i2o_msg_nop(c, m);
- return 0;
-}
-
/**
* i2o_iop_activate - Bring controller up to HOLD
* @c: controller
*/
static int i2o_iop_activate(struct i2o_controller *c)
{
- struct pci_dev *i960 = NULL;
i2o_status_block *sb = c->status_block.virt;
int rc;
-
- if (c->promise) {
- /* Beat up the hardware first of all */
- i960 =
- pci_find_slot(c->pdev->bus->number,
- PCI_DEVFN(PCI_SLOT(c->pdev->devfn), 0));
- if (i960)
- pci_write_config_word(i960, 0x42, 0);
-
- /* Follow this sequence precisely or the controller
- ceases to perform useful functions until reboot */
- if ((rc = i2o_iop_send_nop(c)))
- return rc;
-
- if ((rc = i2o_iop_reset(c)))
- return rc;
- }
-
/* In INIT state, Wait Inbound Q to initialize (in i2o_status_get) */
/* In READY state, Get status */
if (rc)
return rc;
- if (c->promise) {
- if ((rc = i2o_iop_send_nop(c)))
- return rc;
-
- if ((rc = i2o_status_get(c)))
- return rc;
-
- if (i960)
- pci_write_config_word(i960, 0x42, 0x3FF);
- }
-
/* In HOLD state */
rc = i2o_hrt_get(c);
+ if (rc)
+ return rc;
- return rc;
+ return 0;
};
/**
*/
static int i2o_iop_systab_set(struct i2o_controller *c)
{
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
i2o_status_block *sb = c->status_block.virt;
struct device *dev = &c->pdev->dev;
res->flags = IORESOURCE_MEM;
res->start = 0;
res->end = 0;
- printk(KERN_INFO "%s: requires private memory resources.\n",
- c->name);
+ printk("%s: requires private memory resources.\n", c->name);
root = pci_find_parent_resource(c->pdev, res);
if (root == NULL)
- printk(KERN_WARNING "Can't find parent resource!\n");
+ printk("Can't find parent resource!\n");
if (root && allocate_resource(root, res, sb->desired_mem_size, sb->desired_mem_size, sb->desired_mem_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
NULL, NULL) >= 0) {
c->mem_alloc = 1;
res->flags = IORESOURCE_IO;
res->start = 0;
res->end = 0;
- printk(KERN_INFO "%s: requires private memory resources.\n",
- c->name);
+ printk("%s: requires private memory resources.\n", c->name);
root = pci_find_parent_resource(c->pdev, res);
if (root == NULL)
- printk(KERN_WARNING "Can't find parent resource!\n");
+ printk("Can't find parent resource!\n");
if (root && allocate_resource(root, res, sb->desired_io_size, sb->desired_io_size, sb->desired_io_size, 1 << 20, /* Unspecified, so use 1Mb and play safe */
NULL, NULL) >= 0) {
c->io_alloc = 1;
writel(c->unit + 2, &msg->body[0]);
writel(0, &msg->body[1]);
- writel(0x54000000 | i2o_systab.len, &msg->body[2]);
+ writel(0x54000000 | i2o_systab.phys, &msg->body[2]);
writel(i2o_systab.phys, &msg->body[3]);
writel(0x54000000 | sb->current_mem_size, &msg->body[4]);
writel(sb->current_mem_base, &msg->body[5]);
*/
int i2o_status_get(struct i2o_controller *c)
{
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
u8 *status_block;
unsigned long timeout;
*
* Returns 0 on success or negativer error code on failure.
*/
-static int i2o_hrt_get(struct i2o_controller *c)
+int i2o_hrt_get(struct i2o_controller *c)
{
int rc;
int i;
struct device *dev = &c->pdev->dev;
for (i = 0; i < I2O_HRT_GET_TRIES; i++) {
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
memset(c, 0, sizeof(*c));
INIT_LIST_HEAD(&c->devices);
- spin_lock_init(&c->lock);
+ c->lock = SPIN_LOCK_UNLOCKED;
init_MUTEX(&c->lct_lock);
c->unit = unit++;
sprintf(c->name, "iop%d", c->unit);
#if BITS_PER_LONG == 64
- spin_lock_init(&c->context_list_lock);
+ c->context_list_lock = SPIN_LOCK_UNLOCKED;
atomic_set(&c->context_list_counter, 0);
INIT_LIST_HEAD(&c->context_list);
#endif
int tcntxt, u32 evt_mask)
{
struct i2o_controller *c = dev->iop;
- struct i2o_message __iomem *msg;
+ struct i2o_message *msg;
u32 m;
m = i2o_msg_get_wait(c, &msg, I2O_TIMEOUT_MESSAGE_GET);
EXPORT_SYMBOL(i2o_iop_find_device);
EXPORT_SYMBOL(i2o_event_register);
EXPORT_SYMBOL(i2o_status_get);
+EXPORT_SYMBOL(i2o_hrt_get);
EXPORT_SYMBOL(i2o_controllers);