Skip to contentSkip to conversation

hw/ide: Make "ide_internal.h" really internal

PATCH In review Philippe Mathieu-Daudé 2 participants 6 messages Feb 26, 2024 – Feb 27, 2024

lore
Share & tools
lore
#0 lore raw

v3 cover hw/ide: Make "ide_internal.h" really internal

Missing review: 3

Since v2:
- Remove local 'ahci' variable
- Rename "ide_internal.h" -> "ide-internal.h" (Zoltan)

Since v1:
- Remove use of "ahci_internal.h" in SBSA-Ref
- Rename "internal.h" -> "ide_internal.h"

Supersedes: <[email protected]>

BALATON Zoltan (1):
hw/ide: Remove last two uses of ide/internal.h outside of hw/ide/

Philippe Mathieu-Daudé (2):
hw/arm/sbsa-ref: Do not open-code ahci_ide_create_devs() hw/ide: Include 'ide_internal.h' from current path

 hw/ide/ahci_internal.h                             |  2 +-
 include/hw/ide/internal.h => hw/ide/ide-internal.h |  0
 include/hw/misc/macio/macio.h                      |  2 +-
 hw/arm/sbsa-ref.c                                  | 13 ++-----------
 hw/ide/ahci.c                                      |  2 +-
 hw/ide/atapi.c                                     |  2 +-
 hw/ide/cmd646.c                                    |  2 +-
 hw/ide/core.c                                      |  2 +-
 hw/ide/ide-bus.c                                   |  2 +-
 hw/ide/ide-dev.c                                   |  2 +-
 hw/ide/ioport.c                                    |  2 +-
 hw/ide/isa.c                                       |  2 +-
 hw/ide/macio.c                                     |  2 +-
 hw/ide/microdrive.c                                |  2 +-
 hw/ide/mmio.c                                      |  2 +-
 hw/ide/pci.c                                       |  2 +-
 hw/ide/piix.c                                      |  2 +-
 hw/ide/sii3112.c                                   |  2 +-
 hw/ide/via.c                                       |  2 +-
 19 files changed, 19 insertions(+), 28 deletions(-)
 rename include/hw/ide/internal.h => hw/ide/ide-internal.h (100%)
Signature · 1 line
2.41.0
#1 lore raw

PATCH v3 1/3 hw/arm/sbsa-ref: Do not open-code ahci_ide_create_devs()

Use ahci_ide_create_devs() instead of open-coding it. Not accessing AHCIDevice internals anymore allows to remove "hw/ide/ahci_internal.h" (which isn't really a public header).

---
 hw/arm/sbsa-ref.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
hw/arm/sbsa-ref.c +1 -10
index 5d3a574664..4a59e2fd37 100644
@@ -37,7 +37,6 @@
 #include "hw/block/flash.h"
 #include "hw/boards.h"
 #include "hw/ide/internal.h"
-#include "hw/ide/ahci_internal.h"
 #include "hw/ide/ahci-sysbus.h"
 #include "hw/intc/arm_gicv3_common.h"
 #include "hw/intc/arm_gicv3_its_common.h"
@@ -571,8 +570,6 @@ static void create_ahci(const SBSAMachineState *sms)
     DeviceState *dev;
     DriveInfo *hd[NUM_SATA_PORTS];
     SysbusAHCIState *sysahci;
-    AHCIState *ahci;
-    int i;
 
     dev = qdev_new("sysbus-ahci");
     qdev_prop_set_uint32(dev, "num-ports", NUM_SATA_PORTS);
@@ -581,14 +578,8 @@ static void create_ahci(const SBSAMachineState *sms)
     sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(sms->gic, irq));
 
     sysahci = SYSBUS_AHCI(dev);
-    ahci = &sysahci->ahci;
     ide_drive_get(hd, ARRAY_SIZE(hd));
-    for (i = 0; i < ahci->ports; i++) {
-        if (hd[i] == NULL) {
-            continue;
-        }
-        ide_bus_create_drive(&ahci->dev[i].port, 0, hd[i]);
-    }
+    ahci_ide_create_devs(&sysahci->ahci, hd);
 }
 
 static void create_xhci(const SBSAMachineState *sms)
Signature · 1 line
2.41.0
#2 lore raw

PATCH v3 2/3 hw/ide: Remove last two uses of ide/internal.h outside of hw/ide/

In reply to Philippe Mathieu-Daudé

From: BALATON Zoltan <[email protected]>

Remove last two includes of hw/ide/intarnal.h outside of hw/ide and replace them with newly added public header to allow moving internal.h into hw/ide to really stop exposing it.

Fixes a11f439a0e (hw/ide: Stop exposing internal.h to non-IDE files)

Message-ID: <[email protected]>

---
 {include/hw => hw}/ide/internal.h | 0
 include/hw/misc/macio/macio.h     | 2 +-
 hw/arm/sbsa-ref.c                 | 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename {include/hw => hw}/ide/internal.h (100%)
