From nobody Sat Oct 25 08:57:40 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 1520286249475981.3095426060322; Mon, 5 Mar 2018 13:44:09 -0800 (PST) Received: from localhost ([::1]:51741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxtw-0008CO-Ny for importer@patchew.org; Mon, 05 Mar 2018 16:44:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWl-0004jI-9b for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWk-0001pS-8R for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:11 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:39945) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWj-0001oN-Vk for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:10 -0500 Received: by mail-wm0-x241.google.com with SMTP id t6so18389535wmt.5 for ; Mon, 05 Mar 2018 13:20:09 -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.20.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20: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=bxe6fRds++En9bBx5copdbN5Zlyz7ErRGYq7UYEJacY=; b=f6YnWw1Vxly4XE0WW3PvwBU0444EubYV0UgfwyVja/mbHOHdDyQrfHIXwh7bX/2cvo aosPghzjd7alGI8ztIy2vnoVS/xDRi6Y+AiXKpsUNtpGrBvxg3hqS6RUnJ45zNRuJqAW 9wYJJJnAHWQvxPARySEWpCC3CyV+vcfQs6lz5gkNkG6Wqts93bvg7M3gGtkjm6EMVA4Z weeA+13Mg16120oAYFgmAQl+jgXXMT06IiBWARv2j2wGuXqyYToANAC8CdRFYCBOshCY yt+dpDuVaHTf3Bl5dkhc47PcjvHuVA4ow7SjGf6X/sEmfTNyiGzvz3pykXLIT8zwjNay KTPA== 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=bxe6fRds++En9bBx5copdbN5Zlyz7ErRGYq7UYEJacY=; b=JKpE5VhTVlx4pYJ0Bf51QURuQIjE2uNbjkLcLM4TKzZxN4ftB2gJVIApUhAYNJ5b0O zpct9sgMO/8OP+ob/4hG/dBXDJ8PSRoiF6iWKw3cuZDxKJDfGWH7TmBuzKJ/jVIKdTTg +jArK06djiZ0loQ2sJS8u4Tv0ALCDBlPixEH62S/3BxQ6AptyvNCzMPaJsRsexvXzCt0 pikDOCZ9f0AOANEWyUSlXXcjpSBXlazgigCm3oX+zeJDPiaKAGH1K6J6ML9FVc3PvcHc XjyLr/xxHiQvwbFW/+gnSH+XjsKFW+4pLCdpnWktx08uC3dsgxp8v114PAACpBJ7cktf wSsw== X-Gm-Message-State: AElRT7FNhTgg8DnFbNfy3t5WIWVWk+o7b565zyL6QKJb8/64TcXmIWwp KhL/3/bA3zZsZEKkWmCBwcc= X-Google-Smtp-Source: AG47ELtgT1kMNozQyOiw2UFlD3rjnO5OyO0qV+icUak9iN1EB3mS4nvCTSkdM4lDHEgJ5/8OULhatg== X-Received: by 10.28.21.67 with SMTP id 64mr9303007wmv.151.1520284809051; Mon, 05 Mar 2018 13:20: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: Mon, 5 Mar 2018 18:19:25 -0300 Message-Id: <20180305211928.466-20-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:c09::241 Subject: [Qemu-devel] [RFC PATCH v2 19/22] 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: 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 | 1 + hw/isa/smc37c669-superio.c | 115 +++++++++++++++++++++++++++++++++++++++++= ++++ hw/isa/Makefile.objs | 2 +- 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 hw/isa/smc37c669-superio.c 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 */ 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/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 --=20 2.16.2