1#ifndef _VME_BRIDGE_H_
2#define _VME_BRIDGE_H_
3
4#define VME_CRCSR_BUF_SIZE (508*1024)
5#define VME_SLOTS_MAX 32
6
7
8
9struct vme_master_resource {
10 struct list_head list;
11 struct vme_bridge *parent;
12
13
14
15
16 spinlock_t lock;
17 int locked;
18 int number;
19 vme_address_t address_attr;
20 vme_cycle_t cycle_attr;
21 vme_width_t width_attr;
22 struct resource pci_resource;
23 void *kern_base;
24};
25
26struct vme_slave_resource {
27 struct list_head list;
28 struct vme_bridge *parent;
29 struct mutex mtx;
30 int locked;
31 int number;
32 vme_address_t address_attr;
33 vme_cycle_t cycle_attr;
34};
35
36struct vme_dma_pattern {
37 u32 pattern;
38 vme_pattern_t type;
39};
40
41struct vme_dma_pci {
42 dma_addr_t address;
43};
44
45struct vme_dma_vme {
46 unsigned long long address;
47 vme_address_t aspace;
48 vme_cycle_t cycle;
49 vme_width_t dwidth;
50};
51
52struct vme_dma_list {
53 struct list_head list;
54 struct vme_dma_resource *parent;
55 struct list_head entries;
56 struct mutex mtx;
57};
58
59struct vme_dma_resource {
60 struct list_head list;
61 struct vme_bridge *parent;
62 struct mutex mtx;
63 int locked;
64 int number;
65 struct list_head pending;
66 struct list_head running;
67};
68
69struct vme_lm_resource {
70 struct list_head list;
71 struct vme_bridge *parent;
72 struct mutex mtx;
73 int locked;
74 int number;
75 int monitors;
76};
77
78struct vme_bus_error {
79 struct list_head list;
80 unsigned long long address;
81 u32 attributes;
82};
83
84struct vme_callback {
85 void (*func)(int, int, void*);
86 void *priv_data;
87};
88
89struct vme_irq {
90 int count;
91 struct vme_callback callback[255];
92};
93
94
95#define VMENAMSIZ 16
96
97
98
99
100
101
102
103struct vme_bridge {
104 char name[VMENAMSIZ];
105 int num;
106 struct list_head master_resources;
107 struct list_head slave_resources;
108 struct list_head dma_resources;
109 struct list_head lm_resources;
110
111 struct list_head vme_errors;
112
113
114 struct device *parent;
115 void * base;
116
117 struct device dev[VME_SLOTS_MAX];
118
119
120
121
122 struct vme_irq irq[7];
123
124
125 int (*slave_get) (struct vme_slave_resource *, int *,
126 unsigned long long *, unsigned long long *, dma_addr_t *,
127 vme_address_t *, vme_cycle_t *);
128 int (*slave_set) (struct vme_slave_resource *, int, unsigned long long,
129 unsigned long long, dma_addr_t, vme_address_t, vme_cycle_t);
130
131
132 int (*master_get) (struct vme_master_resource *, int *,
133 unsigned long long *, unsigned long long *, vme_address_t *,
134 vme_cycle_t *, vme_width_t *);
135 int (*master_set) (struct vme_master_resource *, int,
136 unsigned long long, unsigned long long, vme_address_t,
137 vme_cycle_t, vme_width_t);
138 ssize_t (*master_read) (struct vme_master_resource *, void *, size_t,
139 loff_t);
140 ssize_t (*master_write) (struct vme_master_resource *, void *, size_t,
141 loff_t);
142 unsigned int (*master_rmw) (struct vme_master_resource *, unsigned int,
143 unsigned int, unsigned int, loff_t);
144
145
146 int (*dma_list_add) (struct vme_dma_list *, struct vme_dma_attr *,
147 struct vme_dma_attr *, size_t);
148 int (*dma_list_exec) (struct vme_dma_list *);
149 int (*dma_list_empty) (struct vme_dma_list *);
150
151
152 int (*request_irq) (int, int, void (*cback)(int, int, void*), void *);
153 void (*free_irq) (int, int);
154 int (*generate_irq) (int, int);
155
156
157 int (*lm_set) (struct vme_lm_resource *, unsigned long long,
158 vme_address_t, vme_cycle_t);
159 int (*lm_get) (struct vme_lm_resource *, unsigned long long *,
160 vme_address_t *, vme_cycle_t *);
161 int (*lm_attach) (struct vme_lm_resource *, int, void (*callback)(int));
162 int (*lm_detach) (struct vme_lm_resource *, int);
163
164
165 int (*slot_get) (void);
166
167
168#if 0
169 int (*set_prefetch) (void);
170 int (*get_prefetch) (void);
171 int (*set_arbiter) (void);
172 int (*get_arbiter) (void);
173 int (*set_requestor) (void);
174 int (*get_requestor) (void);
175#endif
176};
177
178int vme_register_bridge (struct vme_bridge *);
179void vme_unregister_bridge (struct vme_bridge *);
180
181#endif
182
183#if 0
184
185
186
187struct vmeInfoCfg {
188 int vmeSlotNum;
189 int boardResponded;
190 char sysConFlag;
191 int vmeControllerID;
192 int vmeControllerRev;
193 char osName[8];
194 int vmeSharedDataValid;
195 int vmeDriverRev;
196 unsigned int vmeAddrHi[8];
197 unsigned int vmeAddrLo[8];
198 unsigned int vmeSize[8];
199 unsigned int vmeAm[8];
200 int reserved;
201};
202typedef struct vmeInfoCfg vmeInfoCfg_t;
203
204
205
206
207struct vmeRequesterCfg {
208 int requestLevel;
209 char fairMode;
210 int releaseMode;
211 int timeonTimeoutTimer;
212 int timeoffTimeoutTimer;
213 int reserved;
214};
215typedef struct vmeRequesterCfg vmeRequesterCfg_t;
216
217
218
219
220struct vmeArbiterCfg {
221 vme_arbitration_t arbiterMode;
222 char arbiterTimeoutFlag;
223 int globalTimeoutTimer;
224 char noEarlyReleaseFlag;
225 int reserved;
226};
227typedef struct vmeArbiterCfg vmeArbiterCfg_t;
228
229
230
231
232
233struct vmeRmwCfg {
234 unsigned int targetAddrU;
235 unsigned int targetAddr;
236 vme_address_t addrSpace;
237 int enableMask;
238 int compareData;
239 int swapData;
240 int maxAttempts;
241 int numAttempts;
242 int reserved;
243
244};
245typedef struct vmeRmwCfg vmeRmwCfg_t;
246
247
248
249
250struct vmeLmCfg {
251 unsigned int addrU;
252 unsigned int addr;
253 vme_address_t addrSpace;
254 int userAccessType;
255 int dataAccessType;
256 int lmWait;
257 int lmEvents;
258 int reserved;
259};
260typedef struct vmeLmCfg vmeLmCfg_t;
261#endif
262