#include <linux/i2o-dev.h>
/* How many different OSM's are we allowing */
-#define I2O_MAX_DRIVERS 4
+#define I2O_MAX_DRIVERS 8
#include <asm/io.h>
#include <asm/semaphore.h> /* Needed for MUTEX init macros */
struct pci_dev *pdev; /* PCI device */
- int short_req:1; /* use small block sizes */
- int no_quiesce:1; /* dont quiesce before reset */
- int raptor:1; /* split bar */
- int promise:1; /* Promise controller */
+ unsigned int short_req:1; /* use small block sizes */
+ unsigned int no_quiesce:1; /* dont quiesce before reset */
+ unsigned int raptor:1; /* split bar */
+ unsigned int promise:1; /* Promise controller */
#ifdef CONFIG_MTRR
int mtrr_reg0;
struct notifier_block *event_notifer; /* Events */
atomic_t users;
struct list_head list; /* Controller list */
- void *post_port; /* Inbout port address */
- void *reply_port; /* Outbound port address */
- void *irq_mask; /* Interrupt register address */
+ void __iomem *post_port; /* Inbout port address */
+ void __iomem *reply_port; /* Outbound port address */
+ void __iomem *irq_mask; /* Interrupt register address */
/* Dynamic LCT related data */
struct i2o_dma in_queue; /* inbound message queue Host->IOP */
struct i2o_dma out_queue; /* outbound message queue IOP->Host */
- int battery:1; /* Has a battery backup */
- int io_alloc:1; /* An I/O resource was allocated */
- int mem_alloc:1; /* A memory resource was allocated */
+ unsigned int battery:1; /* Has a battery backup */
+ unsigned int io_alloc:1; /* An I/O resource was allocated */
+ unsigned int mem_alloc:1; /* A memory resource was allocated */
struct resource io_resource; /* I/O resource allocated to the IOP */
struct resource mem_resource; /* Mem resource allocated to the IOP */
extern struct list_head i2o_controllers;
/* Message functions */
-static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message **);
-extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message **,
+static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message __iomem **);
+extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message __iomem **,
int);
static inline void i2o_msg_post(struct i2o_controller *, u32);
static inline int i2o_msg_post_wait(struct i2o_controller *, u32,
/* IOP functions */
extern int i2o_status_get(struct i2o_controller *);
-extern int i2o_hrt_get(struct i2o_controller *);
extern int i2o_event_register(struct i2o_device *, struct i2o_driver *, int,
u32);
/* Exec OSM functions */
extern int i2o_exec_lct_get(struct i2o_controller *);
-extern int i2o_exec_lct_notify(struct i2o_controller *, u32);
/* device to i2o_device and driver to i2o_driver convertion functions */
#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
* available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
*/
static inline u32 i2o_msg_get(struct i2o_controller *c,
- struct i2o_message **msg)
+ struct i2o_message __iomem **msg)
{
u32 m;
I2O_REPLY_WRITE32(c, m);
};
+/**
+ * i2o_out_to_virt - Turn an I2O message to a virtual address
+ * @c: controller
+ * @m: message engine value
+ *
+ * Turn a receive message from an I2O controller bus address into
+ * a Linux virtual address. The shared page frame is a linear block
+ * so we simply have to shift the offset. This function does not
+ * work for sender side messages as they are ioremap objects
+ * provided by the I2O controller.
+ */
+static inline struct i2o_message *i2o_msg_out_to_virt(struct i2o_controller *c,
+ u32 m)
+{
+ BUG_ON(m < c->out_queue.phys
+ || m >= c->out_queue.phys + c->out_queue.len);
+
+ return c->out_queue.virt + (m - c->out_queue.phys);
+};
+
+/**
+ * i2o_msg_in_to_virt - Turn an I2O message to a virtual address
+ * @c: controller
+ * @m: message engine value
+ *
+ * Turn a send message from an I2O controller bus address into
+ * a Linux virtual address. The shared page frame is a linear block
+ * so we simply have to shift the offset. This function does not
+ * work for receive side messages as they are kmalloc objects
+ * in a different pool.
+ */
+static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controller *c,
+ u32 m)
+{
+ return c->in_queue.virt + m;
+};
+
/**
* i2o_dma_alloc - Allocate DMA memory
* @dev: struct device pointer to the PCI device of the I2O controller
#define i2o_raw_writel(val, mem) __raw_writel(cpu_to_le32(val), mem)
extern int i2o_parm_field_get(struct i2o_device *, int, int, void *, int);
-extern int i2o_parm_field_set(struct i2o_device *, int, int, void *, int);
extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
void *, int);
-/* FIXME: remove
-extern int i2o_query_table(int, struct i2o_controller *, int, int, int,
- void *, int, void *, int);
-extern int i2o_clear_table(struct i2o_controller *, int, int);
-extern int i2o_row_add_table(struct i2o_controller *, int, int, int,
- void *, int);
-extern int i2o_issue_params(int, struct i2o_controller *, int, void *, int,
- void *, int);
-*/
+
+/* debugging and troubleshooting/diagnostic helpers. */
+#define osm_printk(level, format, arg...) \
+ printk(level "%s: " format, OSM_NAME , ## arg)
+
+#ifdef DEBUG
+#define osm_debug(format, arg...) \
+ osm_printk(KERN_DEBUG, format , ## arg)
+#else
+#define osm_debug(format, arg...) \
+ do { } while (0)
+#endif
+
+#define osm_err(format, arg...) \
+ osm_printk(KERN_ERR, format , ## arg)
+#define osm_info(format, arg...) \
+ osm_printk(KERN_INFO, format , ## arg)
+#define osm_warn(format, arg...) \
+ osm_printk(KERN_WARNING, format , ## arg)
/* debugging functions */
extern void i2o_report_status(const char *, const char *, struct i2o_message *);
#define I2O_TIMEOUT_MESSAGE_GET 5
#define I2O_TIMEOUT_RESET 30
#define I2O_TIMEOUT_STATUS_GET 5
-#define I2O_TIMEOUT_LCT_GET 20
+#define I2O_TIMEOUT_LCT_GET 360
#define I2O_TIMEOUT_SCSI_SCB_ABORT 240
/* retries */