[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 101/126] hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 101/126] hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h' |
Date: |
Mon, 27 Feb 2023 15:01:48 +0100 |
"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.
Rename ISAIDEState::isairq as 'irqnum' to emphasize this is
not a qemu_irq object but the number (index) of an ISA IRQ.
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 | 14 ++++++--------
include/hw/ide.h | 5 -----
include/hw/ide/isa.h | 20 ++++++++++++++++++++
4 files changed, 27 insertions(+), 13 deletions(-)
create mode 100644 include/hw/ide/isa.h
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7c48ba30e0..126b6c11df 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 8bedbd13f1..5c3e83a0fc 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -31,22 +31,20 @@
#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;
IDEBus bus;
uint32_t iobase;
uint32_t iobase2;
- uint32_t isairq;
+ uint32_t irqnum;
qemu_irq irq;
};
@@ -75,13 +73,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 +90,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 +106,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..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 isairq,
- 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
- [PULL 088/126] hw/usb/xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro, (continued)
- [PULL 088/126] hw/usb/xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 090/126] hw/display/sm501: Alias 'dma-offset' QOM property in chipset object, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 085/126] hw/usb/uhci: Declare QOM macros using OBJECT_DECLARE_TYPE(), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 091/126] hw/display/sm501: Implement more 2D raster operations, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 092/126] hw/display/sm501: Add fallbacks to pixman routines, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 093/126] hw/ppc/sam460ex: Correctly set MAL properties, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 094/126] block/vvfat: Remove pointless check of NDEBUG, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 095/126] scripts/checkpatch.pl: Do not allow assert(0), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 096/126] MAINTAINERS: Mark IDE and Floppy as "Odd Fixes", Philippe Mathieu-Daudé, 2023/02/27
- [PULL 099/126] hw/ide/mmio: Use CamelCase for MMIO_IDE state name, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 101/126] hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h',
Philippe Mathieu-Daudé <=
- [PULL 103/126] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 098/126] hw/ide/ahci: Trace ncq write command as write instead of read, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 100/126] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h', Philippe Mathieu-Daudé, 2023/02/27
- [PULL 102/126] hw/ide/isa: Remove intermediate ISAIDEState::irq variable, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 097/126] hw/i386/xen: Remove unused 'hw/ide.h' include from header, Philippe Mathieu-Daudé, 2023/02/27
- [PULL 105/126] hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h', Philippe Mathieu-Daudé, 2023/02/27
- [PULL 107/126] hw/ide: Rename ide_set_irq() -> ide_bus_set_irq(), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 106/126] hw/ide: Un-inline ide_set_irq(), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 108/126] hw/ide: Rename ide_create_drive() -> ide_bus_create_drive(), Philippe Mathieu-Daudé, 2023/02/27
- [PULL 111/126] hw/ide: Rename ide_init2() -> ide_bus_init_output_irq(), Philippe Mathieu-Daudé, 2023/02/27