diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 21:15:59 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-16 07:04:13 -0400 |
commit | 2c4f4ecb7a421e0be6632d3366f0bc7cdf1e38b1 (patch) | |
tree | 3c040c2edf3e306b78a64f2ce4033f1e8baab652 /arch/sparc64/kernel/vio.c | |
parent | cb4812358423e7ea47d2b6471918d65238452cc5 (diff) |
[SPARC64]: Add domain-services nodes to VIO device tree.
They sit under the root of the MD tree unlike the rest of
the LDC channel based virtual devices.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/vio.c')
-rw-r--r-- | arch/sparc64/kernel/vio.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc64/kernel/vio.c index 21c015e8365b..7eccc91cd59d 100644 --- a/arch/sparc64/kernel/vio.c +++ b/arch/sparc64/kernel/vio.c | |||
@@ -104,18 +104,24 @@ static ssize_t devspec_show(struct device *dev, | |||
104 | struct vio_dev *vdev = to_vio_dev(dev); | 104 | struct vio_dev *vdev = to_vio_dev(dev); |
105 | const char *str = "none"; | 105 | const char *str = "none"; |
106 | 106 | ||
107 | if (vdev->type) { | 107 | if (!strcmp(vdev->type, "network")) |
108 | if (!strcmp(vdev->type, "network")) | 108 | str = "vnet"; |
109 | str = "vnet"; | 109 | else if (!strcmp(vdev->type, "block")) |
110 | else if (!strcmp(vdev->type, "block")) | 110 | str = "vdisk"; |
111 | str = "vdisk"; | ||
112 | } | ||
113 | 111 | ||
114 | return sprintf(buf, "%s\n", str); | 112 | return sprintf(buf, "%s\n", str); |
115 | } | 113 | } |
116 | 114 | ||
115 | static ssize_t type_show(struct device *dev, | ||
116 | struct device_attribute *attr, char *buf) | ||
117 | { | ||
118 | struct vio_dev *vdev = to_vio_dev(dev); | ||
119 | return sprintf(buf, "%s\n", vdev->type); | ||
120 | } | ||
121 | |||
117 | static struct device_attribute vio_dev_attrs[] = { | 122 | static struct device_attribute vio_dev_attrs[] = { |
118 | __ATTR_RO(devspec), | 123 | __ATTR_RO(devspec), |
124 | __ATTR_RO(type), | ||
119 | __ATTR_NULL | 125 | __ATTR_NULL |
120 | }; | 126 | }; |
121 | 127 | ||
@@ -201,8 +207,11 @@ static struct vio_dev *vio_create_one(struct mdesc_node *mp, | |||
201 | int err, clen; | 207 | int err, clen; |
202 | 208 | ||
203 | type = md_get_property(mp, "device-type", NULL); | 209 | type = md_get_property(mp, "device-type", NULL); |
204 | if (!type) | 210 | if (!type) { |
205 | type = md_get_property(mp, "name", NULL); | 211 | type = md_get_property(mp, "name", NULL); |
212 | if (!type) | ||
213 | type = mp->name; | ||
214 | } | ||
206 | compat = md_get_property(mp, "device-type", &clen); | 215 | compat = md_get_property(mp, "device-type", &clen); |
207 | 216 | ||
208 | vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); | 217 | vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); |
@@ -279,6 +288,8 @@ static void walk_tree(struct mdesc_node *n, struct vio_dev *parent) | |||
279 | 288 | ||
280 | static void create_devices(struct mdesc_node *root) | 289 | static void create_devices(struct mdesc_node *root) |
281 | { | 290 | { |
291 | struct mdesc_node *mp; | ||
292 | |||
282 | root_vdev = vio_create_one(root, NULL); | 293 | root_vdev = vio_create_one(root, NULL); |
283 | if (!root_vdev) { | 294 | if (!root_vdev) { |
284 | printk(KERN_ERR "VIO: Coult not create root device.\n"); | 295 | printk(KERN_ERR "VIO: Coult not create root device.\n"); |
@@ -286,6 +297,17 @@ static void create_devices(struct mdesc_node *root) | |||
286 | } | 297 | } |
287 | 298 | ||
288 | walk_tree(root, root_vdev); | 299 | walk_tree(root, root_vdev); |
300 | |||
301 | /* Domain services is odd as it doesn't sit underneath the | ||
302 | * channel-devices node, so we plug it in manually. | ||
303 | */ | ||
304 | mp = md_find_node_by_name(NULL, "domain-services"); | ||
305 | if (mp) { | ||
306 | struct vio_dev *parent = vio_create_one(mp, &root_vdev->dev); | ||
307 | |||
308 | if (parent) | ||
309 | walk_tree(mp, parent); | ||
310 | } | ||
289 | } | 311 | } |
290 | 312 | ||
291 | const char *channel_devices_node = "channel-devices"; | 313 | const char *channel_devices_node = "channel-devices"; |