All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hervé Poussineau" <hpoussin@reactos.org>
To: Aurelien Jarno <aurelien@aurel32.net>,
	Yongbok Kim <yongbok.kim@mips.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Alexander Graf" <agraf@suse.de>,
	"open list:PowerPC" <qemu-ppc@nongnu.org>
Subject: [Qemu-devel] [PATCH v3 02/16] serial/parallel: move object structures to header file
Date: Fri, 29 Dec 2017 15:29:08 +0100	[thread overview]
Message-ID: <20171229142922.31701-3-hpoussin@reactos.org> (raw)
In-Reply-To: <20171229142922.31701-1-hpoussin@reactos.org>

We are now able to embed serial/parallel ports in another object.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/char/parallel.c       | 31 +-----------------------------
 hw/char/serial-isa.c     | 13 +------------
 hw/ppc/pnv.c             |  2 +-
 include/hw/char/isa.h    | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/char/serial.h |  1 -
 5 files changed, 53 insertions(+), 44 deletions(-)
 create mode 100644 include/hw/char/isa.h

diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index f79dc76543..6b36d425ff 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -28,6 +28,7 @@
 #include "chardev/char-parallel.h"
 #include "chardev/char-fe.h"
 #include "hw/isa/isa.h"
+#include "hw/char/isa.h"
 #include "hw/i386/pc.h"
 #include "sysemu/sysemu.h"
 
@@ -67,36 +68,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;
-
-#define TYPE_ISA_PARALLEL "isa-parallel"
-#define ISA_PARALLEL(obj) \
-    OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL)
-
-typedef struct ISAParallelState {
-    ISADevice parent_obj;
-
-    uint32_t index;
-    uint32_t iobase;
-    uint32_t isairq;
-    ParallelState state;
-} ISAParallelState;
-
 static void parallel_update_irq(ParallelState *s)
 {
     if (s->irq_pending)
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index d7c5cc11fe..2c6cf81790 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -26,18 +26,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "hw/char/serial.h"
-#include "hw/isa/isa.h"
-
-#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SERIAL)
-
-typedef struct ISASerialState {
-    ISADevice parent_obj;
-
-    uint32_t index;
-    uint32_t iobase;
-    uint32_t isairq;
-    SerialState state;
-} ISASerialState;
+#include "hw/char/isa.h"
 
 static const int isa_serial_io[MAX_SERIAL_PORTS] = {
     0x3f8, 0x2f8, 0x3e8, 0x2e8
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 94ffc8e137..bf518d92a2 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -41,7 +41,7 @@
 #include "hw/ppc/pnv_xscom.h"
 
 #include "hw/isa/isa.h"
-#include "hw/char/serial.h"
+#include "hw/char/isa.h"
 #include "hw/timer/mc146818rtc.h"
 
 #include <libfdt.h>
diff --git a/include/hw/char/isa.h b/include/hw/char/isa.h
new file mode 100644
index 0000000000..39f7be41c5
--- /dev/null
+++ b/include/hw/char/isa.h
@@ -0,0 +1,50 @@
+#ifndef HW_CHAR_ISA_H
+#define HW_CHAR_ISA_H
+
+#include "qemu-common.h"
+#include "hw/char/serial.h"
+#include "hw/isa/isa.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;
+
+typedef struct ISAParallelState {
+    ISADevice parent_obj;
+
+    uint32_t index;
+    uint32_t iobase;
+    uint32_t isairq;
+    ParallelState state;
+} ISAParallelState;
+
+#define TYPE_ISA_PARALLEL "isa-parallel"
+#define ISA_PARALLEL(obj) \
+    OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL)
+
+typedef struct ISASerialState {
+    ISADevice parent_obj;
+
+    uint32_t index;
+    uint32_t iobase;
+    uint32_t isairq;
+    SerialState state;
+} ISASerialState;
+
+#define TYPE_ISA_SERIAL "isa-serial"
+#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SERIAL)
+
+#endif
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index c4daf11a14..ec7da3d7f6 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -95,7 +95,6 @@ SerialState *serial_mm_init(MemoryRegion *address_space,
                             Chardev *chr, enum device_endian end);
 
 /* serial-isa.c */
-#define TYPE_ISA_SERIAL "isa-serial"
 void serial_hds_isa_init(ISABus *bus, int from, int to);
 
 #endif
-- 
2.11.0

  parent reply	other threads:[~2017-12-29 14:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 14:29 [Qemu-devel] [PATCH v3 00/16] piix4: cleanup and improvements Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 01/16] fdc: move object structures to header file Hervé Poussineau
2018-01-04 13:11   ` Marcel Apfelbaum
2018-01-04 20:33     ` Hervé Poussineau
2017-12-29 14:29 ` Hervé Poussineau [this message]
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 03/16] mc146818rtc: move structure " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 04/16] mc146818rtc: always register rtc to rtc list Hervé Poussineau
2018-01-04 14:30   ` Marcel Apfelbaum
2018-01-04 20:34     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 05/16] piix4: rename some variables in realize function Hervé Poussineau
2018-01-04 14:33   ` Marcel Apfelbaum
2018-01-04 20:36     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 06/16] piix4: add Reset Control Register Hervé Poussineau
2018-01-04 15:50   ` Marcel Apfelbaum
2018-01-04 20:53     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 07/16] piix4: add a i8259 interrupt controller as specified in datasheet Hervé Poussineau
2018-01-04 23:21   ` Michael S. Tsirkin
2018-01-05  6:13     ` Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 08/16] piix4: add a i8257 dma " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 09/16] piix4: add a i8254 pit " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 10/16] piix4: add a i8042 keyboard/mouse " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 11/16] piix4: add a floppy controller, 1 parallel port and 2 serial ports Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 12/16] piix4: add a mc146818rtc controller as specified in datasheet Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 13/16] piix4: add a speaker " Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 14/16] piix4: convert reset function to QOM Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 15/16] piix4: rename PIIX4 object to piix4-isa Hervé Poussineau
2017-12-29 14:29 ` [Qemu-devel] [PATCH v3 16/16] piix4: we can now instanciate a PIIX4 with -device Hervé Poussineau
2018-01-04 23:25 ` [Qemu-devel] [PATCH v3 00/16] piix4: cleanup and improvements Michael S. Tsirkin
2018-01-05 11:07 ` Paolo Bonzini
2018-01-05 11:53   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171229142922.31701-3-hpoussin@reactos.org \
    --to=hpoussin@reactos.org \
    --cc=agraf@suse.de \
    --cc=aurelien@aurel32.net \
    --cc=david@gibson.dropbear.id.au \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=yongbok.kim@mips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.