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 pci_resource
; /* XXX Rename to be bus agnostic */
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
;
69 struct vme_lm_resource
{
70 struct list_head list
;
71 struct vme_bridge
*parent
;
78 struct vme_bus_error
{
79 struct list_head list
;
80 unsigned long long address
;
85 void (*func
)(int, int, void*);
91 struct vme_callback callback
[255];
94 /* Allow 16 characters for name (including null character) */
97 /* This structure stores all the information about one bridge
98 * The structure should be dynamically allocated by the driver and one instance
99 * of the structure should be present for each VME chip present in the system.
101 * Currently we assume that all chips are PCI-based
104 char name
[VMENAMSIZ
];
106 struct list_head master_resources
;
107 struct list_head slave_resources
;
108 struct list_head dma_resources
;
109 struct list_head lm_resources
;
111 struct list_head vme_errors
; /* List for errors generated on VME */
113 /* Bridge Info - XXX Move to private structure? */
114 struct device
*parent
; /* Generic device struct (pdev->dev for PCI) */
115 void * base
; /* Base Address of device registers */
117 struct device dev
[VME_SLOTS_MAX
]; /* Device registered with
118 * device model on VME bus
121 /* Interrupt callbacks */
122 struct vme_irq irq
[7];
124 /* Slave Functions */
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
);
131 /* Master Functions */
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,
140 ssize_t (*master_write
) (struct vme_master_resource
*, void *, size_t,
142 unsigned int (*master_rmw
) (struct vme_master_resource
*, unsigned int,
143 unsigned int, unsigned int, loff_t
);
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
*);
151 /* Interrupt Functions */
152 int (*request_irq
) (int, int, void (*cback
)(int, int, void*), void *);
153 void (*free_irq
) (int, int);
154 int (*generate_irq
) (int, int);
156 /* Location monitor functions */
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);
164 /* CR/CSR space functions */
165 int (*slot_get
) (void);
166 /* Use standard master read and write functions to access CR/CSR */
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);
178 int vme_register_bridge (struct vme_bridge
*);
179 void vme_unregister_bridge (struct vme_bridge
*);
181 #endif /* _VME_BRIDGE_H_ */
185 * VMEbus GET INFO Arg Structure
188 int vmeSlotNum
; /* VME slot number of interest */
189 int boardResponded
; /* Board responded */
190 char sysConFlag
; /* System controller flag */
191 int vmeControllerID
; /* Vendor/device ID of VME bridge */
192 int vmeControllerRev
; /* Revision of VME bridge */
193 char osName
[8]; /* Name of OS e.g. "Linux" */
194 int vmeSharedDataValid
; /* Validity of data struct */
195 int vmeDriverRev
; /* Revision of VME driver */
196 unsigned int vmeAddrHi
[8]; /* Address on VME bus */
197 unsigned int vmeAddrLo
[8]; /* Address on VME bus */
198 unsigned int vmeSize
[8]; /* Size on VME bus */
199 unsigned int vmeAm
[8]; /* Address modifier on VME bus */
200 int reserved
; /* For future use */
202 typedef struct vmeInfoCfg vmeInfoCfg_t
;
205 * VMEbus Requester Arg Structure
207 struct vmeRequesterCfg
{
208 int requestLevel
; /* Requester Bus Request Level */
209 char fairMode
; /* Requester Fairness Mode Indicator */
210 int releaseMode
; /* Requester Bus Release Mode */
211 int timeonTimeoutTimer
; /* Master Time-on Time-out Timer */
212 int timeoffTimeoutTimer
; /* Master Time-off Time-out Timer */
213 int reserved
; /* For future use */
215 typedef struct vmeRequesterCfg vmeRequesterCfg_t
;
218 * VMEbus Arbiter Arg Structure
220 struct vmeArbiterCfg
{
221 vme_arbitration_t arbiterMode
; /* Arbitration Scheduling Algorithm */
222 char arbiterTimeoutFlag
; /* Arbiter Time-out Timer Indicator */
223 int globalTimeoutTimer
; /* VMEbus Global Time-out Timer */
224 char noEarlyReleaseFlag
; /* No Early Release on BBUSY */
225 int reserved
; /* For future use */
227 typedef struct vmeArbiterCfg vmeArbiterCfg_t
;
231 * VMEbus RMW Configuration Data
234 unsigned int targetAddrU
; /* VME Address (Upper) to trigger RMW cycle */
235 unsigned int targetAddr
; /* VME Address (Lower) to trigger RMW cycle */
236 vme_address_t addrSpace
; /* VME Address Space */
237 int enableMask
; /* Bit mask defining the bits of interest */
238 int compareData
; /* Data to be compared with the data read */
239 int swapData
; /* Data written to the VMEbus on success */
240 int maxAttempts
; /* Maximum times to try */
241 int numAttempts
; /* Number of attempts before success */
242 int reserved
; /* For future use */
245 typedef struct vmeRmwCfg vmeRmwCfg_t
;
248 * VMEbus Location Monitor Arg Structure
251 unsigned int addrU
; /* Location Monitor Address upper */
252 unsigned int addr
; /* Location Monitor Address lower */
253 vme_address_t addrSpace
; /* Address Space */
254 int userAccessType
; /* User/Supervisor Access Type */
255 int dataAccessType
; /* Data/Program Access Type */
256 int lmWait
; /* Time to wait for access */
257 int lmEvents
; /* Lm event mask */
258 int reserved
; /* For future use */
260 typedef struct vmeLmCfg vmeLmCfg_t
;