[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 21/24] Common: Add quick access to first boot device
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 21/24] Common: Add quick access to first boot device |
Date: |
Fri, 26 Apr 2013 20:19:30 +0200 |
From: Dominik Dingel <address@hidden>
Instead of manually parsing the boot_list as character stream,
we can access the nth boot device, specified by the position in the
boot order.
Signed-off-by: Dominik Dingel <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
include/sysemu/sysemu.h | 2 ++
vl.c | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 6578782..43b961c 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -181,6 +181,8 @@ void add_boot_device_path(int32_t bootindex, DeviceState
*dev,
const char *suffix);
char *get_boot_devices_list(size_t *size);
+DeviceState *get_boot_device(uint32_t position);
+
bool usb_enabled(bool default_usb);
extern QemuOptsList qemu_drive_opts;
diff --git a/vl.c b/vl.c
index 2e0d1a7..322ea80 100644
--- a/vl.c
+++ b/vl.c
@@ -1222,6 +1222,24 @@ void add_boot_device_path(int32_t bootindex, DeviceState
*dev,
QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
}
+DeviceState *get_boot_device(uint32_t position)
+{
+ uint32_t counter = 0;
+ FWBootEntry *i = NULL;
+ DeviceState *res = NULL;
+
+ if (!QTAILQ_EMPTY(&fw_boot_order)) {
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ if (counter == position) {
+ res = i->dev;
+ break;
+ }
+ counter++;
+ }
+ }
+ return res;
+}
+
/*
* This function returns null terminated string that consist of new line
* separated device paths.
--
1.6.0.2
- [Qemu-ppc] [PATCH 08/24] S390: ccw firmware: Add glue header, (continued)
- [Qemu-ppc] [PATCH 08/24] S390: ccw firmware: Add glue header, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 09/24] S390: ccw firmware: Add bootmap interpreter, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 18/24] s390-ccw.img: Get queue config from host., Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 23/24] Utilize selective runtime reg sync for hot code paths, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 20/24] S390: CCW: Use new, working firmware by default, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 06/24] S390: ccw firmware: Add sclp output, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 15/24] s390-ccw.img: Detect devices with stsch., Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 03/24] S390: IPL: Use different firmware for different machines, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 17/24] s390-ccw.img: Rudimentary error checking., Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 24/24] virtio-rng-s390: add properties., Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 21/24] Common: Add quick access to first boot device,
Alexander Graf <=
- [Qemu-ppc] [PATCH 16/24] s390-ccw.img: Enhance drain_irqs()., Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 22/24] Allow selective runtime register synchronization, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 19/24] S390: ccw firmware: Add compiled blob, Alexander Graf, 2013/04/26
- [Qemu-ppc] [PATCH 07/24] S390: ccw firmware: Add virtio device drivers, Alexander Graf, 2013/04/26
- Re: [Qemu-ppc] [PULL 00/24] s390 patch queue 2013-04-26, Alexander Graf, 2013/04/26
- Re: [Qemu-ppc] [PULL 00/24] s390 patch queue 2013-04-26, Blue Swirl, 2013/04/26