4 #define VME_CRCSR_BUF_SIZE (508*1024)
8 struct vme_master_resource {
10 struct vme_bridge *parent;
12 * We are likely to need to access the VME bus in interrupt context, so
13 * protect master routines with a spinlock rather than a mutex.
21 struct resource bus_resource;
22 void __iomem *kern_base;
25 struct vme_slave_resource {
26 struct list_head list;
27 struct vme_bridge *parent;
35 struct vme_dma_pattern {
45 unsigned long long address;
52 struct list_head list;
53 struct vme_dma_resource *parent;
54 struct list_head entries;
58 struct vme_dma_resource {
59 struct list_head list;
60 struct vme_bridge *parent;
64 struct list_head pending;
65 struct list_head running;
69 struct vme_lm_resource {
70 struct list_head list;
71 struct vme_bridge *parent;
78 struct vme_error_handler {
79 struct list_head list;
80 unsigned long long start; /* Beginning of error window */
81 unsigned long long end; /* End of error window */
82 unsigned long long first_error; /* Address of the first error */
83 u32 aspace; /* Address space of error window*/
84 unsigned num_errors; /* Number of errors */
88 void (*func)(int, int, void*);
94 struct vme_callback callback[255];
97 /* Allow 16 characters for name (including null character) */
100 /* This structure stores all the information about one bridge
101 * The structure should be dynamically allocated by the driver and one instance
102 * of the structure should be present for each VME chip present in the system.
105 char name[VMENAMSIZ];
107 struct list_head master_resources;
108 struct list_head slave_resources;
109 struct list_head dma_resources;
110 struct list_head lm_resources;
112 /* List for registered errors handlers */
113 struct list_head vme_error_handlers;
114 /* List of devices on this bridge */
115 struct list_head devices;
117 /* Bridge Info - XXX Move to private structure? */
118 struct device *parent; /* Parent device (eg. pdev->dev for PCI) */
119 void *driver_priv; /* Private pointer for the bridge driver */
120 struct list_head bus_list; /* list of VME buses */
122 /* Interrupt callbacks */
123 struct vme_irq irq[7];
124 /* Locking for VME irq callback configuration */
125 struct mutex irq_mtx;
127 /* Slave Functions */
128 int (*slave_get) (struct vme_slave_resource *, int *,
129 unsigned long long *, unsigned long long *, dma_addr_t *,
131 int (*slave_set) (struct vme_slave_resource *, int, unsigned long long,
132 unsigned long long, dma_addr_t, u32, u32);
134 /* Master Functions */
135 int (*master_get) (struct vme_master_resource *, int *,
136 unsigned long long *, unsigned long long *, u32 *, u32 *,
138 int (*master_set) (struct vme_master_resource *, int,
139 unsigned long long, unsigned long long, u32, u32, u32);
140 ssize_t (*master_read) (struct vme_master_resource *, void *, size_t,
142 ssize_t (*master_write) (struct vme_master_resource *, void *, size_t,
144 unsigned int (*master_rmw) (struct vme_master_resource *, unsigned int,
145 unsigned int, unsigned int, loff_t);
148 int (*dma_list_add) (struct vme_dma_list *, struct vme_dma_attr *,
149 struct vme_dma_attr *, size_t);
150 int (*dma_list_exec) (struct vme_dma_list *);
151 int (*dma_list_empty) (struct vme_dma_list *);
153 /* Interrupt Functions */
154 void (*irq_set) (struct vme_bridge *, int, int, int);
155 int (*irq_generate) (struct vme_bridge *, int, int);
157 /* Location monitor functions */
158 int (*lm_set) (struct vme_lm_resource *, unsigned long long, u32, u32);
159 int (*lm_get) (struct vme_lm_resource *, unsigned long long *, u32 *,
161 int (*lm_attach) (struct vme_lm_resource *, int, void (*callback)(int));
162 int (*lm_detach) (struct vme_lm_resource *, int);
164 /* CR/CSR space functions */
165 int (*slot_get) (struct vme_bridge *);
167 /* Bridge parent interface */
168 void *(*alloc_consistent)(struct device *dev, size_t size,
170 void (*free_consistent)(struct device *dev, size_t size,
171 void *vaddr, dma_addr_t dma);
174 void vme_bus_error_handler(struct vme_bridge *bridge,
175 unsigned long long address, int am);
176 void vme_irq_handler(struct vme_bridge *, int, int);
178 int vme_register_bridge(struct vme_bridge *);
179 void vme_unregister_bridge(struct vme_bridge *);
180 struct vme_error_handler *vme_register_error_handler(
181 struct vme_bridge *bridge, u32 aspace,
182 unsigned long long address, size_t len);
183 void vme_unregister_error_handler(struct vme_error_handler *handler);
185 #endif /* _VME_BRIDGE_H_ */