aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/rtas.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-09-29 12:32:44 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-10-06 16:15:40 +1100
commitcf716b31cba278a6dbff585d58fa29d1ae2fe334 (patch)
tree032a53f614772fee48a21bc215e379f7b6ad650c /tests/libqos/rtas.c
parent2020b67d851affd9dd8b3732a5290d90be6187d1 (diff)
downloadqemu-cf716b31cba278a6dbff585d58fa29d1ae2fe334.zip
qemu-cf716b31cba278a6dbff585d58fa29d1ae2fe334.tar.gz
qemu-cf716b31cba278a6dbff585d58fa29d1ae2fe334.tar.bz2
libqos: add PPC64 PCI support
Signed-off-by: Laurent Vivier <lvivier@redhat.com> [dwg: Fixed build problem on 32-bit hosts] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/libqos/rtas.c')
-rw-r--r--tests/libqos/rtas.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/libqos/rtas.c b/tests/libqos/rtas.c
index 820321a..0269803 100644
--- a/tests/libqos/rtas.c
+++ b/tests/libqos/rtas.c
@@ -69,3 +69,48 @@ int qrtas_get_time_of_day(QGuestAllocator *alloc, struct tm *tm, uint32_t *ns)
return res;
}
+
+uint32_t qrtas_ibm_read_pci_config(QGuestAllocator *alloc, uint64_t buid,
+ uint32_t addr, uint32_t size)
+{
+ int res;
+ uint32_t args[4], ret[2];
+
+ args[0] = addr;
+ args[1] = buid >> 32;
+ args[2] = buid & 0xffffffff;
+ args[3] = size;
+ res = qrtas_call(alloc, "ibm,read-pci-config", 4, args, 2, ret);
+ if (res != 0) {
+ return -1;
+ }
+
+ if (ret[0] != 0) {
+ return -1;
+ }
+
+ return ret[1];
+}
+
+int qrtas_ibm_write_pci_config(QGuestAllocator *alloc, uint64_t buid,
+ uint32_t addr, uint32_t size, uint32_t val)
+{
+ int res;
+ uint32_t args[5], ret[1];
+
+ args[0] = addr;
+ args[1] = buid >> 32;
+ args[2] = buid & 0xffffffff;
+ args[3] = size;
+ args[4] = val;
+ res = qrtas_call(alloc, "ibm,write-pci-config", 5, args, 1, ret);
+ if (res != 0) {
+ return -1;
+ }
+
+ if (ret[0] != 0) {
+ return -1;
+ }
+
+ return 0;
+}