From patchwork Sat Dec 16 21:29:51 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: 10117439 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 0E7D560327 for ; Sat, 16 Dec 2017 21:37:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0148229427 for ; Sat, 16 Dec 2017 21:37:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E99992942F; Sat, 16 Dec 2017 21:37:38 +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 736E329427 for ; Sat, 16 Dec 2017 21:37:38 +0000 (UTC) Received: from localhost ([::1]:52233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK9J-0003Cx-Fv for patchwork-qemu-devel@patchwork.kernel.org; Sat, 16 Dec 2017 16:37:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQK6C-0000kf-VH for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQK6B-0003nk-TC for qemu-devel@nongnu.org; Sat, 16 Dec 2017 16:34:24 -0500 Received: from iserv.reactos.org ([2a01:4f8:221:4c5::3]:40021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eQK6B-0003nO-FC; Sat, 16 Dec 2017 16:34:23 -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=EFthO4vljwXjwSHMEKl06fh5KaA5T/exWdvhQzpytdWUSQNpAtjCJxtfTXyCoxHqXnB+NEqn0Khi7kTsQ5OL8BKRvWnlJSr9tb7SzD2jaYH9HqibcqiHjqCYmNOtnYyWD3j/VQ+DSbegXQ/2ay0Md95A2LrNpay5q8Gk51YfK+c=; 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 1eQK4g-0002si-Jp; Sat, 16 Dec 2017 21:32:52 +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 22:29:51 +0100 Message-Id: <20171216213004.30393-3-hpoussin@reactos.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171216213004.30393-1-hpoussin@reactos.org> References: <20171216213004.30393-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 v2 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