6 #define VME_CRCSR_BUF_SIZE (508*1024)
10 struct vme_master_resource {
11 struct list_head list;
12 struct vme_bridge *parent;
14 * We are likely to need to access the VME bus in interrupt context, so
15 * protect master routines with a spinlock rather than a mutex.
23 struct resource bus_resource;
24 void __iomem *kern_base;
27 struct vme_slave_resource {
28 struct list_head list;
29 struct vme_bridge *parent;
37 struct vme_dma_pattern {
47 unsigned long long address;
54 struct list_head list;
55 struct vme_dma_resource *parent;
56 struct list_head entries;
60 struct vme_dma_resource {
61 struct list_head list;
62 struct vme_bridge *parent;
66 struct list_head pending;
67 struct list_head running;
71 struct vme_lm_resource {
72 struct list_head list;
73 struct vme_bridge *parent;
80 struct vme_error_handler {
81 struct list_head list;
82 unsigned long long start; /* Beginning of error window */
83 unsigned long long end; /* End of error window */
84 unsigned long long first_error; /* Address of the first error */
85 u32 aspace; /* Address space of error window*/
86 unsigned num_errors; /* Number of errors */
90 void (*func)(int, int, void*);
96 struct vme_callback callback[VME_NUM_STATUSID];
99 /* Allow 16 characters for name (including null character) */
102 /* This structure stores all the information about one bridge
103 * The structure should be dynamically allocated by the driver and one instance
104 * of the structure should be present for each VME chip present in the system.
107 char name[VMENAMSIZ];
109 struct list_head master_resources;
110 struct list_head slave_resources;
111 struct list_head dma_resources;
112 struct list_head lm_resources;
114 /* List for registered errors handlers */
115 struct list_head vme_error_handlers;
116 /* List of devices on this bridge */
117 struct list_head devices;
119 /* Bridge Info - XXX Move to private structure? */
120 struct device *parent; /* Parent device (eg. pdev->dev for PCI) */
121 void *driver_priv; /* Private pointer for the bridge driver */
122 struct list_head bus_list; /* list of VME buses */
124 /* Interrupt callbacks */
125 struct vme_irq irq[7];
126 /* Locking for VME irq callback configuration */
127 struct mutex irq_mtx;
129 /* Slave Functions */
130 int (*slave_get) (struct vme_slave_resource *, int *,
131 unsigned long long *, unsigned long long *, dma_addr_t *,
133 int (*slave_set) (struct vme_slave_resource *, int, unsigned long long,
134 unsigned long long, dma_addr_t, u32, u32);
136 /* Master Functions */
137 int (*master_get) (struct vme_master_resource *, int *,
138 unsigned long long *, unsigned long long *, u32 *, u32 *,
140 int (*master_set) (struct vme_master_resource *, int,
141 unsigned long long, unsigned long long, u32, u32, u32);
142 ssize_t (*master_read) (struct vme_master_resource *, void *, size_t,
144 ssize_t (*master_write) (struct vme_master_resource *, void *, size_t,
146 unsigned int (*master_rmw) (struct vme_master_resource *, unsigned int,
147 unsigned int, unsigned int, loff_t);
150 int (*dma_list_add) (struct vme_dma_list *, struct vme_dma_attr *,
151 struct vme_dma_attr *, size_t);
152 int (*dma_list_exec) (struct vme_dma_list *);
153 int (*dma_list_empty) (struct vme_dma_list *);
155 /* Interrupt Functions */
156 void (*irq_set) (struct vme_bridge *, int, int, int);
157 int (*irq_generate) (struct vme_bridge *, int, int);
159 /* Location monitor functions */
160 int (*lm_set) (struct vme_lm_resource *, unsigned long long, u32, u32);
161 int (*lm_get) (struct vme_lm_resource *, unsigned long long *, u32 *,
163 int (*lm_attach) (struct vme_lm_resource *, int, void (*callback)(int));
164 int (*lm_detach) (struct vme_lm_resource *, int);
166 /* CR/CSR space functions */
167 int (*slot_get) (struct vme_bridge *);
169 /* Bridge parent interface */
170 void *(*alloc_consistent)(struct device *dev, size_t size,
172 void (*free_consistent)(struct device *dev, size_t size,
173 void *vaddr, dma_addr_t dma);
176 void vme_bus_error_handler(struct vme_bridge *bridge,
177 unsigned long long address, int am);
178 void vme_irq_handler(struct vme_bridge *, int, int);
180 struct vme_bridge *vme_init_bridge(struct vme_bridge *);
181 int vme_register_bridge(struct vme_bridge *);
182 void vme_unregister_bridge(struct vme_bridge *);
183 struct vme_error_handler *vme_register_error_handler(
184 struct vme_bridge *bridge, u32 aspace,
185 unsigned long long address, size_t len);
186 void vme_unregister_error_handler(struct vme_error_handler *handler);
188 #endif /* _VME_BRIDGE_H_ */