qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-block@nongnu.org,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 03/13] hw/ppc/sam460ex: Support short options for adding drives
Date: Tue, 12 Mar 2024 09:22:28 +0100	[thread overview]
Message-ID: <20240312082239.69696-4-philmd@linaro.org> (raw)
In-Reply-To: <20240312082239.69696-1-philmd@linaro.org>

From: BALATON Zoltan <balaton@eik.bme.hu>

Having to use -drive if=none,... and -device ide-[cd,hd] is
inconvenient. Add support for shorter convenience options such as
-cdrom and -drive media=disk. Also adjust two nearby comments for code
style.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20240305225721.E9A404E6005@zero.eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/sam460ex.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index 7e34b6c5e0..d42b677898 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -33,6 +33,7 @@
 #include "hw/char/serial.h"
 #include "hw/i2c/ppc4xx_i2c.h"
 #include "hw/i2c/smbus_eeprom.h"
+#include "hw/ide/pci.h"
 #include "hw/usb/hcd-ehci.h"
 #include "hw/ppc/fdt.h"
 #include "hw/qdev-properties.h"
@@ -449,15 +450,27 @@ static void sam460ex_init(MachineState *machine)
 
     /* PCI devices */
     pci_create_simple(pci_bus, PCI_DEVFN(6, 0), "sm501");
-    /* SoC has a single SATA port but we don't emulate that yet
+    /*
+     * SoC has a single SATA port but we don't emulate that
      * However, firmware and usual clients have driver for SiI311x
-     * so add one for convenience by default */
+     * PCI SATA card so add one for convenience by default
+     */
     if (defaults_enabled()) {
-        pci_create_simple(pci_bus, -1, "sii3112");
+        PCIIDEState *s = PCI_IDE(pci_create_simple(pci_bus, -1, "sii3112"));
+        DriveInfo *di;
+
+        di = drive_get_by_index(IF_IDE, 0);
+        if (di) {
+            ide_bus_create_drive(&s->bus[0], 0, di);
+        }
+        /* Use index 2 only if 1 does not exist, this allows -cdrom */
+        di = drive_get_by_index(IF_IDE, 1) ?: drive_get_by_index(IF_IDE, 2);
+        if (di) {
+            ide_bus_create_drive(&s->bus[1], 0, di);
+        }
     }
 
-    /* SoC has 4 UARTs
-     * but board has only one wired and two are present in fdt */
+    /* SoC has 4 UARTs but board has only one wired and two described in fdt */
     if (serial_hd(0) != NULL) {
         serial_mm_init(get_system_memory(), 0x4ef600300, 0,
                        qdev_get_gpio_in(uic[1], 1),
@@ -531,6 +544,7 @@ static void sam460ex_machine_init(MachineClass *mc)
 {
     mc->desc = "aCube Sam460ex";
     mc->init = sam460ex_init;
+    mc->block_default_type = IF_IDE;
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("460exb");
     mc->default_ram_size = 512 * MiB;
     mc->default_ram_id = "ppc4xx.sdram";
-- 
2.41.0



  parent reply	other threads:[~2024-03-12  8:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12  8:22 [PULL 00/13] Misc HW patches for 2024-03-12 Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 01/13] hw/ide/ahci: Rename ahci_internal.h to ahci-internal.h Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 02/13] hw/pci: add some convenient trace-events for pcie and shpc hotplug Philippe Mathieu-Daudé
2024-03-12  8:22 ` Philippe Mathieu-Daudé [this message]
2024-03-12  8:22 ` [PULL 04/13] hw/core/loader-fit: Fix missing ERRP_GUARD() for error_prepend() Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 05/13] hw/core/qdev-properties-system: " Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 06/13] hw/misc/ivshmem: " Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 07/13] sun4u: remap ebus BAR0 to use unassigned_io_ops instead of alias to PCI IO space Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 08/13] hw/core: Cleanup unused included headers in cpu-common.c Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 09/13] hw/core: Cleanup unused included header in machine-qmp-cmds.c Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 10/13] hw/core: Cleanup unused included headers in numa.c Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 11/13] hw/gpio: introduce pcf8574 driver Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 12/13] meson.build: Always require an objc compiler on macos hosts Philippe Mathieu-Daudé
2024-03-12  8:22 ` [PULL 13/13] docs/about/deprecated.rst: Move SMP configurations item to system emulator section Philippe Mathieu-Daudé
2024-03-12 16:28 ` [PULL 00/13] Misc HW patches for 2024-03-12 Peter Maydell

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=20240312082239.69696-4-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=balaton@eik.bme.hu \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).