aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/vio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc64/vio.h')
-rw-r--r--include/asm-ppc64/vio.h91
1 files changed, 47 insertions, 44 deletions
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h
index 20cd98ee6337..03f1b95f433b 100644
--- a/include/asm-ppc64/vio.h
+++ b/include/asm-ppc64/vio.h
@@ -19,13 +19,15 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22#include <linux/mod_devicetable.h>
23
22#include <asm/hvcall.h> 24#include <asm/hvcall.h>
23#include <asm/prom.h>
24#include <asm/scatterlist.h> 25#include <asm/scatterlist.h>
25/* 26
27/*
26 * Architecture-specific constants for drivers to 28 * Architecture-specific constants for drivers to
27 * extract attributes of the device using vio_get_attribute() 29 * extract attributes of the device using vio_get_attribute()
28*/ 30 */
29#define VETH_MAC_ADDR "local-mac-address" 31#define VETH_MAC_ADDR "local-mac-address"
30#define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters" 32#define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters"
31 33
@@ -37,64 +39,65 @@
37#define VIO_IRQ_DISABLE 0UL 39#define VIO_IRQ_DISABLE 0UL
38#define VIO_IRQ_ENABLE 1UL 40#define VIO_IRQ_ENABLE 1UL
39 41
40struct vio_dev;
41struct vio_driver;
42struct vio_device_id;
43struct iommu_table; 42struct iommu_table;
44 43
45int vio_register_driver(struct vio_driver *drv); 44/*
46void vio_unregister_driver(struct vio_driver *drv); 45 * The vio_dev structure is used to describe virtual I/O devices.
47 46 */
48#ifdef CONFIG_PPC_PSERIES 47struct vio_dev {
49struct vio_dev * __devinit vio_register_device_node( 48 struct iommu_table *iommu_table; /* vio_map_* uses this */
50 struct device_node *node_vdev); 49 char *name;
51#endif
52void __devinit vio_unregister_device(struct vio_dev *dev);
53struct vio_dev *vio_find_node(struct device_node *vnode);
54
55const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length);
56int vio_get_irq(struct vio_dev *dev);
57int vio_enable_interrupts(struct vio_dev *dev);
58int vio_disable_interrupts(struct vio_dev *dev);
59
60extern struct dma_mapping_ops vio_dma_ops;
61
62extern struct bus_type vio_bus_type;
63
64struct vio_device_id {
65 char *type; 50 char *type;
66 char *compat; 51 uint32_t unit_address;
52 unsigned int irq;
53 struct device dev;
67}; 54};
68 55
69struct vio_driver { 56struct vio_driver {
70 struct list_head node; 57 struct list_head node;
71 char *name; 58 char *name;
72 const struct vio_device_id *id_table; /* NULL if wants all devices */ 59 const struct vio_device_id *id_table;
73 int (*probe) (struct vio_dev *dev, const struct vio_device_id *id); /* New device inserted */ 60 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
74 int (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ 61 int (*remove)(struct vio_dev *dev);
75 unsigned long driver_data; 62 unsigned long driver_data;
76
77 struct device_driver driver; 63 struct device_driver driver;
78}; 64};
79 65
66struct vio_bus_ops {
67 int (*match)(const struct vio_device_id *id, const struct vio_dev *dev);
68 void (*unregister_device)(struct vio_dev *);
69 void (*release_device)(struct device *);
70};
71
72extern struct dma_mapping_ops vio_dma_ops;
73extern struct bus_type vio_bus_type;
74extern struct vio_dev vio_bus_device;
75
76extern int vio_register_driver(struct vio_driver *drv);
77extern void vio_unregister_driver(struct vio_driver *drv);
78
79extern struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev);
80extern void __devinit vio_unregister_device(struct vio_dev *dev);
81
82extern int vio_bus_init(struct vio_bus_ops *);
83
84#ifdef CONFIG_PPC_PSERIES
85struct device_node;
86
87extern struct vio_dev * __devinit vio_register_device_node(
88 struct device_node *node_vdev);
89extern struct vio_dev *vio_find_node(struct device_node *vnode);
90extern const void *vio_get_attribute(struct vio_dev *vdev, void *which,
91 int *length);
92extern int vio_enable_interrupts(struct vio_dev *dev);
93extern int vio_disable_interrupts(struct vio_dev *dev);
94#endif
95
80static inline struct vio_driver *to_vio_driver(struct device_driver *drv) 96static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
81{ 97{
82 return container_of(drv, struct vio_driver, driver); 98 return container_of(drv, struct vio_driver, driver);
83} 99}
84 100
85/*
86 * The vio_dev structure is used to describe virtual I/O devices.
87 */
88struct vio_dev {
89 struct iommu_table *iommu_table; /* vio_map_* uses this */
90 char *name;
91 char *type;
92 uint32_t unit_address;
93 unsigned int irq;
94
95 struct device dev;
96};
97
98static inline struct vio_dev *to_vio_dev(struct device *dev) 101static inline struct vio_dev *to_vio_dev(struct device *dev)
99{ 102{
100 return container_of(dev, struct vio_dev, dev); 103 return container_of(dev, struct vio_dev, dev);