diff options
Diffstat (limited to 'include/asm-ppc64/vio.h')
-rw-r--r-- | include/asm-ppc64/vio.h | 101 |
1 files changed, 47 insertions, 54 deletions
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h index a82e87c1c5fa..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,77 +39,68 @@ | |||
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 | ||
40 | struct vio_dev; | ||
41 | struct vio_driver; | ||
42 | struct vio_device_id; | ||
43 | struct iommu_table; | 42 | struct iommu_table; |
44 | 43 | ||
45 | int vio_register_driver(struct vio_driver *drv); | 44 | /* |
46 | void 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 | 47 | struct vio_dev { |
49 | struct 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 | ||
52 | void __devinit vio_unregister_device(struct vio_dev *dev); | ||
53 | struct vio_dev *vio_find_node(struct device_node *vnode); | ||
54 | |||
55 | const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length); | ||
56 | int vio_get_irq(struct vio_dev *dev); | ||
57 | int vio_enable_interrupts(struct vio_dev *dev); | ||
58 | int vio_disable_interrupts(struct vio_dev *dev); | ||
59 | extern struct vio_dev * __devinit vio_register_device_common( | ||
60 | struct vio_dev *viodev, char *name, char *type, | ||
61 | uint32_t unit_address, struct iommu_table *iommu_table); | ||
62 | |||
63 | extern struct dma_mapping_ops vio_dma_ops; | ||
64 | |||
65 | extern struct bus_type vio_bus_type; | ||
66 | |||
67 | struct vio_device_id { | ||
68 | char *type; | 50 | char *type; |
69 | char *compat; | 51 | uint32_t unit_address; |
52 | unsigned int irq; | ||
53 | struct device dev; | ||
70 | }; | 54 | }; |
71 | 55 | ||
72 | struct vio_driver { | 56 | struct vio_driver { |
73 | struct list_head node; | 57 | struct list_head node; |
74 | char *name; | 58 | char *name; |
75 | const struct vio_device_id *id_table; /* NULL if wants all devices */ | 59 | const struct vio_device_id *id_table; |
76 | 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); |
77 | int (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ | 61 | int (*remove)(struct vio_dev *dev); |
78 | unsigned long driver_data; | 62 | unsigned long driver_data; |
79 | |||
80 | struct device_driver driver; | 63 | struct device_driver driver; |
81 | }; | 64 | }; |
82 | 65 | ||
66 | struct 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 | |||
72 | extern struct dma_mapping_ops vio_dma_ops; | ||
73 | extern struct bus_type vio_bus_type; | ||
74 | extern struct vio_dev vio_bus_device; | ||
75 | |||
76 | extern int vio_register_driver(struct vio_driver *drv); | ||
77 | extern void vio_unregister_driver(struct vio_driver *drv); | ||
78 | |||
79 | extern struct vio_dev * __devinit vio_register_device(struct vio_dev *viodev); | ||
80 | extern void __devinit vio_unregister_device(struct vio_dev *dev); | ||
81 | |||
82 | extern int vio_bus_init(struct vio_bus_ops *); | ||
83 | |||
84 | #ifdef CONFIG_PPC_PSERIES | ||
85 | struct device_node; | ||
86 | |||
87 | extern struct vio_dev * __devinit vio_register_device_node( | ||
88 | struct device_node *node_vdev); | ||
89 | extern struct vio_dev *vio_find_node(struct device_node *vnode); | ||
90 | extern const void *vio_get_attribute(struct vio_dev *vdev, void *which, | ||
91 | int *length); | ||
92 | extern int vio_enable_interrupts(struct vio_dev *dev); | ||
93 | extern int vio_disable_interrupts(struct vio_dev *dev); | ||
94 | #endif | ||
95 | |||
83 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) | 96 | static inline struct vio_driver *to_vio_driver(struct device_driver *drv) |
84 | { | 97 | { |
85 | return container_of(drv, struct vio_driver, driver); | 98 | return container_of(drv, struct vio_driver, driver); |
86 | } | 99 | } |
87 | 100 | ||
88 | /* | ||
89 | * The vio_dev structure is used to describe virtual I/O devices. | ||
90 | */ | ||
91 | struct vio_dev { | ||
92 | struct iommu_table *iommu_table; /* vio_map_* uses this */ | ||
93 | char *name; | ||
94 | char *type; | ||
95 | uint32_t unit_address; | ||
96 | unsigned int irq; | ||
97 | |||
98 | struct device dev; | ||
99 | }; | ||
100 | |||
101 | extern struct vio_dev vio_bus_device; | ||
102 | |||
103 | static inline struct vio_dev *to_vio_dev(struct device *dev) | 101 | static inline struct vio_dev *to_vio_dev(struct device *dev) |
104 | { | 102 | { |
105 | return container_of(dev, struct vio_dev, dev); | 103 | return container_of(dev, struct vio_dev, dev); |
106 | } | 104 | } |
107 | 105 | ||
108 | extern int vio_bus_init(int (*is_match)(const struct vio_device_id *id, | ||
109 | const struct vio_dev *dev), | ||
110 | void (*)(struct vio_dev *), | ||
111 | void (*)(struct device *)); | ||
112 | |||
113 | #endif /* _ASM_VIO_H */ | 106 | #endif /* _ASM_VIO_H */ |