diff options
author | Heiko J Schick <schihei@de.ibm.com> | 2005-11-16 02:56:43 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:49:06 -0500 |
commit | d7a301033f1990188f65abf4fe8e5b90ef0e3888 (patch) | |
tree | 5df64f9e06049e6006e6a124dc6fa4953d6e42b9 /include | |
parent | 401d1f029bebb7153ca704997772113dc36d9527 (diff) |
[PATCH] powerpc: IBMEBUS bus support
This patch adds the necessary core bus support used by device drivers
that sit on the IBM GX bus on modern pSeries machines like the Galaxy
infiniband for example. It provide transparent DMA ops (the low level
driver works with virtual addresses directly) along with a simple bus
layer using the Open Firmware matching routines.
Signed-off-by: Heiko J Schick <schickhj@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-powerpc/ibmebus.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/include/asm-powerpc/ibmebus.h b/include/asm-powerpc/ibmebus.h new file mode 100644 index 000000000000..55982b8e5b98 --- /dev/null +++ b/include/asm-powerpc/ibmebus.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * IBM PowerPC eBus Infrastructure Support. | ||
3 | * | ||
4 | * Copyright (c) 2005 IBM Corporation | ||
5 | * Heiko J Schick <schickhj@de.ibm.com> | ||
6 | * | ||
7 | * All rights reserved. | ||
8 | * | ||
9 | * This source code is distributed under a dual license of GPL v2.0 and OpenIB | ||
10 | * BSD. | ||
11 | * | ||
12 | * OpenIB BSD License | ||
13 | * | ||
14 | * Redistribution and use in source and binary forms, with or without | ||
15 | * modification, are permitted provided that the following conditions are met: | ||
16 | * | ||
17 | * Redistributions of source code must retain the above copyright notice, this | ||
18 | * list of conditions and the following disclaimer. | ||
19 | * | ||
20 | * Redistributions in binary form must reproduce the above copyright notice, | ||
21 | * this list of conditions and the following disclaimer in the documentation | ||
22 | * and/or other materials | ||
23 | * provided with the distribution. | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
32 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER | ||
33 | * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
35 | * POSSIBILITY OF SUCH DAMAGE. | ||
36 | */ | ||
37 | |||
38 | #ifndef _ASM_EBUS_H | ||
39 | #define _ASM_EBUS_H | ||
40 | |||
41 | #include <linux/device.h> | ||
42 | #include <linux/interrupt.h> | ||
43 | #include <linux/mod_devicetable.h> | ||
44 | #include <asm/of_device.h> | ||
45 | |||
46 | extern struct dma_mapping_ops ibmebus_dma_ops; | ||
47 | extern struct bus_type ibmebus_bus_type; | ||
48 | |||
49 | struct ibmebus_dev { | ||
50 | char *name; | ||
51 | struct of_device ofdev; | ||
52 | }; | ||
53 | |||
54 | struct ibmebus_driver { | ||
55 | char *name; | ||
56 | struct of_device_id *id_table; | ||
57 | int (*probe) (struct ibmebus_dev *dev, const struct of_device_id *id); | ||
58 | int (*remove) (struct ibmebus_dev *dev); | ||
59 | struct device_driver driver; | ||
60 | }; | ||
61 | |||
62 | int ibmebus_register_driver(struct ibmebus_driver *drv); | ||
63 | void ibmebus_unregister_driver(struct ibmebus_driver *drv); | ||
64 | |||
65 | int ibmebus_request_irq(struct ibmebus_dev *dev, | ||
66 | u32 ist, | ||
67 | irqreturn_t (*handler)(int, void*, struct pt_regs *), | ||
68 | unsigned long irq_flags, const char * devname, | ||
69 | void *dev_id); | ||
70 | void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id); | ||
71 | |||
72 | static inline struct ibmebus_driver *to_ibmebus_driver(struct device_driver *drv) | ||
73 | { | ||
74 | return container_of(drv, struct ibmebus_driver, driver); | ||
75 | } | ||
76 | |||
77 | static inline struct ibmebus_dev *to_ibmebus_dev(struct device *dev) | ||
78 | { | ||
79 | return container_of(dev, struct ibmebus_dev, ofdev.dev); | ||
80 | } | ||
81 | |||
82 | |||
83 | #endif /* _ASM_IBMEBUS_H */ | ||