4 #define VME_CRCSR_BUF_SIZE (508*1024)
5 #define VME_SLOTS_MAX 32
9 struct vme_master_resource {
10 struct list_head list;
11 struct vme_bridge *parent;
13 * We are likely to need to access the VME bus in interrupt context, so
14 * protect master routines with a spinlock rather than a mutex.
19 vme_address_t address_attr;
20 vme_cycle_t cycle_attr;
21 vme_width_t width_attr;
22 struct resource bus_resource;
26 struct vme_slave_resource {
27 struct list_head list;
28 struct vme_bridge *parent;
32 vme_address_t address_attr;
33 vme_cycle_t cycle_attr;
36 struct vme_dma_pattern {
46 unsigned long long address;
53 struct list_head list;
54 struct vme_dma_resource *parent;
55 struct list_head entries;
59 struct vme_dma_resource {
60 struct list_head list;
61 struct vme_bridge *parent;
65 struct list_head pending;
66 struct list_head running;
67 vme_dma_route_t route_attr;
70 struct vme_lm_resource {
71 struct list_head list;
72 struct vme_bridge *parent;
79 struct vme_bus_error {
80 struct list_head list;
81 unsigned long long address;
86 void (*func)(int, int, void*);
92 struct vme_callback callback[255];
95 /* Allow 16 characters for name (including null character) */
98 /* This structure stores all the information about one bridge
99 * The structure should be dynamically allocated by the driver and one instance
100 * of the structure should be present for each VME chip present in the system.
102 * Currently we assume that all chips are PCI-based
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 struct list_head vme_errors; /* List for errors generated on VME */
114 /* Bridge Info - XXX Move to private structure? */
115 struct device *parent; /* Generic device struct (pdev->dev for PCI) */
116 void *driver_priv; /* Private pointer for the bridge driver */
118 struct device dev[VME_SLOTS_MAX]; /* Device registered with
119 * device model on VME bus
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 *,
130 vme_address_t *, vme_cycle_t *);
131 int (*slave_set) (struct vme_slave_resource *, int, unsigned long long,
132 unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t);
134 /* Master Functions */
135 int (*master_get) (struct vme_master_resource *, int *,
136 unsigned long long *, unsigned long long *, vme_address_t *,
137 vme_cycle_t *, vme_width_t *);
138 int (*master_set) (struct vme_master_resource *, int,
139 unsigned long long, unsigned long long, vme_address_t,
140 vme_cycle_t, vme_width_t);
141 ssize_t (*master_read) (struct vme_master_resource *, void *, size_t,
143 ssize_t (*master_write) (struct vme_master_resource *, void *, size_t,
145 unsigned int (*master_rmw) (struct vme_master_resource *, unsigned int,
146 unsigned int, unsigned int, loff_t);
149 int (*dma_list_add) (struct vme_dma_list *, struct vme_dma_attr *,
150 struct vme_dma_attr *, size_t);
151 int (*dma_list_exec) (struct vme_dma_list *);
152 int (*dma_list_empty) (struct vme_dma_list *);
154 /* Interrupt Functions */
155 void (*irq_set) (struct vme_bridge *, int, int, int);
156 int (*irq_generate) (struct vme_bridge *, int, int);
158 /* Location monitor functions */
159 int (*lm_set) (struct vme_lm_resource *, unsigned long long,
160 vme_address_t, vme_cycle_t);
161 int (*lm_get) (struct vme_lm_resource *, unsigned long long *,
162 vme_address_t *, vme_cycle_t *);
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 *);
170 void vme_irq_handler(struct vme_bridge *, int, int);
172 int vme_register_bridge(struct vme_bridge *);
173 void vme_unregister_bridge(struct vme_bridge *);
175 #endif /* _VME_BRIDGE_H_ */