vserver 1.9.5.x5
[linux-2.6.git] / include / linux / i2o.h
index a684376..ea9a3ad 100644 (file)
@@ -23,7 +23,7 @@
 #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 */
@@ -147,10 +147,10 @@ struct i2o_controller {
 
        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;
@@ -162,9 +162,9 @@ struct i2o_controller {
        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 */
 
@@ -180,9 +180,9 @@ struct i2o_controller {
        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 */
@@ -241,8 +241,8 @@ struct i2o_sys_tbl {
 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,
@@ -263,7 +263,6 @@ static inline void i2o_dma_unmap(struct device *, struct i2o_dma *);
 
 /* 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);
@@ -385,7 +384,6 @@ extern int i2o_device_claim_release(struct i2o_device *);
 
 /* 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)
@@ -445,7 +443,7 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val)
  *     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;
 
@@ -501,6 +499,43 @@ static inline void i2o_flush_reply(struct i2o_controller *c, 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
@@ -594,18 +629,27 @@ static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr)
 #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 *);
@@ -942,7 +986,7 @@ extern void i2o_debug_state(struct i2o_controller *c);
 #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 */