From patchwork Sat Dec 16 09:02:15 2017 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: 10116855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACAAB60327 for ; Sat, 16 Dec 2017 09:04:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A17022921B for ; Sat, 16 Dec 2017 09:04:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96188292C5; Sat, 16 Dec 2017 09:04:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 29D562921B for ; Sat, 16 Dec 2017 09:04:31 +0000 (UTC) Received: from localhost ([::1]:49856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQ8OU-0005rn-A7 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 16 Dec 2017 04:04:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQ8Mx-0004hP-UT for qemu-devel@nongnu.org; Sat, 16 Dec 2017 04:02:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQ8Mw-000212-QO for qemu-devel@nongnu.org; Sat, 16 Dec 2017 04:02:55 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:58791) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQ8Mw-0001wK-JV; Sat, 16 Dec 2017 04:02:54 -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=v5ITkP4LYDjuSFZ+1Tbir8sf2qHgjxn6E4nUfh2WzoY=; b=UWXa2nwglsAFp3+zQ6XmmV1dFp0yYbgDD4Hmhtp+imVjk/Nj/3xsnfi+4nVJluLP3UYhuh+2FGWE0O1GcSL03J3j/UYBznsuiYOxHN67sUb9xswszZwQ0DBg2VNyd9xYr/LlQN4xp707yympNcMSo/nGHagbeaNn3TvyAOU0h5s=; Received: from [2a01:e34:ee6b:9c80:6267:20ff:fe65:a488] (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 1eQ8Mh-0001v2-Tv; Sat, 16 Dec 2017 09:02:40 +0000 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= To: Aurelien Jarno , Yongbok Kim , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org Date: Sat, 16 Dec 2017 10:02:15 +0100 Message-Id: <20171216090228.28505-3-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216090228.28505-1-hpoussin@reactos.org> References: <20171216090228.28505-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 02/15] 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=20Poussineau?= , Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP We are now able to embed serial/parallel ports in another object. 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 c35c439d81..91d8e36cac 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