hw/ide: QOM/QDev housekeeping
v2 cover hw/ide: QOM/QDev housekeeping
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
Signature · 1 line
2.38.1
PATCH v2 1/24 MAINTAINERS: Mark IDE and Floppy as "Odd Fixes"
From: John Snow <[email protected]>
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.
Message-Id: <[email protected]>
--- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -1791,7 +1791,7 @@ F: hw/misc/edu.c IDE M: John Snow <[email protected]> L: [email protected] -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 <[email protected]> L: [email protected] -S: Supported +S: Odd Fixes F: hw/block/fdc.c F: hw/block/fdc-internal.h F: hw/block/fdc-isa.c
Signature · 1 line
2.38.1
PATCH v2 2/24 hw/ide/mmio: Use CamelCase for MMIO_IDE state name
In reply to 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").
--- hw/ide/mmio.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
hw/ide/mmio.c +14 -16
@@ -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);
Signature · 1 line
2.38.1
Re: [PATCH v2 02/24] hw/ide/mmio: Use CamelCase for MMIO_IDE state name
Quoted 7 lines · Philippe Mathieu-Daudé
Following
docs/devel/style.rstguidelines, 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 recentOBJECT_DECLARE_SIMPLE_TYPE().
Quoted 5 lines
Note, due to that name mismatch, this macro wasn't automatically converted during commit
8063396bf3("UseOBJECT_DECLARE_SIMPLE_TYPEwhen possible").Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 3/24 hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h'
In reply to Philippe Mathieu-Daudé"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: <[email protected]>
--- 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
hw/ide/mmio.c +1 -4
@@ -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;
hw/sh4/r2d.c +2 -2
@@ -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 );
include/hw/ide.h +0 -3
@@ -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);
include/hw/ide/mmio.h new file +26 -0
@@ -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
Signature · 1 line
2.38.1
PATCH v2 4/24 hw/ide/isa: Rename isairq -> irqnum
In reply to Philippe Mathieu-DaudéRename ISAIDEState::isairq as 'irqnum' to emphasize this is not a qemu_irq object but the number (index) of an ISA IRQ.
Message-Id: <[email protected]>
--- hw/ide/isa.c | 10 +++++----- include/hw/ide.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
hw/ide/isa.c +5 -5
@@ -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 (), };
include/hw/ide.h +1 -1
@@ -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,
Signature · 1 line
2.38.1
PATCH v2 5/24 hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h'
In reply to Philippe Mathieu-Daudé"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: <[email protected]>
--- 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
hw/i386/pc_piix.c +1 -0
@@ -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"
hw/ide/isa.c +1 -3
@@ -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;
include/hw/ide.h +0 -5
@@ -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);
include/hw/ide/isa.h new file +20 -0
@@ -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
Signature · 1 line
2.38.1
PATCH v2 6/24 hw/ide/isa: Remove intermediate ISAIDEState::irq variable
In reply to Philippe Mathieu-DaudéThe intermediate ISAIDEState::irq variable just add noise, remove it.
Message-Id: <[email protected]>
--- hw/ide/isa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/ide/isa.c +1 -3
@@ -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); }
Signature · 1 line
2.38.1
PATCH v2 7/24 hw/ide/atapi: Restrict 'scsi/constants.h' inclusion
In reply to Philippe Mathieu-DaudéOnly atapi.c requires the SCSI constants. No need to include it in all files including "hw/ide/internal.h".
Message-Id: <[email protected]>
--- hw/ide/atapi.c | 1 + include/hw/ide/internal.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
hw/ide/atapi.c +1 -0
@@ -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)
include/hw/ide/internal.h +0 -1
@@ -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
Signature · 1 line
2.38.1
Re: [PATCH v2 07/24] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion
Quoted 6 lines · Philippe Mathieu-Daudé
Only
atapi.crequires the SCSI constants. No need to include it in all files including "hw/ide/internal.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
Reviewed-by Richard Henderson <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 8/24 hw/ide: Remove unused 'qapi/qapi-types-run-state.h'
In reply to Philippe Mathieu-DaudéMissed in commit d7458e7754 ("hw/ide/internal: Remove unused DMARestartFunc typedef") which removed the single use of RunState.
Message-Id: <[email protected]>
--- include/hw/ide/internal.h | 1 - 1 file changed, 1 deletion(-)
include/hw/ide/internal.h +0 -1
@@ -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"
Signature · 1 line
2.38.1
Re: [PATCH v2 08/24] hw/ide: Remove unused 'qapi/qapi-types-run-state.h'
Quoted 6 lines · Philippe Mathieu-Daudé
Missed in commit
d7458e7754("hw/ide/internal: Remove unused DMARestartFunc typedef") which removed the single use of RunState.Signed-off-by Philippe Mathieu-Daudé <[email protected]>Message-Id: <[email protected]>
Reviewed-by Richard Henderson <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 9/24 hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'
In reply to Philippe Mathieu-DaudéThe IDEBus structure has PortioList fields, so we need its declarations from "exec/ioport.h". "hw/isa/isa.h" is not required.
Message-Id: <[email protected]>
--- include/hw/ide/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/ide/internal.h +1 -1
@@ -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
Signature · 1 line
2.38.1
Re: [PATCH v2 09/24] hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'
Quoted 6 lines · Philippe Mathieu-Daudé
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é <[email protected]>Message-Id: <[email protected]>
Reviewed-by Richard Henderson <[email protected]>
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 10/24 hw/ide: Un-inline ide_set_irq()
In reply to Philippe Mathieu-DaudéOnly include "hw/irq.h" where appropriate.
Message-Id: <[email protected]>
--- 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(-)
hw/ide/ahci.c +1 -0
@@ -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"
hw/ide/core.c +8 -0
@@ -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);
hw/ide/ich.c +1 -0
@@ -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"
hw/ide/macio.c +1 -0
@@ -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"
hw/ide/microdrive.c +1 -0
@@ -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"
hw/ide/pci.c +1 -0
@@ -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"
hw/misc/macio/gpio.c +1 -0
@@ -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"
hw/sparc64/sun4u.c +1 -0
@@ -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"
include/hw/ide/internal.h +1 -8
@@ -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);
Signature · 1 line
2.38.1
PATCH v2 11/24 hw/ide: Rename ide_set_irq() -> ide_bus_set_irq()
In reply to Philippe Mathieu-Daudéide_set_irq() operates on a IDEBus; rename it aside_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)Message-Id: <[email protected]>
--- 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(-)
hw/ide/atapi.c +6 -6
@@ -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; }
hw/ide/core.c +22 -22
176 lines not on this page · raw message
hw/ide/macio.c +1 -1
@@ -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; }
include/hw/ide/internal.h +1 -1
@@ -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);
Signature · 1 line
2.38.1
PATCH v2 12/24 hw/ide: Rename ide_create_drive() -> ide_bus_create_drive()
In reply to Philippe Mathieu-Daudé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)Message-Id: <[email protected]>
--- 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(-)
hw/arm/sbsa-ref.c +1 -1
@@ -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]); } }
hw/ide/ahci.c +1 -1
@@ -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]); } }
hw/ide/isa.c +2 -2
@@ -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; }
hw/ide/macio.c +1 -1
@@ -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]); } } }
hw/ide/microdrive.c +1 -1
@@ -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 ;
hw/ide/mmio.c +2 -2
@@ -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); } }
hw/ide/pci.c +1 -1
@@ -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]); } } }
hw/ide/qdev.c +1 -1
@@ -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;
include/hw/ide/internal.h +1 -1
@@ -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);
Signature · 1 line
2.38.1
PATCH v2 13/24 hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb
In reply to Philippe Mathieu-Daudé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)Message-Id: <[email protected]>
--- 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(-)
hw/ide/ahci.c +1 -1
@@ -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); }
hw/ide/cmd646.c +1 -1
@@ -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]); } }
hw/ide/core.c +1 -1
@@ -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);
hw/ide/isa.c +1 -1
@@ -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,
hw/ide/piix.c +1 -1
@@ -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 ;
hw/ide/sii3112.c +1 -1
@@ -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]); } }
hw/ide/via.c +1 -1
@@ -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]); } }
include/hw/ide/internal.h +1 -1
@@ -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);
Signature · 1 line
2.38.1
PATCH v2 14/24 hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd()
In reply to Philippe Mathieu-Daudé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)Message-Id: <[email protected]>
--- 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(-)
hw/ide/ahci.c +1 -1
@@ -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)
hw/ide/core.c +3 -3
@@ -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) {
hw/ide/trace-events +1 -1
@@ -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"
include/hw/ide/internal.h +1 -1
@@ -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);
Signature · 1 line
2.38.1
PATCH v2 15/24 hw/ide: Rename ide_init2() -> ide_bus_init_output_irq()
In reply to Philippe Mathieu-Daudé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)Message-Id: <[email protected]>
--- 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(-)
hw/ide/ahci.c +1 -1
@@ -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;
hw/ide/cmd646.c +1 -1
@@ -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];
hw/ide/core.c +2 -2
@@ -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; }
hw/ide/isa.c +1 -1
@@ -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); }
hw/ide/macio.c +1 -1
@@ -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;
hw/ide/microdrive.c +1 -1
@@ -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)
hw/ide/mmio.c +1 -1
@@ -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);
hw/ide/piix.c +2 -1
@@ -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];
hw/ide/sii3112.c +1 -1
@@ -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];
hw/ide/via.c +1 -1
@@ -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];
include/hw/ide/internal.h +2 -2
@@ -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);
Signature · 1 line
2.38.1
PATCH v2 16/24 hw/ide: Rename idebus_active_if() -> ide_bus_active_if()
In reply to Philippe Mathieu-Daudé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)Message-Id: <[email protected]>
--- 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(-)
hw/ide/core.c +9 -9
@@ -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
hw/ide/macio.c +4 -4
@@ -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);
hw/ide/microdrive.c +2 -2
@@ -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);
hw/ide/pci.c +1 -1
@@ -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;
include/hw/ide/internal.h +1 -1
@@ -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; }
Signature · 1 line
2.38.1
PATCH v2 17/24 hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
In reply to Philippe Mathieu-Daudé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".
--- hw/i386/pc.c | 3 ++- include/hw/ide.h | 4 ---- include/hw/ide/internal.h | 4 ++++ 3 files changed, 6 insertions(+), 5 deletions(-)
hw/i386/pc.c +2 -1
@@ -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"
include/hw/ide.h +0 -4
@@ -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);
include/hw/ide/internal.h +4 -0
@@ -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 */
Signature · 1 line
2.38.1
Re: [PATCH v2 17/24] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
Quoted 18 lines · Philippe Mathieu-Daudé
ide_get_geometry()andide_get_bios_chs_trans()are only used by theTYPE_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é <[email protected]>--- hw/i386/pc.c | 3 ++- include/hw/ide.h | 4 ---- include/hw/ide/internal.h | 4 ++++ 3 files changed, 6 insertions(+), 5 deletions(-)hw/i386/pc.c +0
-0
hw/i386/pc.c line 38
Quoted 6 lines
hw/i386/pc.c +2
-1@@ -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:
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH v2 17/24] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
Quoted 16 lines · Alex Bennée
Quoted 13 lines · Philippe Mathieu-Daudé
ide_get_geometry()andide_get_bios_chs_trans()are only used by theTYPE_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é <[email protected]>--- hw/i386/pc.c | 3 ++- include/hw/ide.h | 4 ---- include/hw/ide/internal.h | 4 ++++ 3 files changed, 6 insertions(+), 5 deletions(-)
Quoted 15 lines
hw/i386/pc.c line 38
Quoted 11 lines
hw/i386/pc.c +2
-1@@ -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.hisn'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.
Quoted 17 lines
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
Quoted 3 lines
Anyway:
Reviewed-by Alex Bennée <[email protected]>
Thanks!
PATCH v2 18/24 hw/ide: Rename ISA specific ide_init_ioport -> ide_bus_init_ioport_isa
In reply to Philippe Mathieu-Daudé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: <[email protected]>
--- 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(-)
hw/ide/ioport.c +3 -1
@@ -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;
hw/ide/isa.c +1 -1
@@ -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);
hw/ide/piix.c +3 -2
@@ -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; }
include/hw/ide/internal.h +0 -1
@@ -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);
include/hw/ide/isa.h +3 -0
@@ -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
Signature · 1 line
2.38.1
PATCH v2 19/24 hw/ide/ioport: Remove unnecessary includes
In reply to Philippe Mathieu-DaudéMessage-Id: <[email protected]>
--- hw/ide/ioport.c | 10 ---------- 1 file changed, 10 deletions(-)
hw/ide/ioport.c +0 -10
@@ -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"
Signature · 1 line
2.38.1
PATCH v2 20/24 hw/ide/pci: Unexport bmdma_active_if()
In reply to Philippe Mathieu-DaudéFrom: Bernhard Beschow <[email protected]>
The function is only used inside ide/pci.c, so doesn't need to be exported.
--- hw/ide/pci.c | 6 ++++++ include/hw/ide/pci.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
hw/ide/pci.c +6 -0
@@ -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) {
include/hw/ide/pci.h +0 -6
@@ -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;
Signature · 1 line
2.38.1
PATCH v2 21/24 hw/ide/piix: Remove unused includes
In reply to Philippe Mathieu-DaudéMessage-Id: <[email protected]>
--- hw/ide/piix.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
hw/ide/piix.c +1 -6
@@ -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"
Signature · 1 line
2.38.1
PATCH v2 22/24 hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg
In reply to Philippe Mathieu-DaudéMessage-Id: <[email protected]>
--- hw/ide/piix.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
hw/ide/piix.c +7 -8
@@ -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 ; } }
Signature · 1 line
2.38.1
PATCH v2 23/24 hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus
In reply to Philippe Mathieu-DaudéMessage-Id: <[email protected]>
--- hw/ide/piix.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-)
hw/ide/piix.c +18 -19
@@ -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 ; + } } }
Signature · 1 line
2.38.1
PATCH v2 24/24 hw/ide/ahci: trace ncq write command as write instead of read
In reply to Philippe Mathieu-DaudéFrom: Fiona Ebner <[email protected]>
Message-Id: <[email protected]>
--- hw/ide/ahci.c | 4 ++-- hw/ide/trace-events | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
hw/ide/ahci.c +2 -2
@@ -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,
hw/ide/trace-events +1 -0
@@ -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"
Signature · 1 line
2.38.1
ping for 3 patches :)
Quoted 10 lines · Philippe Mathieu-Daudé
Missing review: 2, 17, 20
Since v1:
- addressed review commentsJohn, can I get your formal Ack?
Thanks,
Phil.