From nobody Sat Oct 25 08:57:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520285688845228.63912699425043; Mon, 5 Mar 2018 13:34:48 -0800 (PST) Received: from localhost ([::1]:51680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxkt-0000xV-MW for importer@patchew.org; Mon, 05 Mar 2018 16:34:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWQ-0004Ks-A8 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWP-0001YO-7u for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:50 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWP-0001XN-1c for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:49 -0500 Received: by mail-wr0-x242.google.com with SMTP id v111so18788059wrb.3 for ; Mon, 05 Mar 2018 13:19:48 -0800 (PST) Received: from x1.local (ABayonne-654-1-79-224.w86-222.abo.wanadoo.fr. [86.222.222.224]) by smtp.gmail.com with ESMTPSA id g96sm12904808wrd.73.2018.03.05.13.19.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gl2oiuUeUOvRLGWDBaPE5F3VlALniqfDySAhQpac0WA=; b=LfMiYwirj2brMbNK8Q5SL2gpUPWHen5uUeqhfTkUXQ+oGbVQYAyfA4oHuTsQylQZC+ mnxEGLfvTiUogaBFpHFNgJciNj9CrfJllaUIFsQl4K9Ai+MXb1DrNLQAuV8oPoMaLcgv 4OApL66l25xu0Ajhsx1zOI71wWagWTRAia32etcrsjuD3KU3s730FaODjkTUgroFQld6 xfIb1iUbFGV50Z1x37cHO8996EfZj7UBf9pdK+1xWYmpkK/8rStdKXK3xX+SvL4qNSAH S+ihwyquzTfjI8BJKVm8t6U8NxMrriQi90DOQg4zvEe3CPwikTm+TVOQHV5ZdkrL/WPP iqpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gl2oiuUeUOvRLGWDBaPE5F3VlALniqfDySAhQpac0WA=; b=fyWrE94/YUQmc9IWMlQV6+3JTvx3Nwwntg9rBcHhtCB5bl13kDxlCzkDBAkJV8Hf8U vjOL4JKDaNinnny3FbE8mWz7j5LRX6zFa07LK/IzO1Th1ViKtqwf4L2kAQxM/udDpQbn WsaKyBpEOiBG6LTb697biI6NwuTXB0b8L9zR/hCMjGwbHF3BoNlbPONDKWk/fqFoEXhy Im9ygU/sYak19GGP425DsBtHkWWOrnf0sxXcx/nzJC3PNArmx14bTydeLAA7GIHjn+tx JUxNBFm4AoC07x05j/yfocT5cx2/nN5M8uC8Io6xZRkxwKfKqpg6dWpp8V/+0nnwLpBa uUxw== X-Gm-Message-State: APf1xPCUXoqABcwbUegC5nMLwZBxpk272k9Ly1n359W2wuNvGmwZGUKa enReGETnmqRrj+Z6x5gWX4g= X-Google-Smtp-Source: AG47ELsIxfqLIry/fydTV0Wdkk2Lopr4drznQE8xAsNC8/8AjpqNQZEj/VLyw8BVfr5aVY77W2DEgQ== X-Received: by 10.223.164.158 with SMTP id g30mr12833463wrb.62.1520284788122; Mon, 05 Mar 2018 13:19:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:13 -0300 Message-Id: <20180305211928.466-8-f4bug@amsat.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180305211928.466-1-f4bug@amsat.org> References: <20180305211928.466-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [RFC PATCH v2 07/22] hw/isa/superio: Add a Super I/O template based on the PC87312 device 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: Eduardo Habkost , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ hw/isa/isa-superio.c | 27 +++++++++++++++++++++++++++ hw/isa/Makefile.objs | 1 + 3 files changed, 72 insertions(+) create mode 100644 include/hw/isa/superio.h create mode 100644 hw/isa/isa-superio.c diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h new file mode 100644 index 0000000000..cff6ad6c08 --- /dev/null +++ b/include/hw/isa/superio.h @@ -0,0 +1,44 @@ +/* + * Generic ISA Super I/O + * + * Copyright (c) 2018 Philippe Mathieu-Daud=C3=A9 + * + * This code is licensed under the GNU GPLv2 and later. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef HW_ISA_SUPERIO_H +#define HW_ISA_SUPERIO_H + +#include "qemu-common.h" +#include "sysemu/sysemu.h" +#include "hw/isa/isa.h" + +#define TYPE_ISA_SUPERIO "isa-superio" +#define ISA_SUPERIO(obj) \ + OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO) +#define ISA_SUPERIO_GET_CLASS(obj) \ + OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO) +#define ISA_SUPERIO_CLASS(klass) \ + OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO) + +typedef struct ISASuperIODevice { + ISADevice parent_obj; +} ISASuperIODevice; + +typedef struct ISASuperIOFuncs { + size_t count; + bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index); + uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index); + unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index); + unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index); +} ISASuperIOFuncs; + +typedef struct ISASuperIOClass { + /*< private >*/ + ISADeviceClass parent_class; + /*< public >*/ + DeviceRealize parent_realize; +} ISASuperIOClass; + +#endif /* HW_ISA_SUPERIO_H */ diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c new file mode 100644 index 0000000000..7777f8b9f0 --- /dev/null +++ b/hw/isa/isa-superio.c @@ -0,0 +1,27 @@ +/* + * Generic ISA Super I/O + * + * Copyright (c) 2010-2012 Herve Poussineau + * Copyright (c) 2011-2012 Andreas F=C3=A4rber + * Copyright (c) 2018 Philippe Mathieu-Daud=C3=A9 + * + * This code is licensed under the GNU GPLv2 and later. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "qemu/osdep.h" +#include "hw/isa/superio.h" +#include "trace.h" + +static const TypeInfo isa_superio_type_info =3D { + .name =3D TYPE_ISA_SUPERIO, + .parent =3D TYPE_ISA_DEVICE, + .abstract =3D true, +}; + +static void isa_superio_register_types(void) +{ + type_register_static(&isa_superio_type_info); +} + +type_init(isa_superio_register_types) diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs index fb37c55cf2..cac655ba58 100644 --- a/hw/isa/Makefile.objs +++ b/hw/isa/Makefile.objs @@ -1,4 +1,5 @@ common-obj-$(CONFIG_ISA_BUS) +=3D isa-bus.o +common-obj-$(CONFIG_ISA_BUS) +=3D isa-superio.o common-obj-$(CONFIG_APM) +=3D apm.o common-obj-$(CONFIG_I82378) +=3D i82378.o common-obj-$(CONFIG_PC87312) +=3D pc87312.o --=20 2.16.2