From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "John Snow" <jsnow@redhat.com>,
qemu-block@nongnu.org, qemu-arm@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Magnus Damm" <magnus.damm@gmail.com>
Subject: [PATCH v2 03/24] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h'
Date: Mon, 20 Feb 2023 10:13:37 +0100 [thread overview]
Message-ID: <20230220091358.17038-4-philmd@linaro.org> (raw)
In-Reply-To: <20230220091358.17038-1-philmd@linaro.org>
"hw/ide.h" is a mixed bag of lost IDE declarations.
Extract mmio_ide_init_drives() and the TYPE_MMIO_IDE QOM
declarations to a new "hw/ide/mmio.h" header.
Document the SysBus interface.
Message-Id: <20230215112712.23110-4-philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ide/mmio.c | 5 +----
hw/sh4/r2d.c | 4 ++--
include/hw/ide.h | 3 ---
include/hw/ide/mmio.h | 26 ++++++++++++++++++++++++++
4 files changed, 29 insertions(+), 9 deletions(-)
create mode 100644 include/hw/ide/mmio.h
diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c
index c33d42437f..8b2ba604c5 100644
--- a/hw/ide/mmio.c
+++ b/hw/ide/mmio.c
@@ -29,9 +29,9 @@
#include "qemu/module.h"
#include "sysemu/dma.h"
+#include "hw/ide/mmio.h"
#include "hw/ide/internal.h"
#include "hw/qdev-properties.h"
-#include "qom/object.h"
/***********************************************************/
/* MMIO based ide port
@@ -39,9 +39,6 @@
* dedicated ide controller, which is often seen on embedded boards.
*/
-#define TYPE_MMIO_IDE "mmio-ide"
-OBJECT_DECLARE_SIMPLE_TYPE(MmioIdeState, MMIO_IDE)
-
struct MmioIdeState {
/*< private >*/
SysBusDevice parent_obj;
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index 39fc4f19d9..7aaa11b748 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -38,7 +38,7 @@
#include "hw/qdev-properties.h"
#include "net/net.h"
#include "sh7750_regs.h"
-#include "hw/ide.h"
+#include "hw/ide/mmio.h"
#include "hw/irq.h"
#include "hw/loader.h"
#include "hw/usb.h"
@@ -283,7 +283,7 @@ static void r2d_init(MachineState *machine)
/* onboard CF (True IDE mode, Master only). */
dinfo = drive_get(IF_IDE, 0, 0);
- dev = qdev_new("mmio-ide");
+ dev = qdev_new(TYPE_MMIO_IDE);
busdev = SYS_BUS_DEVICE(dev);
sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
qdev_prop_set_uint32(dev, "shift", 1);
diff --git a/include/hw/ide.h b/include/hw/ide.h
index 60f1f4f714..5f8c36b2aa 100644
--- a/include/hw/ide.h
+++ b/include/hw/ide.h
@@ -8,9 +8,6 @@
ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
DriveInfo *hd0, DriveInfo *hd1);
-/* ide-mmio.c */
-void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1);
-
int ide_get_geometry(BusState *bus, int unit,
int16_t *cyls, int8_t *heads, int8_t *secs);
int ide_get_bios_chs_trans(BusState *bus, int unit);
diff --git a/include/hw/ide/mmio.h b/include/hw/ide/mmio.h
new file mode 100644
index 0000000000..fccfd17c79
--- /dev/null
+++ b/include/hw/ide/mmio.h
@@ -0,0 +1,26 @@
+/*
+ * QEMU IDE Emulation: mmio support (for embedded).
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ * Copyright (c) 2006 Openedhand Ltd.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#ifndef HW_IDE_MMIO_H
+#define HW_IDE_MMIO_H
+
+#include "qom/object.h"
+
+/*
+ * QEMU interface:
+ * + sysbus IRQ 0: asserted by the IDE channel
+ * + sysbus MMIO region 0: data registers
+ * + sysbus MMIO region 1: status & control registers
+ */
+#define TYPE_MMIO_IDE "mmio-ide"
+OBJECT_DECLARE_SIMPLE_TYPE(MmioIdeState, MMIO_IDE)
+
+void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1);
+
+#endif
--
2.38.1
next prev parent reply other threads:[~2023-02-20 9:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 01/24] MAINTAINERS: Mark IDE and Floppy as "Odd Fixes" Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 02/24] hw/ide/mmio: Use CamelCase for MMIO_IDE state name Philippe Mathieu-Daudé
2023-02-27 10:49 ` Alex Bennée
2023-02-20 9:13 ` Philippe Mathieu-Daudé [this message]
2023-02-20 9:13 ` [PATCH v2 04/24] hw/ide/isa: Rename isairq -> irqnum Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 05/24] hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h' Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 06/24] hw/ide/isa: Remove intermediate ISAIDEState::irq variable Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 07/24] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion Philippe Mathieu-Daudé
2023-02-27 11:12 ` Alex Bennée
2023-02-20 9:13 ` [PATCH v2 08/24] hw/ide: Remove unused 'qapi/qapi-types-run-state.h' Philippe Mathieu-Daudé
2023-02-27 11:13 ` Alex Bennée
2023-02-20 9:13 ` [PATCH v2 09/24] hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h' Philippe Mathieu-Daudé
2023-02-27 11:13 ` Alex Bennée
2023-02-20 9:13 ` [PATCH v2 10/24] hw/ide: Un-inline ide_set_irq() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 11/24] hw/ide: Rename ide_set_irq() -> ide_bus_set_irq() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 12/24] hw/ide: Rename ide_create_drive() -> ide_bus_create_drive() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 13/24] hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 14/24] hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 15/24] hw/ide: Rename ide_init2() -> ide_bus_init_output_irq() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 16/24] hw/ide: Rename idebus_active_if() -> ide_bus_active_if() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 17/24] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h' Philippe Mathieu-Daudé
2023-02-27 11:17 ` Alex Bennée
2023-02-27 11:22 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 18/24] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 19/24] hw/ide/ioport: Remove unnecessary includes Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 20/24] hw/ide/pci: Unexport bmdma_active_if() Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 21/24] hw/ide/piix: Remove unused includes Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 22/24] hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 23/24] hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 24/24] hw/ide/ahci: trace ncq write command as write instead of read Philippe Mathieu-Daudé
2023-02-24 22:23 ` [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
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=20230220091358.17038-4-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=jsnow@redhat.com \
--cc=magnus.damm@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=ysato@users.sourceforge.jp \
/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).