hw/ide/internal.h renamed from include/hw/ide/internal.h +0 -0
similarity index 100%
rename from include/hw/ide/internal.h
rename to hw/ide/internal.h
include/hw/misc/macio/macio.h +1 -1
index 86df2c2b60..2b54da6b31 100644
@@ -28,7 +28,7 @@
 
 #include "hw/char/escc.h"
 #include "hw/pci/pci_device.h"
-#include "hw/ide/internal.h"
+#include "hw/ide/ide-bus.h"
 #include "hw/intc/heathrow_pic.h"
 #include "hw/misc/macio/cuda.h"
 #include "hw/misc/macio/gpio.h"
hw/arm/sbsa-ref.c +1 -1
index 4a59e2fd37..13dde50cba 100644
@@ -36,7 +36,7 @@
 #include "hw/arm/smmuv3.h"
 #include "hw/block/flash.h"
 #include "hw/boards.h"
-#include "hw/ide/internal.h"
+#include "hw/ide/ide-bus.h"
 #include "hw/ide/ahci-sysbus.h"
 #include "hw/intc/arm_gicv3_common.h"
 #include "hw/intc/arm_gicv3_its_common.h"
Signature · 1 line
2.41.0
#3 lore raw

PATCH v3 3/3 hw/ide: Include 'ide_internal.h' from current path

In reply to Philippe Mathieu-Daudé

Rename "internal.h" as "ide_internal.h", and include it via its relative local path, instead of absolute to the project root path.

---
 hw/ide/ahci_internal.h                | 2 +-
 hw/ide/{internal.h => ide-internal.h} | 0
 hw/ide/ahci.c                         | 2 +-
 hw/ide/atapi.c                        | 2 +-
 hw/ide/cmd646.c                       | 2 +-
 hw/ide/core.c                         | 2 +-
 hw/ide/ide-bus.c                      | 2 +-
 hw/ide/ide-dev.c                      | 2 +-
 hw/ide/ioport.c                       | 2 +-
 hw/ide/isa.c                          | 2 +-
 hw/ide/macio.c                        | 2 +-
 hw/ide/microdrive.c                   | 2 +-
 hw/ide/mmio.c                         | 2 +-
 hw/ide/pci.c                          | 2 +-
 hw/ide/piix.c                         | 2 +-
 hw/ide/sii3112.c                      | 2 +-
 hw/ide/via.c                          | 2 +-
 17 files changed, 16 insertions(+), 16 deletions(-)
 rename hw/ide/{internal.h => ide-internal.h} (100%)
hw/ide/ahci_internal.h +1 -1
index 4e13329bb2..7e63ea2310 100644
@@ -25,8 +25,8 @@
 #define HW_IDE_AHCI_INTERNAL_H
 
 #include "hw/ide/ahci.h"
-#include "hw/ide/internal.h"
 #include "hw/pci/pci_device.h"
+#include "ide-internal.h"
 
 #define AHCI_MEM_BAR_SIZE         0x1000
 #define AHCI_MAX_PORTS            32
hw/ide/ide-internal.h renamed from hw/ide/internal.h +0 -0
similarity index 100%
rename from hw/ide/internal.h
rename to hw/ide/ide-internal.h
hw/ide/ahci.c +1 -1
index 54c9685495..b8123bc73d 100644
@@ -34,11 +34,11 @@
 #include "qemu/module.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/dma.h"
-#include "hw/ide/internal.h"
 #include "hw/ide/pci.h"
 #include "hw/ide/ahci-pci.h"
 #include "hw/ide/ahci-sysbus.h"
 #include "ahci_internal.h"
+#include "ide-internal.h"
 
 #include "trace.h"
 
hw/ide/atapi.c +1 -1
index dcc39df9a4..73ec373184 100644
@@ -24,10 +24,10 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/ide/internal.h"
 #include "hw/scsi/scsi.h"
 #include "sysemu/block-backend.h"
 #include "scsi/constants.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 #define ATAPI_SECTOR_BITS (2 + BDRV_SECTOR_BITS)
hw/ide/cmd646.c +1 -1
index 23d213ff01..8cebd1b63d 100644
@@ -33,7 +33,7 @@
 #include "sysemu/reset.h"
 
 #include "hw/ide/pci.h"
-#include "hw/ide/internal.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 /* CMD646 specific */
hw/ide/core.c +1 -1
index 9c4a812902..130c4d8865 100644
@@ -41,7 +41,7 @@
 #include "qemu/cutils.h"
 #include "sysemu/replay.h"
 #include "sysemu/runstate.h"
