From nobody Mon Feb 9 18:19:59 2026 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 1520548985697419.5936557929174; Thu, 8 Mar 2018 14:43:05 -0800 (PST) Received: from localhost ([::1]:42229 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu4Fc-0000Jw-QV for importer@patchew.org; Thu, 08 Mar 2018 17:43:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eu4Cp-0006rO-Fl for qemu-devel@nongnu.org; Thu, 08 Mar 2018 17:40:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eu4Co-0003wm-Bx for qemu-devel@nongnu.org; Thu, 08 Mar 2018 17:40:11 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:44421) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eu4Co-0003wI-2U for qemu-devel@nongnu.org; Thu, 08 Mar 2018 17:40:10 -0500 Received: by mail-wr0-x242.google.com with SMTP id v65so7241072wrc.11 for ; Thu, 08 Mar 2018 14:40:09 -0800 (PST) Received: from x1.local (ABayonne-654-1-76-150.w86-222.abo.wanadoo.fr. [86.222.219.150]) by smtp.gmail.com with ESMTPSA id x190sm19315070wme.27.2018.03.08.14.40.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 14:40:08 -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=TARYWOhrsRPUPzT4UB0gFWKbOBroR1G5N3bKrx6nU+4=; b=Dks21kCF0m6PSEDua7aFULiu2qW3alAxQRQx0U2EYEN3Ttn46N+beU7BHfl6HhN3EW EeatgA1LhJiX+A5cbdx+00WNq7is2BzeN+yrh+vjlJfUMlX7l72HtwH31U5WmvmRqRoG v/sg0Cw6kLyer6HtTa991VY0RoD4qzRt8o5F4ahuFIJI8FzLOx8l7KwYfbJDufZkgEhC Kh0bVu9gEqWWQR51aB2ZDI3IX2dLQyWryvVO1Q1xIbzB4IKVHd1P0GOMzGA944YwZJ5F DCiEr8D/B5tuo790Q06VGVPryXr9aL1hpRZHpg3PBln/+HxXdfr0Vzbb0j3WU+HTdc9y b4VQ== 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=TARYWOhrsRPUPzT4UB0gFWKbOBroR1G5N3bKrx6nU+4=; b=sISqUFlRA432bOh9BwiDDfc/N9yZG6Ko8Fdpei3oGcAqsQ1EK3b1Fp6YGKOwX240uj SjGY5DJwM8M3zWCeb0xh4/KTI0+/yC/3AERakXSn7R7MN81Ywi8ryMguyYUyKnKypvY8 8aYrj9xdlKKSkAJVk4btdtjvw9rQplpWkOCt+XMvMRoom61CZF2CTTFCzE/3GaD07J02 9ALfU4hK5G2nPMz6FRcpetblZ45CWa+kZ2kBoqrKlP1JOtBt6QOkFkYBsnUHIaYN/QqF yWi6g/VW6ckPq5l3CmwjLAIcUPqiDMkNoPeZXsqBZL4EJrTw4hlhSmS7ZFz13knsV2hR eafA== X-Gm-Message-State: APf1xPAgu9z+bEIsb2tldhNze2Z/vh0IzIJGx+91rPEQ3McRYvI2CY/v Fj5hhfV/pQfQW7V411NcgYA= X-Google-Smtp-Source: AG47ELt+YJ+2ec3vuPzkkpbJZVfcJnSawEeq438AqwdLW+5COYG0p4Xx7r5LjslWc8yr1hnUESYsqQ== X-Received: by 10.223.187.72 with SMTP id x8mr22902918wrg.217.1520548809069; Thu, 08 Mar 2018 14:40:09 -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: Thu, 8 Mar 2018 23:39:29 +0100 Message-Id: <20180308223946.26784-9-f4bug@amsat.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180308223946.26784-1-f4bug@amsat.org> References: <20180308223946.26784-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] [PATCH 08/25] 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 | 28 ++++++++++++++++++++++++++++ MAINTAINERS | 2 ++ hw/isa/Makefile.objs | 1 + 4 files changed, 75 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..14ec16f831 --- /dev/null +++ b/hw/isa/isa-superio.c @@ -0,0 +1,28 @@ +/* + * 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, + .class_size =3D sizeof(ISASuperIOClass), +}; + +static void isa_superio_register_types(void) +{ + type_register_static(&isa_superio_type_info); +} + +type_init(isa_superio_register_types) diff --git a/MAINTAINERS b/MAINTAINERS index 212eaa836a..98a8918c20 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -922,6 +922,7 @@ F: hw/input/pckbd.c F: hw/intc/apic* F: hw/intc/ioapic* F: hw/intc/i8259* +F: hw/isa/isa-superio.c F: hw/misc/debugexit.c F: hw/misc/pc-testdev.c F: hw/timer/hpet* @@ -933,6 +934,7 @@ F: include/hw/char/parallel.h F: include/hw/dma/i8257.h F: include/hw/i2c/pm_smbus.h F: include/hw/input/i8042.h +F: include/hw/isa/superio.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc* 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