From nobody Sat Oct 25 08:57:48 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 1520286181490511.7635102146793; Mon, 5 Mar 2018 13:43:01 -0800 (PST) Received: from localhost ([::1]:51734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxsq-0007NU-Fn for importer@patchew.org; Mon, 05 Mar 2018 16:43:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWg-0004cT-Kw for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWd-0001j0-DM for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:06 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:38776) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWd-0001ie-3s for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:03 -0500 Received: by mail-wm0-x242.google.com with SMTP id z9so18275321wmb.3 for ; Mon, 05 Mar 2018 13:20:03 -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.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:01 -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=kTSntv3zjR2gqhLvImobP5Cg8Z8qq98v4oOFQIFx5U8=; b=ALXTcHo7NCxzAJUV8XsCDmYHlZOf0hZ0fbnf8ST3IdNegfzNytd1quuTCIR1gc52tc 0/HQZtsXzo5UiCRG9YIhXgVUZB2cClwsWWvQM3qq/2hcTxnjdesXrDgfWGRn7D8GHpzJ BAw1NQcX0QW7KK29hnUUXZrN3fPz3F6U+a7LOVr1obZ5pII5PoTKuu0WC7eOCyGxRRH0 sKRScwudNGbLExO8WoM+hlr721605bqr722HNejzSQ6GM7QmgMb3idCYReFHlS50NDGk ZfyZ54m4jvwxb+03319gmC/BEvT7N6IwpGy3Gzmxi9Tk4EZOcnN+F7HE5GbYWvA74cjW fUBA== 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=kTSntv3zjR2gqhLvImobP5Cg8Z8qq98v4oOFQIFx5U8=; b=HmLEcZP1vtLJYM1VGxh3On+tjMkcCFJLnORSl91posSN/EEMzlQQpc1rJP4QFkwC3g a9yizEihVTIFfh2yFJN48WdSFigOvYeXqBOeRGBimZP8CKA7D1vD6nUP+d6VOIzQG4xf fDx1gG8uXRxiFThqsGKOKzGXIQXCywW5JoogdmfjxMWA4ZMwn/c5sJoJsfb/gIDU3Dx4 UnGL1BLuvs8okQHQNP28WPhASgDCNSEP2KpEuEBfr0ZgcJ8cOeR6USMBgjtoqORVI9HS 9wAWmQ2qE6j7hcF7yyMIYc1Z5vGAgKmxm4Fog0OhxDeDiu9eDVJjQF/10/f2TR88ADvF v6KQ== X-Gm-Message-State: AElRT7HIk+fY5djNaXL9gMLbSRAW5C5MYvkxmEhfo/yknB3+8EEkqmmq AMt4cmsnSI1VEbbWP/dLcJY= X-Google-Smtp-Source: AG47ELtmwSfx8cNkFBnvhtbbF0mf3lST3oMnhL6LRNh68YzWq070NW5CMWhkDWMj2PtODloHkw0DnA== X-Received: by 10.28.182.212 with SMTP id g203mr8851327wmf.155.1520284802089; Mon, 05 Mar 2018 13:20:02 -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:21 -0300 Message-Id: <20180305211928.466-16-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::242 Subject: [Qemu-devel] [RFC PATCH v2 15/22] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c 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 | 2 ++ hw/isa/isa-superio.c | 20 ++++++++++++++++++++ hw/mips/mips_malta.c | 35 ++++++++++------------------------- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index 3dd5448f8c..b47aac3cf8 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -54,4 +54,6 @@ typedef struct ISASuperIOClass { ISASuperIOFuncs ide; } ISASuperIOClass; =20 +#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" + #endif /* HW_ISA_SUPERIO_H */ diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 88d254a602..f1f699fc2f 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -182,9 +182,29 @@ static const TypeInfo isa_superio_type_info =3D { .class_init =3D isa_superio_class_init, }; =20 +/* SMS FDC37M817 Super I/O */ +static void fdc37m81x_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc =3D ISA_SUPERIO_CLASS(klass); + + sc->serial.count =3D 2; /* NS16C550A */ + sc->parallel.count =3D 1; + sc->floppy.count =3D 1; /* SMSC 82077AA Compatible */ + sc->ide.count =3D 0; +} + +static const TypeInfo fdc37m81x_type_info =3D { + .name =3D TYPE_FDC37M81X_SUPERIO, + .parent =3D TYPE_ISA_SUPERIO, + .instance_size =3D sizeof(ISASuperIODevice), + .class_size =3D sizeof(ISASuperIOClass), + .class_init =3D fdc37m81x_class_init, +}; + static void isa_superio_register_types(void) { type_register_static(&isa_superio_type_info); + type_register_static(&fdc37m81x_type_info); } =20 type_init(isa_superio_register_types) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 9e0724ca5a..f6513a4fd5 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -27,14 +27,12 @@ #include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/isa/superio.h" #include "hw/dma/i8257.h" #include "hw/char/serial.h" -#include "hw/char/parallel.h" -#include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" -#include "sysemu/block-backend.h" #include "hw/block/flash.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" @@ -47,7 +45,6 @@ #include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" -#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" @@ -1005,10 +1002,8 @@ void mips_malta_init(MachineState *machine) qemu_irq cbus_irq, i8259_irq; int piix4_devfn; I2CBus *smbus; - int i; DriveInfo *dinfo; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - DriveInfo *fd[MAX_FD]; int fl_idx =3D 0; int fl_sectors =3D bios_size >> 16; int be; @@ -1023,15 +1018,6 @@ void mips_malta_init(MachineState *machine) =20 qdev_init_nofail(dev); =20 - /* Make sure the first 3 serial ports are associated with a device. */ - for(i =3D 0; i < 3; i++) { - if (!serial_hds[i]) { - char label[32]; - snprintf(label, sizeof(label), "serial%d", i); - serial_hds[i] =3D qemu_chr_new(label, "null"); - } - } - /* create CPU */ mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq); =20 @@ -1067,7 +1053,14 @@ void mips_malta_init(MachineState *machine) #else be =3D 0; #endif + /* FPGA */ + + /* Make sure the second serial port is associated with a device. */ + if (!serial_hds[2]) { + serial_hds[2] =3D qemu_chr_new("fpga-uart", "null"); + } + /* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 = */ malta_fpga_init(system_memory, FPGA_ADDRESS, cbus_irq, serial_hds[2]); =20 @@ -1214,16 +1207,8 @@ void mips_malta_init(MachineState *machine) smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); =20 - /* Super I/O */ - isa_create_simple(isa_bus, TYPE_I8042); - - serial_hds_isa_init(isa_bus, 0, 2); - parallel_hds_isa_init(isa_bus, 1); - - for(i =3D 0; i < MAX_FD; i++) { - fd[i] =3D drive_get(IF_FLOPPY, 0, i); - } - fdctrl_init_isa(isa_bus, fd); + /* Super I/O: SMS FDC37M817 */ + isa_create_simple(isa_bus, TYPE_FDC37M81X_SUPERIO); =20 /* Network card */ network_init(pci_bus); --=20 2.16.2