12 #include <linux/kernel.h>
13 #include <linux/slab.h>
15 #include <linux/export.h>
32 while (matches->
type[0] || matches->
compat[0]) {
51 struct vio_driver *vio_drv = to_vio_driver(drv);
57 return vio_match_device(matches, vio_dev) !=
NULL;
60 static int vio_device_probe(
struct device *dev)
62 struct vio_dev *vdev = to_vio_dev(dev);
68 id = vio_match_device(drv->
id_table, vdev);
70 error = drv->
probe(vdev,
id);
76 static int vio_device_remove(
struct device *dev)
78 struct vio_dev *vdev = to_vio_dev(dev);
90 struct vio_dev *vdev = to_vio_dev(dev);
91 const char *
str =
"none";
98 return sprintf(buf,
"%s\n", str);
104 struct vio_dev *vdev = to_vio_dev(dev);
116 .dev_attrs = vio_dev_attrs,
117 .match = vio_bus_match,
118 .probe = vio_device_probe,
119 .remove = vio_device_remove,
123 const char *mod_name)
128 viodrv->
driver.mod_name = mod_name;
140 static void vio_dev_release(
struct device *dev)
142 kfree(to_vio_dev(dev));
149 struct vio_dev *vdev;
152 vdev = to_vio_dev(dev);
159 show_pciobppath_attr,
NULL);
163 static struct vio_dev *root_vdev;
164 static u64 cdev_cfg_handle;
167 struct vio_dev *vdev)
197 struct vio_dev *vdev;
199 const u64 *
id, *cfg_handle;
230 if (!
strcmp(type,
"domain-services-port"))
238 if (
strlen(bus_id_name) >= 20 - 4) {
271 vio_fill_channel_info(hp, mp, vdev);
276 }
else if (!cfg_handle) {
282 vdev->
dev_no = *cfg_handle;
285 vdev->
dev.parent = parent;
287 vdev->
dev.release = vio_dev_release;
289 if (parent ==
NULL) {
291 }
else if (to_vio_dev(parent) == root_vdev) {
300 dp = to_vio_dev(parent)->dp;
309 dev_name(&vdev->
dev), err);
315 &dev_attr_obppath.attr);
322 (
void) vio_create_one(hp, node, &root_vdev->
dev);
325 static int vio_md_node_match(
struct device *dev,
void *
arg)
327 struct vio_dev *vdev = to_vio_dev(dev);
329 if (vdev->
mp == (
u64) arg)
350 .remove = vio_remove,
351 .node_name =
"virtual-device-port",
369 if (!
strcmp(name,
"domain-services")) {
376 (
void) vio_create_one(hp, node, &root_vdev->
dev);
381 .remove = vio_remove,
382 .node_name =
"domain-services-port",
385 static const char *channel_devices_node =
"channel-devices";
386 static const char *channel_devices_compat =
"SUNW,sun4v-channel-devices";
387 static const char *cfg_handle_prop =
"cfg-handle";
389 static int __init vio_init(
void)
393 const u64 *cfg_handle;
430 "compat entry.\n", channel_devices_compat);
441 cdev_cfg_handle = *cfg_handle;
443 root_vdev = vio_create_one(hp, root,
NULL);