-#include "hw/ide/internal.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 /* These values were based on a Seagate ST3500418AS but have been modified
hw/ide/ide-bus.c +1 -1
index 57fe67b29c..37d003dd9a 100644
@@ -21,10 +21,10 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
-#include "hw/ide/internal.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/runstate.h"
+#include "ide-internal.h"
 
 static char *idebus_get_fw_dev_path(DeviceState *dev);
 static void idebus_unrealize(BusState *qdev);
hw/ide/ide-dev.c +1 -1
index c8e2033469..799bd4b6ec 100644
@@ -23,11 +23,11 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "hw/ide/ide-dev.h"
-#include "hw/ide/internal.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "qapi/visitor.h"
+#include "ide-internal.h"
 
 static Property ide_props[] = {
     DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1),
hw/ide/ioport.c +1 -1
index 0b283ac783..a2f457f0bd 100644
@@ -25,7 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/isa/isa.h"
-#include "hw/ide/internal.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 int ide_init_ioport(IDEBus *bus, ISADevice *dev, int iobase, int iobase2)
hw/ide/isa.c +1 -1
index cc865c83dc..934c45887c 100644
@@ -32,8 +32,8 @@
 #include "sysemu/dma.h"
 
 #include "hw/ide/isa.h"
-#include "hw/ide/internal.h"
 #include "qom/object.h"
+#include "ide-internal.h"
 
 /***********************************************************/
 /* ISA IDE definitions */
hw/ide/macio.c +1 -1
index 0d2c6ba910..aca90d04f0 100644
@@ -33,7 +33,7 @@
 #include "sysemu/block-backend.h"
 #include "sysemu/dma.h"
 
-#include "hw/ide/internal.h"
+#include "ide-internal.h"
 
 /* debug MACIO */
 // #define DEBUG_MACIO
hw/ide/microdrive.c +1 -1
index a7f415f0fc..3bb152b5d3 100644
@@ -31,8 +31,8 @@
 #include "sysemu/dma.h"
 #include "hw/irq.h"
 
-#include "hw/ide/internal.h"
 #include "qom/object.h"
+#include "ide-internal.h"
 
 #define TYPE_MICRODRIVE "microdrive"
 OBJECT_DECLARE_SIMPLE_TYPE(MicroDriveState, MICRODRIVE)
hw/ide/mmio.c +1 -1
index e8f41c0610..8736281305 100644
@@ -30,8 +30,8 @@
 #include "sysemu/dma.h"
 
 #include "hw/ide/mmio.h"
-#include "hw/ide/internal.h"
 #include "hw/qdev-properties.h"
+#include "ide-internal.h"
 
 /***********************************************************/
 /* MMIO based ide port
hw/ide/pci.c +1 -1
index 73efeec7f4..4675d079a1 100644
@@ -30,8 +30,8 @@
 #include "sysemu/dma.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
-#include "hw/ide/internal.h"
 #include "hw/ide/pci.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 #define BMDMA_PAGE_SIZE 4096
hw/ide/piix.c +1 -1
index 1773a068c3..80efc633d3 100644
@@ -30,9 +30,9 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/pci/pci.h"
-#include "hw/ide/internal.h"
 #include "hw/ide/piix.h"
 #include "hw/ide/pci.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 static uint64_t bmdma_read(void *opaque, hwaddr addr, unsigned size)
hw/ide/sii3112.c +1 -1
index 321b9e46a1..af17384ff2 100644
@@ -13,11 +13,11 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/ide/internal.h"
 #include "hw/ide/pci.h"
 #include "qemu/module.h"
 #include "trace.h"
 #include "qom/object.h"
+#include "ide-internal.h"
 
 #define TYPE_SII3112_PCI "sii3112"
 OBJECT_DECLARE_SIMPLE_TYPE(SiI3112PCIState, SII3112_PCI)
hw/ide/via.c +1 -1
index cf151e70ec..a32f56b0e7 100644
@@ -25,7 +25,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/ide/internal.h"
 #include "hw/pci/pci.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
@@ -34,6 +33,7 @@
 #include "hw/isa/vt82c686.h"
 #include "hw/ide/pci.h"
 #include "hw/irq.h"
+#include "ide-internal.h"
 #include "trace.h"
 
 static uint64_t bmdma_read(void *opaque, hwaddr addr,
Signature · 1 line
2.41.0
#4 lore raw

Re: [PATCH v3 3/3] hw/ide: Include 'ide_internal.h' from current path

Quoted 1 line · Philippe Mathieu-Daudé

Rename "internal.h" as "ide_internal.h", and include

ide-internal.h

Quoted 4 lines

it via its relative local path, instead of absolute to the project root path.

The series is a lovely little cleanup; thanks, guys!

#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé

Missing review: 3

BALATON Zoltan (1):
hw/ide: Remove last two uses of ide/internal.h outside of hw/ide/

Philippe Mathieu-Daudé (2):
hw/arm/sbsa-ref: Do not open-code ahci_ide_create_devs() hw/ide: Include 'ide_internal.h' from current path

Series queued.