* [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping
@ 2023-02-20 9:13 Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 01/24] MAINTAINERS: Mark IDE and Floppy as "Odd Fixes" Philippe Mathieu-Daudé
` (24 more replies)
0 siblings, 25 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé
Missing review: 2, 17, 20
Since v1:
- addressed review comments
John, can I get your formal Ack?
Thanks,
Phil.
Bernhard Beschow (1):
hw/ide/pci: Unexport bmdma_active_if()
Fiona Ebner (1):
hw/ide/ahci: trace ncq write command as write instead of read
John Snow (1):
MAINTAINERS: Mark IDE and Floppy as "Odd Fixes"
Philippe Mathieu-Daudé (21):
hw/ide/mmio: Use CamelCase for MMIO_IDE state name
hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h'
hw/ide/isa: Rename isairq -> irqnum
hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h'
hw/ide/isa: Remove intermediate ISAIDEState::irq variable
hw/ide/atapi: Restrict 'scsi/constants.h' inclusion
hw/ide: Remove unused 'qapi/qapi-types-run-state.h'
hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'
hw/ide: Un-inline ide_set_irq()
hw/ide: Rename ide_set_irq() -> ide_bus_set_irq()
hw/ide: Rename ide_create_drive() -> ide_bus_create_drive()
hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb
hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd()
hw/ide: Rename ide_init2() -> ide_bus_init_output_irq()
hw/ide: Rename idebus_active_if() -> ide_bus_active_if()
hw/ide: Declare ide_get_[geometry/bios_chs_trans] in
'hw/ide/internal.h'
hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa
hw/ide/ioport: Remove unnecessary includes
hw/ide/piix: Remove unused includes
hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg
hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus
MAINTAINERS | 4 +-
hw/arm/sbsa-ref.c | 2 +-
hw/i386/pc.c | 3 +-
hw/i386/pc_piix.c | 1 +
hw/ide/ahci.c | 13 ++++---
hw/ide/atapi.c | 13 ++++---
hw/ide/cmd646.c | 4 +-
hw/ide/core.c | 80 +++++++++++++++++++++------------------
hw/ide/ich.c | 1 +
hw/ide/ioport.c | 14 ++-----
hw/ide/isa.c | 24 +++++-------
hw/ide/macio.c | 15 ++++----
hw/ide/microdrive.c | 9 +++--
hw/ide/mmio.c | 39 +++++++++----------
hw/ide/pci.c | 11 +++++-
hw/ide/piix.c | 47 ++++++++++-------------
hw/ide/qdev.c | 2 +-
hw/ide/sii3112.c | 4 +-
hw/ide/trace-events | 3 +-
hw/ide/via.c | 4 +-
hw/misc/macio/gpio.c | 1 +
hw/sh4/r2d.c | 4 +-
hw/sparc64/sun4u.c | 1 +
include/hw/ide.h | 12 ------
include/hw/ide/internal.h | 30 ++++++---------
include/hw/ide/isa.h | 23 +++++++++++
include/hw/ide/mmio.h | 26 +++++++++++++
include/hw/ide/pci.h | 6 ---
28 files changed, 212 insertions(+), 184 deletions(-)
create mode 100644 include/hw/ide/isa.h
create mode 100644 include/hw/ide/mmio.h
--
2.38.1
^ permalink raw reply [flat|nested] 32+ messages in thread
* [PATCH v2 01/24] MAINTAINERS: Mark IDE and Floppy as "Odd Fixes"
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (23 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm, Alex Bennée,
Philippe Mathieu-Daudé
From: John Snow <jsnow@redhat.com>
I have not been able to give these devices the love they need for a
while now. Update the maintainers file to reflect the truth of the
matter.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20230206182544.711117-1-jsnow@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index fd54c1f140..0612fff63b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1791,7 +1791,7 @@ F: hw/misc/edu.c
IDE
M: John Snow <jsnow@redhat.com>
L: qemu-block@nongnu.org
-S: Supported
+S: Odd Fixes
F: include/hw/ide.h
F: include/hw/ide/
F: hw/ide/
@@ -1816,7 +1816,7 @@ T: git https://github.com/cminyard/qemu.git master-ipmi-rebase
Floppy
M: John Snow <jsnow@redhat.com>
L: qemu-block@nongnu.org
-S: Supported
+S: Odd Fixes
F: hw/block/fdc.c
F: hw/block/fdc-internal.h
F: hw/block/fdc-isa.c
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 02/24] hw/ide/mmio: Use CamelCase for MMIO_IDE state name
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 ` Philippe Mathieu-Daudé
2023-02-27 10:49 ` Alex Bennée
2023-02-20 9:13 ` [PATCH v2 03/24] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h' Philippe Mathieu-Daudé
` (22 subsequent siblings)
24 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé
Following docs/devel/style.rst guidelines, rename MMIOIDEState
as MmioIdeState.
Having the structure name and its typedef named equally,
we can manually convert from the old DECLARE_INSTANCE_CHECKER()
macro to the more recent OBJECT_DECLARE_SIMPLE_TYPE().
Note, due to that name mismatch, this macro wasn't automatically
converted during commit 8063396bf3 ("Use OBJECT_DECLARE_SIMPLE_TYPE
when possible").
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ide/mmio.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c
index fb2ebd4847..c33d42437f 100644
--- a/hw/ide/mmio.c
+++ b/hw/ide/mmio.c
@@ -40,11 +40,9 @@
*/
#define TYPE_MMIO_IDE "mmio-ide"
-typedef struct MMIOIDEState MMIOState;
-DECLARE_INSTANCE_CHECKER(MMIOState, MMIO_IDE,
- TYPE_MMIO_IDE)
+OBJECT_DECLARE_SIMPLE_TYPE(MmioIdeState, MMIO_IDE)
-struct MMIOIDEState {
+struct MmioIdeState {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
@@ -58,7 +56,7 @@ struct MMIOIDEState {
static void mmio_ide_reset(DeviceState *dev)
{
- MMIOState *s = MMIO_IDE(dev);
+ MmioIdeState *s = MMIO_IDE(dev);
ide_bus_reset(&s->bus);
}
@@ -66,7 +64,7 @@ static void mmio_ide_reset(DeviceState *dev)
static uint64_t mmio_ide_read(void *opaque, hwaddr addr,
unsigned size)
{
- MMIOState *s = opaque;
+ MmioIdeState *s = opaque;
addr >>= s->shift;
if (addr & 7)
return ide_ioport_read(&s->bus, addr);
@@ -77,7 +75,7 @@ static uint64_t mmio_ide_read(void *opaque, hwaddr addr,
static void mmio_ide_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
- MMIOState *s = opaque;
+ MmioIdeState *s = opaque;
addr >>= s->shift;
if (addr & 7)
ide_ioport_write(&s->bus, addr, val);
@@ -94,14 +92,14 @@ static const MemoryRegionOps mmio_ide_ops = {
static uint64_t mmio_ide_status_read(void *opaque, hwaddr addr,
unsigned size)
{
- MMIOState *s= opaque;
+ MmioIdeState *s= opaque;
return ide_status_read(&s->bus, 0);
}
static void mmio_ide_ctrl_write(void *opaque, hwaddr addr,
uint64_t val, unsigned size)
{
- MMIOState *s = opaque;
+ MmioIdeState *s = opaque;
ide_ctrl_write(&s->bus, 0, val);
}
@@ -116,8 +114,8 @@ static const VMStateDescription vmstate_ide_mmio = {
.version_id = 3,
.minimum_version_id = 0,
.fields = (VMStateField[]) {
- VMSTATE_IDE_BUS(bus, MMIOState),
- VMSTATE_IDE_DRIVES(bus.ifs, MMIOState),
+ VMSTATE_IDE_BUS(bus, MmioIdeState),
+ VMSTATE_IDE_DRIVES(bus.ifs, MmioIdeState),
VMSTATE_END_OF_LIST()
}
};
@@ -125,7 +123,7 @@ static const VMStateDescription vmstate_ide_mmio = {
static void mmio_ide_realizefn(DeviceState *dev, Error **errp)
{
SysBusDevice *d = SYS_BUS_DEVICE(dev);
- MMIOState *s = MMIO_IDE(dev);
+ MmioIdeState *s = MMIO_IDE(dev);
ide_init2(&s->bus, s->irq);
@@ -140,14 +138,14 @@ static void mmio_ide_realizefn(DeviceState *dev, Error **errp)
static void mmio_ide_initfn(Object *obj)
{
SysBusDevice *d = SYS_BUS_DEVICE(obj);
- MMIOState *s = MMIO_IDE(obj);
+ MmioIdeState *s = MMIO_IDE(obj);
ide_bus_init(&s->bus, sizeof(s->bus), DEVICE(obj), 0, 2);
sysbus_init_irq(d, &s->irq);
}
static Property mmio_ide_properties[] = {
- DEFINE_PROP_UINT32("shift", MMIOState, shift, 0),
+ DEFINE_PROP_UINT32("shift", MmioIdeState, shift, 0),
DEFINE_PROP_END_OF_LIST()
};
@@ -164,7 +162,7 @@ static void mmio_ide_class_init(ObjectClass *oc, void *data)
static const TypeInfo mmio_ide_type_info = {
.name = TYPE_MMIO_IDE,
.parent = TYPE_SYS_BUS_DEVICE,
- .instance_size = sizeof(MMIOState),
+ .instance_size = sizeof(MmioIdeState),
.instance_init = mmio_ide_initfn,
.class_init = mmio_ide_class_init,
};
@@ -176,7 +174,7 @@ static void mmio_ide_register_types(void)
void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1)
{
- MMIOState *s = MMIO_IDE(dev);
+ MmioIdeState *s = MMIO_IDE(dev);
if (hd0 != NULL) {
ide_create_drive(&s->bus, 0, hd0);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 03/24] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h'
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-20 9:13 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 04/24] hw/ide/isa: Rename isairq -> irqnum Philippe Mathieu-Daudé
` (21 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Yoshinori Sato, Magnus Damm
"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
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 04/24] hw/ide/isa: Rename isairq -> irqnum
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 03/24] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h' Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (20 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson, Bernhard Beschow
Rename ISAIDEState::isairq as 'irqnum' to emphasize this is
not a qemu_irq object but the number (index) of an ISA IRQ.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-5-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
---
hw/ide/isa.c | 10 +++++-----
include/hw/ide.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 8bedbd13f1..b434cbd0e9 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -46,7 +46,7 @@ struct ISAIDEState {
IDEBus bus;
uint32_t iobase;
uint32_t iobase2;
- uint32_t isairq;
+ uint32_t irqnum;
qemu_irq irq;
};
@@ -75,13 +75,13 @@ static void isa_ide_realizefn(DeviceState *dev, Error **errp)
ide_bus_init(&s->bus, sizeof(s->bus), dev, 0, 2);
ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2);
- s->irq = isa_get_irq(isadev, s->isairq);
+ s->irq = isa_get_irq(isadev, s->irqnum);
ide_init2(&s->bus, s->irq);
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s);
ide_register_restart_cb(&s->bus);
}
-ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
+ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
DriveInfo *hd0, DriveInfo *hd1)
{
DeviceState *dev;
@@ -92,7 +92,7 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
dev = DEVICE(isadev);
qdev_prop_set_uint32(dev, "iobase", iobase);
qdev_prop_set_uint32(dev, "iobase2", iobase2);
- qdev_prop_set_uint32(dev, "irq", isairq);
+ qdev_prop_set_uint32(dev, "irq", irqnum);
isa_realize_and_unref(isadev, bus, &error_fatal);
s = ISA_IDE(dev);
@@ -108,7 +108,7 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
static Property isa_ide_properties[] = {
DEFINE_PROP_UINT32("iobase", ISAIDEState, iobase, 0x1f0),
DEFINE_PROP_UINT32("iobase2", ISAIDEState, iobase2, 0x3f6),
- DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, 14),
+ DEFINE_PROP_UINT32("irq", ISAIDEState, irqnum, 14),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/ide.h b/include/hw/ide.h
index 5f8c36b2aa..09fe169ebb 100644
--- a/include/hw/ide.h
+++ b/include/hw/ide.h
@@ -5,7 +5,7 @@
#include "exec/memory.h"
/* ide-isa.c */
-ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
+ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
DriveInfo *hd0, DriveInfo *hd1);
int ide_get_geometry(BusState *bus, int unit,
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 05/24] hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h'
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 04/24] hw/ide/isa: Rename isairq -> irqnum Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 06/24] hw/ide/isa: Remove intermediate ISAIDEState::irq variable Philippe Mathieu-Daudé
` (19 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson, Bernhard Beschow,
Paolo Bonzini, Eduardo Habkost, Michael S. Tsirkin,
Marcel Apfelbaum
"hw/ide.h" is a mixed bag of lost IDE declarations.
Extract isa_ide_init() and the TYPE_ISA_IDE QOM declarations
to a new "hw/ide/isa.h" header.
Message-Id: <20230215112712.23110-5-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc_piix.c | 1 +
hw/ide/isa.c | 4 +---
include/hw/ide.h | 5 -----
include/hw/ide/isa.h | 20 ++++++++++++++++++++
4 files changed, 22 insertions(+), 8 deletions(-)
create mode 100644 include/hw/ide/isa.h
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index df64dd8dcc..7085b4bc58 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -39,6 +39,7 @@
#include "hw/pci/pci_ids.h"
#include "hw/usb.h"
#include "net/net.h"
+#include "hw/ide/isa.h"
#include "hw/ide/pci.h"
#include "hw/ide/piix.h"
#include "hw/irq.h"
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index b434cbd0e9..5c3e83a0fc 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -31,15 +31,13 @@
#include "qemu/module.h"
#include "sysemu/dma.h"
+#include "hw/ide/isa.h"
#include "hw/ide/internal.h"
#include "qom/object.h"
/***********************************************************/
/* ISA IDE definitions */
-#define TYPE_ISA_IDE "isa-ide"
-OBJECT_DECLARE_SIMPLE_TYPE(ISAIDEState, ISA_IDE)
-
struct ISAIDEState {
ISADevice parent_obj;
diff --git a/include/hw/ide.h b/include/hw/ide.h
index 09fe169ebb..24a7aa2925 100644
--- a/include/hw/ide.h
+++ b/include/hw/ide.h
@@ -1,13 +1,8 @@
#ifndef HW_IDE_H
#define HW_IDE_H
-#include "hw/isa/isa.h"
#include "exec/memory.h"
-/* ide-isa.c */
-ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
- 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/isa.h b/include/hw/ide/isa.h
new file mode 100644
index 0000000000..1cd0ff1fa6
--- /dev/null
+++ b/include/hw/ide/isa.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU IDE Emulation: ISA Bus support.
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ * Copyright (c) 2006 Openedhand Ltd.
+ *
+ * SPDX-License-Identifier: MIT
+ */
+#ifndef HW_IDE_ISA_H
+#define HW_IDE_ISA_H
+
+#include "qom/object.h"
+
+#define TYPE_ISA_IDE "isa-ide"
+OBJECT_DECLARE_SIMPLE_TYPE(ISAIDEState, ISA_IDE)
+
+ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
+ DriveInfo *hd0, DriveInfo *hd1);
+
+#endif
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 06/24] hw/ide/isa: Remove intermediate ISAIDEState::irq variable
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (4 preceding siblings ...)
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 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 07/24] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion Philippe Mathieu-Daudé
` (18 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Bernhard Beschow, Richard Henderson
The intermediate ISAIDEState::irq variable just add noise, remove it.
Message-Id: <20230215112712.23110-6-philmd@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ide/isa.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 5c3e83a0fc..ad47e0899e 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -45,7 +45,6 @@ struct ISAIDEState {
uint32_t iobase;
uint32_t iobase2;
uint32_t irqnum;
- qemu_irq irq;
};
static void isa_ide_reset(DeviceState *d)
@@ -73,8 +72,7 @@ static void isa_ide_realizefn(DeviceState *dev, Error **errp)
ide_bus_init(&s->bus, sizeof(s->bus), dev, 0, 2);
ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2);
- s->irq = isa_get_irq(isadev, s->irqnum);
- ide_init2(&s->bus, s->irq);
+ ide_init2(&s->bus, isa_get_irq(isadev, s->irqnum));
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s);
ide_register_restart_cb(&s->bus);
}
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 07/24] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (5 preceding siblings ...)
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 ` 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é
` (17 subsequent siblings)
24 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Only atapi.c requires the SCSI constants. No need to include
it in all files including "hw/ide/internal.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-7-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/atapi.c | 1 +
include/hw/ide/internal.h | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 0a9aa6f009..0c36bd0afd 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -27,6 +27,7 @@
#include "hw/ide/internal.h"
#include "hw/scsi/scsi.h"
#include "sysemu/block-backend.h"
+#include "scsi/constants.h"
#include "trace.h"
#define ATAPI_SECTOR_BITS (2 + BDRV_SECTOR_BITS)
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index fc0aa81a88..29a8e79817 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -13,7 +13,6 @@
#include "hw/isa/isa.h"
#include "sysemu/dma.h"
#include "hw/block/block.h"
-#include "scsi/constants.h"
/* debug IDE devices */
#define USE_DMA_CDROM
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 08/24] hw/ide: Remove unused 'qapi/qapi-types-run-state.h'
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 07/24] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (16 subsequent siblings)
24 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Missed in commit d7458e7754 ("hw/ide/internal: Remove unused
DMARestartFunc typedef") which removed the single use of RunState.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-8-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
include/hw/ide/internal.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 29a8e79817..e6deb1c5dc 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -7,7 +7,6 @@
* non-internal declarations are in hw/ide.h
*/
-#include "qapi/qapi-types-run-state.h"
#include "hw/ide.h"
#include "hw/irq.h"
#include "hw/isa/isa.h"
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 09/24] hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 08/24] hw/ide: Remove unused 'qapi/qapi-types-run-state.h' Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (15 subsequent siblings)
24 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
The IDEBus structure has PortioList fields, so we need its
declarations from "exec/ioport.h". "hw/isa/isa.h" is not required.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-9-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
include/hw/ide/internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index e6deb1c5dc..84d3722d67 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -9,9 +9,9 @@
#include "hw/ide.h"
#include "hw/irq.h"
-#include "hw/isa/isa.h"
#include "sysemu/dma.h"
#include "hw/block/block.h"
+#include "exec/ioport.h"
/* debug IDE devices */
#define USE_DMA_CDROM
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 10/24] hw/ide: Un-inline ide_set_irq()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (8 preceding siblings ...)
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-20 9:13 ` 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é
` (14 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson, Mark Cave-Ayland,
Artyom Tarasenko
Only include "hw/irq.h" where appropriate.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-10-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/ahci.c | 1 +
hw/ide/core.c | 8 ++++++++
hw/ide/ich.c | 1 +
hw/ide/macio.c | 1 +
hw/ide/microdrive.c | 1 +
hw/ide/pci.c | 1 +
hw/misc/macio/gpio.c | 1 +
hw/sparc64/sun4u.c | 1 +
include/hw/ide/internal.h | 9 +--------
9 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 7ce001cacd..3e21f607fe 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -22,6 +22,7 @@
*/
#include "qemu/osdep.h"
+#include "hw/irq.h"
#include "hw/pci/msi.h"
#include "hw/pci/pci.h"
#include "hw/qdev-properties.h"
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 5d1039378f..1473b6057f 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -24,6 +24,7 @@
*/
#include "qemu/osdep.h"
+#include "hw/irq.h"
#include "hw/isa/isa.h"
#include "migration/vmstate.h"
#include "qemu/error-report.h"
@@ -2782,6 +2783,13 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
bus->dma = &ide_dma_nop;
}
+void ide_set_irq(IDEBus *bus)
+{
+ if (!(bus->cmd & IDE_CTRL_DISABLE_IRQ)) {
+ qemu_irq_raise(bus->irq);
+ }
+}
+
void ide_exit(IDEState *s)
{
timer_free(s->sector_write_timer);
diff --git a/hw/ide/ich.c b/hw/ide/ich.c
index 1007a51fcb..d61faab532 100644
--- a/hw/ide/ich.c
+++ b/hw/ide/ich.c
@@ -61,6 +61,7 @@
*/
#include "qemu/osdep.h"
+#include "hw/irq.h"
#include "hw/pci/msi.h"
#include "hw/pci/pci.h"
#include "migration/vmstate.h"
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index e604466acb..15fd934831 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -24,6 +24,7 @@
*/
#include "qemu/osdep.h"
+#include "hw/irq.h"
#include "hw/ppc/mac_dbdma.h"
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 56c5be3655..b9822b939b 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -29,6 +29,7 @@
#include "qapi/error.h"
#include "qemu/module.h"
#include "sysemu/dma.h"
+#include "hw/irq.h"
#include "hw/ide/internal.h"
#include "qom/object.h"
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 84ba733548..ae638dee0d 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -24,6 +24,7 @@
*/
#include "qemu/osdep.h"
+#include "hw/irq.h"
#include "hw/pci/pci.h"
#include "migration/vmstate.h"
#include "sysemu/dma.h"
diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c
index c8ac5633b2..4deb330471 100644
--- a/hw/misc/macio/gpio.c
+++ b/hw/misc/macio/gpio.c
@@ -28,6 +28,7 @@
#include "migration/vmstate.h"
#include "hw/misc/macio/macio.h"
#include "hw/misc/macio/gpio.h"
+#include "hw/irq.h"
#include "hw/nmi.h"
#include "qemu/log.h"
#include "qemu/module.h"
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 387181ff77..cb2d0fbbe7 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -28,6 +28,7 @@
#include "qapi/error.h"
#include "qemu/datadir.h"
#include "cpu.h"
+#include "hw/irq.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_bridge.h"
#include "hw/pci/pci_bus.h"
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 84d3722d67..57a6278327 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -8,7 +8,6 @@
*/
#include "hw/ide.h"
-#include "hw/irq.h"
#include "sysemu/dma.h"
#include "hw/block/block.h"
#include "exec/ioport.h"
@@ -572,13 +571,6 @@ static inline IDEState *idebus_active_if(IDEBus *bus)
return bus->ifs + bus->unit;
}
-static inline void ide_set_irq(IDEBus *bus)
-{
- if (!(bus->cmd & IDE_CTRL_DISABLE_IRQ)) {
- qemu_irq_raise(bus->irq);
- }
-}
-
/* hw/ide/core.c */
extern const VMStateDescription vmstate_ide_bus;
@@ -627,6 +619,7 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_exit(IDEState *s);
int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
+void ide_set_irq(IDEBus *bus);
void ide_register_restart_cb(IDEBus *bus);
void ide_exec_cmd(IDEBus *bus, uint32_t val);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 11/24] hw/ide: Rename ide_set_irq() -> ide_bus_set_irq()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 10/24] hw/ide: Un-inline ide_set_irq() Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (13 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
ide_set_irq() operates on a IDEBus; rename it as
ide_bus_set_irq() to emphasize its first argument
is a IDEBus.
Mechanical change using:
$ sed -i -e 's/ide_set_irq/ide_bus_set_irq/g' \
$(git grep -l ide_set_irq)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-11-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/atapi.c | 12 +++++------
hw/ide/core.c | 44 +++++++++++++++++++--------------------
hw/ide/macio.c | 2 +-
include/hw/ide/internal.h | 2 +-
4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 0c36bd0afd..dcc39df9a4 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -179,7 +179,7 @@ void ide_atapi_cmd_ok(IDEState *s)
s->status = READY_STAT | SEEK_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
ide_transfer_stop(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
void ide_atapi_cmd_error(IDEState *s, int sense_key, int asc)
@@ -191,7 +191,7 @@ void ide_atapi_cmd_error(IDEState *s, int sense_key, int asc)
s->sense_key = sense_key;
s->asc = asc;
ide_transfer_stop(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
void ide_atapi_io_error(IDEState *s, int ret)
@@ -254,7 +254,7 @@ void ide_atapi_cmd_reply_end(IDEState *s)
} else {
/* a new transfer is needed */
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
byte_count_limit = atapi_byte_count_limit(s);
trace_ide_atapi_cmd_reply_end_bcl(s, byte_count_limit);
size = s->packet_transfer_size;
@@ -294,7 +294,7 @@ void ide_atapi_cmd_reply_end(IDEState *s)
/* end of transfer */
trace_ide_atapi_cmd_reply_end_eot(s, s->status);
ide_atapi_cmd_ok(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
/* send a reply of 'size' bytes in s->io_buffer to an ATAPI command */
@@ -340,7 +340,7 @@ static void ide_atapi_cmd_check_status(IDEState *s)
s->error = MC_ERR | (UNIT_ATTENTION << 4);
s->status = ERR_STAT;
s->nsector = 0;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
/* ATAPI DMA support */
@@ -384,7 +384,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)
if (s->packet_transfer_size <= 0) {
s->status = READY_STAT | SEEK_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
goto eot;
}
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 1473b6057f..117e26cef1 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -654,7 +654,7 @@ void ide_set_sector(IDEState *s, int64_t sector_num)
static void ide_rw_error(IDEState *s) {
ide_abort_command(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
static void ide_buffered_readv_cb(void *opaque, int ret)
@@ -773,7 +773,7 @@ static void ide_sector_read_cb(void *opaque, int ret)
s->nsector -= n;
/* Allow the guest to read the io_buffer */
ide_transfer_start(s, s->io_buffer, n * BDRV_SECTOR_SIZE, ide_sector_read);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
static void ide_sector_read(IDEState *s)
@@ -837,7 +837,7 @@ void ide_dma_error(IDEState *s)
dma_buf_commit(s, 0);
ide_abort_command(s);
ide_set_inactive(s, false);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
int ide_handle_rw_error(IDEState *s, int error, int op)
@@ -907,7 +907,7 @@ static void ide_dma_cb(void *opaque, int ret)
/* end of transfer ? */
if (s->nsector == 0) {
s->status = READY_STAT | SEEK_STAT;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
goto eot;
}
@@ -1007,7 +1007,7 @@ static void ide_sector_write(IDEState *s);
static void ide_sector_write_timer_cb(void *opaque)
{
IDEState *s = opaque;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
static void ide_sector_write_cb(void *opaque, int ret)
@@ -1055,7 +1055,7 @@ static void ide_sector_write_cb(void *opaque, int ret)
timer_mod(s->sector_write_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
(NANOSECONDS_PER_SECOND / 1000));
} else {
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
}
@@ -1106,7 +1106,7 @@ static void ide_flush_cb(void *opaque, int ret)
}
s->status = READY_STAT | SEEK_STAT;
ide_cmd_done(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
static void ide_flush_cache(IDEState *s)
@@ -1195,7 +1195,7 @@ static void ide_cd_change_cb(void *opaque, bool load, Error **errp)
s->cdrom_changed = 1;
s->events.new_media = true;
s->events.eject_request = false;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
static void ide_cd_eject_request_cb(void *opaque, bool force)
@@ -1206,7 +1206,7 @@ static void ide_cd_eject_request_cb(void *opaque, bool force)
if (force) {
s->tray_locked = false;
}
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
static void ide_cmd_lba48_transform(IDEState *s, int lba48)
@@ -1440,7 +1440,7 @@ static bool cmd_identify(IDEState *s, uint8_t cmd)
}
s->status = READY_STAT | SEEK_STAT;
ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
} else {
if (s->drive_kind == IDE_CD) {
@@ -1630,7 +1630,7 @@ static bool cmd_specify(IDEState *s, uint8_t cmd)
if (s->blk && s->drive_kind != IDE_CD) {
s->heads = (s->select & (ATA_DEV_HS)) + 1;
s->sectors = s->nsector;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
} else {
ide_abort_command(s);
}
@@ -1731,7 +1731,7 @@ static bool cmd_identify_packet(IDEState *s, uint8_t cmd)
ide_atapi_identify(s);
s->status = READY_STAT | SEEK_STAT;
ide_transfer_start(s, s->io_buffer, 512, ide_transfer_stop);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
}
@@ -1756,7 +1756,7 @@ static bool cmd_exec_dev_diagnostic(IDEState *s, uint8_t cmd)
* They are part of the regular output (this is why ERR_STAT isn't set)
* Device 0 passed, Device 1 passed or not present. */
s->error = 0x01;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
return false;
@@ -1788,7 +1788,7 @@ static bool cmd_cfa_req_ext_error_code(IDEState *s, uint8_t cmd)
{
s->error = 0x09; /* miscellaneous error */
s->status = READY_STAT | SEEK_STAT;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
}
@@ -1827,7 +1827,7 @@ static bool cmd_cfa_translate_sector(IDEState *s, uint8_t cmd)
s->io_buffer[0x1a] = 0x01; /* Hot count */
ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
}
@@ -1851,7 +1851,7 @@ static bool cmd_cfa_access_metadata_storage(IDEState *s, uint8_t cmd)
ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop);
s->status = 0x00; /* NOTE: READY is _not_ set */
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
}
@@ -1934,7 +1934,7 @@ static bool cmd_smart(IDEState *s, uint8_t cmd)
s->status = READY_STAT | SEEK_STAT;
ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
case SMART_READ_DATA:
@@ -1975,7 +1975,7 @@ static bool cmd_smart(IDEState *s, uint8_t cmd)
s->status = READY_STAT | SEEK_STAT;
ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
case SMART_READ_LOG:
@@ -2014,7 +2014,7 @@ static bool cmd_smart(IDEState *s, uint8_t cmd)
}
s->status = READY_STAT | SEEK_STAT;
ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return false;
case SMART_EXECUTE_OFFLINE:
@@ -2146,7 +2146,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
if (!ide_cmd_permitted(s, val)) {
ide_abort_command(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
return;
}
@@ -2164,7 +2164,7 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
}
ide_cmd_done(s);
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
}
}
@@ -2783,7 +2783,7 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
bus->dma = &ide_dma_nop;
}
-void ide_set_irq(IDEBus *bus)
+void ide_bus_set_irq(IDEBus *bus)
{
if (!(bus->cmd & IDE_CTRL_DISABLE_IRQ)) {
qemu_irq_raise(bus->irq);
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 15fd934831..24fb7a3f9d 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -160,7 +160,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
MACIO_DPRINTF("End of IDE transfer\n");
qemu_sglist_destroy(&s->sg);
s->status = READY_STAT | SEEK_STAT;
- ide_set_irq(s->bus);
+ ide_bus_set_irq(s->bus);
m->dma_active = false;
goto done;
}
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 57a6278327..7b4b71d0b0 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -619,7 +619,7 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_exit(IDEState *s);
int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
-void ide_set_irq(IDEBus *bus);
+void ide_bus_set_irq(IDEBus *bus);
void ide_register_restart_cb(IDEBus *bus);
void ide_exec_cmd(IDEBus *bus, uint32_t val);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 12/24] hw/ide: Rename ide_create_drive() -> ide_bus_create_drive()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (10 preceding siblings ...)
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 ` 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é
` (12 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson,
Radoslaw Biernacki, Peter Maydell, Leif Lindholm
ide_create_drive() operates on a IDEBus; rename it as
ide_bus_create_drive() to emphasize its first argument
is a IDEBus.
Mechanical change using:
$ sed -i -e 's/ide_create_drive/ide_bus_create_drive/g' \
$(git grep -wl ide_create_drive)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-12-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/arm/sbsa-ref.c | 2 +-
hw/ide/ahci.c | 2 +-
hw/ide/isa.c | 4 ++--
hw/ide/macio.c | 2 +-
hw/ide/microdrive.c | 2 +-
hw/ide/mmio.c | 4 ++--
hw/ide/pci.c | 2 +-
hw/ide/qdev.c | 2 +-
include/hw/ide/internal.h | 2 +-
9 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index f778cb6d09..0b93558dde 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -554,7 +554,7 @@ static void create_ahci(const SBSAMachineState *sms)
if (hd[i] == NULL) {
continue;
}
- ide_create_drive(&ahci->dev[i].port, 0, hd[i]);
+ ide_bus_create_drive(&ahci->dev[i].port, 0, hd[i]);
}
}
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 3e21f607fe..90fea5d059 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1842,7 +1842,7 @@ void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd)
if (hd[i] == NULL) {
continue;
}
- ide_create_drive(&ahci->dev[i].port, 0, hd[i]);
+ ide_bus_create_drive(&ahci->dev[i].port, 0, hd[i]);
}
}
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index ad47e0899e..74f7b43137 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -93,10 +93,10 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
s = ISA_IDE(dev);
if (hd0) {
- ide_create_drive(&s->bus, 0, hd0);
+ ide_bus_create_drive(&s->bus, 0, hd0);
}
if (hd1) {
- ide_create_drive(&s->bus, 1, hd1);
+ ide_bus_create_drive(&s->bus, 1, hd1);
}
return isadev;
}
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 24fb7a3f9d..7efbbc720a 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -501,7 +501,7 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo **hd_table)
for (i = 0; i < 2; i++) {
if (hd_table[i]) {
- ide_create_drive(&s->bus, i, hd_table[i]);
+ ide_bus_create_drive(&s->bus, i, hd_table[i]);
}
}
}
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index b9822b939b..08504b499f 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -566,7 +566,7 @@ PCMCIACardState *dscm1xxxx_init(DriveInfo *dinfo)
qdev_realize(DEVICE(md), NULL, &error_fatal);
if (dinfo != NULL) {
- ide_create_drive(&md->bus, 0, dinfo);
+ ide_bus_create_drive(&md->bus, 0, dinfo);
}
md->bus.ifs[0].drive_kind = IDE_CFATA;
md->bus.ifs[0].mdata_size = METADATA_SIZE;
diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c
index 8b2ba604c5..d650dcee4d 100644
--- a/hw/ide/mmio.c
+++ b/hw/ide/mmio.c
@@ -174,10 +174,10 @@ void mmio_ide_init_drives(DeviceState *dev, DriveInfo *hd0, DriveInfo *hd1)
MmioIdeState *s = MMIO_IDE(dev);
if (hd0 != NULL) {
- ide_create_drive(&s->bus, 0, hd0);
+ ide_bus_create_drive(&s->bus, 0, hd0);
}
if (hd1 != NULL) {
- ide_create_drive(&s->bus, 1, hd1);
+ ide_bus_create_drive(&s->bus, 1, hd1);
}
}
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index ae638dee0d..4223f5e64d 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -489,7 +489,7 @@ void pci_ide_create_devs(PCIDevice *dev)
ide_drive_get(hd_table, ARRAY_SIZE(hd_table));
for (i = 0; i < 4; i++) {
if (hd_table[i]) {
- ide_create_drive(d->bus + bus[i], unit[i], hd_table[i]);
+ ide_bus_create_drive(d->bus + bus[i], unit[i], hd_table[i]);
}
}
}
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 6f6c7462f3..1b3b4da01d 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -124,7 +124,7 @@ static void ide_qdev_realize(DeviceState *qdev, Error **errp)
dc->realize(dev, errp);
}
-IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
+IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
{
DeviceState *dev;
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 7b4b71d0b0..ccfe064643 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -645,7 +645,7 @@ void ide_atapi_cmd_reply_end(IDEState *s);
/* hw/ide/qdev.c */
void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev,
int bus_id, int max_units);
-IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive);
+IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive);
int ide_handle_rw_error(IDEState *s, int error, int op);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 13/24] hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (11 preceding siblings ...)
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 ` 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é
` (11 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson, BALATON Zoltan
ide_register_restart_cb() operates on a IDEBus; rename it as
ide_bus_register_restart_cb() to emphasize its first argument
is a IDEBus.
Mechanical change using:
$ sed -i -e 's/ide_register_restart_cb/ide_bus_register_restart_cb/g' \
$(git grep -l ide_register_restart_cb)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-13-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/ahci.c | 2 +-
hw/ide/cmd646.c | 2 +-
hw/ide/core.c | 2 +-
hw/ide/isa.c | 2 +-
hw/ide/piix.c | 2 +-
hw/ide/sii3112.c | 2 +-
hw/ide/via.c | 2 +-
include/hw/ide/internal.h | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 90fea5d059..430961d73b 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1560,7 +1560,7 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
ad->port_no = i;
ad->port.dma = &ad->dma;
ad->port.dma->ops = &ahci_dma_ops;
- ide_register_restart_cb(&ad->port);
+ ide_bus_register_restart_cb(&ad->port);
}
g_free(irqs);
}
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 94c576262c..2865bc25fc 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -298,7 +298,7 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
- ide_register_restart_cb(&d->bus[i]);
+ ide_bus_register_restart_cb(&d->bus[i]);
}
}
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 117e26cef1..5897411b95 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2759,7 +2759,7 @@ static void ide_restart_cb(void *opaque, bool running, RunState state)
}
}
-void ide_register_restart_cb(IDEBus *bus)
+void ide_bus_register_restart_cb(IDEBus *bus)
{
if (bus->dma->ops->restart_dma) {
bus->vmstate = qemu_add_vm_change_state_handler(ide_restart_cb, bus);
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 74f7b43137..f8ed26b587 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -74,7 +74,7 @@ static void isa_ide_realizefn(DeviceState *dev, Error **errp)
ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2);
ide_init2(&s->bus, isa_get_irq(isadev, s->irqnum));
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s);
- ide_register_restart_cb(&s->bus);
+ ide_bus_register_restart_cb(&s->bus);
}
ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 267dbf37db..daeb9b605d 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -149,7 +149,7 @@ static int pci_piix_init_ports(PCIIDEState *d)
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
- ide_register_restart_cb(&d->bus[i]);
+ ide_bus_register_restart_cb(&d->bus[i]);
}
return 0;
diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index 46204f10d7..c918370220 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -288,7 +288,7 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp)
bmdma_init(&s->bus[i], &s->bmdma[i], s);
s->bmdma[i].bus = &s->bus[i];
- ide_register_restart_cb(&s->bus[i]);
+ ide_bus_register_restart_cb(&s->bus[i]);
}
}
diff --git a/hw/ide/via.c b/hw/ide/via.c
index e1a429405d..fd398226d4 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -195,7 +195,7 @@ static void via_ide_realize(PCIDevice *dev, Error **errp)
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
- ide_register_restart_cb(&d->bus[i]);
+ ide_bus_register_restart_cb(&d->bus[i]);
}
}
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index ccfe064643..cc95cd47a0 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -620,7 +620,7 @@ void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_exit(IDEState *s);
int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_bus_set_irq(IDEBus *bus);
-void ide_register_restart_cb(IDEBus *bus);
+void ide_bus_register_restart_cb(IDEBus *bus);
void ide_exec_cmd(IDEBus *bus, uint32_t val);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 14/24] hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (12 preceding siblings ...)
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 ` 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é
` (10 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
ide_exec_cmd() operates on a IDEBus; rename it as
ide_bus_exec_cmd() to emphasize its first argument
is a IDEBus.
Mechanical change using:
$ sed -i -e 's/ide_exec_cmd/ide_bus_exec_cmd/g' \
$(git grep -wl ide_exec_cmd)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-14-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/ahci.c | 2 +-
hw/ide/core.c | 6 +++---
hw/ide/trace-events | 2 +-
include/hw/ide/internal.h | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 430961d73b..7f67fb3119 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1269,7 +1269,7 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
cmd->status = 0;
/* We're ready to process the command in FIS byte 2. */
- ide_exec_cmd(&s->dev[port].port, cmd_fis[2]);
+ ide_bus_exec_cmd(&s->dev[port].port, cmd_fis[2]);
}
static int handle_cmd(AHCIState *s, int port, uint8_t slot)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 5897411b95..1be0731d1a 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1327,7 +1327,7 @@ void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
case ATA_IOPORT_WR_COMMAND:
ide_clear_hob(bus);
qemu_irq_lower(bus->irq);
- ide_exec_cmd(bus, val);
+ ide_bus_exec_cmd(bus, val);
break;
}
}
@@ -2123,13 +2123,13 @@ static bool ide_cmd_permitted(IDEState *s, uint32_t cmd)
&& (ide_cmd_table[cmd].flags & (1u << s->drive_kind));
}
-void ide_exec_cmd(IDEBus *bus, uint32_t val)
+void ide_bus_exec_cmd(IDEBus *bus, uint32_t val)
{
IDEState *s;
bool complete;
s = idebus_active_if(bus);
- trace_ide_exec_cmd(bus, s, val);
+ trace_ide_bus_exec_cmd(bus, s, val);
/* ignore commands to non existent slave */
if (s != bus->ifs && !s->blk) {
diff --git a/hw/ide/trace-events b/hw/ide/trace-events
index 15d7921f15..a394c05710 100644
--- a/hw/ide/trace-events
+++ b/hw/ide/trace-events
@@ -12,7 +12,7 @@ ide_data_writew(uint32_t addr, uint32_t val, void *bus, void *s)
ide_data_readl(uint32_t addr, uint32_t val, void *bus, void *s) "IDE PIO rd @ 0x%"PRIx32" (Data: Long); val 0x%08"PRIx32"; bus %p; IDEState %p"
ide_data_writel(uint32_t addr, uint32_t val, void *bus, void *s) "IDE PIO wr @ 0x%"PRIx32" (Data: Long); val 0x%08"PRIx32"; bus %p; IDEState %p"
# misc
-ide_exec_cmd(void *bus, void *state, uint32_t cmd) "IDE exec cmd: bus %p; state %p; cmd 0x%02x"
+ide_bus_exec_cmd(void *bus, void *state, uint32_t cmd) "IDE exec cmd: bus %p; state %p; cmd 0x%02x"
ide_cancel_dma_sync_buffered(void *fn, void *req) "invoking cb %p of buffered request %p with -ECANCELED"
ide_cancel_dma_sync_remaining(void) "draining all remaining requests"
ide_sector_read(int64_t sector_num, int nsectors) "sector=%"PRId64" nsectors=%d"
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index cc95cd47a0..11a4931ef9 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -622,7 +622,7 @@ int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_bus_set_irq(IDEBus *bus);
void ide_bus_register_restart_cb(IDEBus *bus);
-void ide_exec_cmd(IDEBus *bus, uint32_t val);
+void ide_bus_exec_cmd(IDEBus *bus, uint32_t val);
void ide_transfer_start(IDEState *s, uint8_t *buf, int size,
EndTransferFunc *end_transfer_func);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 15/24] hw/ide: Rename ide_init2() -> ide_bus_init_output_irq()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (13 preceding siblings ...)
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 ` 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é
` (9 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson, BALATON Zoltan
ide_init2() initializes an IDEBus, and sets its output IRQ.
To emphasize this, rename it as ide_bus_init_output_irq().
Mechanical change using:
$ sed -i -e 's/ide_init2/ide_bus_init_output_irq/g' \
$(git grep -l ide_init2)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-15-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/ahci.c | 2 +-
hw/ide/cmd646.c | 2 +-
hw/ide/core.c | 4 ++--
hw/ide/isa.c | 2 +-
hw/ide/macio.c | 2 +-
hw/ide/microdrive.c | 2 +-
hw/ide/mmio.c | 2 +-
hw/ide/piix.c | 3 ++-
hw/ide/sii3112.c | 2 +-
hw/ide/via.c | 2 +-
include/hw/ide/internal.h | 4 ++--
11 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 7f67fb3119..d79b70d8c5 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1554,7 +1554,7 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
AHCIDevice *ad = &s->dev[i];
ide_bus_init(&ad->port, sizeof(ad->port), qdev, i, 1);
- ide_init2(&ad->port, irqs[i]);
+ ide_bus_init_output_irq(&ad->port, irqs[i]);
ad->hba = s;
ad->port_no = i;
diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 2865bc25fc..26a90ed45f 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -294,7 +294,7 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp)
qdev_init_gpio_in(ds, cmd646_set_irq, 2);
for (i = 0; i < 2; i++) {
ide_bus_init(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
- ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
+ ide_bus_init_output_irq(&d->bus[i], qdev_get_gpio_in(ds, i));
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 1be0731d1a..fd2215c506 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2771,7 +2771,7 @@ static IDEDMA ide_dma_nop = {
.aiocb = NULL,
};
-void ide_init2(IDEBus *bus, qemu_irq irq)
+void ide_bus_init_output_irq(IDEBus *bus, qemu_irq irq_out)
{
int i;
@@ -2779,7 +2779,7 @@ void ide_init2(IDEBus *bus, qemu_irq irq)
ide_init1(bus, i);
ide_reset(&bus->ifs[i]);
}
- bus->irq = irq;
+ bus->irq = irq_out;
bus->dma = &ide_dma_nop;
}
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index f8ed26b587..95053e026f 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -72,7 +72,7 @@ static void isa_ide_realizefn(DeviceState *dev, Error **errp)
ide_bus_init(&s->bus, sizeof(s->bus), dev, 0, 2);
ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2);
- ide_init2(&s->bus, isa_get_irq(isadev, s->irqnum));
+ ide_bus_init_output_irq(&s->bus, isa_get_irq(isadev, s->irqnum));
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s);
ide_bus_register_restart_cb(&s->bus);
}
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 7efbbc720a..6be29e44bc 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -420,7 +420,7 @@ static void macio_ide_realizefn(DeviceState *dev, Error **errp)
{
MACIOIDEState *s = MACIO_IDE(dev);
- ide_init2(&s->bus, s->ide_irq);
+ ide_bus_init_output_irq(&s->bus, s->ide_irq);
/* Register DMA callbacks */
s->dma.ops = &dbdma_ops;
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 08504b499f..84452ae4ef 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -599,7 +599,7 @@ static void microdrive_realize(DeviceState *dev, Error **errp)
{
MicroDriveState *md = MICRODRIVE(dev);
- ide_init2(&md->bus, qemu_allocate_irq(md_set_irq, md, 0));
+ ide_bus_init_output_irq(&md->bus, qemu_allocate_irq(md_set_irq, md, 0));
}
static void microdrive_init(Object *obj)
diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c
index d650dcee4d..c6c0299c53 100644
--- a/hw/ide/mmio.c
+++ b/hw/ide/mmio.c
@@ -122,7 +122,7 @@ static void mmio_ide_realizefn(DeviceState *dev, Error **errp)
SysBusDevice *d = SYS_BUS_DEVICE(dev);
MmioIdeState *s = MMIO_IDE(dev);
- ide_init2(&s->bus, s->irq);
+ ide_bus_init_output_irq(&s->bus, s->irq);
memory_region_init_io(&s->iomem1, OBJECT(s), &mmio_ide_ops, s,
"ide-mmio.1", 16 << s->shift);
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index daeb9b605d..2f71376b93 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -145,7 +145,8 @@ static int pci_piix_init_ports(PCIIDEState *d)
if (ret) {
return ret;
}
- ide_init2(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
+ ide_bus_init_output_irq(&d->bus[i],
+ isa_get_irq(NULL, port_info[i].isairq));
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index c918370220..f9becdff8e 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -284,7 +284,7 @@ static void sii3112_pci_realize(PCIDevice *dev, Error **errp)
qdev_init_gpio_in(ds, sii3112_set_irq, 2);
for (i = 0; i < 2; i++) {
ide_bus_init(&s->bus[i], sizeof(s->bus[i]), ds, i, 1);
- ide_init2(&s->bus[i], qdev_get_gpio_in(ds, i));
+ ide_bus_init_output_irq(&s->bus[i], qdev_get_gpio_in(ds, i));
bmdma_init(&s->bus[i], &s->bmdma[i], s);
s->bmdma[i].bus = &s->bus[i];
diff --git a/hw/ide/via.c b/hw/ide/via.c
index fd398226d4..ab9e43e244 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -191,7 +191,7 @@ static void via_ide_realize(PCIDevice *dev, Error **errp)
qdev_init_gpio_in(ds, via_ide_set_irq, 2);
for (i = 0; i < 2; i++) {
ide_bus_init(&d->bus[i], sizeof(d->bus[i]), ds, i, 2);
- ide_init2(&d->bus[i], qdev_get_gpio_in(ds, i));
+ ide_bus_init_output_irq(&d->bus[i], qdev_get_gpio_in(ds, i));
bmdma_init(&d->bus[i], &d->bmdma[i], d);
d->bmdma[i].bus = &d->bus[i];
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 11a4931ef9..c687282a78 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -488,7 +488,7 @@ struct IDEBus {
IDEDMA *dma;
uint8_t unit;
uint8_t cmd;
- qemu_irq irq;
+ qemu_irq irq; /* bus output */
int error_status;
uint8_t retry_unit;
@@ -616,8 +616,8 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
uint64_t wwn,
uint32_t cylinders, uint32_t heads, uint32_t secs,
int chs_trans, Error **errp);
-void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_exit(IDEState *s);
+void ide_bus_init_output_irq(IDEBus *bus, qemu_irq irq_out);
int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_bus_set_irq(IDEBus *bus);
void ide_bus_register_restart_cb(IDEBus *bus);
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 16/24] hw/ide: Rename idebus_active_if() -> ide_bus_active_if()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (14 preceding siblings ...)
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 ` 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é
` (8 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
idebus_active_if() operates on a IDEBus; rename it as
ide_bus_active_if() to emphasize its first argument
is a IDEBus.
Mechanical change using:
$ sed -i -e 's/idebus_active_if/ide_bus_active_if/g' \
$(git grep -l idebus_active_if)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-16-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/core.c | 18 +++++++++---------
hw/ide/macio.c | 8 ++++----
hw/ide/microdrive.c | 4 ++--
hw/ide/pci.c | 2 +-
include/hw/ide/internal.h | 2 +-
5 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index fd2215c506..2d034731cf 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1265,7 +1265,7 @@ const char *ATA_IOPORT_WR_lookup[ATA_IOPORT_WR_NUM_REGISTERS] = {
void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
int reg_num = addr & 7;
trace_ide_ioport_write(addr, ATA_IOPORT_WR_lookup[reg_num], val, bus, s);
@@ -2128,7 +2128,7 @@ void ide_bus_exec_cmd(IDEBus *bus, uint32_t val)
IDEState *s;
bool complete;
- s = idebus_active_if(bus);
+ s = ide_bus_active_if(bus);
trace_ide_bus_exec_cmd(bus, s, val);
/* ignore commands to non existent slave */
@@ -2195,7 +2195,7 @@ const char *ATA_IOPORT_RR_lookup[ATA_IOPORT_RR_NUM_REGISTERS] = {
uint32_t ide_ioport_read(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
uint32_t reg_num;
int ret, hob;
@@ -2281,7 +2281,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr)
uint32_t ide_status_read(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
int ret;
if ((!bus->ifs[0].blk && !bus->ifs[1].blk) ||
@@ -2370,7 +2370,7 @@ static bool ide_is_pio_out(IDEState *s)
void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
uint8_t *p;
trace_ide_data_writew(addr, val, bus, s);
@@ -2406,7 +2406,7 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
uint32_t ide_data_readw(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
uint8_t *p;
int ret;
@@ -2444,7 +2444,7 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
uint8_t *p;
trace_ide_data_writel(addr, val, bus, s);
@@ -2472,7 +2472,7 @@ void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
uint32_t ide_data_readl(void *opaque, uint32_t addr)
{
IDEBus *bus = opaque;
- IDEState *s = idebus_active_if(bus);
+ IDEState *s = ide_bus_active_if(bus);
uint8_t *p;
int ret;
@@ -2711,7 +2711,7 @@ static void ide_restart_bh(void *opaque)
return;
}
- s = idebus_active_if(bus);
+ s = ide_bus_active_if(bus);
is_read = (bus->error_status & IDE_RETRY_READ) != 0;
/* The error status must be cleared before resubmitting the request: The
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 6be29e44bc..dca1cc9efc 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -60,7 +60,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
{
DBDMA_io *io = opaque;
MACIOIDEState *m = io->opaque;
- IDEState *s = idebus_active_if(&m->bus);
+ IDEState *s = ide_bus_active_if(&m->bus);
int64_t offset;
MACIO_DPRINTF("pmac_ide_atapi_transfer_cb\n");
@@ -136,7 +136,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret)
{
DBDMA_io *io = opaque;
MACIOIDEState *m = io->opaque;
- IDEState *s = idebus_active_if(&m->bus);
+ IDEState *s = ide_bus_active_if(&m->bus);
int64_t offset;
MACIO_DPRINTF("pmac_ide_transfer_cb\n");
@@ -220,7 +220,7 @@ done:
static void pmac_ide_transfer(DBDMA_io *io)
{
MACIOIDEState *m = io->opaque;
- IDEState *s = idebus_active_if(&m->bus);
+ IDEState *s = ide_bus_active_if(&m->bus);
MACIO_DPRINTF("\n");
@@ -251,7 +251,7 @@ static void pmac_ide_transfer(DBDMA_io *io)
static void pmac_ide_flush(DBDMA_io *io)
{
MACIOIDEState *m = io->opaque;
- IDEState *s = idebus_active_if(&m->bus);
+ IDEState *s = ide_bus_active_if(&m->bus);
if (s->bus->dma->aiocb) {
blk_drain(s->blk);
diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c
index 84452ae4ef..f1017f7333 100644
--- a/hw/ide/microdrive.c
+++ b/hw/ide/microdrive.c
@@ -250,14 +250,14 @@ static uint16_t md_common_read(PCMCIACardState *card, uint32_t at)
case 0xd: /* Error */
return ide_ioport_read(&s->bus, 0x1);
case 0xe: /* Alternate Status */
- ifs = idebus_active_if(&s->bus);
+ ifs = ide_bus_active_if(&s->bus);
if (ifs->blk) {
return ifs->status;
} else {
return 0;
}
case 0xf: /* Device Address */
- ifs = idebus_active_if(&s->bus);
+ ifs = ide_bus_active_if(&s->bus);
return 0xc2 | ((~ifs->select << 2) & 0x3c);
default:
return ide_ioport_read(&s->bus, at);
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 4223f5e64d..2ddcb49b27 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -296,7 +296,7 @@ void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val)
/* Ignore writes to SSBM if it keeps the old value */
if ((val & BM_CMD_START) != (bm->cmd & BM_CMD_START)) {
if (!(val & BM_CMD_START)) {
- ide_cancel_dma_sync(idebus_active_if(bm->bus));
+ ide_cancel_dma_sync(ide_bus_active_if(bm->bus));
bm->status &= ~BM_STATUS_DMAING;
} else {
bm->cur_addr = bm->addr;
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index c687282a78..c2b794150f 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -566,7 +566,7 @@ static inline uint8_t ide_dma_cmd_to_retry(uint8_t dma_cmd)
return 0;
}
-static inline IDEState *idebus_active_if(IDEBus *bus)
+static inline IDEState *ide_bus_active_if(IDEBus *bus)
{
return bus->ifs + bus->unit;
}
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 17/24] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (15 preceding siblings ...)
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 ` Philippe Mathieu-Daudé
2023-02-27 11:17 ` Alex Bennée
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é
` (7 subsequent siblings)
24 siblings, 1 reply; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Michael S. Tsirkin, Marcel Apfelbaum,
Paolo Bonzini, Richard Henderson, Eduardo Habkost
ide_get_geometry() and ide_get_bios_chs_trans() are only
used by the TYPE_PC_MACHINE.
"hw/ide.h" is a mixed bag of lost IDE declarations. In order
to remove this (almost) pointless header soon, move these
declarations to "hw/ide/internal.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/i386/pc.c | 3 ++-
include/hw/ide.h | 4 ----
include/hw/ide/internal.h | 4 ++++
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 6e592bd969..79297a6ecd 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -34,7 +34,8 @@
#include "hw/i386/vmport.h"
#include "sysemu/cpus.h"
#include "hw/block/fdc.h"
-#include "hw/ide.h"
+#include "hw/ide/internal.h"
+#include "hw/ide/isa.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_bus.h"
#include "hw/pci-bridge/pci_expander_bridge.h"
diff --git a/include/hw/ide.h b/include/hw/ide.h
index 24a7aa2925..db963bdb77 100644
--- a/include/hw/ide.h
+++ b/include/hw/ide.h
@@ -3,10 +3,6 @@
#include "exec/memory.h"
-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);
-
/* ide/core.c */
void ide_drive_get(DriveInfo **hd, int max_bus);
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index c2b794150f..d9f1f77dd5 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -647,6 +647,10 @@ void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev,
int bus_id, int max_units);
IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive);
+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);
+
int ide_handle_rw_error(IDEState *s, int error, int op);
#endif /* HW_IDE_INTERNAL_H */
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 18/24] hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (16 preceding siblings ...)
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-20 9:13 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 19/24] hw/ide/ioport: Remove unnecessary includes Philippe Mathieu-Daudé
` (6 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Rename ide_init_ioport() as ide_bus_init_ioport_isa() to make
explicit it expects an ISA device. Move the declaration to
"hw/ide/isa.h" where it belongs.
Message-Id: <20230215161641.32663-13-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ide/ioport.c | 4 +++-
hw/ide/isa.c | 2 +-
hw/ide/piix.c | 5 +++--
include/hw/ide/internal.h | 1 -
include/hw/ide/isa.h | 3 +++
5 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/ide/ioport.c b/hw/ide/ioport.c
index e6caa537fa..7156c465da 100644
--- a/hw/ide/ioport.c
+++ b/hw/ide/ioport.c
@@ -35,6 +35,7 @@
#include "qemu/cutils.h"
#include "sysemu/replay.h"
+#include "hw/ide/isa.h"
#include "hw/ide/internal.h"
#include "trace.h"
@@ -50,7 +51,8 @@ static const MemoryRegionPortio ide_portio2_list[] = {
PORTIO_END_OF_LIST(),
};
-int ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2)
+int ide_bus_init_ioport_isa(IDEBus *bus, ISADevice *dev,
+ int iobase, int iobase2)
{
int ret;
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 95053e026f..6eed16bf87 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -71,7 +71,7 @@ static void isa_ide_realizefn(DeviceState *dev, Error **errp)
ISAIDEState *s = ISA_IDE(dev);
ide_bus_init(&s->bus, sizeof(s->bus), dev, 0, 2);
- ide_init_ioport(&s->bus, isadev, s->iobase, s->iobase2);
+ ide_bus_init_ioport_isa(&s->bus, isadev, s->iobase, s->iobase2);
ide_bus_init_output_irq(&s->bus, isa_get_irq(isadev, s->irqnum));
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_isa, s);
ide_bus_register_restart_cb(&s->bus);
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 2f71376b93..fc44c261cc 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -38,6 +38,7 @@
#include "hw/ide/piix.h"
#include "hw/ide/pci.h"
+#include "hw/ide/isa.h"
#include "trace.h"
static uint64_t bmdma_read(void *opaque, hwaddr addr, unsigned size)
@@ -140,8 +141,8 @@ static int pci_piix_init_ports(PCIIDEState *d)
for (i = 0; i < 2; i++) {
ide_bus_init(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
- ret = ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
- port_info[i].iobase2);
+ ret = ide_bus_init_ioport_isa(&d->bus[i], NULL, port_info[i].iobase,
+ port_info[i].iobase2);
if (ret) {
return ret;
}
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index d9f1f77dd5..d3b7fdc504 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -618,7 +618,6 @@ int ide_init_drive(IDEState *s, BlockBackend *blk, IDEDriveKind kind,
int chs_trans, Error **errp);
void ide_exit(IDEState *s);
void ide_bus_init_output_irq(IDEBus *bus, qemu_irq irq_out);
-int ide_init_ioport(IDEBus *bus, ISADevice *isa, int iobase, int iobase2);
void ide_bus_set_irq(IDEBus *bus);
void ide_bus_register_restart_cb(IDEBus *bus);
diff --git a/include/hw/ide/isa.h b/include/hw/ide/isa.h
index 1cd0ff1fa6..7f7a850265 100644
--- a/include/hw/ide/isa.h
+++ b/include/hw/ide/isa.h
@@ -10,11 +10,14 @@
#define HW_IDE_ISA_H
#include "qom/object.h"
+#include "hw/ide/internal.h"
#define TYPE_ISA_IDE "isa-ide"
OBJECT_DECLARE_SIMPLE_TYPE(ISAIDEState, ISA_IDE)
ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int irqnum,
DriveInfo *hd0, DriveInfo *hd1);
+int ide_bus_init_ioport_isa(IDEBus *bus, ISADevice *isa,
+ int iobase, int iobase2);
#endif
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 19/24] hw/ide/ioport: Remove unnecessary includes
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (17 preceding siblings ...)
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 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 20/24] hw/ide/pci: Unexport bmdma_active_if() Philippe Mathieu-Daudé
` (5 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-17-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/ioport.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/hw/ide/ioport.c b/hw/ide/ioport.c
index 7156c465da..d869f8018a 100644
--- a/hw/ide/ioport.c
+++ b/hw/ide/ioport.c
@@ -25,16 +25,6 @@
#include "qemu/osdep.h"
#include "hw/isa/isa.h"
-#include "qemu/error-report.h"
-#include "qemu/timer.h"
-#include "sysemu/blockdev.h"
-#include "sysemu/dma.h"
-#include "hw/block/block.h"
-#include "sysemu/block-backend.h"
-#include "qapi/error.h"
-#include "qemu/cutils.h"
-#include "sysemu/replay.h"
-
#include "hw/ide/isa.h"
#include "hw/ide/internal.h"
#include "trace.h"
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 20/24] hw/ide/pci: Unexport bmdma_active_if()
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (18 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 19/24] hw/ide/ioport: Remove unnecessary includes Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` Philippe Mathieu-Daudé
2023-02-20 9:13 ` [PATCH v2 21/24] hw/ide/piix: Remove unused includes Philippe Mathieu-Daudé
` (4 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm, Bernhard Beschow,
Philippe Mathieu-Daudé
From: Bernhard Beschow <shentey@gmail.com>
The function is only used inside ide/pci.c, so doesn't need to be exported.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ide/pci.c | 6 ++++++
include/hw/ide/pci.h | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 2ddcb49b27..fc9224bbc9 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -104,6 +104,12 @@ const MemoryRegionOps pci_ide_data_le_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
+static IDEState *bmdma_active_if(BMDMAState *bmdma)
+{
+ assert(bmdma->bus->retry_unit != (uint8_t)-1);
+ return bmdma->bus->ifs + bmdma->bus->retry_unit;
+}
+
static void bmdma_start_dma(const IDEDMA *dma, IDEState *s,
BlockCompletionFunc *dma_cb)
{
diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h
index 2a6284acac..7b5e3f6e1c 100644
--- a/include/hw/ide/pci.h
+++ b/include/hw/ide/pci.h
@@ -55,12 +55,6 @@ struct PCIIDEState {
MemoryRegion data_bar[2];
};
-static inline IDEState *bmdma_active_if(BMDMAState *bmdma)
-{
- assert(bmdma->bus->retry_unit != (uint8_t)-1);
- return bmdma->bus->ifs + bmdma->bus->retry_unit;
-}
-
void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d);
void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val);
extern MemoryRegionOps bmdma_addr_ioport_ops;
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 21/24] hw/ide/piix: Remove unused includes
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (19 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 20/24] hw/ide/pci: Unexport bmdma_active_if() Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (3 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-19-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/piix.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index fc44c261cc..5b1455e232 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -28,14 +28,9 @@
*/
#include "qemu/osdep.h"
-#include "hw/pci/pci.h"
#include "migration/vmstate.h"
#include "qapi/error.h"
-#include "qemu/module.h"
-#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
-#include "sysemu/dma.h"
-
+#include "hw/pci/pci.h"
#include "hw/ide/piix.h"
#include "hw/ide/pci.h"
#include "hw/ide/isa.h"
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 22/24] hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (20 preceding siblings ...)
2023-02-20 9:13 ` [PATCH v2 21/24] hw/ide/piix: Remove unused includes Philippe Mathieu-Daudé
@ 2023-02-20 9:13 ` 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é
` (2 subsequent siblings)
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-20-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/piix.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index 5b1455e232..b74f1c77c4 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -122,7 +122,7 @@ static void piix_ide_reset(DeviceState *dev)
pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */
}
-static int pci_piix_init_ports(PCIIDEState *d)
+static bool pci_piix_init_ports(PCIIDEState *d, Error **errp)
{
static const struct {
int iobase;
@@ -139,7 +139,9 @@ static int pci_piix_init_ports(PCIIDEState *d)
ret = ide_bus_init_ioport_isa(&d->bus[i], NULL, port_info[i].iobase,
port_info[i].iobase2);
if (ret) {
- return ret;
+ error_setg_errno(errp, -ret, "Failed to realize %s port %u",
+ object_get_typename(OBJECT(d)), i);
+ return false;
}
ide_bus_init_output_irq(&d->bus[i],
isa_get_irq(NULL, port_info[i].isairq));
@@ -149,14 +151,13 @@ static int pci_piix_init_ports(PCIIDEState *d)
ide_bus_register_restart_cb(&d->bus[i]);
}
- return 0;
+ return true;
}
static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
{
PCIIDEState *d = PCI_IDE(dev);
uint8_t *pci_conf = dev->config;
- int rc;
pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
@@ -165,10 +166,8 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d);
- rc = pci_piix_init_ports(d);
- if (rc) {
- error_setg_errno(errp, -rc, "Failed to realize %s",
- object_get_typename(OBJECT(dev)));
+ if (!pci_piix_init_ports(d, errp)) {
+ return;
}
}
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 23/24] hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (21 preceding siblings ...)
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 ` 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é
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm,
Philippe Mathieu-Daudé, Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-21-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/ide/piix.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index b74f1c77c4..acb4eaa27f 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -122,7 +122,7 @@ static void piix_ide_reset(DeviceState *dev)
pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */
}
-static bool pci_piix_init_ports(PCIIDEState *d, Error **errp)
+static bool pci_piix_init_bus(PCIIDEState *d, unsigned i, Error **errp)
{
static const struct {
int iobase;
@@ -132,24 +132,21 @@ static bool pci_piix_init_ports(PCIIDEState *d, Error **errp)
{0x1f0, 0x3f6, 14},
{0x170, 0x376, 15},
};
- int i, ret;
+ int ret;
- for (i = 0; i < 2; i++) {
- ide_bus_init(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
- ret = ide_bus_init_ioport_isa(&d->bus[i], NULL, port_info[i].iobase,
- port_info[i].iobase2);
- if (ret) {
- error_setg_errno(errp, -ret, "Failed to realize %s port %u",
- object_get_typename(OBJECT(d)), i);
- return false;
- }
- ide_bus_init_output_irq(&d->bus[i],
- isa_get_irq(NULL, port_info[i].isairq));
-
- bmdma_init(&d->bus[i], &d->bmdma[i], d);
- d->bmdma[i].bus = &d->bus[i];
- ide_bus_register_restart_cb(&d->bus[i]);
+ ide_bus_init(&d->bus[i], sizeof(d->bus[i]), DEVICE(d), i, 2);
+ ret = ide_bus_init_ioport_isa(&d->bus[i], NULL,
+ port_info[i].iobase, port_info[i].iobase2);
+ if (ret) {
+ error_setg_errno(errp, -ret, "Failed to realize %s port %u",
+ object_get_typename(OBJECT(d)), i);
+ return false;
}
+ ide_bus_init_output_irq(&d->bus[i], isa_get_irq(NULL, port_info[i].isairq));
+
+ bmdma_init(&d->bus[i], &d->bmdma[i], d);
+ d->bmdma[i].bus = &d->bus[i];
+ ide_bus_register_restart_cb(&d->bus[i]);
return true;
}
@@ -166,8 +163,10 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d);
- if (!pci_piix_init_ports(d, errp)) {
- return;
+ for (unsigned i = 0; i < 2; i++) {
+ if (!pci_piix_init_bus(d, i, errp)) {
+ return;
+ }
}
}
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* [PATCH v2 24/24] hw/ide/ahci: trace ncq write command as write instead of read
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (22 preceding siblings ...)
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 ` Philippe Mathieu-Daudé
2023-02-24 22:23 ` [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-20 9:13 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm, Fiona Ebner,
Alex Bennée, Philippe Mathieu-Daudé
From: Fiona Ebner <f.ebner@proxmox.com>
Fixes: e4baa9f00b ("AHCI: Replace DPRINTF with trace-events")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230217103130.42077-1-f.ebner@proxmox.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/ide/ahci.c | 4 ++--
hw/ide/trace-events | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index d79b70d8c5..55902e1df7 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1086,8 +1086,8 @@ static void execute_ncq_command(NCQTransferState *ncq_tfs)
ncq_cb, ncq_tfs);
break;
case WRITE_FPDMA_QUEUED:
- trace_execute_ncq_command_read(ad->hba, port, ncq_tfs->tag,
- ncq_tfs->sector_count, ncq_tfs->lba);
+ trace_execute_ncq_command_write(ad->hba, port, ncq_tfs->tag,
+ ncq_tfs->sector_count, ncq_tfs->lba);
dma_acct_start(ide_state->blk, &ncq_tfs->acct,
&ncq_tfs->sglist, BLOCK_ACCT_WRITE);
ncq_tfs->aiocb = dma_blk_write(ide_state->blk, &ncq_tfs->sglist,
diff --git a/hw/ide/trace-events b/hw/ide/trace-events
index a394c05710..57042cafdd 100644
--- a/hw/ide/trace-events
+++ b/hw/ide/trace-events
@@ -91,6 +91,7 @@ ahci_populate_sglist_short_map(void *s, int port) "ahci(%p)[%d]: mapped less tha
ahci_populate_sglist_bad_offset(void *s, int port, int off_idx, int64_t off_pos) "ahci(%p)[%d]: Incorrect offset! off_idx: %d, off_pos: %"PRId64
ncq_finish(void *s, int port, uint8_t tag) "ahci(%p)[%d][tag:%d]: NCQ transfer finished"
execute_ncq_command_read(void *s, int port, uint8_t tag, int count, int64_t lba) "ahci(%p)[%d][tag:%d]: NCQ reading %d sectors from LBA %"PRId64
+execute_ncq_command_write(void *s, int port, uint8_t tag, int count, int64_t lba) "ahci(%p)[%d][tag:%d]: NCQ writing %d sectors to LBA %"PRId64
execute_ncq_command_unsup(void *s, int port, uint8_t tag, uint8_t cmd) "ahci(%p)[%d][tag:%d]: error: unsupported NCQ command (0x%02x) received"
process_ncq_command_mismatch(void *s, int port, uint8_t tag, uint8_t slot) "ahci(%p)[%d][tag:%d]: Warning: NCQ slot (%d) did not match the given tag"
process_ncq_command_aux(void *s, int port, uint8_t tag) "ahci(%p)[%d][tag:%d]: Warn: Attempt to use NCQ auxiliary fields"
--
2.38.1
^ permalink raw reply related [flat|nested] 32+ messages in thread
* Re: [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping
2023-02-20 9:13 [PATCH v2 00/24] hw/ide: QOM/QDev housekeeping Philippe Mathieu-Daudé
` (23 preceding siblings ...)
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 ` Philippe Mathieu-Daudé
24 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-24 22:23 UTC (permalink / raw)
To: qemu-devel, John Snow; +Cc: qemu-ppc, qemu-block, qemu-arm
ping for 3 patches :)
On 20/2/23 10:13, Philippe Mathieu-Daudé wrote:
> Missing review: 2, 17, 20
>
> Since v1:
> - addressed review comments
>
> John, can I get your formal Ack?
>
> Thanks,
>
> Phil.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v2 02/24] hw/ide/mmio: Use CamelCase for MMIO_IDE state name
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
0 siblings, 0 replies; 32+ messages in thread
From: Alex Bennée @ 2023-02-27 10:49 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-ppc, John Snow, qemu-block, qemu-arm
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Following docs/devel/style.rst guidelines, rename MMIOIDEState
> as MmioIdeState.
>
> Having the structure name and its typedef named equally,
> we can manually convert from the old DECLARE_INSTANCE_CHECKER()
> macro to the more recent OBJECT_DECLARE_SIMPLE_TYPE().
>
> Note, due to that name mismatch, this macro wasn't automatically
> converted during commit 8063396bf3 ("Use OBJECT_DECLARE_SIMPLE_TYPE
> when possible").
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v2 07/24] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion
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
0 siblings, 0 replies; 32+ messages in thread
From: Alex Bennée @ 2023-02-27 11:12 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-ppc, John Snow, qemu-block, Richard Henderson,
qemu-arm
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Only atapi.c requires the SCSI constants. No need to include
> it in all files including "hw/ide/internal.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Message-Id: <20230215112712.23110-7-philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v2 08/24] hw/ide: Remove unused 'qapi/qapi-types-run-state.h'
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
0 siblings, 0 replies; 32+ messages in thread
From: Alex Bennée @ 2023-02-27 11:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-ppc, John Snow, qemu-block, Richard Henderson,
qemu-arm
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Missed in commit d7458e7754 ("hw/ide/internal: Remove unused
> DMARestartFunc typedef") which removed the single use of RunState.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Message-Id: <20230215112712.23110-8-philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v2 09/24] hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'
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
0 siblings, 0 replies; 32+ messages in thread
From: Alex Bennée @ 2023-02-27 11:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm, Richard Henderson,
qemu-devel
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> The IDEBus structure has PortioList fields, so we need its
> declarations from "exec/ioport.h". "hw/isa/isa.h" is not required.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Message-Id: <20230215112712.23110-9-philmd@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v2 17/24] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
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é
0 siblings, 1 reply; 32+ messages in thread
From: Alex Bennée @ 2023-02-27 11:17 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm, Michael S. Tsirkin,
Marcel Apfelbaum, Paolo Bonzini, Richard Henderson,
Eduardo Habkost, qemu-devel
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> ide_get_geometry() and ide_get_bios_chs_trans() are only
> used by the TYPE_PC_MACHINE.
> "hw/ide.h" is a mixed bag of lost IDE declarations. In order
> to remove this (almost) pointless header soon, move these
> declarations to "hw/ide/internal.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/i386/pc.c | 3 ++-
> include/hw/ide.h | 4 ----
> include/hw/ide/internal.h | 4 ++++
> 3 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 6e592bd969..79297a6ecd 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -34,7 +34,8 @@
> #include "hw/i386/vmport.h"
> #include "sysemu/cpus.h"
> #include "hw/block/fdc.h"
> -#include "hw/ide.h"
> +#include "hw/ide/internal.h"
> +#include "hw/ide/isa.h"
I do kind of wonder why hw/ide/internal.h isn't in the appropriate
subdir (e.g. hw/ide and included as #include "internal.h") rather than
the "public" include directory. However QEMU isn't super consistent with
that:
➜ find . -iname "internal.h"
./accel/tcg/internal.h
./target/ppc/internal.h
./target/mips/internal.h
./target/hexagon/internal.h
./include/hw/ide/internal.h
🕙11:15:58 alex@zen:qemu.git on review/qom-housekeeping-v2 [$?] took 7s
➜ find . -iname "internals.h"
./tests/fp/berkeley-softfloat-3/source/include/internals.h
./target/arm/internals.h
./target/riscv/internals.h
./target/loongarch/internals.h
./gdbstub/internals.h
Anyway:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [PATCH v2 17/24] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
2023-02-27 11:17 ` Alex Bennée
@ 2023-02-27 11:22 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-27 11:22 UTC (permalink / raw)
To: Alex Bennée
Cc: qemu-ppc, John Snow, qemu-block, qemu-arm, Michael S. Tsirkin,
Marcel Apfelbaum, Paolo Bonzini, Richard Henderson,
Eduardo Habkost, qemu-devel
On 27/2/23 12:17, Alex Bennée wrote:
>
> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>
>> ide_get_geometry() and ide_get_bios_chs_trans() are only
>> used by the TYPE_PC_MACHINE.
>> "hw/ide.h" is a mixed bag of lost IDE declarations. In order
>> to remove this (almost) pointless header soon, move these
>> declarations to "hw/ide/internal.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/i386/pc.c | 3 ++-
>> include/hw/ide.h | 4 ----
>> include/hw/ide/internal.h | 4 ++++
>> 3 files changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index 6e592bd969..79297a6ecd 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -34,7 +34,8 @@
>> #include "hw/i386/vmport.h"
>> #include "sysemu/cpus.h"
>> #include "hw/block/fdc.h"
>> -#include "hw/ide.h"
>> +#include "hw/ide/internal.h"
>> +#include "hw/ide/isa.h"
>
> I do kind of wonder why hw/ide/internal.h isn't in the appropriate
> subdir (e.g. hw/ide and included as #include "internal.h") rather than
> the "public" include directory.
It should be internal but is included by PCI and MacIO:
include/hw/ide/pci.h:4:#include "hw/ide/internal.h"
include/hw/misc/macio/macio.h:31:#include "hw/ide/internal.h"
Long term I'd like to split it in internal vs public API.
> However QEMU isn't super consistent with
> that:
>
> ➜ find . -iname "internal.h"
> ./accel/tcg/internal.h
> ./target/ppc/internal.h
> ./target/mips/internal.h
> ./target/hexagon/internal.h
> ./include/hw/ide/internal.h
> 🕙11:15:58 alex@zen:qemu.git on review/qom-housekeeping-v2 [$?] took 7s
> ➜ find . -iname "internals.h"
> ./tests/fp/berkeley-softfloat-3/source/include/internals.h
> ./target/arm/internals.h
> ./target/riscv/internals.h
> ./target/loongarch/internals.h
> ./gdbstub/internals.h
>
> Anyway:
>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Thanks!
^ permalink raw reply [flat|nested] 32+ messages in thread
end of thread, other threads:[~2023-02-27 11:23 UTC | newest]
Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2 03/24] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h' Philippe Mathieu-Daudé
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é
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).