aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/vio.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-18 15:15:45 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-19 21:27:18 -0700
commit91ba3c2128e9ee490a9f04bcd5b54749b18e4410 (patch)
treec90f5711b990468dc684a8859cc9c498b8d4163d /arch/sparc64/kernel/vio.c
parent48db7b7c50cdb06c85f0ff01b5c19ac34903048b (diff)
[SPARC64]: Fix handling of multiple vdc-port nodes.
The "id" property in vdc-port nodes are not unique, they are all zero. Therefore assign ID's using the parent's "cfg-handle" property which will be unique. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/vio.c')
-rw-r--r--arch/sparc64/kernel/vio.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/arch/sparc64/kernel/vio.c b/arch/sparc64/kernel/vio.c
index 7e65b5a28bf..9ae1f61d4db 100644
--- a/arch/sparc64/kernel/vio.c
+++ b/arch/sparc64/kernel/vio.c
@@ -221,6 +221,27 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
return NULL;
}
+ if (!strcmp(type, "vdc-port")) {
+ u64 a;
+
+ id = NULL;
+ mdesc_for_each_arc(a, hp, mp, MDESC_ARC_TYPE_BACK) {
+ u64 target;
+
+ target = mdesc_arc_target(hp, a);
+ id = mdesc_get_property(hp, target,
+ "cfg-handle", NULL);
+ if (id)
+ break;
+ }
+ if (!id) {
+ printk(KERN_ERR "VIO: vdc-prot lacks parent "
+ "cfg-handle.\n");
+ return NULL;
+ }
+ } else
+ id = mdesc_get_property(hp, mp, "id", NULL);
+
bus_id_name = type;
if (!strcmp(type, "domain-services-port"))
bus_id_name = "ds";
@@ -260,13 +281,15 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
vio_fill_channel_info(hp, mp, vdev);
- id = mdesc_get_property(hp, mp, "id", NULL);
- if (!id)
+ if (!id) {
snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s",
bus_id_name);
- else
+ vdev->dev_no = ~(u64)0;
+ } else {
snprintf(vdev->dev.bus_id, BUS_ID_SIZE, "%s-%lu",
bus_id_name, *id);
+ vdev->dev_no = *id;
+ }
vdev->dev.parent = parent;
vdev->dev.bus = &vio_bus_type;