static struct vnet *vsw_get_vnet(struct mdesc_handle *hp, u64 port_node, u64 *handle) { struct vnet *vp; struct vnet *iter; const u64 *local_mac = NULL; const u64 *cfghandle = NULL; u64 a; /* Get the parent virtual-network-switch macaddr and cfghandle */ mdesc_for_each_arc(a, hp, port_node, MDESC_ARC_TYPE_BACK) { u64 target = mdesc_arc_target(hp, a); const char *name; name = mdesc_get_property(hp, target, "name", NULL); if (!name || strcmp(name, "virtual-network-switch")) continue; local_mac = mdesc_get_property(hp, target, local_mac_prop, NULL); cfghandle = mdesc_get_property(hp, target, cfg_handle_prop, NULL); break; }
static void vio_fill_channel_info(struct mdesc_handle *hp, u64 mp, struct vio_dev *vdev) { u64 a; mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_FWD) { const u64 *chan_id; const u64 *irq; u64 target; target = mdesc_arc_target(hp, a); irq = mdesc_get_property(hp, target, "tx-ino", NULL); if (irq) vdev->tx_irq = sun4v_build_virq(cdev_cfg_handle, *irq); irq = mdesc_get_property(hp, target, "rx-ino", NULL); if (irq) vdev->rx_irq = sun4v_build_virq(cdev_cfg_handle, *irq); chan_id = mdesc_get_property(hp, target, "id", NULL); if (chan_id) vdev->channel_id = *chan_id; } }
static const u64 *parent_cfg_handle(struct mdesc_handle *hp, u64 node) { const u64 *id; u64 a; id = NULL; mdesc_for_each_arc(a, hp, node, MDESC_ARC_TYPE_BACK) { u64 target; target = mdesc_arc_target(hp, a); id = mdesc_get_property(hp, target, "cfg-handle", NULL); if (id) break; }
static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, struct device *parent) { const char *type, *compat, *bus_id_name; struct device_node *dp; struct vio_dev *vdev; int err, tlen, clen; const u64 *id, *cfg_handle; u64 a; type = mdesc_get_property(hp, mp, "device-type", &tlen); if (!type) { type = mdesc_get_property(hp, mp, "name", &tlen); if (!type) { type = mdesc_node_name(hp, mp); tlen = strlen(type) + 1; } } if (tlen > VIO_MAX_TYPE_LEN) { printk(KERN_ERR "VIO: Type string [%s] is too long.\n", type); return NULL; } id = mdesc_get_property(hp, mp, "id", NULL); cfg_handle = NULL; mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) { u64 target; target = mdesc_arc_target(hp, a); cfg_handle = mdesc_get_property(hp, target, "cfg-handle", NULL); if (cfg_handle) break; }