vmod/vmodttl: fixed bug related to luns not ordered and/or not starting from zero.
[ht-drivers.git] / vmebridge / driver / vme_bridge.h
blob7b24860cdd6f6fe6ec5215e693611e1201bbf4f8
1 /*
2 * vme_bridge.h - PCI-VME bridge driver definitions
4 * Copyright (c) 2009 Sebastien Dugue
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
14 * This file provides the data structures and definitions internal to the
15 * driver.
18 #ifndef _VME_BRIDGE_H
19 #define _VME_BRIDGE_H
21 #include <linux/device.h>
22 #include <linux/pci.h>
23 #include <linux/interrupt.h>
25 #include "tsi148.h"
26 #include "vmebus.h"
28 #define PFX "VME Bridge: "
29 #define DRV_MODULE_NAME "vmebus"
30 #define DRV_MODULE_VERSION "1.4"
31 #define DRV_MODULE_RELDATE "May, 19 2010"
34 * We just keep the last VME error caught, protecting it with a spinlock.
35 * A new VME bus error overwrites it.
36 * This is very simple yet good enough for most (sane) purposes.
37 * A linked list of handlers is kept for async notification of bus errors.
39 struct vme_verr {
40 spinlock_t lock;
41 struct vme_bus_error_desc desc;
42 struct list_head h_list;
45 struct vme_bridge_device {
46 int rev; /* chip revision */
47 int irq; /* chip interrupt */
48 int slot; /* the VME slot we're in */
49 int syscon; /* syscon status */
50 struct tsi148_chip *regs;
51 struct pci_dev *pdev;
52 struct vme_verr verr;
55 /**
56 * struct vme_berr_handler - VME bus error handler descriptor
57 * @h_list: handler's list entry
58 * @offset: VME Bus error descriptor (Initial address + Address Modifier)
59 * @size: Size of the VME address range of interest
60 * @func: Handler function
62 struct vme_berr_handler {
63 struct list_head h_list;
64 struct vme_bus_error error;
65 size_t size;
66 vme_berr_handler_t func;
69 extern struct vme_bridge_device *vme_bridge;
70 extern struct resource *vmepcimem;
71 extern void *crg_base;
72 extern unsigned int vme_report_bus_errors;
74 /* Use the standard VME Major */
75 #define VME_MAJOR 221
78 * Define our own minor numbers
79 * If a device get added, do not forget to update devlist[] in vme_bridge.c
81 #define VME_MINOR_MWINDOW 0
82 #define VME_MINOR_DMA 1
83 #define VME_MINOR_CTL 3
84 #define VME_MINOR_REGS 4
86 #define VME_MINOR_NR VME_MINOR_LM + 1
88 /* Devices access rules */
89 #define DEV_RW 1 /* Device implements read/write */
91 struct dev_entry {
92 unsigned int minor;
93 char *name;
94 unsigned int flags;
95 struct file_operations *fops;
98 extern const struct dev_entry devlist[];
101 /* Prototypes */
103 /* vme_irq.c */
104 extern void account_dma_interrupt(int);
105 extern irqreturn_t vme_bridge_interrupt(int, void *);
106 extern int vme_enable_interrupts(unsigned int);
107 extern int vme_disable_interrupts(unsigned int);
109 /* vme_window.c */
110 extern int vme_window_release(struct inode *, struct file *);
111 extern long vme_window_ioctl(struct file *, unsigned int, unsigned long);
112 extern int vme_window_mmap(struct file *, struct vm_area_struct *);
113 extern void __devinit vme_window_init(void);
114 extern void __devexit vme_window_exit(void);
116 /* vme_dma.c */
117 extern void handle_dma_interrupt(int);
118 extern long vme_dma_ioctl(struct file *, unsigned int, unsigned long);
119 extern int __devinit vme_dma_init(void);
120 extern void __devexit vme_dma_exit(void);
122 /* vme_misc.c */
123 extern ssize_t vme_misc_read(struct file *, char *, size_t, loff_t *);
124 extern ssize_t vme_misc_write(struct file *, const char *, size_t, loff_t *);
125 extern long vme_misc_ioctl(struct file *, unsigned int, unsigned long);
126 extern int vme_bus_error_check(int clear);
127 extern int vme_bus_error_check_clear(struct vme_bus_error *);
129 /* Procfs stuff grouped here for comodity */
130 #ifdef CONFIG_PROC_FS
131 extern int vme_interrupts_proc_show(char *page, char **start, off_t off,
132 int count, int *eof, void *data);
133 extern int vme_irq_proc_show(char *page, char **start, off_t off,
134 int count, int *eof, void *data);
135 extern int vme_window_proc_show(char *page, char **start, off_t off,
136 int count, int *eof, void *data);
137 #endif /* CONFIG_PROC_FS */
140 #endif /* _VME_BRIDGE_H */