From patchwork Mon Mar 5 21:19:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881714 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="TWkWa4Kq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCZ00jBJz9sXt for ; Tue, 6 Mar 2018 08:23:20 +1100 (AEDT) Received: from localhost ([::1]:51597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxZm-0006mU-3k for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:23:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWG-0004BF-4s for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWE-0001TC-ID for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:40 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:34030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWE-0001Sc-8L for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:38 -0500 Received: by mail-wr0-x243.google.com with SMTP id o8so7291944wra.1 for ; Mon, 05 Mar 2018 13:19:38 -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=q3Cp+tUtLDDMJZl0HxrMwPLs9V+5DPEGV6PjYxTJXXo=; b=TWkWa4KqRUtPfVTpha6d0ehXTSI8721mSiSjjTKb9jdU9lPxT+Pe+PPDP61LM7cmZ9 ERceYESvKfhaETwOGS53vzJOMWywWixw661K56aE3BkTNLg//ZJntAIfK3A4NOEYRXk8 AuCsE45juJTQSwH21E/riHGkg5r/uNGf+m8FDBDdRtpze7ZcfTprsypNJ5vLQr3kIsme y4YZoXpk/oA92ZqtNliKwMiE1b3Qug1gdyo5VY20iQXhr/DOORho4CZpH0ohn2TzG57k w+N+EmfB+QzsBluwYcXVn0tqPEj8Nr5VeVLa63uDuyw1HJ0j5q1QPAEZkTpAAkADIcHE 9LOA== 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=q3Cp+tUtLDDMJZl0HxrMwPLs9V+5DPEGV6PjYxTJXXo=; b=V7XaAjRFjZJxAkzDDaheuhLZPHXSfL2ydeYTUsx3EEj8o6rMHwW/pYY9r6UfiJ3fLy lGwvkTq2asBC0sq/pVZhLjZw6XIzfya3n8CCIEu+RXSCiGKZATSgPsX+qTLuzWzyRKyK DnopFgrpgqEpjxAOK/tHD38wSkhrvfMSkC/U8rQboIOdCuCAZ4nzgzyDkN1+AX0puGwj OL5H9ISCxvBnJxXXZWt57ImsHsmbzqsXX1KPO80KmKZ8xs7dw+rrmg8UjovmEFYu8w9k 0pJyvl2y/3+Z3BzssRbpP0wcf7pxHQO9zrOAOF95iGhEzG9LtCULmHFDEBB6cRrd9lnu PInA== X-Gm-Message-State: APf1xPDKrdvw9s/+nThoJTrTeQtwcBBBj8I4mAD+zrk8/wfBc4kJX/tw O5VVPo+VtnZp66APkggsQV0= X-Google-Smtp-Source: AG47ELsK/I6YNDloUmyUO0G++k5DLd65oiAkDkRYPikq1EXZyMxfrgORe0y2oZRhOcjnylMhDWkMyw== X-Received: by 10.223.160.157 with SMTP id m29mr13813657wrm.119.1520284777172; Mon, 05 Mar 2018 13:19:37 -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.19.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:36 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:07 -0300 Message-Id: <20180305211928.466-2-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 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] [RFC PATCH v2 01/22] hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Again... (after 07dc788054d7 and 9157eee1b1c0). We now extract the ISA bus specific helpers. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/char/parallel.h | 14 ++++++++++++++ include/hw/i386/pc.h | 8 -------- hw/char/parallel-isa.c | 36 ++++++++++++++++++++++++++++++++++++ hw/char/parallel.c | 2 +- hw/i386/pc.c | 1 + hw/isa/isa-bus.c | 26 -------------------------- hw/mips/mips_fulong2e.c | 1 + hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 1 + hw/sparc64/sun4u.c | 1 + MAINTAINERS | 3 ++- hw/char/Makefile.objs | 1 + 12 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 include/hw/char/parallel.h create mode 100644 hw/char/parallel-isa.c diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h new file mode 100644 index 0000000000..d6dd62fb9f --- /dev/null +++ b/include/hw/char/parallel.h @@ -0,0 +1,14 @@ +#ifndef HW_PARALLEL_H +#define HW_PARALLEL_H + +#include "exec/memory.h" +#include "hw/isa/isa.h" +#include "chardev/char.h" + +void parallel_hds_isa_init(ISABus *bus, int n); + +bool parallel_mm_init(MemoryRegion *address_space, + hwaddr base, int it_shift, qemu_irq irq, + Chardev *chr); + +#endif diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index bb49165fe0..f1feb18c3c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -151,14 +151,6 @@ struct PCMachineClass { #define PC_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) -/* parallel.c */ - -void parallel_hds_isa_init(ISABus *bus, int n); - -bool parallel_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, qemu_irq irq, - Chardev *chr); - /* i8259.c */ extern DeviceState *isa_pic; diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c new file mode 100644 index 0000000000..639e179585 --- /dev/null +++ b/hw/char/parallel-isa.c @@ -0,0 +1,36 @@ +/* + * QEMU Parallel PORT (ISA bus helpers) + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ +#include "qemu/osdep.h" +#include "sysemu/sysemu.h" +#include "hw/isa/isa.h" +#include "hw/char/parallel.h" + +static void parallel_init(ISABus *bus, int index, Chardev *chr) +{ + DeviceState *dev; + ISADevice *isadev; + + isadev = isa_create(bus, "isa-parallel"); + dev = DEVICE(isadev); + qdev_prop_set_uint32(dev, "index", index); + qdev_prop_set_chr(dev, "chardev", chr); + qdev_init_nofail(dev); +} + +void parallel_hds_isa_init(ISABus *bus, int n) +{ + int i; + + assert(n <= MAX_PARALLEL_PORTS); + + for (i = 0; i < n; i++) { + if (parallel_hds[i]) { + parallel_init(bus, i, parallel_hds[i]); + } + } +} diff --git a/hw/char/parallel.c b/hw/char/parallel.c index f79dc76543..1542d62201 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -28,7 +28,7 @@ #include "chardev/char-parallel.h" #include "chardev/char-fe.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" +#include "hw/char/parallel.h" #include "sysemu/sysemu.h" //#define DEBUG_PARALLEL diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 94cfd40ef2..404bb39ffd 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -26,6 +26,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/i386/apic.h" #include "hw/i386/topology.h" #include "sysemu/cpus.h" diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 0f2e426d02..63fa77effc 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -24,7 +24,6 @@ #include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" static ISABus *isabus; @@ -288,28 +287,3 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) } type_init(isabus_register_types) - -static void parallel_init(ISABus *bus, int index, Chardev *chr) -{ - DeviceState *dev; - ISADevice *isadev; - - isadev = isa_create(bus, "isa-parallel"); - dev = DEVICE(isadev); - qdev_prop_set_uint32(dev, "index", index); - qdev_prop_set_chr(dev, "chardev", chr); - qdev_init_nofail(dev); -} - -void parallel_hds_isa_init(ISABus *bus, int n) -{ - int i; - - assert(n <= MAX_PARALLEL_PORTS); - - for (i = 0; i < n; i++) { - if (parallel_hds[i]) { - parallel_init(bus, i, parallel_hds[i]); - } - } -} diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index f68c625666..dc77b55755 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -23,6 +23,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index b09871a814..b24305b7b4 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -28,6 +28,7 @@ #include "hw/mips/cpudevs.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "sysemu/sysemu.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 6f0deb99e7..c74882c7e9 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -28,6 +28,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index da28ab9413..ceb1ba7eaf 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -34,6 +34,7 @@ #include "hw/pci-host/sabre.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/timer/m48t59.h" #include "hw/block/fdc.h" #include "net/net.h" diff --git a/MAINTAINERS b/MAINTAINERS index b7c4130388..c0f1620f3a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -913,7 +913,7 @@ M: Michael S. Tsirkin M: Paolo Bonzini S: Supported F: hw/char/debugcon.c -F: hw/char/parallel.c +F: hw/char/parallel* F: hw/char/serial* F: hw/dma/i8257* F: hw/i2c/pm_smbus.c @@ -928,6 +928,7 @@ F: hw/timer/i8254* F: hw/timer/mc146818rtc* F: hw/watchdog/wdt_ib700.c F: include/hw/display/vga.h +F: include/hw/char/parallel.h F: include/hw/i2c/pm_smbus.h F: include/hw/isa/i8257.h F: include/hw/timer/hpet.h diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs index 1bcd37e98d..1b979100b7 100644 --- a/hw/char/Makefile.objs +++ b/hw/char/Makefile.objs @@ -1,6 +1,7 @@ common-obj-$(CONFIG_IPACK) += ipoctal232.o common-obj-$(CONFIG_ESCC) += escc.o common-obj-$(CONFIG_PARALLEL) += parallel.o +common-obj-$(CONFIG_PARALLEL) += parallel-isa.o common-obj-$(CONFIG_PL011) += pl011.o common-obj-$(CONFIG_SERIAL) += serial.o common-obj-$(CONFIG_SERIAL_ISA) += serial-isa.o From patchwork Mon Mar 5 21:19:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881711 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="PV9ZgE0C"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCVv0Fffz9sgP for ; Tue, 6 Mar 2018 08:20:39 +1100 (AEDT) Received: from localhost ([::1]:51581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxXB-0004Fw-2X for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:20:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWH-0004CA-NT for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWG-0001Tn-D8 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:41 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:38490) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWG-0001TP-37; Mon, 05 Mar 2018 16:19:40 -0500 Received: by mail-wr0-x244.google.com with SMTP id n7so18805458wrn.5; Mon, 05 Mar 2018 13:19:40 -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=WGdaIr4uwsZpaFDn5IINoVSGD+bqXMUs64wkRtsUD2Y=; b=PV9ZgE0CPZjSEf7d0mTFiPy2YvMuGumutFkJhRtoK1p2R2NUpm6VHMBbH6sF6LYlHG ckWKNLY4H+qgnHmboUmYQaKDM6fzxH9lbZC8uYZ12IHIOUP6Uv3Eo/XsgdlGqHVBhqxY QE5sCngINSSWP8vTCmZo6vJLAilX71Bl8sTpwMAiuRdHEEgXOjPYjPM5+0G2GllVS0t/ HsrpEUx0P21K7YwdVL3JUeM6zps3YaROoFqSzZxKvanq6jsom8wGbK4Zsxc4dRTJkKhn Z9+aCPDMAqmxJ6ONkyUSUzmJQImvZ8VE0Oypk0Mv2sFg+hPCDlVq64Ym2R4ZgLhDJXw3 Ptvg== 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=WGdaIr4uwsZpaFDn5IINoVSGD+bqXMUs64wkRtsUD2Y=; b=tumJIug2hW40LvZqLnNp0R01lb9By97gKWp+y8eaQnIJ1E4TO/mjXftpbBKBjeVSW3 zkJMg7bQ63DEq1aQ22kQA5C0SKD2AZtYeobjoW/RSRL4XGcp0gFBpoQd6iHVeRhBkV1q ckV9sW8u/bjOsnM7I0aQxb04QLvWO6/IweACfyYno6K4JcqvQEQ6OzYFhgly3vB1sbiL D+LO/YYbx0VrVgg9rZcNN7uhtYmGKoTpzuZoO+rEOadEZWx8hhdtIF7vOuagng1Jd81f AGp7ezcUgU+ESJDJiWn77dQOd++PHmaooM1aaGKuBq3XENwjsS5dnZVLALwaJuPDfo4z wWuQ== X-Gm-Message-State: APf1xPCQkvL3mvudeS0PZwYfiAuQ/e8nzcct/A5zZ97H1UtRrOjfeP8k 7j/HyhzU5I0yOcg/Ajy8E64= X-Google-Smtp-Source: AG47ELu//+q8d5MPLPVFRt1LW8qmcWUg1fugU/R7evHQBEInsisV2Cw/cCjGcBXoCTQ5xFuNYQ5s6w== X-Received: by 10.223.141.200 with SMTP id o66mr13368938wrb.39.1520284778965; Mon, 05 Mar 2018 13:19:38 -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.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:38 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:08 -0300 Message-Id: <20180305211928.466-3-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [RFC PATCH v2 02/22] hw/dma/i8257: Rename DMA_init() to i8257_dma_init() 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" - Move the header from hw/isa/ to hw/dma/ - Remove the old i386/pc dependency - use a bool type for the high_page_enable argument Signed-off-by: Philippe Mathieu-Daudé --- include/hw/{isa => dma}/i8257.h | 6 ++++++ include/hw/isa/isa.h | 2 -- hw/dma/i82374.c | 3 ++- hw/dma/i8257.c | 4 ++-- hw/i386/pc.c | 3 ++- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 3 ++- hw/mips/mips_malta.c | 3 ++- hw/sparc/sun4m.c | 4 ---- hw/sparc64/sun4u.c | 4 ---- MAINTAINERS | 2 +- 11 files changed, 19 insertions(+), 18 deletions(-) rename include/hw/{isa => dma}/i8257.h (86%) diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h similarity index 86% rename from include/hw/isa/i8257.h rename to include/hw/dma/i8257.h index 88a2766a3f..2cab50bb6c 100644 --- a/include/hw/isa/i8257.h +++ b/include/hw/dma/i8257.h @@ -1,6 +1,10 @@ #ifndef HW_I8257_H #define HW_I8257_H +#include "hw/hw.h" +#include "hw/isa/isa.h" +#include "exec/ioport.h" + #define TYPE_I8257 "i8257" typedef struct I8257Regs { @@ -40,4 +44,6 @@ typedef struct I8257State { PortioList portio_pageh; } I8257State; +void i8257_dma_init(ISABus *bus, bool high_page_enable); + #endif diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 95593408ef..b9dbab24b4 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d) return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); } -/* i8257.c */ -void DMA_init(ISABus *bus, int high_page_enable); #endif diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index 6c0f975df0..83c87d92e0 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "hw/isa/isa.h" +#include "hw/dma/i8257.h" #define TYPE_I82374 "i82374" #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374) @@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp) portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj), s->iobase); - DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1); + i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true); memset(s->commands, 0, sizeof(s->commands)); } diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index bd23e893bf..52675e97c9 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -24,7 +24,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/isa/isa.h" -#include "hw/isa/i8257.h" +#include "hw/dma/i8257.h" #include "qemu/main-loop.h" #include "trace.h" @@ -622,7 +622,7 @@ static void i8257_register_types(void) type_init(i8257_register_types) -void DMA_init(ISABus *bus, int high_page_enable) +void i8257_dma_init(ISABus *bus, bool high_page_enable) { ISADevice *isa1, *isa2; DeviceState *d; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 404bb39ffd..95b3fb3523 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -41,6 +41,7 @@ #include "elf.h" #include "multiboot.h" #include "hw/timer/mc146818rtc.h" +#include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h" @@ -1609,7 +1610,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, port92_init(port92, a20_line[1]); g_free(a20_line); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index dc77b55755..0545fcd899 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -22,6 +22,7 @@ #include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/block/fdc.h" @@ -360,7 +361,7 @@ static void mips_fulong2e_init(MachineState *machine) /* init other devices */ pit = i8254_pit_init(isa_bus, 0x40, 0, NULL); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); /* Super I/O */ isa_create_simple(isa_bus, "i8042"); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index b24305b7b4..827ffdcd4a 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -27,6 +27,7 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/isa/isa.h" @@ -220,7 +221,7 @@ static void mips_jazz_init(MachineState *machine, /* ISA devices */ i8259 = i8259_init(isa_bus, env->irq[4]); isa_bus_irqs(isa_bus, i8259); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); pit = i8254_pit_init(isa_bus, 0x40, 0, NULL); pcspk_init(isa_bus, pit); diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index c74882c7e9..9cb86c432e 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -27,6 +27,7 @@ #include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/block/fdc.h" @@ -1209,7 +1210,7 @@ void mips_malta_init(MachineState *machine) smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); pit = i8254_pit_init(isa_bus, 0x40, 0, NULL); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); /* Super I/O */ isa_create_simple(isa_bus, "i8042"); diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 61eb424bbc..b6138760e6 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -99,10 +99,6 @@ struct sun4m_hwdef { uint8_t nvram_machine_id; }; -void DMA_init(ISABus *bus, int high_page_enable) -{ -} - static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index ceb1ba7eaf..0ca0243821 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -90,10 +90,6 @@ typedef struct EbusState { #define TYPE_EBUS "ebus" #define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) -void DMA_init(ISABus *bus, int high_page_enable) -{ -} - static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { diff --git a/MAINTAINERS b/MAINTAINERS index c0f1620f3a..335c6c9f65 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -929,8 +929,8 @@ F: hw/timer/mc146818rtc* F: hw/watchdog/wdt_ib700.c F: include/hw/display/vga.h F: include/hw/char/parallel.h +F: include/hw/dma/i8257.h F: include/hw/i2c/pm_smbus.h -F: include/hw/isa/i8257.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc* From patchwork Mon Mar 5 21:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tEm/5IRH"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCVx5hrKz9sgQ for ; Tue, 6 Mar 2018 08:20:41 +1100 (AEDT) Received: from localhost ([::1]:51582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxXD-0004K4-Qd for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:20:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWK-0004Eh-4C for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWI-0001UJ-GA for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:44 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:53424) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWI-0001U1-5f; Mon, 05 Mar 2018 16:19:42 -0500 Received: by mail-wm0-x242.google.com with SMTP id t74so18846259wme.3; Mon, 05 Mar 2018 13:19:42 -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=9BhZ2Ad+M63Anz2wzY251SFzNDhq56ESLYCil4p9fQQ=; b=tEm/5IRHvESuSgRWRFjZlK58AbA3/57VrubNYF5IwHsXxl4Xuih7anQyLAv4M4iTW5 NmrjNjfu9zRJ6AROz/GGxPbirzmHos0SEe53fyIAlLV7gznfRspxm5yEHx0tUoWEEp2T ARtrbjEbyND3pUH4cbCpQirRpo0kmHGCghIl9XeDPftvBhxAyvRpiqsVOEPNy8E+981y g0/POTNUg0BR1UWf62d8yfkqSTRgPSjgpS0lY+NN3z21By4KgHe89/vg9TU1k0MRYac9 t8rIwghQwWHYPvp9rfG2VJLwWt8Lv7fjmMkI6zyRRicMgb9R4GwJtuH3DSxCVycYXbH1 znvw== 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=9BhZ2Ad+M63Anz2wzY251SFzNDhq56ESLYCil4p9fQQ=; b=TaRxLfagW/nkNmYiaJ7nzruMV9pteSEcWA4WuEsP8ivKgXxYXVldasHWLKjcuxcufp vU3oeBEvn9x8a3ZuCaTIFiVLsPo2kn0x/5i79TMr9kDyesih9EGvDAU3XomSciPCNmXi eKYQaCWCFWuuqq9+l2+YhAk1dbMQOUkFgyRdKHwtMlAUhsKl6OBVlvp0RuZgiwDimIQ0 S+ALlw9zCUC7Rq9A+T0IIY2dcC1we9IoJpIFxddcUYiw08n1og6Vo6BkQ5CuLi5ivC9+ nej/CNmpYeAhrQ+K5gKG7xOUvIDLJ3xUQawlLoSY0BFhghPnSDxI5Am35U/rF/rxm8// PhJA== X-Gm-Message-State: AElRT7G7w2e7Tux7p2ZJaZLaf6dIH09fTwR1Hr16rOPqGcuKOlaAzf8I 0iQ/giyRw8aSv9PCmaexvQI= X-Google-Smtp-Source: AG47ELs5OfIC68rWXiy/V4EGzLWRSCRhoX4dsOosbDNoZm1hwWdslDcaMSthT6AiNo7U+yfns51ejg== X-Received: by 10.28.208.70 with SMTP id h67mr1151262wmg.95.1520284780974; Mon, 05 Mar 2018 13:19:40 -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.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:40 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:09 -0300 Message-Id: <20180305211928.466-4-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 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 03/22] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h 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: Alexander Graf , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, "open list:PReP" , David Gibson , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson --- include/hw/i386/pc.h | 9 --------- include/hw/input/i8042.h | 24 ++++++++++++++++++++++++ hw/alpha/dp264.c | 3 ++- hw/i386/pc.c | 1 + hw/i386/vmmouse.c | 1 + hw/i386/vmport.c | 1 + hw/input/pckbd.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 3 ++- hw/mips/mips_r4k.c | 3 ++- hw/ppc/prep.c | 5 +++-- hw/sparc64/sun4u.c | 1 + hw/unicore32/puv3.c | 1 + MAINTAINERS | 1 + 15 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 include/hw/input/i8042.h diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index f1feb18c3c..1638618dfc 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -188,15 +188,6 @@ void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque); void vmmouse_get_data(uint32_t *data); void vmmouse_set_data(const uint32_t *data); -/* pckbd.c */ -#define I8042_A20_LINE "a20" - -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask); -void i8042_isa_mouse_fake_event(void *opaque); -void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); - /* pc.c */ extern int fd_bootchk; diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h new file mode 100644 index 0000000000..f6ff146364 --- /dev/null +++ b/include/hw/input/i8042.h @@ -0,0 +1,24 @@ +/* + * QEMU PS/2 Controller + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ +#ifndef HW_INPUT_I8042_H +#define HW_INPUT_I8042_H + +#include "hw/hw.h" +#include "hw/isa/isa.h" + +#define TYPE_I8042 "i8042" + +#define I8042_A20_LINE "a20" + +void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask); +void i8042_isa_mouse_fake_event(void *opaque); +void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); + +#endif /* HW_INPUT_I8042_H */ diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 766373eec7..e13cb576fd 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -19,6 +19,7 @@ #include "hw/timer/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "qemu/cutils.h" @@ -81,7 +82,7 @@ static void clipper_init(MachineState *machine) mc146818_rtc_init(isa_bus, 1900, rtc_irq); i8254_pit_init(isa_bus, 0x40, 0, NULL); - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); /* VGA setup. Don't bother loading the bios. */ pci_vga_init(pci_bus); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 95b3fb3523..efb1b3bccf 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -43,6 +43,7 @@ #include "hw/timer/mc146818rtc.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h" #include "hw/sysbus.h" diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index 65ef55329e..5d2d278be4 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -25,6 +25,7 @@ #include "hw/hw.h" #include "ui/console.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "hw/qdev.h" /* debug only vmmouse */ diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c index 116aa09819..3bf8cfe041 100644 --- a/hw/i386/vmport.c +++ b/hw/i386/vmport.c @@ -25,6 +25,7 @@ #include "hw/hw.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "sysemu/hw_accel.h" #include "hw/qdev.h" #include "qemu/log.h" diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c479f827b6..f17f18e51b 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -26,6 +26,7 @@ #include "hw/isa/isa.h" #include "hw/i386/pc.h" #include "hw/input/ps2.h" +#include "hw/input/i8042.h" #include "sysemu/sysemu.h" /* debug PC keyboard */ @@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } -#define TYPE_I8042 "i8042" #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) typedef struct ISAKBDState { diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 0545fcd899..9339e02120 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -44,6 +44,7 @@ #include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" @@ -364,7 +365,7 @@ static void mips_fulong2e_init(MachineState *machine) i8257_dma_init(isa_bus, 0); /* Super I/O */ - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); mc146818_rtc_init(isa_bus, 2000, NULL); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 827ffdcd4a..5abbe30c21 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -43,6 +43,7 @@ #include "hw/timer/i8254.h" #include "hw/display/vga.h" #include "hw/audio/pcspk.h" +#include "hw/input/i8042.h" #include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 9cb86c432e..cd7bd0eef6 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -47,6 +47,7 @@ #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" @@ -1213,7 +1214,7 @@ void mips_malta_init(MachineState *machine) i8257_dma_init(isa_bus, 0); /* Super I/O */ - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); mc146818_rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, 0, 2); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 830ee7732c..aeadc4a340 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -28,6 +28,7 @@ #include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" @@ -286,7 +287,7 @@ void mips_r4k_init(MachineState *machine) hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); } static void mips_machine_init(MachineClass *mc) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 096d4d4cfb..ae724b0613 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -41,6 +41,7 @@ #include "hw/ide.h" #include "hw/loader.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" #include "sysemu/block-backend.h" @@ -641,7 +642,7 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); cpu = POWERPC_CPU(first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; @@ -771,7 +772,7 @@ static void ibm_40p_init(MachineState *machine) /* add some more devices */ if (defaults_enabled()) { - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59")); dev = DEVICE(isa_create(isa_bus, "cs4231a")); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 0ca0243821..2044a52ded 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -36,6 +36,7 @@ #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/timer/m48t59.h" +#include "hw/input/i8042.h" #include "hw/block/fdc.h" #include "net/net.h" #include "qemu/timer.h" diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index db26959a1d..830fe3face 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -20,6 +20,7 @@ #undef DEBUG_PUV3 #include "hw/unicore32/puv3.h" +#include "hw/input/i8042.h" #define KERNEL_LOAD_ADDR 0x03000000 #define KERNEL_MAX_SIZE 0x00800000 /* Just a guess */ diff --git a/MAINTAINERS b/MAINTAINERS index 335c6c9f65..6622efc1da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -931,6 +931,7 @@ F: include/hw/display/vga.h 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/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc* From patchwork Mon Mar 5 21:19:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="otPFCYuc"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCd552H5z9s3c for ; Tue, 6 Mar 2018 08:26:01 +1100 (AEDT) Received: from localhost ([::1]:51621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxcN-00015L-NY for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:25:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWL-0004FZ-4v for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWK-0001Ux-7P for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:45 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:40373) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWK-0001UU-0l; Mon, 05 Mar 2018 16:19:44 -0500 Received: by mail-wr0-x244.google.com with SMTP id o76so18792672wrb.7; Mon, 05 Mar 2018 13:19:43 -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=4Lfa+6A8WxRJYq2hEeK1UhJhMqsu1kQoRG3gp3uTQkQ=; b=otPFCYucyEe5S9ZZ8q7kwOglxyXmEST+R0OGqFfFUMw6DyGvaWbPzrSAsg3n5BKlub Y4C7orkp0FsUYfF7i0QavNrcba5Yfj/TBWeKmVzig5ZLienGobBZ2EN3zKbCXDFMdnOY vlpn1x5fa0ihXeCX49VZovYpBkdksxkqodCSGLeclyqHt2X8HBN8n8wWF3jss86R/Zn9 s1flL95IpwsMmquxwbTdNnO1D2oJVLfD0wna9bjA6PzufdYRW+3REUaZPBoEL43jNDu8 kjerAHKP0MHRY1bowu85ZSZ+2S83l4cnGlEeQ4TBKL1CjF8SJ2hqBx8XPBl2Au/YMRFt TtTw== 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=4Lfa+6A8WxRJYq2hEeK1UhJhMqsu1kQoRG3gp3uTQkQ=; b=VSpA7CAWRNKHhkgZgtXS/6NcgNyu4DgiE7zmY8ZVwENmGgfbu4FRLtoaAdEODF3HY/ SpYHgNj38GESP/EICTMI/C6fnh6E5NMVNx9az3XVAqQUnVzBexsifqemIXNNaXwOCQZ7 8bXCzwd008+B+YnOBTP+Rbx/jZ4cRem9DEqlSPvmHiymuj142SskiH0wokN8+kyaErws jVlWfb801GJU03dethNFa9lyY4wTH0KjtNjyt3kLo6s1bYXZYFcW0l6S0ZXHpuN80Zcw y29quRuMXVEjdW7rYK/7TggC6Om7tzG+5Sxf38JMp1KB45szLtfVmcUIkk3Olcyvoobq RnnQ== X-Gm-Message-State: APf1xPCV4E4Y8SkIdTiRCOAcuzTUSyxH9AQIwIaQiCiTVwJeCMimMjTD +u6nhE+i4r3iUhaW4dZTFhE= X-Google-Smtp-Source: AG47ELtyzr+iJc+xFPWC9Z+Gn4jaX32itEnzMG0cWxBT5fQg6iqlIXQtiR6+BszLSqvhX5BqutRlXw== X-Received: by 10.223.208.141 with SMTP id y13mr13764670wrh.13.1520284783135; Mon, 05 Mar 2018 13:19:43 -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.19.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:42 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:10 -0300 Message-Id: <20180305211928.466-5-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [RFC PATCH v2 04/22] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO 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: Alexander Graf , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, "open list:PReP" , David Gibson , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson --- include/hw/isa/pc87312.h | 4 ++-- hw/isa/pc87312.c | 2 +- hw/ppc/prep.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index bf74470d40..710eb1c807 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -28,8 +28,8 @@ #include "hw/isa/isa.h" -#define TYPE_PC87312 "pc87312" -#define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312) +#define TYPE_PC87312_SUPERIO "pc87312" +#define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO) typedef struct PC87312State { ISADevice dev; diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 48b29e3c3c..e9edbc6c50 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -391,7 +391,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data) } static const TypeInfo pc87312_type_info = { - .name = TYPE_PC87312, + .name = TYPE_PC87312_SUPERIO, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof(PC87312State), .instance_init = pc87312_initfn, diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index ae724b0613..610ec7ec32 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -613,7 +613,7 @@ static void ppc_prep_init(MachineState *machine) isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0")); /* Super I/O (parallel + serial ports) */ - isa = isa_create(isa_bus, TYPE_PC87312); + isa = isa_create(isa_bus, TYPE_PC87312_SUPERIO); dev = DEVICE(isa); qdev_prop_set_uint8(dev, "config", 13); /* fdc, ser0, ser1, par0 */ qdev_init_nofail(dev); From patchwork Mon Mar 5 21:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WOYfHfFk"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwClR39Vkz9sgP for ; Tue, 6 Mar 2018 08:31:31 +1100 (AEDT) Received: from localhost ([::1]:51666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxhh-0006Dk-D3 for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:31:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWO-0004KT-BW for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWM-0001Vk-2W for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:48 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:39943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWL-0001VO-SC; Mon, 05 Mar 2018 16:19:45 -0500 Received: by mail-wm0-x244.google.com with SMTP id t6so18387556wmt.5; Mon, 05 Mar 2018 13:19:45 -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=DpHz+yOPRcolXxaCJjY99eF/NmlCOKIkmxQN+o7Gzr0=; b=WOYfHfFkYRWQ8MHdjuHfPd08NB47K4gT5J98FLXhWbH7DsoK1E/TuxWkmCCjn7/diR dFf6nQgBbNgq/eEvoP8WLWLzCTUDHbt+krOfI1jGwr9oq/N4j7ONAmSF3gWl3a7G3t3y HHQEsPxlevdCC1Lo0WQisfwfRKx2P4wXqlVE/cnB/sTaE2z6bo/w2ApZ/wXspTXuTLfc VumVrAYQmrORQBBLEHW2PHpM63Qb6ZaRomt/dGmr0zIaZ4BJv7c+8M2/q+xQ3ipS9QwM N4a4qifpSKQp4TqWt/kvauU7WB1HKMTphBjKUIlO2rCLCbGswkOIHrGzH9MJiPppJbnt 4fuQ== 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=DpHz+yOPRcolXxaCJjY99eF/NmlCOKIkmxQN+o7Gzr0=; b=H/70l+3Q8xWOUvEWC2oIiHUpFz85AhgxSMtMe0pRD13wG9QlGOAm/oPguX0PxYfdLh p2l20Xb1PxB7i7kN0CkfwsM1U0IxGYZNeKUYxnaoxN/gqelp1GjHeuA1RTm19XjIRYvp O8Eca5FtlvSwE8k+JgXdpgAE3gTPYOGgctU/5uH6AeDLcvW8x08ImmmjSlY03YCZmcmF FG6Rm5S4JZ9dMs0wnyiTdwQHVg32C7+wKaM/OvozXFbF8kMcyuAz3f33W7CASMB2wbBE cIGqu8bAejwH88t0ywPDYmidvG4a4wlHbUBLE4C1jq8mXPcmXVGnkFXs5fRn1E1fZzVy f1LA== X-Gm-Message-State: AElRT7G736BSl/af4sRQX7uyJhA/og1QdKI9WSAC/9sQTEvfqbiULj6n BDWD0+VFg1z3FtQaaOUP2Mo= X-Google-Smtp-Source: AG47ELu/J7lTvqzHJycPDL7VDzb17vV8nti7bxiKzBa4qHM59dqslXEErvBmAQH91AyqCxsx2PvVlQ== X-Received: by 10.28.146.68 with SMTP id u65mr10282682wmd.107.1520284784885; Mon, 05 Mar 2018 13:19:44 -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.19.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:44 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:11 -0300 Message-Id: <20180305211928.466-6-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [RFC PATCH v2 05/22] hw/isa/pc87312: Use uint16_t for the ISA I/O base address 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This matches the isa_register_ioport() prototype. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/pc87312.h | 2 +- hw/isa/pc87312.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index 710eb1c807..b65b219a8a 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -34,7 +34,7 @@ typedef struct PC87312State { ISADevice dev; - uint32_t iobase; + uint16_t iobase; uint8_t config; /* initial configuration */ struct { diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index e9edbc6c50..105c23e680 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -69,9 +69,9 @@ static inline bool is_parallel_enabled(PC87312State *s) return s->regs[REG_FER] & FER_PARALLEL_EN; } -static const uint32_t parallel_base[] = { 0x378, 0x3bc, 0x278, 0x00 }; +static const uint16_t parallel_base[] = { 0x378, 0x3bc, 0x278, 0x00 }; -static inline uint32_t get_parallel_iobase(PC87312State *s) +static inline uint16_t get_parallel_iobase(PC87312State *s) { return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR]; } @@ -92,12 +92,12 @@ static inline uint32_t get_parallel_irq(PC87312State *s) /* UARTs */ -static const uint32_t uart_base[2][4] = { +static const uint16_t uart_base[2][4] = { { 0x3e8, 0x338, 0x2e8, 0x220 }, { 0x2e8, 0x238, 0x2e0, 0x228 } }; -static inline uint32_t get_uart_iobase(PC87312State *s, int i) +static inline uint16_t get_uart_iobase(PC87312State *s, int i) { int idx; idx = (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; @@ -130,7 +130,7 @@ static inline bool is_fdc_enabled(PC87312State *s) return s->regs[REG_FER] & FER_FDC_EN; } -static inline uint32_t get_fdc_iobase(PC87312State *s) +static inline uint16_t get_fdc_iobase(PC87312State *s) { return (s->regs[REG_FER] & FER_FDC_ADDR) ? 0x370 : 0x3f0; } @@ -143,7 +143,7 @@ static inline bool is_ide_enabled(PC87312State *s) return s->regs[REG_FER] & FER_IDE_EN; } -static inline uint32_t get_ide_iobase(PC87312State *s) +static inline uint16_t get_ide_iobase(PC87312State *s) { return (s->regs[REG_FER] & FER_IDE_ADDR) ? 0x170 : 0x1f0; } @@ -373,7 +373,7 @@ static const VMStateDescription vmstate_pc87312 = { }; static Property pc87312_properties[] = { - DEFINE_PROP_UINT32("iobase", PC87312State, iobase, 0x398), + DEFINE_PROP_UINT16("iobase", PC87312State, iobase, 0x398), DEFINE_PROP_UINT8("config", PC87312State, config, 1), DEFINE_PROP_END_OF_LIST() }; From patchwork Mon Mar 5 21:19:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="HdLt7ZMD"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCh86kvLz9sfP for ; Tue, 6 Mar 2018 08:28:40 +1100 (AEDT) Received: from localhost ([::1]:51639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxex-0003WZ-1O for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:28:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWO-0004Kf-KC for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWN-0001WQ-Me for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:48 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:44195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWN-0001W6-Fc; Mon, 05 Mar 2018 16:19:47 -0500 Received: by mail-wr0-x242.google.com with SMTP id v65so18776885wrc.11; Mon, 05 Mar 2018 13:19:47 -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=W3d2bI+1KY2S/D2mZY27YY9JOlWJC+XrekaqDSGntIg=; b=HdLt7ZMDQncCvlSUM5ZnT6GsozyEqiEOXUsHbtfGfIJOe/7AZs70ZC4AUgMXtzAxDl f1TYSOPIjzOaN6X2vUo+dlvjnWGxMuBR6ejpH7OPPkbZYfMmd5YMpHxkUxqxH5+VhsUL VAenihuKjz5/oIoAx4AesR4Az9r+phRzWKoSDeqWEsstVGsS05mjmfu0TnVTOT7WfObm P18EqFeX2oBtIUHKknk/zt3jfOEMFSo807mYPVS4QgJDlDirutnRF3/JFwDEVtuulo7S xgpkN3VRZBhr0pKHnm/OpdSZPUlgleU4wU9s8GhdmWjerawZSsZ4QArWvlxhGI+LKLrh JGmg== 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=W3d2bI+1KY2S/D2mZY27YY9JOlWJC+XrekaqDSGntIg=; b=Z9fLyf610TDlw1RRsIxd67wgpQKoVUcRto7NtK1PyuAE6du80+CXcGon5p0otFsi1O 1FOjZj8x7mxxKMICsGgCcRDn+pPUzf4U25mGEf2WZ42I1k3Y6yUt/Ka+eZzrNlbn7PtJ lE5mR1iiYqjU+gdws88v68RD4e8RoBtKhfycLdW35boGJJA2TRhBqqaHQUSTE4MaFkxH 6S4TDgognZQD76cBegmqW1f8PO+niGAuYAv/sM4/PkMGOAqK371JvuiNUbWM/RXpduJR kkSPlhWH2cvKzmgaQ/kFd2P0jzaZz5SafOf1+nUAjyI1PgcuQpQWQqHVUQAHvL6zzWlf lcYg== X-Gm-Message-State: APf1xPDw0R4oVigXZO0MkoFVVWs3CzCjzPJY8VXHwcJMPqj828PqC1sw R2jZ8NBxgb52oqFwi2BM4HE= X-Google-Smtp-Source: AG47ELviF3oQlKhUHV3+TQ3vjuh21kEe+fE0KPUQyTLBl74YChUYOl7bBmEDMOp0/lB3JrfuDCLSSQ== X-Received: by 10.223.130.76 with SMTP id 70mr13476361wrb.95.1520284786487; Mon, 05 Mar 2018 13:19:46 -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.19.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:12 -0300 Message-Id: <20180305211928.466-7-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 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] [RFC PATCH v2 06/22] hw/isa/pc87312: Use 'unsigned int' for the irq value 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- hw/isa/pc87312.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 105c23e680..fda91fed21 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -76,9 +76,9 @@ static inline uint16_t get_parallel_iobase(PC87312State *s) return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR]; } -static const uint32_t parallel_irq[] = { 5, 7, 5, 0 }; +static const unsigned int parallel_irq[] = { 5, 7, 5, 0 }; -static inline uint32_t get_parallel_irq(PC87312State *s) +static inline unsigned int get_parallel_irq(PC87312State *s) { int idx; idx = (s->regs[REG_FAR] & FAR_PARALLEL_ADDR); @@ -110,7 +110,7 @@ static inline uint16_t get_uart_iobase(PC87312State *s, int i) } } -static inline uint32_t get_uart_irq(PC87312State *s, int i) +static inline unsigned int get_uart_irq(PC87312State *s, int i) { int idx; idx = (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; From patchwork Mon Mar 5 21:19:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="LfMiYwir"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCpF56Y9z9sfP for ; Tue, 6 Mar 2018 08:33:57 +1100 (AEDT) Received: from localhost ([::1]:51676 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxk3-0008GK-PU for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:33:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWQ-0004Ks-A8 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWP-0001YO-7u for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:50 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWP-0001XN-1c for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:49 -0500 Received: by mail-wr0-x242.google.com with SMTP id v111so18788059wrb.3 for ; Mon, 05 Mar 2018 13:19:48 -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=gl2oiuUeUOvRLGWDBaPE5F3VlALniqfDySAhQpac0WA=; b=LfMiYwirj2brMbNK8Q5SL2gpUPWHen5uUeqhfTkUXQ+oGbVQYAyfA4oHuTsQylQZC+ mnxEGLfvTiUogaBFpHFNgJciNj9CrfJllaUIFsQl4K9Ai+MXb1DrNLQAuV8oPoMaLcgv 4OApL66l25xu0Ajhsx1zOI71wWagWTRAia32etcrsjuD3KU3s730FaODjkTUgroFQld6 xfIb1iUbFGV50Z1x37cHO8996EfZj7UBf9pdK+1xWYmpkK/8rStdKXK3xX+SvL4qNSAH S+ihwyquzTfjI8BJKVm8t6U8NxMrriQi90DOQg4zvEe3CPwikTm+TVOQHV5ZdkrL/WPP iqpQ== 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=gl2oiuUeUOvRLGWDBaPE5F3VlALniqfDySAhQpac0WA=; b=fyWrE94/YUQmc9IWMlQV6+3JTvx3Nwwntg9rBcHhtCB5bl13kDxlCzkDBAkJV8Hf8U vjOL4JKDaNinnny3FbE8mWz7j5LRX6zFa07LK/IzO1Th1ViKtqwf4L2kAQxM/udDpQbn WsaKyBpEOiBG6LTb697biI6NwuTXB0b8L9zR/hCMjGwbHF3BoNlbPONDKWk/fqFoEXhy Im9ygU/sYak19GGP425DsBtHkWWOrnf0sxXcx/nzJC3PNArmx14bTydeLAA7GIHjn+tx JUxNBFm4AoC07x05j/yfocT5cx2/nN5M8uC8Io6xZRkxwKfKqpg6dWpp8V/+0nnwLpBa uUxw== X-Gm-Message-State: APf1xPCUXoqABcwbUegC5nMLwZBxpk272k9Ly1n359W2wuNvGmwZGUKa enReGETnmqRrj+Z6x5gWX4g= X-Google-Smtp-Source: AG47ELsIxfqLIry/fydTV0Wdkk2Lopr4drznQE8xAsNC8/8AjpqNQZEj/VLyw8BVfr5aVY77W2DEgQ== X-Received: by 10.223.164.158 with SMTP id g30mr12833463wrb.62.1520284788122; Mon, 05 Mar 2018 13:19:48 -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.19.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:47 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:13 -0300 Message-Id: <20180305211928.466-8-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 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] [RFC PATCH v2 07/22] 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ hw/isa/isa-superio.c | 27 +++++++++++++++++++++++++++ hw/isa/Makefile.objs | 1 + 3 files changed, 72 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é + * + * 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..7777f8b9f0 --- /dev/null +++ b/hw/isa/isa-superio.c @@ -0,0 +1,27 @@ +/* + * Generic ISA Super I/O + * + * Copyright (c) 2010-2012 Herve Poussineau + * Copyright (c) 2011-2012 Andreas Färber + * Copyright (c) 2018 Philippe Mathieu-Daudé + * + * 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 = { + .name = TYPE_ISA_SUPERIO, + .parent = TYPE_ISA_DEVICE, + .abstract = true, +}; + +static void isa_superio_register_types(void) +{ + type_register_static(&isa_superio_type_info); +} + +type_init(isa_superio_register_types) 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) += isa-bus.o +common-obj-$(CONFIG_ISA_BUS) += isa-superio.o common-obj-$(CONFIG_APM) += apm.o common-obj-$(CONFIG_I82378) += i82378.o common-obj-$(CONFIG_PC87312) += pc87312.o From patchwork Mon Mar 5 21:19:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881716 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="G6hlohkL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCZl5pB6z9sXt for ; Tue, 6 Mar 2018 08:23:59 +1100 (AEDT) Received: from localhost ([::1]:51607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxaP-0007OQ-SA for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:23:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWR-0004MB-UG for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWR-0001ZX-3J for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:51 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:34821) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWQ-0001Z6-SZ; Mon, 05 Mar 2018 16:19:51 -0500 Received: by mail-wr0-x241.google.com with SMTP id l43so18816358wrc.2; Mon, 05 Mar 2018 13:19:50 -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=IDISHE/WXhKazKS9RqpzgTEj/9/+RmtPBdEpXusdzis=; b=G6hlohkLdhIud1NH183EbVhsvrSaRQ1Q1JjA/asdjl8HV0jsFkOUavRQvXJmfTmpT4 VPpxLLFpSIGnrR9TRgQCl2IxhSLxqxL5e8x3phmt/+9+vkNMKMJtKtcN6nUqJ7CZfeef IiLfX0EPgfFIaxiXLRHgzGhPVWmxWtjei54zpqT2C0V87vUIARKTWeaMZX2GiTCmwSp3 fEfFNwWcTWxRooglMZ46R8vr8qsSjZTSL4t5utk+lhKzQf3Ir+cd/uhl0OiTYmt8P2Ht BS25TwKnMUQwu18Qxr6TULnrX3SQoVFNeU0e228JykaUFDzNGVvedsrklYGejwgFiObH BKXg== 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=IDISHE/WXhKazKS9RqpzgTEj/9/+RmtPBdEpXusdzis=; b=LhTLi7k7hjtIjemQUs9v1DWuLR9mui4eFNJg7DgoY5M30MpitPY+8nQ1euRh+CZQaa T7FG8dEkDrumN52V/YqO+qBWJXpuVaYy/UjwZIPmAb+37xGrgLDjPaslvuHTDtfgaw5m 0T85MzyslxK0dGFZSf/T/etNetbqlXHGVjJnrY+lHzzUk0ksBUzPVIvTkFYyHJPdNuzI FO9A++gtNAta/+Etwm8eFkakMzy0IuKp9m+UxTGHXp52vUdHUHaCZmDZ6BWmsIoW+xge 9RLQoldxxCdlgRApohj0mD5dQsfwWiZGhRJ+ClSQma94JwMmfH0S6HU6UzyXqHU4zxxe e/wQ== X-Gm-Message-State: APf1xPCiN2gQFGtX3u2BNWZTKZC/vUBo1WcRUCY7sg5R0m/qlisRTtnh d7ErcQ58NTPvijJtZBQxZUs= X-Google-Smtp-Source: AG47ELuJbMR02sB1BQrgvcdLtP57Lyy/3wVEXdeqXoTtBWX4fsZ45NZjwS4jXBb/n0LjM5vxX1nwdg== X-Received: by 10.223.133.214 with SMTP id 22mr14521545wru.130.1520284789906; Mon, 05 Mar 2018 13:19:49 -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.19.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:49 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:14 -0300 Message-Id: <20180305211928.466-9-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [RFC PATCH v2 08/22] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/pc87312.h | 6 ++++-- hw/isa/pc87312.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index b65b219a8a..f3761d6fe1 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -25,14 +25,16 @@ #ifndef QEMU_PC87312_H #define QEMU_PC87312_H -#include "hw/isa/isa.h" +#include "hw/isa/superio.h" #define TYPE_PC87312_SUPERIO "pc87312" #define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO) typedef struct PC87312State { - ISADevice dev; + /*< private >*/ + ISASuperIODevice parent_dev; + /*< public >*/ uint16_t iobase; uint8_t config; /* initial configuration */ diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index fda91fed21..6b8100ff56 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -270,6 +270,7 @@ static void pc87312_realize(DeviceState *dev, Error **errp) ISABus *bus; Chardev *chr; DriveInfo *drive; + Error *local_err = NULL; char name[5]; int i; @@ -279,6 +280,12 @@ static void pc87312_realize(DeviceState *dev, Error **errp) isa_register_ioport(isa, &s->io, s->iobase); pc87312_hard_reset(s); + ISA_SUPERIO_GET_CLASS(dev)->parent_realize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + if (is_parallel_enabled(s)) { /* FIXME use a qdev chardev prop instead of parallel_hds[] */ chr = parallel_hds[0]; @@ -381,7 +388,9 @@ static Property pc87312_properties[] = { static void pc87312_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass); + sc->parent_realize = dc->realize; dc->realize = pc87312_realize; dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; @@ -392,7 +401,7 @@ static void pc87312_class_init(ObjectClass *klass, void *data) static const TypeInfo pc87312_type_info = { .name = TYPE_PC87312_SUPERIO, - .parent = TYPE_ISA_DEVICE, + .parent = TYPE_ISA_SUPERIO, .instance_size = sizeof(PC87312State), .instance_init = pc87312_initfn, .class_init = pc87312_class_init, From patchwork Mon Mar 5 21:19:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="k4LAw0hL"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCrW04fZz9sgR for ; Tue, 6 Mar 2018 08:35:55 +1100 (AEDT) Received: from localhost ([::1]:51693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxlx-0001gu-3K for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:35:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWV-0004QH-8x for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWT-0001aS-EB for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:55 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:38491) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWT-0001aC-3A; Mon, 05 Mar 2018 16:19:53 -0500 Received: by mail-wr0-x243.google.com with SMTP id n7so18805892wrn.5; Mon, 05 Mar 2018 13:19:53 -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=EDEfYwpMGrgR1nDYzLP0TFaSRPmSsCRkHo47/1+rh4Y=; b=k4LAw0hLXs0bcilWWfib2V9ZABDsFx6xfuVJbdeN+6XXge+jeJN+PL3pbxSe8b/NUl nisEFv6r9w+tjWwl3Iwe+kdAYAvAIp70RY0zPoEKJshrFXp6QHTR0KHvxzAK0BcDlq2e khfdxks5oCuZRWshZ5qPecMgLAezcNTJSCYukka13t2WSjEr7p13hleHGclxKl2dkovZ p9gTkNxcqpAreeDcy7RpGlisOS9Xic8t49odvEd8pgq+DAN2w+ohK4wwkdHw7XOIAB/W rBZOPcw9MO2fye8BukrgA6/49r5AjDlxtamaR3ucNpMkUetY+Z32UDAkm8RBMS2IO2ly Y11w== 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=EDEfYwpMGrgR1nDYzLP0TFaSRPmSsCRkHo47/1+rh4Y=; b=bAtB/XYYIYuLgLVfyZkiv7mZdtRJZuw21tFNvBWBI1iU+ftnrBP/MyO9GYMqw9ZfVJ Esi0frLM11E2EreE5e79Y7lRANxT2AgfWNIEocxWxdQ6yiXpuhru7T9Qxif5nNmvNsbY WJ3yd1VJkZum10L+dczfsd7FVXFSU7u83dTQWN3v74cRLub/8P5+fyxOTB2g/MbuziZJ zpoi7yAWBdXXkJATqZca4f2iTGN+Hu17au/cjthAi6Dn3U4Yd0hlBBkJwwczAOTxS2Qn ljfU66YVILCi5sjW59qvC4pRMu6xeuu9TmURPi3hyJhrRQofPVRYSRHrCxph8wL9mDZ5 /x/Q== X-Gm-Message-State: APf1xPDPZaRR2Hk8ZepfPGHY7HEOHfyY1FVZk+DQdr6BDZ+3lIBgQuL3 AsvYVrtsBs4JJMzYicusHg0= X-Google-Smtp-Source: AG47ELujfriU0at7Lum05KlGtFIgt6L9WwXqY08RTaaxnjzacHZ4dk6a2AKaCS8K0SjMFDfCqyiwgg== X-Received: by 10.223.160.157 with SMTP id m29mr13814101wrm.119.1520284791969; Mon, 05 Mar 2018 13:19:51 -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.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:51 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:15 -0300 Message-Id: <20180305211928.466-10-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 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] [RFC PATCH v2 09/22] hw/isa/superio: Factor out the parallel code from pc87312.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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/pc87312.h | 4 --- include/hw/isa/superio.h | 6 +++++ hw/isa/isa-superio.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 38 ++++++++++++----------------- hw/isa/trace-events | 4 ++- 5 files changed, 87 insertions(+), 28 deletions(-) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index f3761d6fe1..bcc4578479 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -39,10 +39,6 @@ typedef struct PC87312State { uint16_t iobase; uint8_t config; /* initial configuration */ - struct { - ISADevice *dev; - } parallel; - struct { ISADevice *dev; } uart[2]; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index cff6ad6c08..e9879cfde1 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -23,7 +23,11 @@ OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO) typedef struct ISASuperIODevice { + /*< private >*/ ISADevice parent_obj; + /*< public >*/ + + ISADevice *parallel[MAX_PARALLEL_PORTS]; } ISASuperIODevice; typedef struct ISASuperIOFuncs { @@ -39,6 +43,8 @@ typedef struct ISASuperIOClass { ISADeviceClass parent_class; /*< public >*/ DeviceRealize parent_realize; + + ISASuperIOFuncs parallel; } ISASuperIOClass; #endif /* HW_ISA_SUPERIO_H */ diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 7777f8b9f0..4e0b1af633 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -10,13 +10,76 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ #include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "sysemu/sysemu.h" +#include "chardev/char.h" #include "hw/isa/superio.h" #include "trace.h" +static void isa_superio_realize(DeviceState *dev, Error **errp) +{ + ISASuperIODevice *sio = ISA_SUPERIO(dev); + ISASuperIOClass *k = ISA_SUPERIO_GET_CLASS(sio); + ISABus *bus = isa_bus_from_device(ISA_DEVICE(dev)); + ISADevice *isa; + DeviceState *d; + Chardev *chr; + char *name; + int i; + + /* Parallel port */ + for (i = 0; i < k->parallel.count; i++) { + if (i >= ARRAY_SIZE(sio->parallel)) { + warn_report("superio: ignoring %ld parallel controllers", + k->parallel.count - ARRAY_SIZE(sio->parallel)); + break; + } + if (!k->parallel.is_enabled || k->parallel.is_enabled(sio, i)) { + name = g_strdup_printf("discarding-parallel%d", i); + /* FIXME use a qdev chardev prop instead of parallel_hds[] */ + chr = parallel_hds[i]; + if (chr == NULL || chr->be) { + chr = qemu_chr_new(name, "null"); + } + isa = isa_create(bus, "isa-parallel"); + d = DEVICE(isa); + qdev_prop_set_uint32(d, "index", i); + if (k->parallel.get_iobase) { + qdev_prop_set_uint32(d, "iobase", + k->parallel.get_iobase(sio, i)); + } + if (k->parallel.get_irq) { + qdev_prop_set_uint32(d, "irq", k->parallel.get_irq(sio, i)); + } + qdev_prop_set_chr(d, "chardev", chr); + qdev_init_nofail(d); + sio->parallel[i] = isa; + trace_superio_create_parallel(i, + k->parallel.get_iobase ? + k->parallel.get_iobase(sio, i) : -1, + k->parallel.get_irq ? + k->parallel.get_irq(sio, i) : -1); + object_property_add_child(OBJECT(dev), name, + OBJECT(sio->parallel[i]), NULL); + g_free(name); + } + } +} + +static void isa_superio_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + + dc->realize = isa_superio_realize; + /* Reason: Uses parallel_hds[0] in realize(), so it can't be used twice */ + dc->user_creatable = false; +} + static const TypeInfo isa_superio_type_info = { .name = TYPE_ISA_SUPERIO, .parent = TYPE_ISA_DEVICE, .abstract = true, + .class_init = isa_superio_class_init, }; static void isa_superio_register_types(void) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 6b8100ff56..1c15715c69 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -64,22 +64,25 @@ /* Parallel port */ -static inline bool is_parallel_enabled(PC87312State *s) +static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index) { - return s->regs[REG_FER] & FER_PARALLEL_EN; + PC87312State *s = PC87312(sio); + return index ? false : s->regs[REG_FER] & FER_PARALLEL_EN; } static const uint16_t parallel_base[] = { 0x378, 0x3bc, 0x278, 0x00 }; -static inline uint16_t get_parallel_iobase(PC87312State *s) +static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s = PC87312(sio); return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR]; } static const unsigned int parallel_irq[] = { 5, 7, 5, 0 }; -static inline unsigned int get_parallel_irq(PC87312State *s) +static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s = PC87312(sio); int idx; idx = (s->regs[REG_FAR] & FAR_PARALLEL_ADDR); if (idx == 0) { @@ -286,24 +289,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp) return; } - if (is_parallel_enabled(s)) { - /* FIXME use a qdev chardev prop instead of parallel_hds[] */ - chr = parallel_hds[0]; - if (chr == NULL) { - chr = qemu_chr_new("par0", "null"); - } - isa = isa_create(bus, "isa-parallel"); - d = DEVICE(isa); - qdev_prop_set_uint32(d, "index", 0); - qdev_prop_set_uint32(d, "iobase", get_parallel_iobase(s)); - qdev_prop_set_uint32(d, "irq", get_parallel_irq(s)); - qdev_prop_set_chr(d, "chardev", chr); - qdev_init_nofail(d); - s->parallel.dev = isa; - trace_pc87312_info_parallel(get_parallel_iobase(s), - get_parallel_irq(s)); - } - for (i = 0; i < 2; i++) { if (is_uart_enabled(s, i)) { /* FIXME use a qdev chardev prop instead of serial_hds[] */ @@ -395,8 +380,15 @@ static void pc87312_class_init(ObjectClass *klass, void *data) dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; - /* Reason: Uses parallel_hds[0] in realize(), so it can't be used twice */ + /* Reason: Uses serial_hds[0] in realize(), so it can't be used twice */ dc->user_creatable = false; + + sc->parallel = (ISASuperIOFuncs){ + .count = 1, + .is_enabled = is_parallel_enabled, + .get_iobase = get_parallel_iobase, + .get_irq = get_parallel_irq, + }; } static const TypeInfo pc87312_type_info = { diff --git a/hw/isa/trace-events b/hw/isa/trace-events index a4ab4e3634..97b1949981 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -1,9 +1,11 @@ # See docs/devel/tracing.txt for syntax documentation. +# hw/isa/isa-superio.c +superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" + # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" -pc87312_info_parallel(uint32_t base, uint32_t irq) "base 0x%x, irq %u" pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=%d, base 0x%x, irq %u" From patchwork Mon Mar 5 21:19:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881721 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dtx+61EJ"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCfT6nWdz9sfK for ; Tue, 6 Mar 2018 08:27:13 +1100 (AEDT) Received: from localhost ([::1]:51631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxdY-0002Dp-1a for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:27:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWX-0004SW-9k for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWV-0001bm-CB for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:57 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:32815) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWV-0001bH-1l; Mon, 05 Mar 2018 16:19:55 -0500 Received: by mail-wm0-x241.google.com with SMTP id s206so15056023wme.0; Mon, 05 Mar 2018 13:19:54 -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=E6CmwAbuixBoaMoC9st/HQkAu0Y77Oi5FRt9Y0DZMao=; b=dtx+61EJJM3yuYIQnJ/NY/BelM+0LnQBoUSvasz3p9j2mhIH07j0+5hU6udBcDQtWJ 81QbeaqIEPx7k48B93BN7Lx8np6BLcg8xP56IhBrYCLi/MkO/TYxDrYotHgQei/bchqV tsffbXW5Nc8YElkBVQXUQ1W9vnjrvpo9ffpeu2ofUSR559j6/QKsyQ+oMc0xB7k+UeYr dfzKNux2uNFENS9/gL/4+Y5e/DDPzcxrhNkndfqOJpCVLLu+lwNbp8sPgmR5n/WE+KRV ieSmssOl89K3nZQwDd2gZ9XRgkIVAQzD2wFWQgw5oG4VncwLVfngXh8ZM0YGlfbsumFW IIvQ== 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=E6CmwAbuixBoaMoC9st/HQkAu0Y77Oi5FRt9Y0DZMao=; b=n315wvIQxuX6UK7uY10gw5X+L7DCwtwVaIKLF9UqHjd6+MM1myk29tRie57hD6KyXq 0snJxlX2jVSCcOYqIx+lr80bfinwDnr2L80Mvv/FzOCyQEXaf1DAJOOu1xJSh+m7vIzH zKIMjmTeCSkfcPhiTkRRNGSZNQtjYbKL1nmUvD+RGVE4JYVjSJ/KWIFDmDojHHa/SIRs MzjKSO6oHrMUqCOL9IL5yWcb9/7fYahOzqo3rfHrgnAnir2nOFqlE+LLgb+rtMYGpVHG t7/7vaqgx6UNQlm5RJeqp1pJzmKoT8ayTdRhDixWnAC5ITVZPmbT1z57m56HgP4TOaRZ g5oQ== X-Gm-Message-State: AElRT7HK4cljH0aBhf8zsUpIgFlamRU/EM6lt0q5cUvfqgRXtkDgDqSf rBs8hlAwwFi8y9uipXN/oM4= X-Google-Smtp-Source: AG47ELutCVqKX0PMvvI2E+tNMLnWk9cHrMHIf0XVysvl8nVj8hTkwh4AuNlOoVyJ/mFnFMwDli38fQ== X-Received: by 10.28.230.147 with SMTP id e19mr10133619wmi.2.1520284793848; Mon, 05 Mar 2018 13:19:53 -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.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:16 -0300 Message-Id: <20180305211928.466-11-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 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 10/22] hw/isa/superio: Factor out the serial code from pc87312.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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/pc87312.h | 4 ---- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 39 +++++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 43 ++++++++++++------------------------------- hw/isa/trace-events | 2 +- 5 files changed, 54 insertions(+), 36 deletions(-) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index bcc4578479..1480615a2c 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -39,10 +39,6 @@ typedef struct PC87312State { uint16_t iobase; uint8_t config; /* initial configuration */ - struct { - ISADevice *dev; - } uart[2]; - struct { ISADevice *dev; } fdc; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index e9879cfde1..0b516721c3 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -28,6 +28,7 @@ typedef struct ISASuperIODevice { /*< public >*/ ISADevice *parallel[MAX_PARALLEL_PORTS]; + ISADevice *serial[MAX_SERIAL_PORTS]; } ISASuperIODevice; typedef struct ISASuperIOFuncs { @@ -45,6 +46,7 @@ typedef struct ISASuperIOClass { DeviceRealize parent_realize; ISASuperIOFuncs parallel; + ISASuperIOFuncs serial; } ISASuperIOClass; #endif /* HW_ISA_SUPERIO_H */ diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 4e0b1af633..bd4671655e 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -14,6 +14,7 @@ #include "sysemu/sysemu.h" #include "chardev/char.h" #include "hw/isa/superio.h" +#include "hw/char/serial.h" #include "trace.h" static void isa_superio_realize(DeviceState *dev, Error **errp) @@ -64,6 +65,44 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) g_free(name); } } + + /* Serial */ + for (i = 0; i < k->serial.count; i++) { + if (i >= ARRAY_SIZE(sio->serial)) { + warn_report("superio: ignoring %ld serial controllers", + k->serial.count - ARRAY_SIZE(sio->serial)); + break; + } + if (!k->serial.is_enabled || k->serial.is_enabled(sio, i)) { + name = g_strdup_printf("discarding-serial%d", i); + /* FIXME use a qdev chardev prop instead of serial_hds[] */ + chr = serial_hds[i]; + if (chr == NULL || chr->be) { + chr = qemu_chr_new(name, "null"); + } + isa = isa_create(bus, TYPE_ISA_SERIAL); + d = DEVICE(isa); + qdev_prop_set_uint32(d, "index", i); + if (k->serial.get_iobase) { + qdev_prop_set_uint32(d, "iobase", + k->serial.get_iobase(sio, i)); + } + if (k->serial.get_irq) { + qdev_prop_set_uint32(d, "irq", k->serial.get_irq(sio, i)); + } + qdev_prop_set_chr(d, "chardev", chr); + qdev_init_nofail(d); + sio->serial[i] = isa; + trace_superio_create_serial(i, + k->serial.get_iobase ? + k->serial.get_iobase(sio, i) : -1, + k->serial.get_irq ? + k->serial.get_irq(sio, i) : -1); + object_property_add_child(OBJECT(dev), name, + OBJECT(sio->serial[0]), NULL); + g_free(name); + } + } } static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 1c15715c69..c2837bca43 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -29,8 +29,6 @@ #include "qemu/error-report.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" -#include "sysemu/sysemu.h" -#include "chardev/char.h" #include "trace.h" @@ -100,8 +98,9 @@ static const uint16_t uart_base[2][4] = { { 0x2e8, 0x238, 0x2e0, 0x228 } }; -static inline uint16_t get_uart_iobase(PC87312State *s, int i) +static uint16_t get_uart_iobase(ISASuperIODevice *sio, uint8_t i) { + PC87312State *s = PC87312(sio); int idx; idx = (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; if (idx == 0) { @@ -113,15 +112,17 @@ static inline uint16_t get_uart_iobase(PC87312State *s, int i) } } -static inline unsigned int get_uart_irq(PC87312State *s, int i) +static unsigned int get_uart_irq(ISASuperIODevice *sio, uint8_t i) { + PC87312State *s = PC87312(sio); int idx; idx = (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; return (idx & 1) ? 3 : 4; } -static inline bool is_uart_enabled(PC87312State *s, int i) +static bool is_uart_enabled(ISASuperIODevice *sio, uint8_t i) { + PC87312State *s = PC87312(sio); return s->regs[REG_FER] & (FER_UART1_EN << i); } @@ -271,11 +272,8 @@ static void pc87312_realize(DeviceState *dev, Error **errp) DeviceState *d; ISADevice *isa; ISABus *bus; - Chardev *chr; DriveInfo *drive; Error *local_err = NULL; - char name[5]; - int i; s = PC87312(dev); isa = ISA_DEVICE(dev); @@ -289,27 +287,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp) return; } - for (i = 0; i < 2; i++) { - if (is_uart_enabled(s, i)) { - /* FIXME use a qdev chardev prop instead of serial_hds[] */ - chr = serial_hds[i]; - if (chr == NULL) { - snprintf(name, sizeof(name), "ser%d", i); - chr = qemu_chr_new(name, "null"); - } - isa = isa_create(bus, "isa-serial"); - d = DEVICE(isa); - qdev_prop_set_uint32(d, "index", i); - qdev_prop_set_uint32(d, "iobase", get_uart_iobase(s, i)); - qdev_prop_set_uint32(d, "irq", get_uart_irq(s, i)); - qdev_prop_set_chr(d, "chardev", chr); - qdev_init_nofail(d); - s->uart[i].dev = isa; - trace_pc87312_info_serial(i, get_uart_iobase(s, i), - get_uart_irq(s, i)); - } - } - if (is_fdc_enabled(s)) { isa = isa_create(bus, "isa-fdc"); d = DEVICE(isa); @@ -380,8 +357,6 @@ static void pc87312_class_init(ObjectClass *klass, void *data) dc->reset = pc87312_reset; dc->vmsd = &vmstate_pc87312; dc->props = pc87312_properties; - /* Reason: Uses serial_hds[0] in realize(), so it can't be used twice */ - dc->user_creatable = false; sc->parallel = (ISASuperIOFuncs){ .count = 1, @@ -389,6 +364,12 @@ static void pc87312_class_init(ObjectClass *klass, void *data) .get_iobase = get_parallel_iobase, .get_irq = get_parallel_irq, }; + sc->serial = (ISASuperIOFuncs){ + .count = 2, + .is_enabled = is_uart_enabled, + .get_iobase = get_uart_iobase, + .get_irq = get_uart_irq, + }; } static const TypeInfo pc87312_type_info = { diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 97b1949981..c78dd6c353 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -2,10 +2,10 @@ # hw/isa/isa-superio.c superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" +superio_create_serial(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" -pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=%d, base 0x%x, irq %u" From patchwork Mon Mar 5 21:19:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881761 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YQZoSCEA"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCtF6HXhz9sgR for ; Tue, 6 Mar 2018 08:37:25 +1100 (AEDT) Received: from localhost ([::1]:51704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxnP-0002eY-VG for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:37:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWY-0004T3-Cn for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWX-0001e4-1T for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:58 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:37348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWW-0001ct-Mn; Mon, 05 Mar 2018 16:19:56 -0500 Received: by mail-wr0-x241.google.com with SMTP id z12so18804086wrg.4; Mon, 05 Mar 2018 13:19:56 -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=WK6U9yd6ZMUMrCLK86FU12jHAAYi33/FjpMrnsMB77E=; b=YQZoSCEAG38U3yyDlmpe53KkA/oYYnrpr5DbWT2ftdFHybLG4lMHTcR+iEBqeoQH5l aA5GelRorhAqDpfxw3SDK0JxvA/U10SbGZflvferM0iVesd/N2mhvJnfGAvk18YiHnE/ EABvGkyryAdeXGKrBLq7DojnkoFRlPobepIIUyJM71Dd0FYQpwY8O8MGdlfp5QlnShKz UkJQD4pQ0LICJT97Wdber1N7XlMSMpB7coa2LRrNdInY5mvAqzCKHDRkLyS3ha2qx9Hn Lf7RqElKQn1tjSdRR7thnc9jFLbljy7KPYNgPnYVYxy+Kfu68A9EwhJehvcs8agrCDAo PpVg== 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=WK6U9yd6ZMUMrCLK86FU12jHAAYi33/FjpMrnsMB77E=; b=clvBXM2veM/GXiz6SN/CdGusvx806FOQmKOQPQhuarfxnhZzJ1ezYxXeyEtLQsDdXO mXd9w8q3YEDwokz0T8U8SgqdiJlFnzkuuTlKlRKvjuoCEc5/b470JMThvpMjs2UcqKq4 N96fua0G2Kz06SPmgjQ0QEzmJV8iYoM/5dDWv2y+rWC39SjDYmmLW/o/OLV+MyYuIdLa 6f4h5Xq/QdpQVwPyMUil6+3/9CcyXmn08wCVeN9qEFj2SkLqisNLmQSQPkNtNNrVUoDp GHiMjDFBTe4ksUNadGyKobV/zzptfYlw+3xEkonnr1EuktPDXzaMU1QCBJzmdhh6naBK 4M2g== X-Gm-Message-State: APf1xPBVq5NprsNLb46j3pmGE1rbQX7KRTut9dz+xugYpQaZ8jJGuJEm iab64/vhRrM9kPXuJ5emmzg= X-Google-Smtp-Source: AG47ELs+Mid14F7YGOpqDdv5q9CVCglJBvkjAbL0I3070nL1EIMGsba5bg3NCkKDLhQF+GxCohCxtw== X-Received: by 10.223.199.69 with SMTP id b5mr15160146wrh.212.1520284795606; Mon, 05 Mar 2018 13:19:55 -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.19.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:17 -0300 Message-Id: <20180305211928.466-12-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [RFC PATCH v2 11/22] hw/isa/superio: Factor out the floppy disc controller code from pc87312.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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/pc87312.h | 4 ---- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 36 ++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 46 +++++++++++++++++++--------------------------- hw/isa/trace-events | 2 +- 5 files changed, 58 insertions(+), 32 deletions(-) diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index 1480615a2c..e16263d4b1 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -39,10 +39,6 @@ typedef struct PC87312State { uint16_t iobase; uint8_t config; /* initial configuration */ - struct { - ISADevice *dev; - } fdc; - struct { ISADevice *dev; } ide; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index 0b516721c3..e8007b9eee 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -29,6 +29,7 @@ typedef struct ISASuperIODevice { ISADevice *parallel[MAX_PARALLEL_PORTS]; ISADevice *serial[MAX_SERIAL_PORTS]; + ISADevice *floppy; } ISASuperIODevice; typedef struct ISASuperIOFuncs { @@ -47,6 +48,7 @@ typedef struct ISASuperIOClass { ISASuperIOFuncs parallel; ISASuperIOFuncs serial; + ISASuperIOFuncs floppy; } ISASuperIOClass; #endif /* HW_ISA_SUPERIO_H */ diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index bd4671655e..22bf79d3c3 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -11,7 +11,10 @@ */ #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" +#include "sysemu/block-backend.h" +#include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" #include "hw/char/serial.h" @@ -25,6 +28,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) ISADevice *isa; DeviceState *d; Chardev *chr; + DriveInfo *drive; char *name; int i; @@ -103,6 +107,38 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) g_free(name); } } + + /* Floppy disc */ + if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) { + isa = isa_create(bus, "isa-fdc"); + d = DEVICE(isa); + if (k->floppy.get_iobase) { + qdev_prop_set_uint32(d, "iobase", k->floppy.get_iobase(sio, 0)); + } + if (k->floppy.get_irq) { + qdev_prop_set_uint32(d, "irq", k->floppy.get_irq(sio, 0)); + } + /* FIXME use a qdev drive property instead of drive_get() */ + drive = drive_get(IF_FLOPPY, 0, 0); + if (drive != NULL) { + qdev_prop_set_drive(d, "driveA", blk_by_legacy_dinfo(drive), + &error_fatal); + } + /* FIXME use a qdev drive property instead of drive_get() */ + drive = drive_get(IF_FLOPPY, 0, 1); + if (drive != NULL) { + qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive), + &error_fatal); + } + qdev_init_nofail(d); + sio->floppy = isa; + trace_superio_create_floppy(0, + k->floppy.get_iobase ? + k->floppy.get_iobase(sio, 0) : -1, + k->floppy.get_irq ? + k->floppy.get_irq(sio, 0) : -1); + } + } static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index c2837bca43..a1845a91c3 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -27,8 +27,6 @@ #include "hw/isa/pc87312.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "trace.h" @@ -129,16 +127,26 @@ static bool is_uart_enabled(ISASuperIODevice *sio, uint8_t i) /* Floppy controller */ -static inline bool is_fdc_enabled(PC87312State *s) +static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s = PC87312(sio); + assert(!index); return s->regs[REG_FER] & FER_FDC_EN; } -static inline uint16_t get_fdc_iobase(PC87312State *s) +static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s = PC87312(sio); + assert(!index); return (s->regs[REG_FER] & FER_FDC_ADDR) ? 0x370 : 0x3f0; } +static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index) +{ + assert(!index); + return 6; +} + /* IDE controller */ @@ -272,7 +280,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp) DeviceState *d; ISADevice *isa; ISABus *bus; - DriveInfo *drive; Error *local_err = NULL; s = PC87312(dev); @@ -287,28 +294,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp) return; } - if (is_fdc_enabled(s)) { - isa = isa_create(bus, "isa-fdc"); - d = DEVICE(isa); - qdev_prop_set_uint32(d, "iobase", get_fdc_iobase(s)); - qdev_prop_set_uint32(d, "irq", 6); - /* FIXME use a qdev drive property instead of drive_get() */ - drive = drive_get(IF_FLOPPY, 0, 0); - if (drive != NULL) { - qdev_prop_set_drive(d, "driveA", blk_by_legacy_dinfo(drive), - &error_fatal); - } - /* FIXME use a qdev drive property instead of drive_get() */ - drive = drive_get(IF_FLOPPY, 0, 1); - if (drive != NULL) { - qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive), - &error_fatal); - } - qdev_init_nofail(d); - s->fdc.dev = isa; - trace_pc87312_info_floppy(get_fdc_iobase(s)); - } - if (is_ide_enabled(s)) { isa = isa_create(bus, "isa-ide"); d = DEVICE(isa); @@ -370,6 +355,12 @@ static void pc87312_class_init(ObjectClass *klass, void *data) .get_iobase = get_uart_iobase, .get_irq = get_uart_irq, }; + sc->floppy = (ISASuperIOFuncs){ + .count = 1, + .is_enabled = is_fdc_enabled, + .get_iobase = get_fdc_iobase, + .get_irq = get_fdc_irq, + }; } static const TypeInfo pc87312_type_info = { @@ -378,6 +369,7 @@ static const TypeInfo pc87312_type_info = { .instance_size = sizeof(PC87312State), .instance_init = pc87312_initfn, .class_init = pc87312_class_init, + /* FIXME use a qdev drive property instead of drive_get() */ }; static void pc87312_register_types(void) diff --git a/hw/isa/trace-events b/hw/isa/trace-events index c78dd6c353..8d9900882f 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -3,9 +3,9 @@ # hw/isa/isa-superio.c superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" superio_create_serial(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" +superio_create_floppy(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" -pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" From patchwork Mon Mar 5 21:19:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mH8/iZ+q"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCZW1Mgpz9sXt for ; Tue, 6 Mar 2018 08:23:47 +1100 (AEDT) Received: from localhost ([::1]:51605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxaD-0007DY-7v for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:23:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWZ-0004TD-7b for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWY-0001f7-E9 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:19:59 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:42735) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWY-0001ei-6n; Mon, 05 Mar 2018 16:19:58 -0500 Received: by mail-wr0-x241.google.com with SMTP id k9so18770964wre.9; Mon, 05 Mar 2018 13:19:58 -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=AsoLr1/MM62IsbV12d02fGecu677026mzyPu4UM20Is=; b=mH8/iZ+qsK3nEQYb7h/48wybqwI2Reh5XGZKYBpFv2OBrW4LyEFslOqVZ8IswsAjPY gIHyNhkA96UAB0oiyq9fL99PJmjed/uvz5K9arAejPUgLBj83zyAlbHYV953SPJ7JciI AWrDnXlZBWfL5rC8wM/K4DqpAPGxbmaVNZ8veHOq77eCVYoUuMccJ91Gkvozdq1EaCSl ECZQn9fyE5fSK8Up+DmSy/JZlALN5SIUK5SZF7xuu9LOUkjtj1BpqddR7AxX8FiAvETK cAaZEU4j/Ls2NnI0Tm0D5+Xsh6eUkTG4hhBdilwE0XliAWTGiE0k/ThZC696Swlxs116 MXBw== 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=AsoLr1/MM62IsbV12d02fGecu677026mzyPu4UM20Is=; b=XYgIbHJD0SL3MOqTATkabsdmBFakdhfT2qdfaLWFrpqSg1CqBSUKQicsxkGsun6cR6 OROfvPfa/oRZqfGnjk1cU7h9x+92puY8h3ViAj9knEhhulIusYvQkvbIC75dcuKLYJVn fG+UUphO+xI6M62yQrRKcGbgw6XJa1V+TxQnX0Qrnf8vlCCouuCUano666SVCs6TILZn x9yc+uG9F0Z2VIDAmaZbTdnaZn5OEZVYvKNELISYQs91eNMjn9uN+J11R2PnXh/FmwlD 2RLKKaq9qVx0HioT3voQkoHvCcUTh5hQl25+gbPasu23JdGzFZM7RbVQYZh8qq+YCFHc 4hDw== X-Gm-Message-State: APf1xPBZuOykvm6QUF2eync6bV6IS5Mtw+4bYwt4tD/tmORebjahG7FM rzl62EODjsyg+sPPit6xaUc= X-Google-Smtp-Source: AG47ELuw2Qtd/x9+JKxIPo9dkEYx7my0Pq+C0r6eVxCFvn14vSdsQk3N5L/9cwmP2iNPmGz3f2Kj0w== X-Received: by 10.223.161.194 with SMTP id v2mr13247305wrv.48.1520284797286; Mon, 05 Mar 2018 13:19:57 -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.19.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:18 -0300 Message-Id: <20180305211928.466-13-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [RFC PATCH v2 12/22] hw/isa/superio: Add a keyboard/mouse controller (8042) 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: Alexander Graf , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, "open list:PReP" , David Gibson , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since the PC87312 inherits this abstract model, we remove the I8042 instance in the PREP machine. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson --- include/hw/isa/superio.h | 1 + hw/isa/isa-superio.c | 3 +++ hw/ppc/prep.c | 1 - 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index e8007b9eee..2fc33bf3d3 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -30,6 +30,7 @@ typedef struct ISASuperIODevice { ISADevice *parallel[MAX_PARALLEL_PORTS]; ISADevice *serial[MAX_SERIAL_PORTS]; ISADevice *floppy; + ISADevice *kbc; } ISASuperIODevice; typedef struct ISASuperIOFuncs { diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 22bf79d3c3..6a24ac0259 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -17,6 +17,7 @@ #include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "trace.h" @@ -139,6 +140,8 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) k->floppy.get_irq(sio, 0) : -1); } + /* Keyboard, mouse */ + sio->kbc = isa_create_simple(bus, TYPE_I8042); } static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 610ec7ec32..96d319b87c 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -642,7 +642,6 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } - isa_create_simple(isa_bus, TYPE_I8042); cpu = POWERPC_CPU(first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; From patchwork Mon Mar 5 21:19:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881772 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BDehQ/84"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCxr5k9Tz9sfP for ; Tue, 6 Mar 2018 08:40:32 +1100 (AEDT) Received: from localhost ([::1]:51718 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxqQ-0005LX-Ty for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:40:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWb-0004Vk-BQ for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWa-0001g4-7l for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:01 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36328) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWZ-0001fW-Uj; Mon, 05 Mar 2018 16:20:00 -0500 Received: by mail-wr0-x242.google.com with SMTP id v111so18788517wrb.3; Mon, 05 Mar 2018 13:19:59 -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=+zYkSBPkxyE471bKM0LQ2S9m8Lb9giIeXCDaIKVgIpM=; b=BDehQ/8494yabFULID+OBFx3DchpdE21WyXTSyjG1uIp+VZG5jnzXu0Qwtt65U1EA6 2std5kKiHGk8MQQbtq74QkRPmPMd1qYqn7FwRTclytcMjE9uXlg6Q6reBBE32jS99EUa XnOX8pREw68YU8Hr7n/v8pkwaPhzPvnrwYHQZMChWKvPIlVpTLUzwKCwZMnIRPduTmTM 3Cnm2Qc2TSGSYwvjW5wtiIapuOBBSnHL7JAr+RTsR3iXu/p9QkxI9TK7M+EP7F8IVsYj AV5xLz4pCsr4JY5EcERJXKliFLfJC1Ny4rnT+Gk881cNebBdkkGMxqVYmvsltL35y2nO R5EQ== 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=+zYkSBPkxyE471bKM0LQ2S9m8Lb9giIeXCDaIKVgIpM=; b=Q0ha5s+iC8QlQPKO1OtUV1eXPQbyDpPX1PH+8uVMX8C/yBeliV9e8y0SxssfYyJZTj ogT8bz5u2SrzG2Bul9YWCVGNjOjePw2VlWqk/XUbu4c93Sbt2fUusUIgnaVVV0SJnF2o eTI2GLdfjJeYqskApAvOGQBQQwoZm5T91WRGmexm38V/zKudFU1Jc2NcaxAl8qP6MdYk HU+gB3mdqwqP6aAjBNnJBQ+dNoDhSbG06utUgR/9/8Wr4x8bFZC/aMIH/IGyPb3eseqK nf3nr147ZJRkd9nVyZyvZGZIcgb9tRqgxgHT5pJLoo8jzXTd57ZYKlGdE49EPJPlNa89 InNg== X-Gm-Message-State: AElRT7GhT6TZz5Ni9iLyGhBt7k5ib1ZavOfVdmZJbQXXs/Yr2kSJ0zxD jKI9xN+RAGPcpvKc+88Y/K0= X-Google-Smtp-Source: AG47ELszxV/zcpua0V/MkEsJQngXIsviXkvm4eXiyEyHBp4FoMjxArNekL+n+7ZEm0FfpjoDe+kD2A== X-Received: by 10.223.136.164 with SMTP id f33mr377462wrf.77.1520284798933; Mon, 05 Mar 2018 13:19:58 -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.19.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:19:58 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:19 -0300 Message-Id: <20180305211928.466-14-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 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] [RFC PATCH v2 13/22] hw/isa/superio: Factor out the IDE code from pc87312.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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, "open list:PReP" , Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/superio.h | 2 ++ hw/isa/isa-superio.c | 22 ++++++++++++++++++++++ hw/isa/pc87312.c | 36 ++++++++++++++++++++---------------- hw/isa/trace-events | 2 +- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index 2fc33bf3d3..3dd5448f8c 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -31,6 +31,7 @@ typedef struct ISASuperIODevice { ISADevice *serial[MAX_SERIAL_PORTS]; ISADevice *floppy; ISADevice *kbc; + ISADevice *ide; } ISASuperIODevice; typedef struct ISASuperIOFuncs { @@ -50,6 +51,7 @@ typedef struct ISASuperIOClass { ISASuperIOFuncs parallel; ISASuperIOFuncs serial; ISASuperIOFuncs floppy; + ISASuperIOFuncs ide; } ISASuperIOClass; #endif /* HW_ISA_SUPERIO_H */ diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 6a24ac0259..88d254a602 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -142,6 +142,28 @@ static void isa_superio_realize(DeviceState *dev, Error **errp) /* Keyboard, mouse */ sio->kbc = isa_create_simple(bus, TYPE_I8042); + + /* IDE */ + if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) { + isa = isa_create(bus, "isa-ide"); + d = DEVICE(isa); + if (k->ide.get_iobase) { + qdev_prop_set_uint32(d, "iobase", k->ide.get_iobase(sio, 0)); + } + if (k->ide.get_iobase) { + qdev_prop_set_uint32(d, "iobase2", k->ide.get_iobase(sio, 1)); + } + if (k->ide.get_irq) { + qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0)); + } + qdev_init_nofail(d); + sio->ide = isa; + trace_superio_create_ide(0, + k->ide.get_iobase ? + k->ide.get_iobase(sio, 0) : -1, + k->ide.get_irq ? + k->ide.get_irq(sio, 0) : -1); + } } static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index a1845a91c3..5cf64505fe 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -150,16 +150,28 @@ static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index) /* IDE controller */ -static inline bool is_ide_enabled(PC87312State *s) +static bool is_ide_enabled(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s = PC87312(sio); + return s->regs[REG_FER] & FER_IDE_EN; } -static inline uint16_t get_ide_iobase(PC87312State *s) +static uint16_t get_ide_iobase(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s = PC87312(sio); + + if (index == 1) { + return get_ide_iobase(sio, 0) + 0x206; + } return (s->regs[REG_FER] & FER_IDE_ADDR) ? 0x170 : 0x1f0; } +static unsigned int get_ide_irq(ISASuperIODevice *sio, uint8_t index) +{ + assert(index == 0); + return 14; +} static void reconfigure_devices(PC87312State *s) { @@ -277,14 +289,11 @@ static void pc87312_reset(DeviceState *d) static void pc87312_realize(DeviceState *dev, Error **errp) { PC87312State *s; - DeviceState *d; ISADevice *isa; - ISABus *bus; Error *local_err = NULL; s = PC87312(dev); isa = ISA_DEVICE(dev); - bus = isa_bus_from_device(isa); isa_register_ioport(isa, &s->io, s->iobase); pc87312_hard_reset(s); @@ -293,17 +302,6 @@ static void pc87312_realize(DeviceState *dev, Error **errp) error_propagate(errp, local_err); return; } - - if (is_ide_enabled(s)) { - isa = isa_create(bus, "isa-ide"); - d = DEVICE(isa); - qdev_prop_set_uint32(d, "iobase", get_ide_iobase(s)); - qdev_prop_set_uint32(d, "iobase2", get_ide_iobase(s) + 0x206); - qdev_prop_set_uint32(d, "irq", 14); - qdev_init_nofail(d); - s->ide.dev = isa; - trace_pc87312_info_ide(get_ide_iobase(s)); - } } static void pc87312_initfn(Object *obj) @@ -361,6 +359,12 @@ static void pc87312_class_init(ObjectClass *klass, void *data) .get_iobase = get_fdc_iobase, .get_irq = get_fdc_irq, }; + sc->ide = (ISASuperIOFuncs){ + .count = 1, + .is_enabled = is_ide_enabled, + .get_iobase = get_ide_iobase, + .get_irq = get_ide_irq, + }; } static const TypeInfo pc87312_type_info = { diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 8d9900882f..80ac6175d6 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -4,8 +4,8 @@ superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" superio_create_serial(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" superio_create_floppy(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" +superio_create_ide(int id, uint16_t base, unsigned int irq) "id=%d, base 0x%03x, irq %u" # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=0x%x val=0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" -pc87312_info_ide(uint32_t base) "base 0x%x" From patchwork Mon Mar 5 21:19:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881717 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aJWNhwct"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCZp1jxQz9sXt for ; Tue, 6 Mar 2018 08:24:02 +1100 (AEDT) Received: from localhost ([::1]:51609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxaS-0007Sv-8h for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:24:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWc-0004X5-C7 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWb-0001hZ-Im for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:02 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:32817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWb-0001gs-Ce for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:01 -0500 Received: by mail-wm0-x242.google.com with SMTP id s206so15056368wme.0 for ; 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=IV0pzBsGANS34ps4xxZJbR881CnlULNAoIhbunxpJU4=; b=aJWNhwctfI6xHQimuuWwx2QPEVJWFMK/6tqik9iF0SP/1sCUYeBeoKGePXWMex8qLv cbNAx3JE8E/jgbNtqtDvGkGHD1mSvyCb+WheiaHzKhyAj0cIxdC/cU+l1kEQHp2pAmvq K3IHObNNc+dh0d5DROUb8KEDawQ5efKH8aojU85a4Urq5Rt10RZjIIqsk7qWKfejyFmu wDdnsoU06dW6X7m7wzoBlMU5FwUuAVuwshHsMMzXtM2kJKtKEgswXTkSbk4y3NNDX5P8 m7rzFGRpDMLm5JfCAZwoalXvJSQd5TXQ9Van6IdAF6x/UkXZSKGs1iXzM/gqCHrEulaw Jiig== 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=IV0pzBsGANS34ps4xxZJbR881CnlULNAoIhbunxpJU4=; b=eP+3gnxhMlfs3fXVY7vDE367lmBon1xp71+XHQxaMrkxlDtGZr+W9w0Vp0YpQrIooo D+xlcVdSqOVqfsPBgtCUB5d6utupwJq/PqMH7viF1YS1xOv918zcUzHAYU6r/CnLB87P JtNWog5sOvel4R5x7GqgN4ruVOLIWJMq/7CZrt3inOJV0Mv3nH24IzAlsdMK0HWFzhVd RBbupeFsAE2aBhI8IbBLk/kUEyJjEHHwLRheAnjBFa1KN0yZOD6N/qQZtLS0OLfHo2Cv bXvjQ01TUQfsuhZ+rSoLcsfwGkyadGPEICpkO2Mxe4FxbFWU2yiNLYRe8T+T4yrsNxR2 gycA== X-Gm-Message-State: AElRT7G9e+GQlmcaBwZemSjMIWIhRQeC6xlpoR1wsByYCHu/iY1v1Wk9 3tQL4t1YGnDTe0r3oTlxYKI= X-Google-Smtp-Source: AG47ELt/0fzswqgZ/w/ChWzO+nL7C2EQuKXbZDEQ2nV/jeSviHyTucqqC26DX2rGRA8ptORFoq7iIg== X-Received: by 10.28.69.29 with SMTP id s29mr8150643wma.152.1520284800496; Mon, 05 Mar 2018 13:20:00 -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.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:00 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:20 -0300 Message-Id: <20180305211928.466-15-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 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 14/22] hw/mips/malta: Code movement 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move the SouthBridge peripherals first, and keep the Super I/O peripherals last. Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/mips_malta.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index cd7bd0eef6..9e0724ca5a 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1062,10 +1062,6 @@ void mips_malta_init(MachineState *machine) memory_region_add_subregion(system_memory, 512 << 20, ram_low_postio); } - /* generate SPD EEPROM data */ - generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size); - generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]); - #ifdef TARGET_WORDS_BIGENDIAN be = 1; #else @@ -1208,15 +1204,19 @@ void mips_malta_init(MachineState *machine) pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); - smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); - g_free(smbus_eeprom_buf); pit = i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(isa_bus, 0); + mc146818_rtc_init(isa_bus, 2000, NULL); + + /* generate SPD EEPROM data */ + generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size); + generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]); + smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); + g_free(smbus_eeprom_buf); /* Super I/O */ isa_create_simple(isa_bus, TYPE_I8042); - mc146818_rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, 0, 2); parallel_hds_isa_init(isa_bus, 1); From patchwork Mon Mar 5 21:19:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ALXTcHo7"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCzs06WXz9sgH for ; Tue, 6 Mar 2018 08:42:15 +1100 (AEDT) Received: from localhost ([::1]:51731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxs5-0006iL-8r for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:42:13 -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) 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , 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 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- 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; +#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 = { .class_init = isa_superio_class_init, }; +/* SMS FDC37M817 Super I/O */ +static void fdc37m81x_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass); + + sc->serial.count = 2; /* NS16C550A */ + sc->parallel.count = 1; + sc->floppy.count = 1; /* SMSC 82077AA Compatible */ + sc->ide.count = 0; +} + +static const TypeInfo fdc37m81x_type_info = { + .name = TYPE_FDC37M81X_SUPERIO, + .parent = TYPE_ISA_SUPERIO, + .instance_size = sizeof(ISASuperIODevice), + .class_size = sizeof(ISASuperIOClass), + .class_init = fdc37m81x_class_init, +}; + static void isa_superio_register_types(void) { type_register_static(&isa_superio_type_info); + type_register_static(&fdc37m81x_type_info); } 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 = 0; int fl_sectors = bios_size >> 16; int be; @@ -1023,15 +1018,6 @@ void mips_malta_init(MachineState *machine) qdev_init_nofail(dev); - /* Make sure the first 3 serial ports are associated with a device. */ - for(i = 0; i < 3; i++) { - if (!serial_hds[i]) { - char label[32]; - snprintf(label, sizeof(label), "serial%d", i); - serial_hds[i] = qemu_chr_new(label, "null"); - } - } - /* create CPU */ mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq); @@ -1067,7 +1053,14 @@ void mips_malta_init(MachineState *machine) #else be = 0; #endif + /* FPGA */ + + /* Make sure the second serial port is associated with a device. */ + if (!serial_hds[2]) { + serial_hds[2] = 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]); @@ -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); - /* 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 = 0; i < MAX_FD; i++) { - fd[i] = 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); /* Network card */ network_init(pci_bus); From patchwork Mon Mar 5 21:19:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881720 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ESStVgXX"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCfG0n85z9sfK for ; Tue, 6 Mar 2018 08:27:02 +1100 (AEDT) Received: from localhost ([::1]:51630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxdM-00022s-5B for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:27:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWg-0004cS-Ki for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWf-0001kH-AM for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:06 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:54408) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWf-0001jT-06 for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:05 -0500 Received: by mail-wm0-x243.google.com with SMTP id z81so18730611wmb.4 for ; Mon, 05 Mar 2018 13:20:04 -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=QZ267pz5Pehx0/O/HW5sMwpiWd03lKnGPfIsK0JMZw4=; b=ESStVgXX8pI90Pc+NaOwHP894WZHKOpRloYpBOPeAp/xtqVVDYhYHi9OrhZYtIN7wI AdlGPfE9Qu0lnSzOGJZxpwi+PfsnuALr5PN2cDENN2cXELrsITmvG3r9pNfAm9rFrK61 hwEXty3PftPCJqWmgsmygrjB4+0N9ZQQYVeeg8zvPBN3GSE7cQsrXLayQWbRf38k3Ach 027Ngof9Gcg+e7dQVHCnaR9tmanNxBsoWO6grATtKcnju3zCEo8EMweqU2t2VzguDaCA xLwEsP6nPXMT4xqJQcLeHqFJQDC68kH1VBkxEYOPQEh26pXjM8FnmS+zOOkH+hxUIvYw 3voQ== 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=QZ267pz5Pehx0/O/HW5sMwpiWd03lKnGPfIsK0JMZw4=; b=im7JLNFVvvQ6cYS3u7nLjqvj8XNs24H1kQkgViIg9R7tPEgM2+48bnsBZ+2JE5YC4h vcU6V6d/CmdeasS4TtVFcE0F2ZeSHsqqlE30R+BrOHagMyEgm2nxLygqEM4KU4M6wHFR us4Mf5IbO6sObznjoG6bc21VPSvGS1gZySbQMft1G3K9A2fudHBZWJGP/V3fnn1MA8Dn 1lEZFhsJp41zjJJFU1Cj3Z8hbfYLA6n1I66invZcQksgqW2nkS4rLNKAI56Hokw9Nv3t +XhXnYzgoZi99PuhHBZEUb0CInWUb5sBkn50JWJiNIZxqVB+9kLLoAqrL4MciMZcXJvl NHtg== X-Gm-Message-State: AElRT7GWn3PojVaPvwv2QCTDkcmctrLBMXs9HEeJH+1k+NWuIeY+gJHz lEhBosj8vjDtKWi0qx0QHAI= X-Google-Smtp-Source: AG47ELssvl74LZ4JohrQ3c5EC8PKyiOd5ZbfkEd39wcFvjNmvDGQsumUQWXRC0haGB5EACph4WrXXw== X-Received: by 10.28.124.20 with SMTP id x20mr8624849wmc.62.1520284803974; 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.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:03 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:22 -0300 Message-Id: <20180305211928.466-17-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC PATCH v2 16/22] hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init() 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- hw/mips/mips_fulong2e.c | 83 ++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 9339e02120..ca1f76a724 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -78,8 +78,6 @@ #define FULONG2E_ATI_SLOT 6 #define FULONG2E_RTL8139_SLOT 7 -static ISADevice *pit; - static struct _loaderparams { int ram_size; const char *kernel_filename; @@ -232,11 +230,44 @@ static const uint8_t eeprom_spd[0x80] = { 0x20,0x30,0x20 }; -/* Audio support */ -static void audio_init (PCIBus *pci_bus) +static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, + I2CBus **i2c_bus, ISABus **p_isa_bus) { - vt82c686b_ac97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 5)); - vt82c686b_mc97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 6)); + qemu_irq *i8259; + ISABus *isa_bus; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + + isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(slot, 0)); + if (!isa_bus) { + fprintf(stderr, "vt82c686b_init error\n"); + exit(1); + } + *p_isa_bus = isa_bus; + /* Interrupt controller */ + /* The 8259 -> IP5 */ + i8259 = i8259_init(isa_bus, intc); + isa_bus_irqs(isa_bus, i8259); + /* init other devices */ + i8254_pit_init(isa_bus, 0x40, 0, NULL); + i8257_dma_init(isa_bus, 0); + + ide_drive_get(hd, ARRAY_SIZE(hd)); + vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(slot, 1)); + + pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); + pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), "vt82c686b-usb-uhci"); + + *i2c_bus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(slot, 4), 0xeee1, NULL); + + /* Audio support */ + vt82c686b_ac97_init(pci_bus, PCI_DEVFN(slot, 5)); + vt82c686b_mc97_init(pci_bus, PCI_DEVFN(slot, 6)); + + /* Super I/O */ + isa_create_simple(isa_bus, TYPE_I8042); + + serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, 1); } /* Network support */ @@ -269,11 +300,9 @@ static void mips_fulong2e_init(MachineState *machine) MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; - qemu_irq *i8259; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; - DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; @@ -335,46 +364,16 @@ static void mips_fulong2e_init(MachineState *machine) /* North bridge, Bonito --> IP2 */ pci_bus = bonito_init((qemu_irq *)&(env->irq[2])); - /* South bridge */ - ide_drive_get(hd, ARRAY_SIZE(hd)); - - isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); - if (!isa_bus) { - error_report("vt82c686b_init error"); - exit(1); - } - - /* Interrupt controller */ - /* The 8259 -> IP5 */ - i8259 = i8259_init(isa_bus, env->irq[5]); - isa_bus_irqs(isa_bus, i8259); - - vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); - pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2), - "vt82c686b-usb-uhci"); - pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3), - "vt82c686b-usb-uhci"); + /* South bridge -> IP5 */ + vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5], + &smbus, &isa_bus); - smbus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), - 0xeee1, NULL); /* TODO: Populate SPD eeprom data. */ smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd)); - /* init other devices */ - pit = i8254_pit_init(isa_bus, 0x40, 0, NULL); - i8257_dma_init(isa_bus, 0); - - /* Super I/O */ - isa_create_simple(isa_bus, TYPE_I8042); - mc146818_rtc_init(isa_bus, 2000, NULL); - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - parallel_hds_isa_init(isa_bus, 1); - - /* Sound card */ - audio_init(pci_bus); - /* Network card */ + /* Network card: RTL8139D */ network_init(pci_bus); } From patchwork Mon Mar 5 21:19:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rANgiwWa"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCk13mDgz9sfK for ; Tue, 6 Mar 2018 08:30:17 +1100 (AEDT) Received: from localhost ([::1]:51653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxgV-00054c-FR for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:30:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWh-0004di-ML 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 1esxWg-0001lM-Ne for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:07 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35435) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWg-0001kd-Gy for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:06 -0500 Received: by mail-wm0-x244.google.com with SMTP id x7so18311140wmc.0 for ; Mon, 05 Mar 2018 13:20:06 -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=I9tlrpPAPTQoMufH7xOCWewFLCL19qQTxXS/LQtqwmY=; b=rANgiwWaE20YJHXyEWfR83kjFlTqKdVsOmSJxgwCx99MwrgtlkG6zxhE20jVUNZp0N O3Ew0uGMaTTYvmr8Rp+hV4rYOkje6gv2b/bJx3CarxFqkp/ArCLNlY5GVHiepPcwgoNI X5UsiS1xc8RH5rdWqupT+H5kNwZYr4AEz7LoNkd6HgFx6D9536gAooZK+9DeIQyQdUZu /DmRgYjJwxUNr1STbDmIJdIaRXCsnSBKX/5ZPi9MWOyZ2bEAeUIb3w2eZtWAaWbwWcFm Y967UmMUkNVb3Q2RcV1o6DKLx5c5krJXeVnqu/nLTN+StVBiMeJMBAqbTbcHEuF0NjGX Th8g== 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=I9tlrpPAPTQoMufH7xOCWewFLCL19qQTxXS/LQtqwmY=; b=r/Zmkc3dViFOjbnxcYr4TJXlXXVtZkM51hRiU32IzUu4n1AasmnVgh6Uq2NYhCqvy9 luDee4ctbH7DKD7t64RgcUiyYbBl2OhMBlmid5spOJiiMQ0eViXzR/CENXsFEYybEEM7 2IQ1fM8RKN1NiVpK/oaeii4bi1OePwgug7zUQjHxSDy1cCkm4avvF7s2CzFFpueMeaR1 fG55GEODHVJ2BS4562txrE+L86X0/DroWhJkxdZ6/1FHhkrD5gXnAwTq3SPKY/dPYCld K8s6ggje8t+t5O28lnwIiJbclM8QO/ejoqo1tspakh15IQJMe/A02LfZL3U7do+t03cD WAdw== X-Gm-Message-State: AElRT7FOYVpbQyv/9qUgmbFIaIt60z3WuHScwgHyJH4AlTngpD8IKVDA Yk5JxEsJ0hSYaDmFs8Z2eIs= X-Google-Smtp-Source: AG47ELuw+K4FvCkNr2/FgQR2r0FJiULZYzKU2gJ+dGe8KMESzG8JBrjXdeE9UJMa77rvsNsx7V4J7w== X-Received: by 10.28.222.3 with SMTP id v3mr8656051wmg.25.1520284805609; Mon, 05 Mar 2018 13:20:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:04 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:23 -0300 Message-Id: <20180305211928.466-18-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [RFC PATCH v2 17/22] hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init() 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This function only initialize the ISA bus. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/vt82c686.h | 2 +- hw/isa/vt82c686.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 471b5e9e53..db97c8ed7a 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -2,7 +2,7 @@ #define HW_VT82C686_H /* vt82c686.c */ -ISABus *vt82c686b_init(PCIBus * bus, int devfn); +ISABus *vt82c686b_isa_init(PCIBus * bus, int devfn); void vt82c686b_ac97_init(PCIBus *bus, int devfn); void vt82c686b_mc97_init(PCIBus *bus, int devfn); I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 070cc1889f..7eaf3c7e8f 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -478,7 +478,7 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp) qemu_register_reset(vt82c686b_reset, d); } -ISABus *vt82c686b_init(PCIBus *bus, int devfn) +ISABus *vt82c686b_isa_init(PCIBus *bus, int devfn) { PCIDevice *d; diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index ca1f76a724..9ebc225d3b 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -237,7 +237,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, ISABus *isa_bus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - isa_bus = vt82c686b_init(pci_bus, PCI_DEVFN(slot, 0)); + isa_bus = vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0)); if (!isa_bus) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); From patchwork Mon Mar 5 21:19:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881719 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="DUvyle5O"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCdv6jH6z9sfK for ; Tue, 6 Mar 2018 08:26:43 +1100 (AEDT) Received: from localhost ([::1]:51628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxd3-0001ms-SS for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:26:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWj-0004gG-PH for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWi-0001nU-Ly for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:09 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:52775) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWi-0001mw-CW for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:08 -0500 Received: by mail-wm0-x243.google.com with SMTP id t3so18728615wmc.2 for ; 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=LaH9lS0Rh473ceQo0RVQSXSQ5r0vdjDcRsNCm7bJndM=; b=DUvyle5O62GrrTmOdxc/tlggQP3F9vUbPj7fMm7hmq9ozjudVcy1s5JKwRT3vhOq+V 7FvaOi5AuN1ffsd2hXWx34QaQiOM3WBWNkUJMv+x52XFumZR738AKBDky7oa2IVt2nxj CUweYJPBhIiTIAwkS74AXpBKftvRYcjKe6wk+wkK9OJCIWZxcPJdbcTBmA6Z67IJj25D WxE3slb+WyTPza/4H0w4okcVC+73GbBHnBAAuOsyaJ0Y7MOvv9PS19qJjkss5PXvgUWl S+EIEQDADEX4laiG2ZehqPsLWBarIsmFDtRi7pdx0dxmUTdUXAh96BZzgSXQZETJcLJf wbJA== 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=LaH9lS0Rh473ceQo0RVQSXSQ5r0vdjDcRsNCm7bJndM=; b=RAR7mexuTv9bsrOiyGIIG/cwVRjeQhOaHEJFVWoCpqTTXnfQ4bHaXx4kHxchZyw1Na YPVF5g3QBllcgG/HS7EqZ+6u4baKDiDkhNRbPa6M8ZlRjNTay/MbsLChSRE5KMpovSBo yRmsNHXYWXatOwBqFjv6jOiRnWVcovjcwrcdLNFWDQzmY1Boioj6xewlAs11r2rlpz5R xSbf1ejq9cwG04UC4GocKoXtW3dMViwzQmqczYoCs/GaO+EoQzYJb/dJyz7grfBQgPca proLrLSxcNPrFIwEDn23ejfAlXO0hdv3zuChg89avYo26wpdNFCZQN4uleOEuQHvIA/y 4Ikg== X-Gm-Message-State: AElRT7EkyVeR8XIuIlVlGdNMeiyXcypfWcW/xMLSgvZoy+tcv9wzlxjR JjF3Vcc08HySO/v9gaMF/F0= X-Google-Smtp-Source: AG47ELtKknCt1X2ysoc86jHrnhgRx2ZLEFLRB9nDjyAo/mLPfiY/voIDSSjI3QH97W9yZQXN8MsjmA== X-Received: by 10.28.40.195 with SMTP id o186mr8962426wmo.134.1520284807428; Mon, 05 Mar 2018 13:20:07 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:24 -0300 Message-Id: <20180305211928.466-19-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC PATCH v2 18/22] hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- include/hw/isa/vt82c686.h | 2 ++ hw/isa/vt82c686.c | 20 ++++++++++++++++++++ hw/mips/mips_fulong2e.c | 15 +++------------ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index db97c8ed7a..c3c2b6e786 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -1,6 +1,8 @@ #ifndef HW_VT82C686_H #define HW_VT82C686_H +#define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" + /* vt82c686.c */ ISABus *vt82c686b_isa_init(PCIBus * bus, int devfn); void vt82c686b_ac97_init(PCIBus *bus, int devfn); diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 7eaf3c7e8f..cff1946232 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -17,6 +17,7 @@ #include "hw/i2c/smbus.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" +#include "hw/isa/superio.h" #include "hw/sysbus.h" #include "hw/mips/mips.h" #include "hw/isa/apm.h" @@ -519,11 +520,30 @@ static const TypeInfo via_info = { }, }; +static void vt82c686b_superio_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass); + + sc->serial.count = 2; + sc->parallel.count = 1; + sc->ide.count = 0; + sc->floppy.count = 1; +} + +static const TypeInfo via_superio_info = { + .name = TYPE_VT82C686B_SUPERIO, + .parent = TYPE_ISA_SUPERIO, + .instance_size = sizeof(ISASuperIODevice), + .class_size = sizeof(ISASuperIOClass), + .class_init = vt82c686b_superio_class_init, +}; + static void vt82c686b_register_types(void) { type_register_static(&via_ac97_info); type_register_static(&via_mc97_info); type_register_static(&via_pm_info); + type_register_static(&via_superio_info); type_register_static(&via_info); } diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 9ebc225d3b..d608f17e1e 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -23,9 +23,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/dma/i8257.h" -#include "hw/char/serial.h" -#include "hw/char/parallel.h" -#include "hw/block/fdc.h" +#include "hw/isa/superio.h" #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" @@ -34,7 +32,6 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "sysemu/sysemu.h" #include "audio/audio.h" #include "qemu/log.h" #include "hw/loader.h" @@ -44,8 +41,6 @@ #include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" -#include "hw/input/i8042.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" @@ -250,6 +245,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, /* init other devices */ i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(isa_bus, 0); + /* Super I/O */ + isa_create_simple(isa_bus, TYPE_VT82C686B_SUPERIO); ide_drive_get(hd, ARRAY_SIZE(hd)); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(slot, 1)); @@ -262,12 +259,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, /* Audio support */ vt82c686b_ac97_init(pci_bus, PCI_DEVFN(slot, 5)); vt82c686b_mc97_init(pci_bus, PCI_DEVFN(slot, 6)); - - /* Super I/O */ - isa_create_simple(isa_bus, TYPE_I8042); - - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - parallel_hds_isa_init(isa_bus, 1); } /* Network support */ From patchwork Mon Mar 5 21:19:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="f6YnWw1V"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwD1T2Shxz9sgH for ; Tue, 6 Mar 2018 08:43:41 +1100 (AEDT) Received: from localhost ([::1]:51740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxtT-0007ry-Gd for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:43:39 -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) 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , 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 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- 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; #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" +#define TYPE_SMC37C669_SUPERIO "smc37c669-superio" #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é + * + * 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 = ISA_SUPERIO_CLASS(klass); + + sc->parallel = (ISASuperIOFuncs){ + .count = 1, + .is_enabled = is_parallel_enabled, + .get_iobase = get_parallel_iobase, + .get_irq = get_parallel_irq, + .get_dma = get_parallel_dma, + }; + sc->serial = (ISASuperIOFuncs){ + .count = 2, + .is_enabled = is_serial_enabled, + .get_iobase = get_serial_iobase, + .get_irq = get_serial_irq, + }; + sc->floppy = (ISASuperIOFuncs){ + .count = 1, + .is_enabled = is_fdc_enabled, + .get_iobase = get_fdc_iobase, + .get_irq = get_fdc_irq, + .get_dma = get_fdc_dma, + }; + sc->ide.count = 0; +} + +static const TypeInfo smc37c669_type_info = { + .name = TYPE_SMC37C669_SUPERIO, + .parent = TYPE_ISA_SUPERIO, + .instance_size = sizeof(ISASuperIODevice), + .class_size = sizeof(ISASuperIOClass), + .class_init = 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) += isa-bus.o -common-obj-$(CONFIG_ISA_BUS) += isa-superio.o +common-obj-$(CONFIG_ISA_BUS) += isa-superio.o smc37c669-superio.o common-obj-$(CONFIG_APM) += apm.o common-obj-$(CONFIG_I82378) += i82378.o common-obj-$(CONFIG_PC87312) += pc87312.o From patchwork Mon Mar 5 21:19:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="spdW8rwT"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwD2n494Zz9sgH for ; Tue, 6 Mar 2018 08:44:49 +1100 (AEDT) Received: from localhost ([::1]:51745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxuZ-0000CE-O4 for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:44:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWm-0004mp-Ld for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWl-0001sW-RC for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:12 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:37823) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWl-0001r4-KP for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:11 -0500 Received: by mail-wm0-x243.google.com with SMTP id 139so18406710wmn.2 for ; Mon, 05 Mar 2018 13:20:11 -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=tPKe60jAPGqC1x9BVaAR9UT5kMd9v4doCYyl5jwN5EU=; b=spdW8rwTSyghBjG1eElk9SeUrTIrIXiw1tOGtP9y8Q3PfOz0CD7UIsSL6ytlOp4ubt GaDPElus7oDTUosvNQgIk7CUf6BoYtmoZ2sDL0euP4MYvRU2hUHmEfCvbGPe5ky+Atnx oaAzli/UydJo+xvQgqlMcEyMUoGmvqw1kJiWoaBe+NAKzJDANrCCwCeOuH4AKkRANggn vzLPRLG5Vq6ou5bB8YXh+d4+UFSwWuimZBInIlBcIsQM0BYyxcPsvlr1b5Wej/WiOY2E dUD7jzDNVHUHfiHhK/RdsO9L/kwY1tHkbNX0fhP8++1sH06ySM/gMbXlkMIY7TDN5RO+ xKKw== 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=tPKe60jAPGqC1x9BVaAR9UT5kMd9v4doCYyl5jwN5EU=; b=HAP7EJ5Ez9OFO7LtPEPOl8sKnteVWA9wv8LCa+tr8O0OvzXsPVQ9QKcfmxNYCOoKws 7hd9rxX/h9li4FmAXNVmQ/vHeHHNL5I14REFLTT7g5fWLVHzkyBN/C9P5dt3YvPvabzt jlsAi5uMJzPaN2tfXvguSLy6fMQNqKWwUuT2Euf5OIKlc4ubICoAUPKVbqcZEfxeZPlc dx+ZOvG0FA9pgbZtwb+75v7ayc1d7h0axzYhwnQ+0NHpC9n7BF7RYXKjXJXnM5nDl71J Q541nf/pK21WLjjQKw332HmpW1kYIkj3GpWalLDTk1b/NOJkSaDTdgdSQDr8Qi4no0oF lC8w== X-Gm-Message-State: AElRT7EKGDxnBlW0TL9bXuYU0DS/WwV2bBOPR6Lg/9tXQGSJ3ntjOl10 gNcWPy9Xtn9k34QihlMcJsw= X-Google-Smtp-Source: AG47ELvv2XHjS6/rewRe/IiRhKd7w/qTQdcfSgE1FXFtmLCzCZCaC4eF3qFeCsK02VdCT1doz/AZpw== X-Received: by 10.28.30.210 with SMTP id e201mr9237816wme.34.1520284810695; Mon, 05 Mar 2018 13:20:10 -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.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:26 -0300 Message-Id: <20180305211928.466-21-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC PATCH v2 20/22] hw/alpha/dp264: Add the ISA DMA controller 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- default-configs/alpha-softmmu.mak | 2 ++ hw/alpha/dp264.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/default-configs/alpha-softmmu.mak b/default-configs/alpha-softmmu.mak index e0d75e3058..3740adc5e9 100644 --- a/default-configs/alpha-softmmu.mak +++ b/default-configs/alpha-softmmu.mak @@ -4,7 +4,9 @@ include pci.mak include usb.mak CONFIG_SERIAL=y CONFIG_SERIAL_ISA=y +CONFIG_I82374=y CONFIG_I8254=y +CONFIG_I8257=y CONFIG_PCKBD=y CONFIG_VGA_CIRRUS=y CONFIG_IDE_CORE=y diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index e13cb576fd..ffad678ea7 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -21,6 +21,7 @@ #include "hw/timer/i8254.h" #include "hw/input/i8042.h" #include "hw/char/serial.h" +#include "hw/dma/i8257.h" #include "qemu/cutils.h" #define MAX_IDE_BUS 2 @@ -95,6 +96,9 @@ static void clipper_init(MachineState *machine) pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL); } + /* 2 82C37 (dma) */ + isa_create_simple(isa_bus, "i82374"); + /* IDE disk setup. */ { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; From patchwork Mon Mar 5 21:19:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881742 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AfJsM2dq"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCn52Rsgz9sfP for ; Tue, 6 Mar 2018 08:32:57 +1100 (AEDT) Received: from localhost ([::1]:51672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxj5-0007Og-FF for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:32:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWp-0004qu-VW for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWn-0001ts-UP for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:15 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:53431) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWn-0001tU-Dv for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:13 -0500 Received: by mail-wm0-x243.google.com with SMTP id t74so18848656wme.3 for ; Mon, 05 Mar 2018 13:20:13 -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=PV0zG50CLD4CRQ3Go/FdO67r9aU1bGuOfTBtuUZTSAU=; b=AfJsM2dqoWV+5hCCsfnaiEMxLSuN53RV9VTvSihOQwU+DaZl79bB9imEDm680PNoK3 Di3kHpAH6znmSEvn3KoUlWWGxNyF2xb5Uso4C8HES9kZsiOoKhPHFvp5Um37xfaQ5C9n vhnoBb7V/wJE3Im1Yy0pL5DT+mPzzY1C4OjCaQJ+Zy54c20AYo+f0iW5BNXXQfbBvOqt sX7i8olijt396g0GkFthwmVWMXcxFIQ7tEb+/ssAwuteV14MZWQ7Y+nZZMIcEFyx4LFc lAeFYLutqghzNQyaa0xZ3tDohGMRJo4RA0zaNgeBYWlzAj0TB/T3toWLnY/tYEE/2SUS luHg== 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=PV0zG50CLD4CRQ3Go/FdO67r9aU1bGuOfTBtuUZTSAU=; b=lVVBUD4LoHcG48E2BKy7NrnRRaXzNyDJ9GulO97IzQ7+kCLH1fiDSWLqrtKp6MK2LK zu2vvNJV5LMtsbGL451yY5SvlUuC++UP5ksf8MYO+62W0nkij8uOmeJKkD2Kacvyslki GdfqaqDmZ3GOM59csa5JtXKMuLsncUwWUzwss1jU/NCt+NSRxuKWt9pva003yOJ+Oi4g naQGiCVNRx57g3CeNrvVFMOR+x9/6XEBcXpwx8fMGkEJXII7NdyHMxZ3dtBQcU7lYrjn gzq+dZTS3qs01Q7XMVKTorPeZ/GQ8rja5ApqEyhh6yOG1abYo1V/bcwibMnsuKSLAUes X21w== X-Gm-Message-State: AElRT7Gc8t0HJFrrffivt8jUEMxUxWZ8w2BBuViDJMqg4EfIxtdMs+IT JINuwqeO0ZMEgUk1unqHCUs= X-Google-Smtp-Source: AG47ELvPKS5BI+ctWkkexrRYIvDrIc6o+6HwJ74wHFAK0F6Awo6IdL/xnzVRJH3Zcr7+qibkv3FHTg== X-Received: by 10.28.20.74 with SMTP id 71mr8664489wmu.71.1520284812532; Mon, 05 Mar 2018 13:20:12 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:11 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:27 -0300 Message-Id: <20180305211928.466-22-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC PATCH v2 21/22] hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- default-configs/alpha-softmmu.mak | 3 +++ hw/alpha/dp264.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/default-configs/alpha-softmmu.mak b/default-configs/alpha-softmmu.mak index 3740adc5e9..bbe361f01a 100644 --- a/default-configs/alpha-softmmu.mak +++ b/default-configs/alpha-softmmu.mak @@ -7,6 +7,9 @@ CONFIG_SERIAL_ISA=y CONFIG_I82374=y CONFIG_I8254=y CONFIG_I8257=y +CONFIG_PARALLEL=y +CONFIG_PARALLEL_ISA=y +CONFIG_FDC=y CONFIG_PCKBD=y CONFIG_VGA_CIRRUS=y CONFIG_IDE_CORE=y diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index ffad678ea7..80b987f7fb 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -19,8 +19,7 @@ #include "hw/timer/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" -#include "hw/input/i8042.h" -#include "hw/char/serial.h" +#include "hw/isa/superio.h" #include "hw/dma/i8257.h" #include "qemu/cutils.h" @@ -83,14 +82,10 @@ static void clipper_init(MachineState *machine) mc146818_rtc_init(isa_bus, 1900, rtc_irq); i8254_pit_init(isa_bus, 0x40, 0, NULL); - isa_create_simple(isa_bus, TYPE_I8042); /* VGA setup. Don't bother loading the bios. */ pci_vga_init(pci_bus); - /* Serial code setup. */ - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - /* Network setup. e1000 is good enough, failing Tulip support. */ for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL); @@ -99,6 +94,9 @@ static void clipper_init(MachineState *machine) /* 2 82C37 (dma) */ isa_create_simple(isa_bus, "i82374"); + /* Super I/O */ + isa_create_simple(isa_bus, TYPE_SMC37C669_SUPERIO); + /* IDE disk setup. */ { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; From patchwork Mon Mar 5 21:19:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 881727 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QrRqWH9R"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zwCj63GN9z9sfP for ; Tue, 6 Mar 2018 08:29:30 +1100 (AEDT) Received: from localhost ([::1]:51643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxfk-0004DN-GO for incoming@patchwork.ozlabs.org; Mon, 05 Mar 2018 16:29:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1esxWq-0004rN-GS for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1esxWp-0001v5-AG for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:16 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:54410) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1esxWp-0001un-1w for qemu-devel@nongnu.org; Mon, 05 Mar 2018 16:20:15 -0500 Received: by mail-wm0-x243.google.com with SMTP id z81so18731461wmb.4 for ; Mon, 05 Mar 2018 13:20:14 -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=DT5xaKXr7YMu+I42iHS7qfp8idcuVAusebYLd1JRHSY=; b=QrRqWH9RAwnCNMSq6/z1m3gb0P/po7UGK5FCY1VEgVXE1Yk3/IVHArGpL2BQA4lG1/ Ut+G98/bguv02xQ91TeU89Qi9movAcpqAQ0G/eGqx/cKLAphsmFmKKF7Eh0wIA6hu7u6 Z7xUEEDAmEp/lPLizimVNDqhoMxp6hsYQJn1StqHEbYfu+UI5HrZiQQY+A++6Jcvha7i uMb/FziB3A/TeqJbS7CnCjgp819+a3nyNyhLEf0SRhOjhKIDWBkOf/KrjGhfjxSnY7Ed aqcPMTsIyhzVFprI7yAOAWRrxgQpjJGgfnQnhXwm5OrS/skXq5JOgrxqFlUzUhpMivdA rP0Q== 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=DT5xaKXr7YMu+I42iHS7qfp8idcuVAusebYLd1JRHSY=; b=B+eFJMXzBkh5yOOZtoIlJWmm9vaAl4kM09s/JxroBcinH5mxraphOZqmjLXqRgMBoT sSc/05Ji1f4qZZFPa2vL9UfnRwgh0eF2r+gJCjVcOrSJh2Nbr7Er2dXym1459GDmnObA mBqFgVkRnnL0TOJ77GnRtwl5OMpJwSJ2FNhvo056UHpF7cRW9NrHem/rLwH9ryNl9mUP SDgzj9OcNlJkq41aMOnqYCAtNY5apRXrV2yMW1WUabex1co7m2LtgNV9sHfy8BWuZomO Kq0mbXBlSoDC/qukQBjpJ9xDWDMYxt680fC/+5pX6ewBvVb0qgywRLgAc1LWWFmQ8gHz zaOg== X-Gm-Message-State: AElRT7FIXYWuc/ylMNft10M1SF13mRT/0+FkeSQqSYmk5oNAIKztM0sy FU1eIQWRaPd90dPlFKkYDeQ= X-Google-Smtp-Source: AG47ELshk5XvbyYWIdQca9K9CWYzE002C6HI+Y6ds7rgEczAebafuW/2IMlbGKnCSbWCTimFZ0cOBw== X-Received: by 10.28.8.201 with SMTP id 192mr9296679wmi.47.1520284814152; Mon, 05 Mar 2018 13:20:14 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 13:20:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: "Michael S . Tsirkin" , Paolo Bonzini , =?utf-8?q?Herv=C3=A9_Poussineau?= , Marcel Apfelbaum , Aurelien Jarno , Mark Cave-Ayland , Alexey Kardashevskiy , Thomas Huth Date: Mon, 5 Mar 2018 18:19:28 -0300 Message-Id: <20180305211928.466-23-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [RFC PATCH v2 22/22] hw/i386/pc: Factor out the superio code 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_Mathieu-Daud?= =?utf-8?b?w6k=?= , qemu-devel@nongnu.org, Guan Xuetao , Yongbok Kim , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- hw/i386/pc.c | 72 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index efb1b3bccf..cb3b480e65 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1519,6 +1519,44 @@ static const MemoryRegionOps ioportF0_io_ops = { }, }; +static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport) +{ + int i; + DriveInfo *fd[MAX_FD]; + qemu_irq *a20_line; + ISADevice *i8042, *port92, *vmmouse; + + serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); + + for (i = 0; i < MAX_FD; i++) { + fd[i] = drive_get(IF_FLOPPY, 0, i); + create_fdctrl |= !!fd[i]; + } + if (create_fdctrl) { + fdctrl_init_isa(isa_bus, fd); + } + + i8042 = isa_create_simple(isa_bus, "i8042"); + if (!no_vmport) { + vmport_init(isa_bus); + vmmouse = isa_try_create(isa_bus, "vmmouse"); + } else { + vmmouse = NULL; + } + if (vmmouse) { + DeviceState *dev = DEVICE(vmmouse); + qdev_prop_set_ptr(dev, "ps2_mouse", i8042); + qdev_init_nofail(dev); + } + port92 = isa_create_simple(isa_bus, "port92"); + + a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); + i8042_setup_a20_line(i8042, a20_line[0]); + port92_init(port92, a20_line[1]); + g_free(a20_line); +} + void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, bool create_fdctrl, @@ -1527,13 +1565,11 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, uint32_t hpet_irqs) { int i; - DriveInfo *fd[MAX_FD]; DeviceState *hpet = NULL; int pit_isa_irq = 0; qemu_irq pit_alt_irq = NULL; qemu_irq rtc_irq = NULL; - qemu_irq *a20_line; - ISADevice *i8042, *port92, *vmmouse, *pit = NULL; + ISADevice *pit = NULL; MemoryRegion *ioport80_io = g_new(MemoryRegion, 1); MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1); @@ -1590,36 +1626,10 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, pcspk_init(isa_bus, pit); } - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); - - a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); - i8042 = isa_create_simple(isa_bus, "i8042"); - i8042_setup_a20_line(i8042, a20_line[0]); - if (!no_vmport) { - vmport_init(isa_bus); - vmmouse = isa_try_create(isa_bus, "vmmouse"); - } else { - vmmouse = NULL; - } - if (vmmouse) { - DeviceState *dev = DEVICE(vmmouse); - qdev_prop_set_ptr(dev, "ps2_mouse", i8042); - qdev_init_nofail(dev); - } - port92 = isa_create_simple(isa_bus, "port92"); - port92_init(port92, a20_line[1]); - g_free(a20_line); - i8257_dma_init(isa_bus, 0); - for(i = 0; i < MAX_FD; i++) { - fd[i] = drive_get(IF_FLOPPY, 0, i); - create_fdctrl |= !!fd[i]; - } - if (create_fdctrl) { - fdctrl_init_isa(isa_bus, fd); - } + /* Super I/O */ + pc_superio_init(isa_bus, create_fdctrl, no_vmport); } void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)