• Home
  • Raw
  • Download

Lines Matching +full:hp +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0
4 * Copyright (c) 2003-2005 IBM Corp.
29 type = dev->type; in vio_match_device()
30 compat = dev->compat; in vio_match_device()
31 len = dev->compat_len; in vio_match_device()
33 while (matches->type[0] || matches->compat[0]) { in vio_match_device()
35 if (matches->type[0]) in vio_match_device()
36 match &= !strcmp(matches->type, type); in vio_match_device()
38 if (matches->compat[0]) { in vio_match_device()
40 of_find_in_proplist(compat, matches->compat, len); in vio_match_device()
53 add_uevent_var(env, "MODALIAS=vio:T%sS%s", vio_dev->type, vio_dev->compat); in vio_hotplug()
61 const struct vio_device_id *matches = vio_drv->id_table; in vio_bus_match()
72 struct vio_driver *drv = to_vio_driver(dev->driver); in vio_device_probe()
75 if (!drv->probe) in vio_device_probe()
76 return -ENODEV; in vio_device_probe()
78 id = vio_match_device(drv->id_table, vdev); in vio_device_probe()
80 return -ENODEV; in vio_device_probe()
83 if (!drv->no_irq) { in vio_device_probe()
84 if (vdev->tx_irq == 0 && vdev->tx_ino != ~0UL) in vio_device_probe()
85 vdev->tx_irq = sun4v_build_virq(vdev->cdev_handle, in vio_device_probe()
86 vdev->tx_ino); in vio_device_probe()
88 if (vdev->rx_irq == 0 && vdev->rx_ino != ~0UL) in vio_device_probe()
89 vdev->rx_irq = sun4v_build_virq(vdev->cdev_handle, in vio_device_probe()
90 vdev->rx_ino); in vio_device_probe()
93 return drv->probe(vdev, id); in vio_device_probe()
99 struct vio_driver *drv = to_vio_driver(dev->driver); in vio_device_remove()
101 if (drv->remove) { in vio_device_remove()
104 * here - however, there are currently no support in vio_device_remove()
108 return drv->remove(vdev); in vio_device_remove()
120 if (!strcmp(vdev->type, "vnet-port")) in devspec_show()
122 else if (!strcmp(vdev->type, "vdc-port")) in devspec_show()
133 return sprintf(buf, "%s\n", vdev->type); in type_show()
142 return sprintf(buf, "vio:T%sS%s\n", vdev->type, vdev->compat); in modalias_show()
166 viodrv->driver.bus = &vio_bus_type; in __vio_register_driver()
167 viodrv->driver.name = viodrv->name; in __vio_register_driver()
168 viodrv->driver.owner = owner; in __vio_register_driver()
169 viodrv->driver.mod_name = mod_name; in __vio_register_driver()
171 return driver_register(&viodrv->driver); in __vio_register_driver()
177 driver_unregister(&viodrv->driver); in vio_unregister_driver()
194 dp = vdev->dp; in show_pciobppath_attr()
207 static const u64 *vio_cfg_handle(struct mdesc_handle *hp, u64 node) in vio_cfg_handle() argument
212 mdesc_for_each_arc(a, hp, node, MDESC_ARC_TYPE_BACK) { in vio_cfg_handle()
215 target = mdesc_arc_target(hp, a); in vio_cfg_handle()
216 cfg_handle = mdesc_get_property(hp, target, in vio_cfg_handle()
217 "cfg-handle", NULL); in vio_cfg_handle()
226 * vio_vdev_node() - Find VDEV node in MD
227 * @hp: Handle to the MD
238 u64 vio_vdev_node(struct mdesc_handle *hp, struct vio_dev *vdev) in vio_vdev_node() argument
245 node = mdesc_get_node(hp, (const char *)vdev->node_name, in vio_vdev_node()
246 &vdev->md_node_info); in vio_vdev_node()
252 static void vio_fill_channel_info(struct mdesc_handle *hp, u64 mp, in vio_fill_channel_info() argument
257 vdev->tx_ino = ~0UL; in vio_fill_channel_info()
258 vdev->rx_ino = ~0UL; in vio_fill_channel_info()
259 vdev->channel_id = ~0UL; in vio_fill_channel_info()
260 mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_FWD) { in vio_fill_channel_info()
265 target = mdesc_arc_target(hp, a); in vio_fill_channel_info()
267 irq = mdesc_get_property(hp, target, "tx-ino", NULL); in vio_fill_channel_info()
269 vdev->tx_ino = *irq; in vio_fill_channel_info()
271 irq = mdesc_get_property(hp, target, "rx-ino", NULL); in vio_fill_channel_info()
273 vdev->rx_ino = *irq; in vio_fill_channel_info()
275 chan_id = mdesc_get_property(hp, target, "id", NULL); in vio_fill_channel_info()
277 vdev->channel_id = *chan_id; in vio_fill_channel_info()
280 vdev->cdev_handle = cdev_cfg_handle; in vio_fill_channel_info()
292 static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, in vio_create_one() argument
302 type = mdesc_get_property(hp, mp, "device-type", &tlen); in vio_create_one()
304 type = mdesc_get_property(hp, mp, "name", &tlen); in vio_create_one()
306 type = mdesc_node_name(hp, mp); in vio_create_one()
316 id = mdesc_get_property(hp, mp, "id", NULL); in vio_create_one()
318 cfg_handle = vio_cfg_handle(hp, mp); in vio_create_one()
320 compat = mdesc_get_property(hp, mp, "device-type", &clen); in vio_create_one()
335 vdev->mp = mp; in vio_create_one()
336 memcpy(vdev->type, type, tlen); in vio_create_one()
338 memcpy(vdev->compat, compat, clen); in vio_create_one()
340 memset(vdev->compat, 0, sizeof(vdev->compat)); in vio_create_one()
341 vdev->compat_len = clen; in vio_create_one()
343 vdev->port_id = ~0UL; in vio_create_one()
344 vdev->tx_irq = 0; in vio_create_one()
345 vdev->rx_irq = 0; in vio_create_one()
347 vio_fill_channel_info(hp, mp, vdev); in vio_create_one()
350 dev_set_name(&vdev->dev, "%s", type); in vio_create_one()
351 vdev->dev_no = ~(u64)0; in vio_create_one()
353 dev_set_name(&vdev->dev, "%s-%llu", type, *id); in vio_create_one()
354 vdev->dev_no = *id; in vio_create_one()
356 dev_set_name(&vdev->dev, "%s-%llu-%llu", type, in vio_create_one()
358 vdev->dev_no = *cfg_handle; in vio_create_one()
359 vdev->port_id = *id; in vio_create_one()
362 vdev->dev.parent = parent; in vio_create_one()
363 vdev->dev.bus = &vio_bus_type; in vio_create_one()
364 vdev->dev.release = vio_dev_release; in vio_create_one()
374 dp = to_vio_dev(parent)->dp; in vio_create_one()
376 vdev->dp = dp; in vio_create_one()
379 * node_name is NULL for the parent/channel-devices node and in vio_create_one()
383 (void) snprintf(vdev->node_name, VIO_MAX_NAME_LEN, "%s", in vio_create_one()
386 err = mdesc_get_node_info(hp, mp, node_name, in vio_create_one()
387 &vdev->md_node_info); in vio_create_one()
390 dev_name(&vdev->dev), err); in vio_create_one()
397 dev_name(&vdev->dev), vdev->tx_ino, vdev->rx_ino); in vio_create_one()
399 err = device_register(&vdev->dev); in vio_create_one()
402 dev_name(&vdev->dev), err); in vio_create_one()
403 put_device(&vdev->dev); in vio_create_one()
406 if (vdev->dp) in vio_create_one()
407 err = sysfs_create_file(&vdev->dev.kobj, in vio_create_one()
413 static void vio_add(struct mdesc_handle *hp, u64 node, in vio_add() argument
416 (void) vio_create_one(hp, node, node_name, &root_vdev->dev); in vio_add()
420 struct mdesc_handle *hp; member
432 node = vio_vdev_node(node_data->hp, vdev); in vio_md_node_match()
434 if (node == node_data->node) in vio_md_node_match()
440 static void vio_remove(struct mdesc_handle *hp, u64 node, const char *node_name) in vio_remove() argument
445 node_data.hp = hp; in vio_remove()
448 dev = device_find_child(&root_vdev->dev, (void *)&node_data, in vio_remove()
463 .node_name = "virtual-device-port",
467 * "domain-services" node. On control nodes there is another port
471 static void vio_add_ds(struct mdesc_handle *hp, u64 node, in vio_add_ds() argument
478 mdesc_for_each_arc(a, hp, node, MDESC_ARC_TYPE_BACK) { in vio_add_ds()
479 u64 target = mdesc_arc_target(hp, a); in vio_add_ds()
480 const char *name = mdesc_node_name(hp, target); in vio_add_ds()
482 if (!strcmp(name, "domain-services")) { in vio_add_ds()
489 (void) vio_create_one(hp, node, node_name, &root_vdev->dev); in vio_add_ds()
495 .node_name = "domain-services-port",
498 static const char *channel_devices_node = "channel-devices";
499 static const char *channel_devices_compat = "SUNW,sun4v-channel-devices";
500 static const char *cfg_handle_prop = "cfg-handle";
504 struct mdesc_handle *hp; in vio_init() local
517 hp = mdesc_grab(); in vio_init()
518 if (!hp) in vio_init()
521 root = mdesc_node_by_name(hp, MDESC_NODE_NULL, channel_devices_node); in vio_init()
523 printk(KERN_INFO "VIO: No channel-devices MDESC node.\n"); in vio_init()
524 mdesc_release(hp); in vio_init()
528 cdev_node = of_find_node_by_name(NULL, "channel-devices"); in vio_init()
529 err = -ENODEV; in vio_init()
531 printk(KERN_INFO "VIO: No channel-devices OBP node.\n"); in vio_init()
535 compat = mdesc_get_property(hp, root, "compatible", &len); in vio_init()
547 cfg_handle = mdesc_get_property(hp, root, cfg_handle_prop, NULL); in vio_init()
556 root_vdev = vio_create_one(hp, root, NULL, NULL); in vio_init()
557 err = -ENODEV; in vio_init()
566 mdesc_release(hp); in vio_init()
571 mdesc_release(hp); in vio_init()