Export struct ISAParallelState
v2 cover Export struct ISAParallelState
This series incorporates rebased versions of the ISAParallelState patches of
[1] as requested by Mark.
v2:
* Add forgotten SoB tags (Zoltan, Phil)
Changes since [1]:
* Don't export register definitions (Phil)
* Rephrase commit message of second patch (Zoltan)
[1] https://patchew.org/QEMU/[email protected]/
Bernhard Beschow (2):
hw/char/parallel: Export struct ParallelState hw/char/parallel-isa: Export struct ISAParallelState
include/hw/char/parallel-isa.h | 46 ++++++++++++++++++++++++++++++++++ include/hw/char/parallel.h | 21 +++++++++++++++- hw/char/parallel-isa.c | 1 + hw/char/parallel.c | 32 +---------------------- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/isa/isa-superio.c | 1 + hw/sparc64/sun4u.c | 2 +- 8 files changed, 72 insertions(+), 35 deletions(-) create mode 100644 include/hw/char/parallel-isa.h
Signature · 1 line
2.41.0
PATCH v2 1/2 hw/char/parallel: Export struct ParallelState
Exporting ParallelState is a precondition for exporing TYPE_ISA_PARALLEL to be performed in the next patch.
--- include/hw/char/parallel.h | 21 +++++++++++++++++++++ hw/char/parallel.c | 20 -------------------- 2 files changed, 21 insertions(+), 20 deletions(-)
include/hw/char/parallel.h +21 -0
@@ -1,9 +1,30 @@#ifndef HW_PARALLEL_H #define HW_PARALLEL_H +#include "exec/ioport.h" +#include "exec/memory.h" #include "hw/isa/isa.h" +#include "hw/irq.h" +#include "chardev/char-fe.h" #include "chardev/char.h" +typedef struct ParallelState { +MemoryRegion iomem; +uint8_t dataw; +uint8_t datar; +uint8_t status; +uint8_t control; +qemu_irq irq; +int irq_pending; +CharBackend chr; +int hw_driver; +int epp_timeout; +uint32_t last_read_offset;/* For debugging */ +/* Memory-mapped interface */ +int it_shift; +PortioList portio_list; +}ParallelState ; +#define TYPE_ISA_PARALLEL "isa-parallel"void parallel_hds_isa_init (ISABus *bus,int n);
hw/char/parallel.c +0 -20
@@ -27,10 +27,7 @@#include "qapi/error.h" #include "qemu/module.h" #include "chardev/char-parallel.h" -#include "chardev/char-fe.h" #include "hw/acpi/acpi_aml_interface.h" -#include "hw/irq.h" -#include "hw/isa/isa.h" #include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" #include "migration/vmstate.h"
@@ -76,23 +73,6 @@#define PARA_CTR_SIGNAL (PARA_CTR_SELECT|PARA_CTR_INIT|PARA_CTR_AUTOLF|PARA_CTR_STROBE) -typedef struct ParallelState { -MemoryRegion iomem; -uint8_t dataw; -uint8_t datar; -uint8_t status; -uint8_t control; -qemu_irq irq; -int irq_pending; -CharBackend chr; -int hw_driver; -int epp_timeout; -uint32_t last_read_offset;/* For debugging */ -/* Memory-mapped interface */ -int it_shift; -PortioList portio_list; -}ParallelState ; - OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL)struct ISAParallelState {
Signature · 1 line
2.41.0
PATCH v2 2/2 hw/char/parallel-isa: Export struct ISAParallelState
In reply to Bernhard BeschowAllows the struct to be embedded directly into device models without additional allocation.
--- include/hw/char/parallel-isa.h | 46 ++++++++++++++++++++++++++++++++++ include/hw/char/parallel.h | 2 -- hw/char/parallel-isa.c | 1 + hw/char/parallel.c | 12 +-------- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/isa/isa-superio.c | 1 + hw/sparc64/sun4u.c | 2 +- 8 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 include/hw/char/parallel-isa.h
include/hw/char/parallel-isa.h new file +46 -0
@@ -0,0 +1,46 @@ +/* +* QEMU ISA Parallel PORT emulation +* +* Copyright (c) 2003-2005 Fabrice Bellard +* Copyright (c) 2007 Marko Kohtala +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ + +#ifndef HW_PARALLEL_ISA_H +#define HW_PARALLEL_ISA_H + +#include "parallel.h" + +#include "hw/isa/isa.h" +#include "qom/object.h" + +#define TYPE_ISA_PARALLEL "isa-parallel" +OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL) + +struct ISAParallelState { +ISADevice parent_obj; + +uint32_t index; +uint32_t iobase; +uint32_t isairq; +ParallelState state; +}; + +#endif /* HW_PARALLEL_ISA_H */
include/hw/char/parallel.h +0 -2
@@ -25,8 +25,6 @@ typedef struct ParallelState {PortioList portio_list; } ParallelState; -#define TYPE_ISA_PARALLEL "isa-parallel" -void parallel_hds_isa_init (ISABus *bus,int n); bool parallel_mm_init(MemoryRegion *address_space,
hw/char/parallel-isa.c +1 -0
@@ -13,6 +13,7 @@#include "sysemu/sysemu.h" #include "hw/isa/isa.h" #include "hw/qdev-properties.h" +#include "hw/char/parallel-isa.h" #include "hw/char/parallel.h" #include "qapi/error.h"
hw/char/parallel.c +1 -11
@@ -31,6 +31,7 @@#include "hw/qdev-properties.h" #include "hw/qdev-properties-system.h" #include "migration/vmstate.h" +#include "hw/char/parallel-isa.h" #include "hw/char/parallel.h" #include "sysemu/reset.h" #include "sysemu/sysemu.h"
@@ -73,17 +74,6 @@#define PARA_CTR_SIGNAL (PARA_CTR_SELECT|PARA_CTR_INIT|PARA_CTR_AUTOLF|PARA_CTR_STROBE) -OBJECT_DECLARE_SIMPLE_TYPE(ISAParallelState, ISA_PARALLEL) - -struct ISAParallelState { -ISADevice parent_obj; - -uint32_t index; -uint32_t iobase; -uint32_t isairq; -ParallelState state; -}; -static void parallel_update_irq (ParallelState *s) {if (s->irq_pending)
hw/i386/pc_piix.c +1 -1
@@ -26,7 +26,7 @@#include CONFIG_DEVICES #include "qemu/units.h" -#include "hw/char/parallel.h" +#include "hw/char/parallel-isa.h" #include "hw/dma/i8257.h" #include "hw/loader.h" #include "hw/i386/x86.h"
hw/i386/pc_q35.c +1 -1
@@ -30,7 +30,7 @@#include "qemu/osdep.h" #include "qemu/units.h" -#include "hw/char/parallel.h" +#include "hw/char/parallel-isa.h" #include "hw/loader.h" #include "hw/i2c/smbus_eeprom.h" #include "hw/rtc/mc146818rtc.h"
hw/isa/isa-superio.c +1 -0
@@ -21,6 +21,7 @@#include "hw/isa/superio.h" #include "hw/qdev-properties.h" #include "hw/input/i8042.h" +#include "hw/char/parallel-isa.h" #include "hw/char/serial.h" #include "trace.h"
hw/sparc64/sun4u.c +1 -1
@@ -35,7 +35,7 @@#include "hw/qdev-properties.h" #include "hw/pci-host/sabre.h" #include "hw/char/serial.h" -#include "hw/char/parallel.h" +#include "hw/char/parallel-isa.h" #include "hw/rtc/m48t59.h" #include "migration/vmstate.h" #include "hw/input/i8042.h"
Signature · 1 line
2.41.0
Quoted 25 lines · Bernhard Beschow
This series incorporates rebased versions of the ISAParallelState patches of
[1] as requested by Mark.v2:
* Add forgotten SoB tags (Zoltan, Phil)Changes since [1]:
* Don't export register definitions (Phil)
* Rephrase commit message of second patch (Zoltan)[1] https://patchew.org/QEMU/[email protected]/
Bernhard Beschow (2):
hw/char/parallel: Export struct ParallelState hw/char/parallel-isa: Export struct ISAParallelStateinclude/hw/char/parallel-isa.h | 46 ++++++++++++++++++++++++++++++++++ include/hw/char/parallel.h | 21 +++++++++++++++- hw/char/parallel-isa.c | 1 + hw/char/parallel.c | 32 +---------------------- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- hw/isa/isa-superio.c | 1 + hw/sparc64/sun4u.c | 2 +- 8 files changed, 72 insertions(+), 35 deletions(-)
Quoted 1 line
create mode 100644
include/hw/char/parallel-isa.h
ATB,
Mark.
Quoted 6 lines · Bernhard Beschow
This series incorporates rebased versions of the ISAParallelState patches of
[1] as requested by Mark.Bernhard Beschow (2):
hw/char/parallel: Export struct ParallelState hw/char/parallel-isa: Export struct ISAParallelState
Quoted 6 lines · Bernhard Beschow
This series incorporates rebased versions of the ISAParallelState patches of
[1] as requested by Mark.Bernhard Beschow (2):
hw/char/parallel: Export struct ParallelState hw/char/parallel-isa: Export struct ISAParallelState
Thanks, queued (updating MAINTAINERS in patch 2).