From nobody Tue Dec 16 05:38:17 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982769829920.4397330837294; Tue, 13 Mar 2018 16:12:49 -0700 (PDT) Received: from localhost ([::1]:43416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt68-0001PK-TG for importer@patchew.org; Tue, 13 Mar 2018 19:12:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiE-0005vf-Kc for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiD-0003bN-DS for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:06 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:39405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiD-0003a4-5v for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:05 -0400 Received: by mail-wm0-x241.google.com with SMTP id u10so668643wmu.4 for ; Tue, 13 Mar 2018 15:48:05 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:03 -0700 (PDT) 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=1iu5nR6twMNpMDcGXmTmrLwJzZ1DaDeciJmYloRZnLw=; b=PaoXMV1JfHNxlA+hX1JscMt+G2OLPjgXNjPuox4EMMELXAErlrSk2zPmiADsrlkIB2 Fi4nch6MuUJZpGkXjBnEMOJPElBODK01VvgpZ+Feomf5VWmmKMAzBEmErhzFLvDIQtHF WR69+5kxP5epyjEGLPMsKX30ns+0uAbXMzc48cbCRSCVHDbgXHtp6fPjKh9MWL+omQFS eq/3EQNOwHfbnpYSSYcMBGkSe0B4QZQkD+lLF17trWTWvvaB+pkTPbyMmWGz6NhqX6/g KjKwbbPgu42ITGEmLCU5trJtOtpx7AmQDdlbfpupx7YThdy5NNFEEhUnK7hg3G7aS89J xYhg== 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=1iu5nR6twMNpMDcGXmTmrLwJzZ1DaDeciJmYloRZnLw=; b=lGi/K9Oq8VT8EzQkVFu3s1zBcnKljmnjPmxEY3EL6SGLe+XR/eB0jLt6mfXj7IgNtd DAFqLvt42QxYT1tn7Ry8fWjb+F6VwTIXQ+pkLv3sHxG1R9jOGOhG/YjgIm8POQ2dPFDJ Br9DoclE5DH09Zn+wGZcb2Y779foA0brII5YFR2ds4cPp3z0aFQC4dKmi09r7CPA4URG VXqorhXCsriSJMqudbk2A2q2094zAerUH1zEd1CXTfE4ABKOcTAs5xlFyimp+jtUcnfj 2t0pjsv1iRyNSpf9lMXsy0adts9XeOAz3c+7pt6yc1ITOLPf6WUiymK/1M/12591yl9J Zakw== X-Gm-Message-State: AElRT7HxUkQoeyrQa0M0JXjQtfRbKnQnZ+yfW5CCtR9rycnDsxRRGO6U xpeO4XNYhUBxrrEZGkko7HTegFSx X-Google-Smtp-Source: AG47ELtxSw+YxkAMZcbyAZ0TVL0rjiPzRn3MXL76xz6prcdnX45wUuqniZvahd9m027gVRJRw6vTWw== X-Received: by 10.28.1.208 with SMTP id 199mr2126095wmb.26.1520981283732; Tue, 13 Mar 2018 15:48:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:44 +0100 Message-Id: <20180313224719.4954-35-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> 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:c09::241 Subject: [Qemu-devel] [PULL 34/69] 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-9-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ hw/isa/Makefile.objs | 1 + hw/isa/isa-superio.c | 28 ++++++++++++++++++++++++++++ include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 hw/isa/isa-superio.c create mode 100644 include/hw/isa/superio.h diff --git a/MAINTAINERS b/MAINTAINERS index 1ff22ce610..9f7b8e79c4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -933,6 +933,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* @@ -944,6 +945,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 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/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 */ --=20 2.14.3