From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, jsnow@redhat.com, armbru@redhat.com,
stefanha@redhat.com, agraf@suse.de
Subject: [Qemu-devel] [RFC 3/4] ide: update ide_drive_get to work with both PCI-IDE and AHCI interfaces
Date: Mon, 18 Aug 2014 18:05:19 -0400 [thread overview]
Message-ID: <1408399520-12778-4-git-send-email-jsnow@redhat.com> (raw)
In-Reply-To: <1408399520-12778-1-git-send-email-jsnow@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
hw/i386/pc_piix.c | 2 +-
hw/ide/core.c | 11 +++++++----
include/hw/ide.h | 3 ++-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 47ac1b5..9da6f0e 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -239,7 +239,7 @@ static void pc_init1(MachineState *machine,
pc_nic_init(isa_bus, pci_bus);
- ide_drive_get(hd, MAX_IDE_BUS);
+ ide_drive_get(hd, IF_IDE, MAX_IDE_BUS);
if (pci_enabled) {
PCIDevice *dev;
if (xen_enabled()) {
diff --git a/hw/ide/core.c b/hw/ide/core.c
index b48127f..408d7c1 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2481,16 +2481,19 @@ const VMStateDescription vmstate_ide_bus = {
}
};
-void ide_drive_get(DriveInfo **hd, int max_bus)
+void ide_drive_get(DriveInfo **hd, BlockInterfaceType type, int max_bus)
{
int i;
- if (drive_get_max_bus(IF_IDE) >= max_bus) {
+ if (drive_get_max_bus(type) >= max_bus) {
fprintf(stderr, "qemu: too many IDE bus: %d\n", max_bus);
exit(1);
}
- for(i = 0; i < max_bus * MAX_IDE_DEVS; i++) {
- hd[i] = drive_get(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS);
+ for (i = 0; i < max_bus * if_get_max_devs(type); i++) {
+ fprintf(stderr, "hd[%u] := drive_get_by_index(%d, %u);\n",
+ i, type, i);
+ hd[i] = drive_get_by_index(type, i);
+ fprintf(stderr, "hd[%u] := %p\n", i, (void *)hd[i]);
}
}
diff --git a/include/hw/ide.h b/include/hw/ide.h
index bc8bd32..c4400ab 100644
--- a/include/hw/ide.h
+++ b/include/hw/ide.h
@@ -4,6 +4,7 @@
#include "hw/isa/isa.h"
#include "hw/pci/pci.h"
#include "exec/memory.h"
+#include "sysemu/blockdev.h"
#define MAX_IDE_DEVS 2
@@ -28,6 +29,6 @@ int ide_get_geometry(BusState *bus, int unit,
int ide_get_bios_chs_trans(BusState *bus, int unit);
/* ide/core.c */
-void ide_drive_get(DriveInfo **hd, int max_bus);
+void ide_drive_get(DriveInfo **hd, BlockInterfaceType type, int max_bus);
#endif /* HW_IDE_H */
--
1.9.3
next prev parent reply other threads:[~2014-08-18 22:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-18 22:05 [Qemu-devel] [RFC 0/4] Adding -cdrom, -hd[abcd] and -drive file=... to Q35 John Snow
2014-08-18 22:05 ` [Qemu-devel] [RFC 1/4] blockdev: add if_get_max_devs John Snow
2014-08-18 22:05 ` [Qemu-devel] [RFC 2/4] blockdev: add IF_AHCI to support -cdrom and -hd[a-d] John Snow
2014-08-18 22:05 ` John Snow [this message]
2014-08-18 22:05 ` [Qemu-devel] [RFC 4/4] ahci: implement " John Snow
2014-08-19 8:05 ` [Qemu-devel] [RFC 0/4] Adding -cdrom, -hd[abcd] and -drive file=... to Q35 Markus Armbruster
2014-08-19 15:56 ` John Snow
2014-08-19 18:08 ` Markus Armbruster
2014-08-19 18:59 ` John Snow
2014-08-20 7:22 ` Markus Armbruster
2014-08-19 16:12 ` Dr. David Alan Gilbert
2014-08-19 16:31 ` John Snow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1408399520-12778-4-git-send-email-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).