From nobody Tue Dec 16 07:07:01 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983703214284.24331379404; Tue, 13 Mar 2018 16:28:23 -0700 (PDT) Received: from localhost ([::1]:43505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtL3-0008BQ-2y for importer@patchew.org; Tue, 13 Mar 2018 19:28:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiW-0006BW-9e for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiV-0003zn-1x for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:24 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:33975) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiU-0003yj-Nk for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: by mail-wr0-x243.google.com with SMTP id o8so2598942wra.1 for ; Tue, 13 Mar 2018 15:48:22 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:20 -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=M1zhUfv16YFP019e1YEXTyAoKHVM5Bbw3qs3fjbc1UY=; b=SUCeoseqbKJEBSmWHzNM6R7k7d7PhJgpyj4lNL0edV4nIoytfGerJxMETCzcY+szIm +qdYynIqM7rqdI0FFmBz3WH10I9s2Ehqxpr6kZ8T74hPrAlyOREeIvGoWvl2gPuyVxkB HMGo5T9UZpGdDJH2rcnCjgziQEuG+l6NGHGtpKazpi4EbZ5+YQIDDqFrb2B2wgCJgJXy qF/MHqEY3YCmm2kz6T7jeF2s1t0e6ZwpdsAx2hTXH8KsBTDjk9GRUANF+Q28EjWTU+7M bFImM+59Ru+613BL3XZLArPbIlyRH5t0f1o6pCJJ2rDfBv75iCLWPTb4L/9b+GQoKB5a Q3Pg== 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=M1zhUfv16YFP019e1YEXTyAoKHVM5Bbw3qs3fjbc1UY=; b=t0GWutv/fbSjzBP2FFpwNH/tt5z9zwBS0tPuWyM+i0mFZe4ig12Un5dCnhHpxWbi3w E4dRbNvDdNNFCYlV52kwL+JgisAKKeZQzbdTBTGsabPUpXvP7JYFgn8j8Z4NtZJgG9om q1zw7o6c+bObufWWRz10cg7tXwBN1G0wYG/T86qeJTfX8kMOsQ79snEcVDDNC5Q4TMJn wpY0gvm/c50qRBe2H0wyM1uNWvAftwl4pu+eYm89kczD0dTxoOksF1Thf9Z9BCpvVaW7 aUdz2fRRbR7gLme5Kloj0JE2U4MYN0Noy5naknk+jxhrs87IJNatr2rHj3F5cJv4Yfzz Y7Pg== X-Gm-Message-State: AElRT7GDUp6slG7PotugT/J66pvpYUNUGsDHEdbVPZ7/jwsjYiKOmYhI qTJs4RgRDjdAt7OgISuGpjF0P8AM X-Google-Smtp-Source: AG47ELszzIxmz8UASboFD3lxPwg9INDO77F6VWx7FwnZebVidJYNEVYlumHxAepnRkN3GWHpYVgZvQ== X-Received: by 10.223.135.26 with SMTP id a26mr1986436wra.211.1520981301026; Tue, 13 Mar 2018 15:48:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:58 +0100 Message-Id: <20180313224719.4954-49-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:c0c::243 Subject: [Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/O 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-23-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + hw/isa/Makefile.objs | 2 +- hw/isa/smc37c669-superio.c | 115 +++++++++++++++++++++++++++++++++++++++++= ++++ include/hw/isa/superio.h | 1 + 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 hw/isa/smc37c669-superio.c diff --git a/MAINTAINERS b/MAINTAINERS index b17324107f..216d01efd6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -416,6 +416,7 @@ Alpha Machines M: Richard Henderson S: Maintained F: hw/alpha/ +F: hw/isa/smc37c669-superio.c =20 ARM Machines ------------ diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs index cac655ba58..83e06f6c04 100644 --- a/hw/isa/Makefile.objs +++ b/hw/isa/Makefile.objs @@ -1,5 +1,5 @@ common-obj-$(CONFIG_ISA_BUS) +=3D isa-bus.o -common-obj-$(CONFIG_ISA_BUS) +=3D isa-superio.o +common-obj-$(CONFIG_ISA_BUS) +=3D isa-superio.o smc37c669-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/smc37c669-superio.c b/hw/isa/smc37c669-superio.c new file mode 100644 index 0000000000..aa233c6967 --- /dev/null +++ b/hw/isa/smc37c669-superio.c @@ -0,0 +1,115 @@ +/* + * SMC FDC37C669 Super I/O controller + * + * 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" + +/* UARTs (compatible with NS16450 or PC16550) */ + +static bool is_serial_enabled(ISASuperIODevice *sio, uint8_t index) +{ + return index < 2; +} + +static uint16_t get_serial_iobase(ISASuperIODevice *sio, uint8_t index) +{ + return index ? 0x2f8 : 0x3f8; +} + +static unsigned int get_serial_irq(ISASuperIODevice *sio, uint8_t index) +{ + return index ? 3 : 4; +} + +/* Parallel port */ + +static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index) +{ + return index < 1; +} + +static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index) +{ + return 0x3bc; +} + +static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index) +{ + return 7; +} + +static unsigned int get_parallel_dma(ISASuperIODevice *sio, uint8_t index) +{ + return 3; +} + +/* Diskette controller (Software compatible with the Intel PC8477) */ + +static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index) +{ + return index < 1; +} + +static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index) +{ + return 0x3f0; +} + +static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index) +{ + return 6; +} + +static unsigned int get_fdc_dma(ISASuperIODevice *sio, uint8_t index) +{ + return 2; +} + +static void smc37c669_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc =3D ISA_SUPERIO_CLASS(klass); + + sc->parallel =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_parallel_enabled, + .get_iobase =3D get_parallel_iobase, + .get_irq =3D get_parallel_irq, + .get_dma =3D get_parallel_dma, + }; + sc->serial =3D (ISASuperIOFuncs){ + .count =3D 2, + .is_enabled =3D is_serial_enabled, + .get_iobase =3D get_serial_iobase, + .get_irq =3D get_serial_irq, + }; + sc->floppy =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_fdc_enabled, + .get_iobase =3D get_fdc_iobase, + .get_irq =3D get_fdc_irq, + .get_dma =3D get_fdc_dma, + }; + sc->ide.count =3D 0; +} + +static const TypeInfo smc37c669_type_info =3D { + .name =3D TYPE_SMC37C669_SUPERIO, + .parent =3D TYPE_ISA_SUPERIO, + .instance_size =3D sizeof(ISASuperIODevice), + .class_size =3D sizeof(ISASuperIOClass), + .class_init =3D smc37c669_class_init, +}; + +static void smc37c669_register_types(void) +{ + type_register_static(&smc37c669_type_info); +} + +type_init(smc37c669_register_types) diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index b47aac3cf8..f9ba29aa30 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -55,5 +55,6 @@ typedef struct ISASuperIOClass { } ISASuperIOClass; =20 #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" +#define TYPE_SMC37C669_SUPERIO "smc37c669-superio" =20 #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3