summary refs log tree commit diff stats
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-08-15 13:32:37 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-08-29 10:46:57 +0100
commit28fa7133b89555355418aeee4fca01cae2081aeb (patch)
tree189aff7dcd01a6cd3989ed2dbd889438a81b72d9 /hw/ide/qdev.c
parenta6aebb38ba4682951ab04fe6d6e6b169bd9e4dca (diff)
downloadfocaccia-qemu-28fa7133b89555355418aeee4fca01cae2081aeb.tar.gz
focaccia-qemu-28fa7133b89555355418aeee4fca01cae2081aeb.zip
ide: Fix bootindex for bus_id > 9
We identify devices by their Open Firmware device paths.  The encoding
of bus numbers is incorrect: idebus_get_fw_dev_path() formats them in
decimal, while SeaBIOS uses hexadecimal.  With bus number > 9, SeaBIOS
will miss the bootindex (lucky case), or apply it to another device
(unlucky case).

Bug can't bite right now: ich9-ahci has six ports, and the sysbus-ahci
created by Calxeda Highbank has just one.

Fix it anyway, by changing %d to %x.

I couldn't find an Open Firmware spec covering this.  For what it's
worth, OVMF agrees with SeaBIOS.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index b4a467116e..efab95b320 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -59,7 +59,7 @@ static char *idebus_get_fw_dev_path(DeviceState *dev)
 {
     char path[30];
 
-    snprintf(path, sizeof(path), "%s@%d", qdev_fw_name(dev),
+    snprintf(path, sizeof(path), "%s@%x", qdev_fw_name(dev),
              ((IDEBus*)dev->parent_bus)->bus_id);
 
     return g_strdup(path);