@@ -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)
@@ -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
@@ -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>
new file mode 100644
@@ -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
@@ -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
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