From patchwork Sat Jan 6 15:37:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Herv=C3=A9_Poussineau?= X-Patchwork-Id: 856405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=reactos.org header.i=@reactos.org header.b="fCXO1A6u"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zDQpT34Skz9s7G for ; Sun, 7 Jan 2018 02:45:05 +1100 (AEDT) Received: from localhost ([::1]:39767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXqed-0003Ix-ET for incoming@patchwork.ozlabs.org; Sat, 06 Jan 2018 10:45:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41053) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXqaf-0000VS-N8 for qemu-devel@nongnu.org; Sat, 06 Jan 2018 10:40:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXqae-00014r-F2 for qemu-devel@nongnu.org; Sat, 06 Jan 2018 10:40:57 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:42412) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXqae-0000yP-8J; Sat, 06 Jan 2018 10:40:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=reactos.org; s=25047; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=fFUEIGffkVIgZZbsUqGDa+8piSBZWOjW5tJjjnPT3hg=; b=fCXO1A6u3Lt8rCjP8RJprt8fZCAJTBrqSI37ZwIZLY02ZVgf8VKW5OeB/TIBl5cUE7V4Ax+GD0kbp7B4J7cBo+f75P6lYWGXdI6LeeW5h8mHxmzJKX6DBBGMbMtDfbYg0eymOmnmTAkqXeGXNfpQkx4Zc/AHpfFfEoBGWu8GLjA=; Received: from rob92-5-82-227-227-196.fbx.proxad.net ([82.227.227.196] helo=localhost.localdomain) by iserv.reactos.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eXqaP-0003wc-1s; Sat, 06 Jan 2018 15:40:41 +0000 From: =?utf-8?q?Herv=C3=A9_Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 6 Jan 2018 16:37:16 +0100 Message-Id: <20180106153730.30313-3-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180106153730.30313-1-hpoussin@reactos.org> References: <20180106153730.30313-1-hpoussin@reactos.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:4f8:221:4c5::3 Subject: [Qemu-devel] [PATCH v4 02/16] serial/parallel: move object structures to header file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:PowerPC" , =?utf-8?q?Herv=C3=A9_Poussi?= =?utf-8?q?neau?= , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are now able to embed serial/parallel ports in another object. Acked-by: Michael S. Tsirkin Acked-by: Paolo Bonzini Signed-off-by: Hervé Poussineau --- 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 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