This source file includes following definitions.
- vio_enable_interrupts
- to_vio_driver
- to_vio_dev
1
2
3
4
5
6
7
8
9
10 #ifndef _ASM_POWERPC_VIO_H
11 #define _ASM_POWERPC_VIO_H
12 #ifdef __KERNEL__
13
14 #include <linux/errno.h>
15 #include <linux/device.h>
16 #include <linux/dma-mapping.h>
17 #include <linux/mod_devicetable.h>
18 #include <linux/scatterlist.h>
19
20 #include <asm/hvcall.h>
21
22
23
24
25
26 #define VETH_MAC_ADDR "local-mac-address"
27 #define VETH_MCAST_FILTER_SIZE "ibm,mac-address-filters"
28
29
30
31 #define h_vio_signal(ua, mode) \
32 plpar_hcall_norets(H_VIO_SIGNAL, ua, mode)
33
34 #define VIO_IRQ_DISABLE 0UL
35 #define VIO_IRQ_ENABLE 1UL
36
37
38
39
40 #define VIO_CMO_MIN_ENT 1562624
41
42 extern struct bus_type vio_bus_type;
43
44 struct iommu_table;
45
46
47
48
49
50
51 #define VIO_BASE_PFO_UA 0x50000000
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 struct vio_pfo_op {
69 u64 flags;
70 s64 in;
71 s64 inlen;
72 s64 out;
73 s64 outlen;
74 u64 csbcpb;
75 void *done;
76 unsigned long handle;
77 unsigned int timeout;
78 long hcall_err;
79 };
80
81
82
83 enum vio_dev_family {
84 VDEVICE,
85 PFO,
86 };
87
88
89
90
91
92
93
94
95
96 struct vio_dev {
97 const char *name;
98 const char *type;
99 uint32_t unit_address;
100 uint32_t resource_id;
101 unsigned int irq;
102 struct {
103 size_t desired;
104 size_t entitled;
105 size_t allocated;
106 atomic_t allocs_failed;
107 } cmo;
108 enum vio_dev_family family;
109 struct device dev;
110 };
111
112 struct vio_driver {
113 const char *name;
114 const struct vio_device_id *id_table;
115 int (*probe)(struct vio_dev *dev, const struct vio_device_id *id);
116 int (*remove)(struct vio_dev *dev);
117
118
119
120 unsigned long (*get_desired_dma)(struct vio_dev *dev);
121 const struct dev_pm_ops *pm;
122 struct device_driver driver;
123 };
124
125 extern int __vio_register_driver(struct vio_driver *drv, struct module *owner,
126 const char *mod_name);
127
128
129
130 #define vio_register_driver(driver) \
131 __vio_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
132 extern void vio_unregister_driver(struct vio_driver *drv);
133
134 extern int vio_cmo_entitlement_update(size_t);
135 extern void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired);
136
137 extern void vio_unregister_device(struct vio_dev *dev);
138
139 extern int vio_h_cop_sync(struct vio_dev *vdev, struct vio_pfo_op *op);
140
141 struct device_node;
142
143 extern struct vio_dev *vio_register_device_node(
144 struct device_node *node_vdev);
145 extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,
146 int *length);
147 #ifdef CONFIG_PPC_PSERIES
148 extern struct vio_dev *vio_find_node(struct device_node *vnode);
149 extern int vio_enable_interrupts(struct vio_dev *dev);
150 extern int vio_disable_interrupts(struct vio_dev *dev);
151 #else
152 static inline int vio_enable_interrupts(struct vio_dev *dev)
153 {
154 return 0;
155 }
156 #endif
157
158 static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
159 {
160 return container_of(drv, struct vio_driver, driver);
161 }
162
163 static inline struct vio_dev *to_vio_dev(struct device *dev)
164 {
165 return container_of(dev, struct vio_dev, dev);
166 }
167
168 #endif
169 #endif