Commit 9019be28 authored by Andrew Morton's avatar Andrew Morton Committed by James Bottomley

[PATCH] I2O: run linux/i2o.h and linux/i2o-dev.h through

From: Markus Lidel <Markus.Lidel@shadowconnect.com>

- i2o.h and i2o-dev.h are now formated using Lindent.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b590b47b
...@@ -44,27 +44,23 @@ ...@@ -44,27 +44,23 @@
#define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru) #define I2OPASSTHRU _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru)
#define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32) #define I2OPASSTHRU32 _IOR(I2O_MAGIC_NUMBER,12,struct i2o_cmd_passthru32)
struct i2o_cmd_passthru32 struct i2o_cmd_passthru32 {
{
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
u32 msg; /* message */ u32 msg; /* message */
}; };
struct i2o_cmd_passthru struct i2o_cmd_passthru {
{
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
void __user *msg; /* message */ void __user *msg; /* message */
}; };
struct i2o_cmd_hrtlct struct i2o_cmd_hrtlct {
{ unsigned int iop; /* IOP unit number */
unsigned int iop; /* IOP unit number */ void __user *resbuf; /* Buffer for result */
void __user *resbuf; /* Buffer for result */
unsigned int __user *reslen; /* Buffer length in bytes */ unsigned int __user *reslen; /* Buffer length in bytes */
}; };
struct i2o_cmd_psetget struct i2o_cmd_psetget {
{
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
unsigned int tid; /* Target device TID */ unsigned int tid; /* Target device TID */
void __user *opbuf; /* Operation List buffer */ void __user *opbuf; /* Operation List buffer */
...@@ -73,8 +69,7 @@ struct i2o_cmd_psetget ...@@ -73,8 +69,7 @@ struct i2o_cmd_psetget
unsigned int __user *reslen; /* Result List buffer length in bytes */ unsigned int __user *reslen; /* Result List buffer length in bytes */
}; };
struct i2o_sw_xfer struct i2o_sw_xfer {
{
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
unsigned char flags; /* Flags field */ unsigned char flags; /* Flags field */
unsigned char sw_type; /* Software type */ unsigned char sw_type; /* Software type */
...@@ -85,21 +80,19 @@ struct i2o_sw_xfer ...@@ -85,21 +80,19 @@ struct i2o_sw_xfer
unsigned int __user *curfrag; /* Current fragment count */ unsigned int __user *curfrag; /* Current fragment count */
}; };
struct i2o_html struct i2o_html {
{
unsigned int iop; /* IOP unit number */ unsigned int iop; /* IOP unit number */
unsigned int tid; /* Target device ID */ unsigned int tid; /* Target device ID */
unsigned int page; /* HTML page */ unsigned int page; /* HTML page */
void __user *resbuf; /* Buffer for reply HTML page */ void __user *resbuf; /* Buffer for reply HTML page */
unsigned int __user *reslen; /* Length in bytes of reply buffer */ unsigned int __user *reslen; /* Length in bytes of reply buffer */
void __user *qbuf; /* Pointer to HTTP query string */ void __user *qbuf; /* Pointer to HTTP query string */
unsigned int qlen; /* Length in bytes of query string buffer */ unsigned int qlen; /* Length in bytes of query string buffer */
}; };
#define I2O_EVT_Q_LEN 32 #define I2O_EVT_Q_LEN 32
struct i2o_evt_id struct i2o_evt_id {
{
unsigned int iop; unsigned int iop;
unsigned int tid; unsigned int tid;
unsigned int evt_mask; unsigned int evt_mask;
...@@ -108,21 +101,18 @@ struct i2o_evt_id ...@@ -108,21 +101,18 @@ struct i2o_evt_id
/* Event data size = frame size - message header + evt indicator */ /* Event data size = frame size - message header + evt indicator */
#define I2O_EVT_DATA_SIZE 88 #define I2O_EVT_DATA_SIZE 88
struct i2o_evt_info struct i2o_evt_info {
{
struct i2o_evt_id id; struct i2o_evt_id id;
unsigned char evt_data[I2O_EVT_DATA_SIZE]; unsigned char evt_data[I2O_EVT_DATA_SIZE];
unsigned int data_size; unsigned int data_size;
}; };
struct i2o_evt_get struct i2o_evt_get {
{
struct i2o_evt_info info; struct i2o_evt_info info;
int pending; int pending;
int lost; int lost;
}; };
/************************************************************************** /**************************************************************************
* HRT related constants and structures * HRT related constants and structures
**************************************************************************/ **************************************************************************/
...@@ -142,139 +132,127 @@ typedef unsigned char u8; ...@@ -142,139 +132,127 @@ typedef unsigned char u8;
typedef unsigned short u16; typedef unsigned short u16;
typedef unsigned int u32; typedef unsigned int u32;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
typedef struct _i2o_pci_bus typedef struct _i2o_pci_bus {
{ u8 PciFunctionNumber;
u8 PciFunctionNumber; u8 PciDeviceNumber;
u8 PciDeviceNumber; u8 PciBusNumber;
u8 PciBusNumber; u8 reserved;
u8 reserved; u16 PciVendorID;
u16 PciVendorID; u16 PciDeviceID;
u16 PciDeviceID;
} i2o_pci_bus; } i2o_pci_bus;
typedef struct _i2o_local_bus typedef struct _i2o_local_bus {
{ u16 LbBaseIOPort;
u16 LbBaseIOPort; u16 reserved;
u16 reserved; u32 LbBaseMemoryAddress;
u32 LbBaseMemoryAddress;
} i2o_local_bus; } i2o_local_bus;
typedef struct _i2o_isa_bus typedef struct _i2o_isa_bus {
{ u16 IsaBaseIOPort;
u16 IsaBaseIOPort; u8 CSN;
u8 CSN; u8 reserved;
u8 reserved; u32 IsaBaseMemoryAddress;
u32 IsaBaseMemoryAddress;
} i2o_isa_bus; } i2o_isa_bus;
typedef struct _i2o_eisa_bus_info typedef struct _i2o_eisa_bus_info {
{ u16 EisaBaseIOPort;
u16 EisaBaseIOPort; u8 reserved;
u8 reserved; u8 EisaSlotNumber;
u8 EisaSlotNumber; u32 EisaBaseMemoryAddress;
u32 EisaBaseMemoryAddress;
} i2o_eisa_bus; } i2o_eisa_bus;
typedef struct _i2o_mca_bus typedef struct _i2o_mca_bus {
{ u16 McaBaseIOPort;
u16 McaBaseIOPort; u8 reserved;
u8 reserved; u8 McaSlotNumber;
u8 McaSlotNumber; u32 McaBaseMemoryAddress;
u32 McaBaseMemoryAddress;
} i2o_mca_bus; } i2o_mca_bus;
typedef struct _i2o_other_bus typedef struct _i2o_other_bus {
{
u16 BaseIOPort; u16 BaseIOPort;
u16 reserved; u16 reserved;
u32 BaseMemoryAddress; u32 BaseMemoryAddress;
} i2o_other_bus; } i2o_other_bus;
typedef struct _i2o_hrt_entry typedef struct _i2o_hrt_entry {
{ u32 adapter_id;
u32 adapter_id; u32 parent_tid:12;
u32 parent_tid:12; u32 state:4;
u32 state:4; u32 bus_num:8;
u32 bus_num:8; u32 bus_type:8;
u32 bus_type:8; union {
union i2o_pci_bus pci_bus;
{ i2o_local_bus local_bus;
i2o_pci_bus pci_bus; i2o_isa_bus isa_bus;
i2o_local_bus local_bus; i2o_eisa_bus eisa_bus;
i2o_isa_bus isa_bus; i2o_mca_bus mca_bus;
i2o_eisa_bus eisa_bus; i2o_other_bus other_bus;
i2o_mca_bus mca_bus;
i2o_other_bus other_bus;
} bus; } bus;
} i2o_hrt_entry; } i2o_hrt_entry;
typedef struct _i2o_hrt typedef struct _i2o_hrt {
{ u16 num_entries;
u16 num_entries; u8 entry_len;
u8 entry_len; u8 hrt_version;
u8 hrt_version; u32 change_ind;
u32 change_ind;
i2o_hrt_entry hrt_entry[1]; i2o_hrt_entry hrt_entry[1];
} i2o_hrt; } i2o_hrt;
typedef struct _i2o_lct_entry typedef struct _i2o_lct_entry {
{ u32 entry_size:16;
u32 entry_size:16; u32 tid:12;
u32 tid:12; u32 reserved:4;
u32 reserved:4; u32 change_ind;
u32 change_ind; u32 device_flags;
u32 device_flags; u32 class_id:12;
u32 class_id:12; u32 version:4;
u32 version:4; u32 vendor_id:16;
u32 vendor_id:16; u32 sub_class;
u32 sub_class; u32 user_tid:12;
u32 user_tid:12; u32 parent_tid:12;
u32 parent_tid:12; u32 bios_info:8;
u32 bios_info:8; u8 identity_tag[8];
u8 identity_tag[8]; u32 event_capabilities;
u32 event_capabilities;
} i2o_lct_entry; } i2o_lct_entry;
typedef struct _i2o_lct typedef struct _i2o_lct {
{ u32 table_size:16;
u32 table_size:16; u32 boot_tid:12;
u32 boot_tid:12; u32 lct_ver:4;
u32 lct_ver:4; u32 iop_flags;
u32 iop_flags; u32 change_ind;
u32 change_ind;
i2o_lct_entry lct_entry[1]; i2o_lct_entry lct_entry[1];
} i2o_lct; } i2o_lct;
typedef struct _i2o_status_block typedef struct _i2o_status_block {
{ u16 org_id;
u16 org_id; u16 reserved;
u16 reserved; u16 iop_id:12;
u16 iop_id:12; u16 reserved1:4;
u16 reserved1:4; u16 host_unit_id;
u16 host_unit_id; u16 segment_number:12;
u16 segment_number:12; u16 i2o_version:4;
u16 i2o_version:4; u8 iop_state;
u8 iop_state; u8 msg_type;
u8 msg_type; u16 inbound_frame_size;
u16 inbound_frame_size; u8 init_code;
u8 init_code; u8 reserved2;
u8 reserved2; u32 max_inbound_frames;
u32 max_inbound_frames; u32 cur_inbound_frames;
u32 cur_inbound_frames; u32 max_outbound_frames;
u32 max_outbound_frames; char product_id[24];
char product_id[24]; u32 expected_lct_size;
u32 expected_lct_size; u32 iop_capabilities;
u32 iop_capabilities; u32 desired_mem_size;
u32 desired_mem_size; u32 current_mem_size;
u32 current_mem_size; u32 current_mem_base;
u32 current_mem_base; u32 desired_io_size;
u32 desired_io_size; u32 current_io_size;
u32 current_io_size; u32 current_io_base;
u32 current_io_base; u32 reserved3:24;
u32 reserved3:24; u32 cmd_status:8;
u32 cmd_status:8;
} i2o_status_block; } i2o_status_block;
/* Event indicator mask flags */ /* Event indicator mask flags */
...@@ -421,4 +399,4 @@ typedef struct _i2o_status_block ...@@ -421,4 +399,4 @@ typedef struct _i2o_status_block
#define ADAPTER_STATE_FAILED 0x10 #define ADAPTER_STATE_FAILED 0x10
#define ADAPTER_STATE_FAULTED 0x11 #define ADAPTER_STATE_FAULTED 0x11
#endif /* _I2O_DEV_H */ #endif /* _I2O_DEV_H */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#ifndef _I2O_H #ifndef _I2O_H
#define _I2O_H #define _I2O_H
#ifdef __KERNEL__ /* This file to be included by kernel only */ #ifdef __KERNEL__ /* This file to be included by kernel only */
#include <linux/i2o-dev.h> #include <linux/i2o-dev.h>
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <asm/dma-mapping.h> #include <asm/dma-mapping.h>
/* message queue empty */ /* message queue empty */
#define I2O_QUEUE_EMPTY 0xffffffff #define I2O_QUEUE_EMPTY 0xffffffff
...@@ -42,20 +41,19 @@ enum i2o_driver_notify { ...@@ -42,20 +41,19 @@ enum i2o_driver_notify {
/* /*
* Message structures * Message structures
*/ */
struct i2o_message struct i2o_message {
{
union { union {
struct { struct {
u8 version_offset; u8 version_offset;
u8 flags; u8 flags;
u16 size; u16 size;
u32 target_tid:12; u32 target_tid:12;
u32 init_tid:12; u32 init_tid:12;
u32 function:8; u32 function:8;
u32 icntxt; /* initiator context */ u32 icntxt; /* initiator context */
u32 tcntxt; /* transaction context */ u32 tcntxt; /* transaction context */
} s; } s;
u32 head[4]; u32 head[4];
} u; } u;
/* List follows */ /* List follows */
u32 body[0]; u32 body[0];
...@@ -64,16 +62,15 @@ struct i2o_message ...@@ -64,16 +62,15 @@ struct i2o_message
/* /*
* Each I2O device entity has one of these. There is one per device. * Each I2O device entity has one of these. There is one per device.
*/ */
struct i2o_device struct i2o_device {
{ i2o_lct_entry lct_data; /* Device LCT information */
i2o_lct_entry lct_data; /* Device LCT information */
struct i2o_controller *iop; /* Controlling IOP */ struct i2o_controller *iop; /* Controlling IOP */
struct list_head list; /* node in IOP devices list */ struct list_head list; /* node in IOP devices list */
struct device device; struct device device;
struct semaphore lock; /* device lock */ struct semaphore lock; /* device lock */
struct class_device classdev; /* i2o device class */ struct class_device classdev; /* i2o device class */
}; };
...@@ -85,11 +82,11 @@ struct i2o_event { ...@@ -85,11 +82,11 @@ struct i2o_event {
struct work_struct work; struct work_struct work;
struct i2o_device *i2o_dev; /* I2O device pointer from which the struct i2o_device *i2o_dev; /* I2O device pointer from which the
event reply was initiated */ event reply was initiated */
u16 size; /* Size of data in 32-bit words */ u16 size; /* Size of data in 32-bit words */
u32 tcntxt; /* Transaction context used at u32 tcntxt; /* Transaction context used at
registration */ registration */
u32 event_indicator; /* Event indicator from reply */ u32 event_indicator; /* Event indicator from reply */
u32 data[0]; /* Event data from reply */ u32 data[0]; /* Event data from reply */
}; };
/* /*
...@@ -103,22 +100,22 @@ struct i2o_class_id { ...@@ -103,22 +100,22 @@ struct i2o_class_id {
* I2O driver structure for OSMs * I2O driver structure for OSMs
*/ */
struct i2o_driver { struct i2o_driver {
char *name; /* OSM name */ char *name; /* OSM name */
int context; /* Low 8 bits of the transaction info */ int context; /* Low 8 bits of the transaction info */
struct i2o_class_id *classes; /* I2O classes that this OSM handles */ struct i2o_class_id *classes; /* I2O classes that this OSM handles */
/* Message reply handler */ /* Message reply handler */
int (*reply)(struct i2o_controller *, u32, struct i2o_message *); int (*reply) (struct i2o_controller *, u32, struct i2o_message *);
/* Event handler */ /* Event handler */
void (*event)(struct i2o_event *); void (*event) (struct i2o_event *);
struct workqueue_struct *event_queue; /* Event queue */ struct workqueue_struct *event_queue; /* Event queue */
struct device_driver driver; struct device_driver driver;
/* notification of changes */ /* notification of changes */
void (*notify)(enum i2o_driver_notify, void *); void (*notify) (enum i2o_driver_notify, void *);
struct semaphore lock; struct semaphore lock;
}; };
...@@ -145,69 +142,66 @@ struct i2o_context_list_element { ...@@ -145,69 +142,66 @@ struct i2o_context_list_element {
/* /*
* Each I2O controller has one of these objects * Each I2O controller has one of these objects
*/ */
struct i2o_controller struct i2o_controller {
{
char name[16]; char name[16];
int unit; int unit;
int type; int type;
struct pci_dev *pdev; /* PCI device */ struct pci_dev *pdev; /* PCI device */
int short_req:1; /* use small block sizes */ int short_req:1; /* use small block sizes */
int no_quiesce:1; /* dont quiesce before reset */ int no_quiesce:1; /* dont quiesce before reset */
int raptor:1; /* split bar */ int raptor:1; /* split bar */
int promise:1; /* Promise controller */ int promise:1; /* Promise controller */
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
int mtrr_reg0; int mtrr_reg0;
int mtrr_reg1; int mtrr_reg1;
#endif #endif
struct list_head devices; /* list of I2O devices */ struct list_head devices; /* list of I2O devices */
struct notifier_block *event_notifer; /* Events */ struct notifier_block *event_notifer; /* Events */
atomic_t users; atomic_t users;
struct list_head list; /* Controller list */ struct list_head list; /* Controller list */
void *post_port; /* Inbout port address */ void *post_port; /* Inbout port address */
void *reply_port; /* Outbound port address */ void *reply_port; /* Outbound port address */
void *irq_mask; /* Interrupt register address */ void *irq_mask; /* Interrupt register address */
/* Dynamic LCT related data */ /* Dynamic LCT related data */
struct i2o_dma status; /* status of IOP */ struct i2o_dma status; /* status of IOP */
struct i2o_dma hrt; /* HW Resource Table */ struct i2o_dma hrt; /* HW Resource Table */
i2o_lct *lct; /* Logical Config Table */ i2o_lct *lct; /* Logical Config Table */
struct i2o_dma dlct; /* Temp LCT */ struct i2o_dma dlct; /* Temp LCT */
struct semaphore lct_lock; /* Lock for LCT updates */ struct semaphore lct_lock; /* Lock for LCT updates */
struct i2o_dma status_block; /* IOP status block */ struct i2o_dma status_block; /* IOP status block */
struct i2o_dma base; /* controller messaging unit */
struct i2o_dma base; /* controller messaging unit */
struct i2o_dma in_queue; /* inbound message queue Host->IOP */ struct i2o_dma in_queue; /* inbound message queue Host->IOP */
struct i2o_dma out_queue; /* outbound message queue IOP->Host */ struct i2o_dma out_queue; /* outbound message queue IOP->Host */
int battery:1; /* Has a battery backup */ int battery:1; /* Has a battery backup */
int io_alloc:1; /* An I/O resource was allocated */ int io_alloc:1; /* An I/O resource was allocated */
int mem_alloc:1; /* A memory resource was allocated */ int mem_alloc:1; /* A memory resource was allocated */
struct resource io_resource; /* I/O resource allocated to the IOP */ struct resource io_resource; /* I/O resource allocated to the IOP */
struct resource mem_resource; /* Mem resource allocated to the IOP */ struct resource mem_resource; /* Mem resource allocated to the IOP */
struct proc_dir_entry *proc_entry; /* /proc dir */ struct proc_dir_entry *proc_entry; /* /proc dir */
struct list_head bus_list; /* list of busses on IOP */
struct list_head bus_list; /* list of busses on IOP */
struct device device; struct device device;
struct i2o_device *exec; /* Executive */ struct i2o_device *exec; /* Executive */
#if BITS_PER_LONG == 64 #if BITS_PER_LONG == 64
spinlock_t context_list_lock; /* lock for context_list */ spinlock_t context_list_lock; /* lock for context_list */
atomic_t context_list_counter; /* needed for unique contexts */ atomic_t context_list_counter; /* needed for unique contexts */
struct list_head context_list; /* list of context id's struct list_head context_list; /* list of context id's
and pointers */ and pointers */
#endif #endif
spinlock_t lock; /* lock for controller spinlock_t lock; /* lock for controller
configuration */ configuration */
void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */ void *driver_data[I2O_MAX_DRIVERS]; /* storage for drivers */
}; };
...@@ -219,49 +213,47 @@ struct i2o_controller ...@@ -219,49 +213,47 @@ struct i2o_controller
* system. It is sent to all IOPs so that they can create peer2peer * system. It is sent to all IOPs so that they can create peer2peer
* connections between them. * connections between them.
*/ */
struct i2o_sys_tbl_entry struct i2o_sys_tbl_entry {
{ u16 org_id;
u16 org_id; u16 reserved1;
u16 reserved1; u32 iop_id:12;
u32 iop_id:12; u32 reserved2:20;
u32 reserved2:20; u16 seg_num:12;
u16 seg_num:12; u16 i2o_version:4;
u16 i2o_version:4; u8 iop_state;
u8 iop_state; u8 msg_type;
u8 msg_type; u16 frame_size;
u16 frame_size; u16 reserved3;
u16 reserved3; u32 last_changed;
u32 last_changed; u32 iop_capabilities;
u32 iop_capabilities; u32 inbound_low;
u32 inbound_low; u32 inbound_high;
u32 inbound_high; };
};
struct i2o_sys_tbl {
struct i2o_sys_tbl u8 num_entries;
{ u8 version;
u8 num_entries; u16 reserved1;
u8 version; u32 change_ind;
u16 reserved1; u32 reserved2;
u32 change_ind; u32 reserved3;
u32 reserved2;
u32 reserved3;
struct i2o_sys_tbl_entry iops[0]; struct i2o_sys_tbl_entry iops[0];
}; };
extern struct list_head i2o_controllers; extern struct list_head i2o_controllers;
/* Message functions */ /* Message functions */
static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message **); static inline u32 i2o_msg_get(struct i2o_controller *, struct i2o_message **);
extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message **,int); extern u32 i2o_msg_get_wait(struct i2o_controller *, struct i2o_message **,
int);
static inline void i2o_msg_post(struct i2o_controller *, u32); static inline void i2o_msg_post(struct i2o_controller *, u32);
static inline int i2o_msg_post_wait(struct i2o_controller *,u32,unsigned long); static inline int i2o_msg_post_wait(struct i2o_controller *, u32,
unsigned long);
extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long, extern int i2o_msg_post_wait_mem(struct i2o_controller *, u32, unsigned long,
struct i2o_dma *); struct i2o_dma *);
extern void i2o_msg_nop(struct i2o_controller *, u32); extern void i2o_msg_nop(struct i2o_controller *, u32);
static inline void i2o_flush_reply(struct i2o_controller *, u32); static inline void i2o_flush_reply(struct i2o_controller *, u32);
/* DMA handling functions */ /* DMA handling functions */
static inline int i2o_dma_alloc(struct device *, struct i2o_dma *, size_t, static inline int i2o_dma_alloc(struct device *, struct i2o_dma *, size_t,
unsigned int); unsigned int);
...@@ -275,7 +267,8 @@ static inline void i2o_dma_unmap(struct device *, struct i2o_dma *); ...@@ -275,7 +267,8 @@ static inline void i2o_dma_unmap(struct device *, struct i2o_dma *);
extern int i2o_status_get(struct i2o_controller *); extern int i2o_status_get(struct i2o_controller *);
extern int i2o_hrt_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); extern int i2o_event_register(struct i2o_device *, struct i2o_driver *, int,
u32);
extern struct i2o_device *i2o_iop_find_device(struct i2o_controller *, u16); extern struct i2o_device *i2o_iop_find_device(struct i2o_controller *, u16);
extern struct i2o_controller *i2o_find_iop(int); extern struct i2o_controller *i2o_find_iop(int);
...@@ -288,17 +281,17 @@ extern u32 i2o_cntxt_list_get_ptr(struct i2o_controller *, void *); ...@@ -288,17 +281,17 @@ extern u32 i2o_cntxt_list_get_ptr(struct i2o_controller *, void *);
static inline u32 i2o_ptr_low(void *ptr) static inline u32 i2o_ptr_low(void *ptr)
{ {
return (u32)(u64)ptr; return (u32) (u64) ptr;
}; };
static inline u32 i2o_ptr_high(void *ptr) static inline u32 i2o_ptr_high(void *ptr)
{ {
return (u32)((u64)ptr>>32); return (u32) ((u64) ptr >> 32);
}; };
#else #else
static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr) static inline u32 i2o_cntxt_list_add(struct i2o_controller *c, void *ptr)
{ {
return (u32)ptr; return (u32) ptr;
}; };
static inline void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context) static inline void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context)
...@@ -308,17 +301,17 @@ static inline void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context) ...@@ -308,17 +301,17 @@ static inline void *i2o_cntxt_list_get(struct i2o_controller *c, u32 context)
static inline u32 i2o_cntxt_list_remove(struct i2o_controller *c, void *ptr) static inline u32 i2o_cntxt_list_remove(struct i2o_controller *c, void *ptr)
{ {
return (u32)ptr; return (u32) ptr;
}; };
static inline u32 i2o_cntxt_list_get_ptr(struct i2o_controller *c, void *ptr) static inline u32 i2o_cntxt_list_get_ptr(struct i2o_controller *c, void *ptr)
{ {
return (u32)ptr; return (u32) ptr;
}; };
static inline u32 i2o_ptr_low(void *ptr) static inline u32 i2o_ptr_low(void *ptr)
{ {
return (u32)ptr; return (u32) ptr;
}; };
static inline u32 i2o_ptr_high(void *ptr) static inline u32 i2o_ptr_high(void *ptr)
...@@ -337,9 +330,10 @@ extern void i2o_driver_unregister(struct i2o_driver *); ...@@ -337,9 +330,10 @@ extern void i2o_driver_unregister(struct i2o_driver *);
* Send notifications to a single registered driver. * Send notifications to a single registered driver.
*/ */
static inline void i2o_driver_notify(struct i2o_driver *drv, static inline void i2o_driver_notify(struct i2o_driver *drv,
enum i2o_driver_notify notify, void *data) { enum i2o_driver_notify notify, void *data)
if(drv->notify) {
drv->notify(notify, data); if (drv->notify)
drv->notify(notify, data);
} }
extern void i2o_driver_notify_all(enum i2o_driver_notify, void *); extern void i2o_driver_notify_all(enum i2o_driver_notify, void *);
...@@ -356,7 +350,6 @@ extern int i2o_exec_lct_notify(struct i2o_controller *, u32); ...@@ -356,7 +350,6 @@ extern int i2o_exec_lct_notify(struct i2o_controller *, u32);
#define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver) #define to_i2o_driver(drv) container_of(drv,struct i2o_driver, driver)
#define to_i2o_device(dev) container_of(dev, struct i2o_device, device) #define to_i2o_device(dev) container_of(dev, struct i2o_device, device)
/* /*
* Messenger inlines * Messenger inlines
*/ */
...@@ -372,7 +365,6 @@ static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val) ...@@ -372,7 +365,6 @@ static inline void I2O_POST_WRITE32(struct i2o_controller *c, u32 val)
writel(val, c->post_port); writel(val, c->post_port);
}; };
static inline u32 I2O_REPLY_READ32(struct i2o_controller *c) static inline u32 I2O_REPLY_READ32(struct i2o_controller *c)
{ {
rmb(); rmb();
...@@ -385,7 +377,6 @@ static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val) ...@@ -385,7 +377,6 @@ static inline void I2O_REPLY_WRITE32(struct i2o_controller *c, u32 val)
writel(val, c->reply_port); writel(val, c->reply_port);
}; };
static inline u32 I2O_IRQ_READ32(struct i2o_controller *c) static inline u32 I2O_IRQ_READ32(struct i2o_controller *c)
{ {
rmb(); rmb();
...@@ -412,11 +403,12 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val) ...@@ -412,11 +403,12 @@ static inline void I2O_IRQ_WRITE32(struct i2o_controller *c, u32 val)
* address from the read port (see the i2o spec). If no message is * address from the read port (see the i2o spec). If no message is
* available returns I2O_QUEUE_EMPTY and msg is leaved untouched. * available returns I2O_QUEUE_EMPTY and msg is leaved untouched.
*/ */
static inline u32 i2o_msg_get(struct i2o_controller *c,struct i2o_message **msg) static inline u32 i2o_msg_get(struct i2o_controller *c,
struct i2o_message **msg)
{ {
u32 m; u32 m;
if((m=I2O_POST_READ32(c))!=I2O_QUEUE_EMPTY) if ((m = I2O_POST_READ32(c)) != I2O_QUEUE_EMPTY)
*msg = c->in_queue.virt + m; *msg = c->in_queue.virt + m;
return m; return m;
...@@ -483,7 +475,7 @@ static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, ...@@ -483,7 +475,7 @@ static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
size_t len, unsigned int gfp_mask) size_t len, unsigned int gfp_mask)
{ {
addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
if(!addr->virt) if (!addr->virt)
return -ENOMEM; return -ENOMEM;
memset(addr->virt, 0, len); memset(addr->virt, 0, len);
...@@ -501,9 +493,10 @@ static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, ...@@ -501,9 +493,10 @@ static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
*/ */
static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
{ {
if(addr->virt) { if (addr->virt) {
if(addr->phys) if (addr->phys)
dma_free_coherent(dev, addr->len,addr->virt,addr->phys); dma_free_coherent(dev, addr->len, addr->virt,
addr->phys);
else else
kfree(addr->virt); kfree(addr->virt);
addr->virt = NULL; addr->virt = NULL;
...@@ -522,14 +515,14 @@ static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr) ...@@ -522,14 +515,14 @@ static inline void i2o_dma_free(struct device *dev, struct i2o_dma *addr)
*/ */
static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr) static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr)
{ {
if(!addr->virt) if (!addr->virt)
return -EFAULT; return -EFAULT;
if(!addr->phys) if (!addr->phys)
addr->phys = dma_map_single(dev, addr->virt, addr->len, addr->phys = dma_map_single(dev, addr->virt, addr->len,
DMA_BIDIRECTIONAL); DMA_BIDIRECTIONAL);
if(!addr->phys) if (!addr->phys)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
}; };
...@@ -543,16 +536,15 @@ static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr) ...@@ -543,16 +536,15 @@ static inline int i2o_dma_map(struct device *dev, struct i2o_dma *addr)
*/ */
static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr) static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr)
{ {
if(!addr->virt) if (!addr->virt)
return; return;
if(addr->phys) { if (addr->phys) {
dma_unmap_single(dev, addr->phys, addr->len, DMA_BIDIRECTIONAL); dma_unmap_single(dev, addr->phys, addr->len, DMA_BIDIRECTIONAL);
addr->phys = 0; addr->phys = 0;
} }
}; };
/* /*
* Endian handling wrapped into the macro - keeps the core code * Endian handling wrapped into the macro - keeps the core code
* cleaner. * cleaner.
...@@ -560,7 +552,6 @@ static inline void i2o_dma_unmap(struct device *dev, struct i2o_dma *addr) ...@@ -560,7 +552,6 @@ 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) #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_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_field_set(struct i2o_device *, int, int, void *, int);
extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int, extern int i2o_parm_table_get(struct i2o_device *, int, int, int, void *, int,
...@@ -575,19 +566,16 @@ extern int i2o_issue_params(int, struct i2o_controller *, int, void *, int, ...@@ -575,19 +566,16 @@ extern int i2o_issue_params(int, struct i2o_controller *, int, void *, int,
void *, int); void *, int);
*/ */
/* debugging functions */ /* debugging functions */
extern void i2o_report_status(const char *, const char *, struct i2o_message *); extern void i2o_report_status(const char *, const char *, struct i2o_message *);
extern void i2o_dump_message(struct i2o_message *); extern void i2o_dump_message(struct i2o_message *);
extern void i2o_dump_hrt(struct i2o_controller *c); extern void i2o_dump_hrt(struct i2o_controller *c);
extern void i2o_debug_state(struct i2o_controller *c); extern void i2o_debug_state(struct i2o_controller *c);
/* /*
* Cache strategies * Cache strategies
*/ */
/* The NULL strategy leaves everything up to the controller. This tends to be a /* The NULL strategy leaves everything up to the controller. This tends to be a
* pessimal but functional choice. * pessimal but functional choice.
*/ */
...@@ -628,13 +616,11 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -628,13 +616,11 @@ extern void i2o_debug_state(struct i2o_controller *c);
* Ioctl structures * Ioctl structures
*/ */
#define BLKI2OGRSTRAT _IOR('2', 1, int) #define BLKI2OGRSTRAT _IOR('2', 1, int)
#define BLKI2OGWSTRAT _IOR('2', 2, int) #define BLKI2OGWSTRAT _IOR('2', 2, int)
#define BLKI2OSRSTRAT _IOW('2', 3, int) #define BLKI2OSRSTRAT _IOW('2', 3, int)
#define BLKI2OSWSTRAT _IOW('2', 4, int) #define BLKI2OSWSTRAT _IOW('2', 4, int)
/* /*
* I2O Function codes * I2O Function codes
*/ */
...@@ -871,7 +857,6 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -871,7 +857,6 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define TRL_SINGLE_VARIABLE_LENGTH 0x40 #define TRL_SINGLE_VARIABLE_LENGTH 0x40
#define TRL_MULTIPLE_FIXED_LENGTH 0x80 #define TRL_MULTIPLE_FIXED_LENGTH 0x80
/* msg header defines for MsgFlags */ /* msg header defines for MsgFlags */
#define MSG_STATIC 0x0100 #define MSG_STATIC 0x0100
#define MSG_64BIT_CNTXT 0x0200 #define MSG_64BIT_CNTXT 0x0200
...@@ -892,7 +877,6 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -892,7 +877,6 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define ELEVEN_WORD_MSG_SIZE 0x000B0000 #define ELEVEN_WORD_MSG_SIZE 0x000B0000
#define I2O_MESSAGE_SIZE(x) ((x)<<16) #define I2O_MESSAGE_SIZE(x) ((x)<<16)
/* Special TID Assignments */ /* Special TID Assignments */
#define ADAPTER_TID 0 #define ADAPTER_TID 0
...@@ -930,5 +914,5 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -930,5 +914,5 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define I2O_REQ_MEMPOOL_SIZE 32 #define I2O_REQ_MEMPOOL_SIZE 32
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _I2O_H */ #endif /* _I2O_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment