1#ifndef _VME_BRIDGE_H_
2#define _VME_BRIDGE_H_
3
4#define VME_CRCSR_BUF_SIZE (508*1024)
5
6
7
8struct vme_master_resource {
9 struct list_head list;
10 struct vme_bridge *parent;
11
12
13
14
15 spinlock_t lock;
16 int locked;
17 int number;
18 u32 address_attr;
19 u32 cycle_attr;
20 u32 width_attr;
21 struct resource bus_resource;
22 void __iomem *kern_base;
23};
24
25struct vme_slave_resource {
26 struct list_head list;
27 struct vme_bridge *parent;
28 struct mutex mtx;
29 int locked;
30 int number;
31 u32 address_attr;
32 u32 cycle_attr;
33};
34
35struct vme_dma_pattern {
36 u32 pattern;
37 u32 type;
38};
39
40struct vme_dma_pci {
41 dma_addr_t address;
42};
43
44struct vme_dma_vme {
45 unsigned long long address;
46 u32 aspace;
47 u32 cycle;
48 u32 dwidth;
49};
50
51struct vme_dma_list {
52 struct list_head list;
53 struct vme_dma_resource *parent;
54 struct list_head entries;
55 struct mutex mtx;
56};
57
58struct vme_dma_resource {
59 struct list_head list;
60 struct vme_bridge *parent;
61 struct mutex mtx;
62 int locked;
63 int number;
64 struct list_head pending;
65 struct list_head running;
66 u32 route_attr;
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
101struct vme_bridge {
102 char name[VMENAMSIZ];
103 int num;
104 struct list_head master_resources;
105 struct list_head slave_resources;
106 struct list_head dma_resources;
107 struct list_head lm_resources;
108
109 struct list_head vme_errors;
110 struct list_head devices;
111
112
113 struct device *parent;
114 void *driver_priv;
115 struct list_head bus_list;
116
117
118 struct vme_irq irq[7];
119
120 struct mutex irq_mtx;
121
122
123 int (*slave_get) (struct vme_slave_resource *, int *,
124 unsigned long long *, unsigned long long *, dma_addr_t *,
125 u32 *, u32 *);
126 int (*slave_set) (struct vme_slave_resource *, int, unsigned long long,
127 unsigned long long, dma_addr_t, u32, u32);
128
129
130 int (*master_get) (struct vme_master_resource *, int *,
131 unsigned long long *, unsigned long long *, u32 *, u32 *,
132 u32 *);
133 int (*master_set) (struct vme_master_resource *, int,
134 unsigned long long, unsigned long long, u32, u32, u32);
135 ssize_t (*master_read) (struct vme_master_resource *, void *, size_t,
136 loff_t);
137 ssize_t (*master_write) (struct vme_master_resource *, void *, size_t,
138 loff_t);
139 unsigned int (*master_rmw) (struct vme_master_resource *, unsigned int,
140 unsigned int, unsigned int, loff_t);
141
142
143 int (*dma_list_add) (struct vme_dma_list *, struct vme_dma_attr *,
144 struct vme_dma_attr *, size_t);
145 int (*dma_list_exec) (struct vme_dma_list *);
146 int (*dma_list_empty) (struct vme_dma_list *);
147
148
149 void (*irq_set) (struct vme_bridge *, int, int, int);
150 int (*irq_generate) (struct vme_bridge *, int, int);
151
152
153 int (*lm_set) (struct vme_lm_resource *, unsigned long long, u32, u32);
154 int (*lm_get) (struct vme_lm_resource *, unsigned long long *, u32 *,
155 u32 *);
156 int (*lm_attach) (struct vme_lm_resource *, int, void (*callback)(int));
157 int (*lm_detach) (struct vme_lm_resource *, int);
158
159
160 int (*slot_get) (struct vme_bridge *);
161
162
163 void *(*alloc_consistent)(struct device *dev, size_t size,
164 dma_addr_t *dma);
165 void (*free_consistent)(struct device *dev, size_t size,
166 void *vaddr, dma_addr_t dma);
167};
168
169void vme_irq_handler(struct vme_bridge *, int, int);
170
171int vme_register_bridge(struct vme_bridge *);
172void vme_unregister_bridge(struct vme_bridge *);
173
174#endif
175