From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA1D9C433E9 for ; Mon, 28 Dec 2020 02:27:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F50C20829 for ; Mon, 28 Dec 2020 02:27:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F50C20829 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiFU-0000p2-IV for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD0-0007SJ-W4 for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:31 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:57206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiCx-0003vB-7I for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:30 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id BEC6D7470F0; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 35A76746552; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <43d949fea01d0ceacc677c9d68b8e64bb637cc21.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 01/10] vt82c686: Rename AC97/MC97 parts from VT82C686B to VIA Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan These parts are common between VT82C686B and VT8231 so can be shared in the future. Rename them to VIA prefix accordingly. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/vt82c686.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index b3170c70c3..2a0f85dea9 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -168,22 +168,22 @@ struct VT686PMState { uint32_t smb_io_base; }; -struct VT686AC97State { +struct VIAAC97State { PCIDevice dev; }; -struct VT686MC97State { +struct VIAMC97State { PCIDevice dev; }; #define TYPE_VT82C686B_PM_DEVICE "VT82C686B_PM" OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM_DEVICE) -#define TYPE_VT82C686B_MC97_DEVICE "VT82C686B_MC97" -OBJECT_DECLARE_SIMPLE_TYPE(VT686MC97State, VT82C686B_MC97_DEVICE) +#define TYPE_VIA_MC97_DEVICE "VIA_MC97" +OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97_DEVICE) -#define TYPE_VT82C686B_AC97_DEVICE "VT82C686B_AC97" -OBJECT_DECLARE_SIMPLE_TYPE(VT686AC97State, VT82C686B_AC97_DEVICE) +#define TYPE_VIA_AC97_DEVICE "VIA_AC97" +OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97_DEVICE) static void pm_update_sci(VT686PMState *s) { @@ -260,7 +260,7 @@ static const VMStateDescription vmstate_acpi = { static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp) { - VT686AC97State *s = VT82C686B_AC97_DEVICE(dev); + VIAAC97State *s = VIA_AC97_DEVICE(dev); uint8_t *pci_conf = s->dev.config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | @@ -274,7 +274,7 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn) { PCIDevice *dev; - dev = pci_new(devfn, TYPE_VT82C686B_AC97_DEVICE); + dev = pci_new(devfn, TYPE_VIA_AC97_DEVICE); pci_realize_and_unref(dev, bus, &error_fatal); } @@ -293,9 +293,9 @@ static void via_ac97_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_ac97_info = { - .name = TYPE_VT82C686B_AC97_DEVICE, + .name = TYPE_VIA_AC97_DEVICE, .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VT686AC97State), + .instance_size = sizeof(VIAAC97State), .class_init = via_ac97_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, @@ -305,7 +305,7 @@ static const TypeInfo via_ac97_info = { static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp) { - VT686MC97State *s = VT82C686B_MC97_DEVICE(dev); + VIAMC97State *s = VIA_MC97_DEVICE(dev); uint8_t *pci_conf = s->dev.config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | @@ -318,7 +318,7 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn) { PCIDevice *dev; - dev = pci_new(devfn, TYPE_VT82C686B_MC97_DEVICE); + dev = pci_new(devfn, TYPE_VIA_MC97_DEVICE); pci_realize_and_unref(dev, bus, &error_fatal); } @@ -337,9 +337,9 @@ static void via_mc97_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_mc97_info = { - .name = TYPE_VT82C686B_MC97_DEVICE, + .name = TYPE_VIA_MC97_DEVICE, .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VT686MC97State), + .instance_size = sizeof(VIAMC97State), .class_init = via_mc97_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DF74C433E6 for ; Mon, 28 Dec 2020 02:29:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 089BB207F7 for ; Mon, 28 Dec 2020 02:29:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 089BB207F7 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiHr-0004Dx-SM for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:29:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD1-0007Sp-Tt for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:31 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:57207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiCx-0003vA-7H for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:31 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id CF4C57470F4; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 3D2E47470DD; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <5b62392a6a3f39ea498e0f95a993a6d0f2288176.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 02/10] vt82c686: Remove unnecessary _DEVICE suffix from type macros Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan There's no reason to suffix everything with _DEVICE when the names are already unique without it and shorter names are more readable. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/vt82c686.c | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 2a0f85dea9..1be1169f83 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -49,8 +49,8 @@ struct VT82C686BState { SuperIOConfig superio_conf; }; -#define TYPE_VT82C686B_DEVICE "VT82C686B" -OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BState, VT82C686B_DEVICE) +#define TYPE_VT82C686B "VT82C686B" +OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BState, VT82C686B) static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, unsigned size) @@ -117,7 +117,7 @@ static const MemoryRegionOps superio_ops = { static void vt82c686b_isa_reset(DeviceState *dev) { - VT82C686BState *vt82c = VT82C686B_DEVICE(dev); + VT82C686BState *vt82c = VT82C686B(dev); uint8_t *pci_conf = vt82c->dev.config; pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); @@ -146,7 +146,7 @@ static void vt82c686b_isa_reset(DeviceState *dev) static void vt82c686b_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { - VT82C686BState *vt686 = VT82C686B_DEVICE(d); + VT82C686BState *vt686 = VT82C686B(d); DPRINTF("vt82c686b_write_config address 0x%x val 0x%x len 0x%x\n", address, val, len); @@ -176,14 +176,14 @@ struct VIAMC97State { PCIDevice dev; }; -#define TYPE_VT82C686B_PM_DEVICE "VT82C686B_PM" -OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM_DEVICE) +#define TYPE_VT82C686B_PM "VT82C686B_PM" +OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM) -#define TYPE_VIA_MC97_DEVICE "VIA_MC97" -OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97_DEVICE) +#define TYPE_VIA_MC97 "VIA_MC97" +OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97) -#define TYPE_VIA_AC97_DEVICE "VIA_AC97" -OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97_DEVICE) +#define TYPE_VIA_AC97 "VIA_AC97" +OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97) static void pm_update_sci(VT686PMState *s) { @@ -260,7 +260,7 @@ static const VMStateDescription vmstate_acpi = { static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp) { - VIAAC97State *s = VIA_AC97_DEVICE(dev); + VIAAC97State *s = VIA_AC97(dev); uint8_t *pci_conf = s->dev.config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | @@ -274,7 +274,7 @@ void vt82c686b_ac97_init(PCIBus *bus, int devfn) { PCIDevice *dev; - dev = pci_new(devfn, TYPE_VIA_AC97_DEVICE); + dev = pci_new(devfn, TYPE_VIA_AC97); pci_realize_and_unref(dev, bus, &error_fatal); } @@ -293,7 +293,7 @@ static void via_ac97_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_ac97_info = { - .name = TYPE_VIA_AC97_DEVICE, + .name = TYPE_VIA_AC97, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VIAAC97State), .class_init = via_ac97_class_init, @@ -305,7 +305,7 @@ static const TypeInfo via_ac97_info = { static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp) { - VIAMC97State *s = VIA_MC97_DEVICE(dev); + VIAMC97State *s = VIA_MC97(dev); uint8_t *pci_conf = s->dev.config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | @@ -318,7 +318,7 @@ void vt82c686b_mc97_init(PCIBus *bus, int devfn) { PCIDevice *dev; - dev = pci_new(devfn, TYPE_VIA_MC97_DEVICE); + dev = pci_new(devfn, TYPE_VIA_MC97); pci_realize_and_unref(dev, bus, &error_fatal); } @@ -337,7 +337,7 @@ static void via_mc97_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_mc97_info = { - .name = TYPE_VIA_MC97_DEVICE, + .name = TYPE_VIA_MC97, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VIAMC97State), .class_init = via_mc97_class_init, @@ -350,7 +350,7 @@ static const TypeInfo via_mc97_info = { /* vt82c686 pm init */ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) { - VT686PMState *s = VT82C686B_PM_DEVICE(dev); + VT686PMState *s = VT82C686B_PM(dev); uint8_t *pci_conf; pci_conf = s->dev.config; @@ -386,10 +386,10 @@ I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, PCIDevice *dev; VT686PMState *s; - dev = pci_new(devfn, TYPE_VT82C686B_PM_DEVICE); + dev = pci_new(devfn, TYPE_VT82C686B_PM); qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base); - s = VT82C686B_PM_DEVICE(dev); + s = VT82C686B_PM(dev); pci_realize_and_unref(dev, bus, &error_fatal); @@ -419,7 +419,7 @@ static void via_pm_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_pm_info = { - .name = TYPE_VT82C686B_PM_DEVICE, + .name = TYPE_VT82C686B_PM, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT686PMState), .class_init = via_pm_class_init, @@ -442,7 +442,7 @@ static const VMStateDescription vmstate_via = { /* init the PCI-to-ISA bridge */ static void vt82c686b_realize(PCIDevice *d, Error **errp) { - VT82C686BState *vt82c = VT82C686B_DEVICE(d); + VT82C686BState *vt82c = VT82C686B(d); uint8_t *pci_conf; ISABus *isa_bus; uint8_t *wmask; @@ -479,9 +479,7 @@ ISABus *vt82c686b_isa_init(PCIBus *bus, int devfn) { PCIDevice *d; - d = pci_create_simple_multifunction(bus, devfn, true, - TYPE_VT82C686B_DEVICE); - + d = pci_create_simple_multifunction(bus, devfn, true, TYPE_VT82C686B); return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); } @@ -507,7 +505,7 @@ static void via_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_info = { - .name = TYPE_VT82C686B_DEVICE, + .name = TYPE_VT82C686B, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VT82C686BState), .class_init = via_class_init, From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA3E2C433E0 for ; Mon, 28 Dec 2020 02:27:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 24767207F7 for ; Mon, 28 Dec 2020 02:27:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24767207F7 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiFU-0000p9-53 for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD1-0007SU-8d for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:31 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:57209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiCx-0003v8-7J for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:31 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id C5C367470F3; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 433277470E3; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: In-Reply-To: References: Subject: [PATCH v2 03/10] vt82c686b: Rename VT82C686B to VT82C686B_ISA Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan This is really the ISA bridge part so name the type accordingly. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/vt82c686.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 1be1169f83..d40599c7da 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -43,14 +43,14 @@ typedef struct SuperIOConfig { uint8_t data; } SuperIOConfig; -struct VT82C686BState { +struct VT82C686BISAState { PCIDevice dev; MemoryRegion superio; SuperIOConfig superio_conf; }; -#define TYPE_VT82C686B "VT82C686B" -OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BState, VT82C686B) +#define TYPE_VT82C686B_ISA "vt82c686b-isa" +OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BISAState, VT82C686B_ISA) static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, unsigned size) @@ -117,7 +117,7 @@ static const MemoryRegionOps superio_ops = { static void vt82c686b_isa_reset(DeviceState *dev) { - VT82C686BState *vt82c = VT82C686B(dev); + VT82C686BISAState *vt82c = VT82C686B_ISA(dev); uint8_t *pci_conf = vt82c->dev.config; pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0); @@ -146,7 +146,7 @@ static void vt82c686b_isa_reset(DeviceState *dev) static void vt82c686b_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { - VT82C686BState *vt686 = VT82C686B(d); + VT82C686BISAState *vt686 = VT82C686B_ISA(d); DPRINTF("vt82c686b_write_config address 0x%x val 0x%x len 0x%x\n", address, val, len); @@ -434,7 +434,7 @@ static const VMStateDescription vmstate_via = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_PCI_DEVICE(dev, VT82C686BState), + VMSTATE_PCI_DEVICE(dev, VT82C686BISAState), VMSTATE_END_OF_LIST() } }; @@ -442,7 +442,7 @@ static const VMStateDescription vmstate_via = { /* init the PCI-to-ISA bridge */ static void vt82c686b_realize(PCIDevice *d, Error **errp) { - VT82C686BState *vt82c = VT82C686B(d); + VT82C686BISAState *vt82c = VT82C686B_ISA(d); uint8_t *pci_conf; ISABus *isa_bus; uint8_t *wmask; @@ -479,7 +479,7 @@ ISABus *vt82c686b_isa_init(PCIBus *bus, int devfn) { PCIDevice *d; - d = pci_create_simple_multifunction(bus, devfn, true, TYPE_VT82C686B); + d = pci_create_simple_multifunction(bus, devfn, true, TYPE_VT82C686B_ISA); return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); } @@ -505,9 +505,9 @@ static void via_class_init(ObjectClass *klass, void *data) } static const TypeInfo via_info = { - .name = TYPE_VT82C686B, + .name = TYPE_VT82C686B_ISA, .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VT82C686BState), + .instance_size = sizeof(VT82C686BISAState), .class_init = via_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B82F8C433E6 for ; Mon, 28 Dec 2020 02:27:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43640207FF for ; Mon, 28 Dec 2020 02:27:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43640207FF Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:44660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiFU-0000oh-9C for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD0-0007SH-Rc for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:30 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:57210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiCx-0003v7-7N for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:30 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id EA4D17470F5; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 495097470DB; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <0df2885abd286feab5d8edf864afa65bf35c6f95.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 04/10] vt82c686: Remove vt82c686b_[am]c97_init() functions Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan These are legacy init functions that are just equivalent to directly calling pci_create_simple so do that instead. Also rename objects to lower case via-ac97 and via-mc97 matching naming of other devices. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- hw/isa/vt82c686.c | 27 ++++----------------------- hw/mips/fuloong2e.c | 4 ++-- include/hw/isa/vt82c686.h | 4 ++-- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index d40599c7da..8677a2d212 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -179,12 +179,6 @@ struct VIAMC97State { #define TYPE_VT82C686B_PM "VT82C686B_PM" OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM) -#define TYPE_VIA_MC97 "VIA_MC97" -OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97) - -#define TYPE_VIA_AC97 "VIA_AC97" -OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97) - static void pm_update_sci(VT686PMState *s) { int sci_level, pmsts; @@ -254,10 +248,13 @@ static const VMStateDescription vmstate_acpi = { }; /* - * TODO: vt82c686b_ac97_init() and vt82c686b_mc97_init() + * TODO: VIA_AC97 and VIA_MC97 * just register a PCI device now, functionalities will be implemented later. */ +OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97) +OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97) + static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp) { VIAAC97State *s = VIA_AC97(dev); @@ -270,14 +267,6 @@ static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp) pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); } -void vt82c686b_ac97_init(PCIBus *bus, int devfn) -{ - PCIDevice *dev; - - dev = pci_new(devfn, TYPE_VIA_AC97); - pci_realize_and_unref(dev, bus, &error_fatal); -} - static void via_ac97_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -314,14 +303,6 @@ static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp) pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); } -void vt82c686b_mc97_init(PCIBus *bus, int devfn) -{ - PCIDevice *dev; - - dev = pci_new(devfn, TYPE_VIA_MC97); - pci_realize_and_unref(dev, bus, &error_fatal); -} - static void via_mc97_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index f0733e87b7..3b0489f781 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -264,8 +264,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, *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)); + pci_create_simple(pci_bus, PCI_DEVFN(slot, 5), TYPE_VIA_AC97); + pci_create_simple(pci_bus, PCI_DEVFN(slot, 6), TYPE_VIA_MC97); } /* Network support */ diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index f23f45dfb1..ff80a926dc 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -3,11 +3,11 @@ #define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" +#define TYPE_VIA_AC97 "via-ac97" +#define TYPE_VIA_MC97 "via-mc97" /* vt82c686.c */ 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, qemu_irq sci_irq); From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61BDDC433E9 for ; Mon, 28 Dec 2020 02:29:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E102B207D0 for ; Mon, 28 Dec 2020 02:29:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E102B207D0 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiHr-0004GB-Ul for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:29:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD9-0007b3-JF for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:39 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:57235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD2-0003xg-LK for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:39 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 617AE7470F6; Mon, 28 Dec 2020 03:24:31 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 500467470DF; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <76efd30b1c69505e4ed4c1e3d680f328b2734750.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 05/10] vt82c686: Split off via-[am]c97 into separate file in hw/audio Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan The via-[am]c97 code is supposed to implement the audio part of VIA south bridge chips so it is better placed under hw/audio/. Split it off into a separate file. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- v2: Reworded commit message hw/audio/meson.build | 1 + hw/audio/via-ac97.c | 106 +++++++++++++++++++++++++++++++++++++++++++ hw/isa/vt82c686.c | 91 ------------------------------------- 3 files changed, 107 insertions(+), 91 deletions(-) create mode 100644 hw/audio/via-ac97.c diff --git a/hw/audio/meson.build b/hw/audio/meson.build index 549e9a0396..32c42bdebe 100644 --- a/hw/audio/meson.build +++ b/hw/audio/meson.build @@ -11,4 +11,5 @@ softmmu_ss.add(when: 'CONFIG_MILKYMIST', if_true: files('milkymist-ac97.c')) softmmu_ss.add(when: 'CONFIG_PCSPK', if_true: files('pcspk.c')) softmmu_ss.add(when: 'CONFIG_PL041', if_true: files('pl041.c', 'lm4549.c')) softmmu_ss.add(when: 'CONFIG_SB16', if_true: files('sb16.c')) +softmmu_ss.add(when: 'CONFIG_VT82C686', if_true: files('via-ac97.c')) softmmu_ss.add(when: 'CONFIG_WM8750', if_true: files('wm8750.c')) diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c new file mode 100644 index 0000000000..e617416ff7 --- /dev/null +++ b/hw/audio/via-ac97.c @@ -0,0 +1,106 @@ +/* + * VIA south bridges sound support + * + * This work is licensed under the GNU GPL license version 2 or later. + */ + +/* + * TODO: This is entirely boiler plate just registering empty PCI devices + * with the right ID guests expect, functionality should be added here. + */ + +#include "qemu/osdep.h" +#include "hw/isa/vt82c686.h" +#include "hw/pci/pci.h" + +struct VIAAC97State { + PCIDevice dev; +}; + +struct VIAMC97State { + PCIDevice dev; +}; + +OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97) +OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97) + +static void via_ac97_realize(PCIDevice *dev, Error **errp) +{ + VIAAC97State *s = VIA_AC97(dev); + uint8_t *pci_conf = s->dev.config; + + pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | + PCI_COMMAND_PARITY); + pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST | + PCI_STATUS_DEVSEL_MEDIUM); + pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); +} + +static void via_ac97_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->realize = via_ac97_realize; + k->vendor_id = PCI_VENDOR_ID_VIA; + k->device_id = PCI_DEVICE_ID_VIA_AC97; + k->revision = 0x50; + k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO; + set_bit(DEVICE_CATEGORY_SOUND, dc->categories); + dc->desc = "AC97"; +} + +static const TypeInfo via_ac97_info = { + .name = TYPE_VIA_AC97, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(VIAAC97State), + .class_init = via_ac97_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + +static void via_mc97_realize(PCIDevice *dev, Error **errp) +{ + VIAMC97State *s = VIA_MC97(dev); + uint8_t *pci_conf = s->dev.config; + + pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | + PCI_COMMAND_VGA_PALETTE); + pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM); + pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); +} + +static void via_mc97_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + + k->realize = via_mc97_realize; + k->vendor_id = PCI_VENDOR_ID_VIA; + k->device_id = PCI_DEVICE_ID_VIA_MC97; + k->class_id = PCI_CLASS_COMMUNICATION_OTHER; + k->revision = 0x30; + set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); + dc->desc = "MC97"; +} + +static const TypeInfo via_mc97_info = { + .name = TYPE_VIA_MC97, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(VIAMC97State), + .class_init = via_mc97_class_init, + .interfaces = (InterfaceInfo[]) { + { INTERFACE_CONVENTIONAL_PCI_DEVICE }, + { }, + }, +}; + +static void via_ac97_register_types(void) +{ + type_register_static(&via_ac97_info); + type_register_static(&via_mc97_info); +} + +type_init(via_ac97_register_types) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 8677a2d212..9567326d8e 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -168,14 +168,6 @@ struct VT686PMState { uint32_t smb_io_base; }; -struct VIAAC97State { - PCIDevice dev; -}; - -struct VIAMC97State { - PCIDevice dev; -}; - #define TYPE_VT82C686B_PM "VT82C686B_PM" OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM) @@ -247,87 +239,6 @@ static const VMStateDescription vmstate_acpi = { } }; -/* - * TODO: VIA_AC97 and VIA_MC97 - * just register a PCI device now, functionalities will be implemented later. - */ - -OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97) -OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97) - -static void vt82c686b_ac97_realize(PCIDevice *dev, Error **errp) -{ - VIAAC97State *s = VIA_AC97(dev); - uint8_t *pci_conf = s->dev.config; - - pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | - PCI_COMMAND_PARITY); - pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST | - PCI_STATUS_DEVSEL_MEDIUM); - pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); -} - -static void via_ac97_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->realize = vt82c686b_ac97_realize; - k->vendor_id = PCI_VENDOR_ID_VIA; - k->device_id = PCI_DEVICE_ID_VIA_AC97; - k->revision = 0x50; - k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO; - set_bit(DEVICE_CATEGORY_SOUND, dc->categories); - dc->desc = "AC97"; -} - -static const TypeInfo via_ac97_info = { - .name = TYPE_VIA_AC97, - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VIAAC97State), - .class_init = via_ac97_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - -static void vt82c686b_mc97_realize(PCIDevice *dev, Error **errp) -{ - VIAMC97State *s = VIA_MC97(dev); - uint8_t *pci_conf = s->dev.config; - - pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | - PCI_COMMAND_VGA_PALETTE); - pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM); - pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); -} - -static void via_mc97_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); - - k->realize = vt82c686b_mc97_realize; - k->vendor_id = PCI_VENDOR_ID_VIA; - k->device_id = PCI_DEVICE_ID_VIA_MC97; - k->class_id = PCI_CLASS_COMMUNICATION_OTHER; - k->revision = 0x30; - set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - dc->desc = "MC97"; -} - -static const TypeInfo via_mc97_info = { - .name = TYPE_VIA_MC97, - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VIAMC97State), - .class_init = via_mc97_class_init, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, -}; - /* vt82c686 pm init */ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) { @@ -516,8 +427,6 @@ static const TypeInfo via_superio_info = { 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); From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A7DEC433DB for ; Mon, 28 Dec 2020 02:32:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2E99207D0 for ; Mon, 28 Dec 2020 02:32:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2E99207D0 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:32786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiL4-0007aM-MZ for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:32:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD3-0007V0-6U for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:33 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:57231) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD0-0003wS-DH for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:32 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 0FE237470DD; Mon, 28 Dec 2020 03:24:24 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 560257470E6; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <1ebc069cbab65386d01125f6b0997a88e560d582.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 06/10] audio/via-ac97: Simplify code and set user_creatable to false Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan Remove some unneded, empty code and set user_creatable to false (besides being not implemented yet, so does nothing anyway) it's also normally part of VIA south bridge chips so no need to confuse users showing them these devices. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- hw/audio/via-ac97.c | 51 +++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/hw/audio/via-ac97.c b/hw/audio/via-ac97.c index e617416ff7..6d556f74fc 100644 --- a/hw/audio/via-ac97.c +++ b/hw/audio/via-ac97.c @@ -13,27 +13,13 @@ #include "hw/isa/vt82c686.h" #include "hw/pci/pci.h" -struct VIAAC97State { - PCIDevice dev; -}; - -struct VIAMC97State { - PCIDevice dev; -}; - -OBJECT_DECLARE_SIMPLE_TYPE(VIAAC97State, VIA_AC97) -OBJECT_DECLARE_SIMPLE_TYPE(VIAMC97State, VIA_MC97) - -static void via_ac97_realize(PCIDevice *dev, Error **errp) +static void via_ac97_realize(PCIDevice *pci_dev, Error **errp) { - VIAAC97State *s = VIA_AC97(dev); - uint8_t *pci_conf = s->dev.config; - - pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | - PCI_COMMAND_PARITY); - pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_CAP_LIST | - PCI_STATUS_DEVSEL_MEDIUM); - pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); + pci_set_word(pci_dev->config + PCI_COMMAND, + PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY); + pci_set_word(pci_dev->config + PCI_STATUS, + PCI_STATUS_CAP_LIST | PCI_STATUS_DEVSEL_MEDIUM); + pci_set_long(pci_dev->config + PCI_INTERRUPT_PIN, 0x03); } static void via_ac97_class_init(ObjectClass *klass, void *data) @@ -47,13 +33,15 @@ static void via_ac97_class_init(ObjectClass *klass, void *data) k->revision = 0x50; k->class_id = PCI_CLASS_MULTIMEDIA_AUDIO; set_bit(DEVICE_CATEGORY_SOUND, dc->categories); - dc->desc = "AC97"; + dc->desc = "VIA AC97"; + /* Reason: Part of a south bridge chip */ + dc->user_creatable = false; } static const TypeInfo via_ac97_info = { .name = TYPE_VIA_AC97, .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VIAAC97State), + .instance_size = sizeof(PCIDevice), .class_init = via_ac97_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, @@ -61,15 +49,12 @@ static const TypeInfo via_ac97_info = { }, }; -static void via_mc97_realize(PCIDevice *dev, Error **errp) +static void via_mc97_realize(PCIDevice *pci_dev, Error **errp) { - VIAMC97State *s = VIA_MC97(dev); - uint8_t *pci_conf = s->dev.config; - - pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_INVALIDATE | - PCI_COMMAND_VGA_PALETTE); - pci_set_word(pci_conf + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM); - pci_set_long(pci_conf + PCI_INTERRUPT_PIN, 0x03); + pci_set_word(pci_dev->config + PCI_COMMAND, + PCI_COMMAND_INVALIDATE | PCI_COMMAND_VGA_PALETTE); + pci_set_word(pci_dev->config + PCI_STATUS, PCI_STATUS_DEVSEL_MEDIUM); + pci_set_long(pci_dev->config + PCI_INTERRUPT_PIN, 0x03); } static void via_mc97_class_init(ObjectClass *klass, void *data) @@ -83,13 +68,15 @@ static void via_mc97_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_COMMUNICATION_OTHER; k->revision = 0x30; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); - dc->desc = "MC97"; + dc->desc = "VIA MC97"; + /* Reason: Part of a south bridge chip */ + dc->user_creatable = false; } static const TypeInfo via_mc97_info = { .name = TYPE_VIA_MC97, .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(VIAMC97State), + .instance_size = sizeof(PCIDevice), .class_init = via_mc97_class_init, .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A26ACC433DB for ; Mon, 28 Dec 2020 02:29:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 48D36207FF for ; Mon, 28 Dec 2020 02:29:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48D36207FF Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiHs-0004Gb-DD for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:29:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD2-0007TA-BU for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:32 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:57230) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD0-0003wT-Dt for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:32 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 12CA77470E3; Mon, 28 Dec 2020 03:24:24 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5C51C7470E8; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <8211f2903fe90d639f574403cdb764eb06b723f9.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 07/10] vt82c686: Remove legacy vt82c686b_isa_init() function Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- v2: Reworded commit message hw/isa/vt82c686.c | 9 --------- hw/mips/fuloong2e.c | 4 +++- include/hw/isa/vt82c686.h | 3 +-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 9567326d8e..2912c253dc 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -49,7 +49,6 @@ struct VT82C686BISAState { SuperIOConfig superio_conf; }; -#define TYPE_VT82C686B_ISA "vt82c686b-isa" OBJECT_DECLARE_SIMPLE_TYPE(VT82C686BISAState, VT82C686B_ISA) static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, @@ -367,14 +366,6 @@ static void vt82c686b_realize(PCIDevice *d, Error **errp) &vt82c->superio); } -ISABus *vt82c686b_isa_init(PCIBus *bus, int devfn) -{ - PCIDevice *d; - - d = pci_create_simple_multifunction(bus, devfn, true, TYPE_VT82C686B_ISA); - return ISA_BUS(qdev_get_child_bus(DEVICE(d), "isa.0")); -} - static void via_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 3b0489f781..d123e34d9e 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -240,7 +240,9 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, ISABus *isa_bus; PCIDevice *dev; - isa_bus = vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0)); + dev = pci_create_simple_multifunction(pci_bus, PCI_DEVFN(slot, 0), true, + TYPE_VT82C686B_ISA); + isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(dev), "isa.0")); assert(isa_bus); *p_isa_bus = isa_bus; /* Interrupt controller */ diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index ff80a926dc..8d2d276fe1 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -1,13 +1,12 @@ #ifndef HW_VT82C686_H #define HW_VT82C686_H - +#define TYPE_VT82C686B_ISA "vt82c686b-isa" #define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" #define TYPE_VIA_AC97 "via-ac97" #define TYPE_VIA_MC97 "via-mc97" /* vt82c686.c */ -ISABus *vt82c686b_isa_init(PCIBus * bus, int devfn); I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, qemu_irq sci_irq); From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A90AC433E0 for ; Mon, 28 Dec 2020 02:32:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5B4A207F7 for ; Mon, 28 Dec 2020 02:32:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C5B4A207F7 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:32798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiL4-0007ag-VZ for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:32:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD5-0007Zr-1t for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:39 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:57232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD2-0003xU-9a for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:34 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 2364D7470DB; Mon, 28 Dec 2020 03:24:24 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 625F87470ED; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <95cbca5085fd2063f606c1a06c85b63ae06996e6.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 08/10] vt82c686: Remove legacy vt82c686b_pm_init() function Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan Remove legacy vt82c686b_pm_init() function and also rename VT82C686B_PM type name to match other device names. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- v2: Reworded commit message, delete i2c include here hw/isa/vt82c686.c | 18 ------------------ hw/mips/fuloong2e.c | 5 ++++- include/hw/isa/vt82c686.h | 5 +---- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 2912c253dc..cd87ec0103 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -12,7 +12,6 @@ #include "qemu/osdep.h" #include "hw/isa/vt82c686.h" -#include "hw/i2c/i2c.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" #include "hw/isa/isa.h" @@ -167,7 +166,6 @@ struct VT686PMState { uint32_t smb_io_base; }; -#define TYPE_VT82C686B_PM "VT82C686B_PM" OBJECT_DECLARE_SIMPLE_TYPE(VT686PMState, VT82C686B_PM) static void pm_update_sci(VT686PMState *s) @@ -271,22 +269,6 @@ static void vt82c686b_pm_realize(PCIDevice *dev, Error **errp) acpi_pm1_cnt_init(&s->ar, &s->io, false, false, 2); } -I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, - qemu_irq sci_irq) -{ - PCIDevice *dev; - VT686PMState *s; - - dev = pci_new(devfn, TYPE_VT82C686B_PM); - qdev_prop_set_uint32(&dev->qdev, "smb_io_base", smb_io_base); - - s = VT82C686B_PM(dev); - - pci_realize_and_unref(dev, bus, &error_fatal); - - return s->smb.smbus; -} - static Property via_pm_properties[] = { DEFINE_PROP_UINT32("smb_io_base", VT686PMState, smb_io_base, 0), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index d123e34d9e..a2b69a3a7a 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -263,7 +263,10 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, 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); + dev = pci_new(PCI_DEVFN(slot, 4), TYPE_VT82C686B_PM); + qdev_prop_set_uint32(DEVICE(dev), "smb_io_base", 0xeee1); + pci_realize_and_unref(dev, pci_bus, &error_fatal); + *i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); /* Audio support */ pci_create_simple(pci_bus, PCI_DEVFN(slot, 5), TYPE_VIA_AC97); diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 8d2d276fe1..5b0a1ffe72 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -3,11 +3,8 @@ #define TYPE_VT82C686B_ISA "vt82c686b-isa" #define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" +#define TYPE_VT82C686B_PM "vt82c686b-pm" #define TYPE_VIA_AC97 "via-ac97" #define TYPE_VIA_MC97 "via-mc97" -/* vt82c686.c */ -I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, - qemu_irq sci_irq); - #endif From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7664C433E0 for ; Mon, 28 Dec 2020 02:35:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6255A207F7 for ; Mon, 28 Dec 2020 02:35:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6255A207F7 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiNj-0000yS-32 for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:35:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD4-0007ZJ-SK for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:34 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:57234) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD2-0003xX-D6 for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:34 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 44FD27470E8; Mon, 28 Dec 2020 03:24:24 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 672347470EE; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <28d9455165261a9cfd2cc4a650b25f987e60295c.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 09/10] vt82c686: Convert debug printf to trace points Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan Drop DPRINTF and use trace functions instead. Two debug messages about unimplemented registers could be converted to qemu_log_mask() but in reality all registers are currently unimplemented (we just store and return values of writable regs but do nothing with them). As we already trace register access there's no need for additional debug messages so these are just removed and a comment is added as a reminder. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- v2: Extended commit message hw/isa/trace-events | 6 ++++++ hw/isa/vt82c686.c | 51 +++++++++++++-------------------------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 3544c6213c..d267d3e652 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -13,3 +13,9 @@ pc87312_io_write(uint32_t addr, uint32_t val) "write addr=0x%x val=0x%x" # apm.c apm_io_read(uint8_t addr, uint8_t val) "read addr=0x%x val=0x%02x" apm_io_write(uint8_t addr, uint8_t val) "write addr=0x%x val=0x%02x" + +# vt82c686.c +via_isa_write(uint32_t addr, uint32_t val, int len) "addr 0x%x val 0x%x len 0x%x" +via_pm_write(uint32_t addr, uint32_t val, int len) "addr 0x%x val 0x%x len 0x%x" +via_superio_read(uint8_t addr, uint8_t val) "addr 0x%x val 0x%x" +via_superio_write(uint8_t addr, uint32_t val) "addr 0x%x val 0x%x" diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index cd87ec0103..d7ce15bf9f 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -27,14 +27,7 @@ #include "qemu/timer.h" #include "exec/address-spaces.h" #include "qom/object.h" - -/* #define DEBUG_VT82C686B */ - -#ifdef DEBUG_VT82C686B -#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __func__, ##__VA_ARGS__) -#else -#define DPRINTF(fmt, ...) -#endif +#include "trace.h" typedef struct SuperIOConfig { uint8_t config[0x100]; @@ -55,12 +48,12 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, { SuperIOConfig *superio_conf = opaque; - DPRINTF("superio_ioport_writeb address 0x%x val 0x%x\n", addr, data); - if (addr == 0x3f0) { + if (addr == 0x3f0) { /* config index register */ superio_conf->index = data & 0xff; } else { bool can_write = true; - /* 0x3f1 */ + /* 0x3f1, config data register */ + trace_via_superio_write(superio_conf->index, data & 0xff); switch (superio_conf->index) { case 0x00 ... 0xdf: case 0xe4: @@ -73,18 +66,7 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, case 0xfd ... 0xff: can_write = false; break; - case 0xe7: - if ((data & 0xff) != 0xfe) { - DPRINTF("change uart 1 base. unsupported yet\n"); - can_write = false; - } - break; - case 0xe8: - if ((data & 0xff) != 0xbe) { - DPRINTF("change uart 2 base. unsupported yet\n"); - can_write = false; - } - break; + /* case 0xe6 ... 0xe8: Should set base port of parallel and serial */ default: break; @@ -98,9 +80,10 @@ static void superio_ioport_writeb(void *opaque, hwaddr addr, uint64_t data, static uint64_t superio_ioport_readb(void *opaque, hwaddr addr, unsigned size) { SuperIOConfig *superio_conf = opaque; + uint8_t val = superio_conf->config[superio_conf->index]; - DPRINTF("superio_ioport_readb address 0x%x\n", addr); - return superio_conf->config[superio_conf->index]; + trace_via_superio_read(superio_conf->index, val); + return val; } static const MemoryRegionOps superio_ops = { @@ -141,16 +124,14 @@ static void vt82c686b_isa_reset(DeviceState *dev) } /* write config pci function0 registers. PCI-ISA bridge */ -static void vt82c686b_write_config(PCIDevice *d, uint32_t address, +static void vt82c686b_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len) { VT82C686BISAState *vt686 = VT82C686B_ISA(d); - DPRINTF("vt82c686b_write_config address 0x%x val 0x%x len 0x%x\n", - address, val, len); - - pci_default_write_config(d, address, val, len); - if (address == 0x85) { /* enable or disable super IO configure */ + trace_via_isa_write(addr, val, len); + pci_default_write_config(d, addr, val, len); + if (addr == 0x85) { /* enable or disable super IO configure */ memory_region_set_enabled(&vt686->superio, val & 0x2); } } @@ -203,12 +184,10 @@ static void pm_io_space_update(VT686PMState *s) memory_region_transaction_commit(); } -static void pm_write_config(PCIDevice *d, - uint32_t address, uint32_t val, int len) +static void pm_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len) { - DPRINTF("pm_write_config address 0x%x val 0x%x len 0x%x\n", - address, val, len); - pci_default_write_config(d, address, val, len); + trace_via_pm_write(addr, val, len); + pci_default_write_config(d, addr, val, len); } static int vmstate_acpi_post_load(void *opaque, int version_id) From patchwork Mon Dec 28 02:08:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 11990787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59DDBC433E0 for ; Mon, 28 Dec 2020 02:29:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0772E207D0 for ; Mon, 28 Dec 2020 02:29:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0772E207D0 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktiHr-0004DY-4l for qemu-devel@archiver.kernel.org; Sun, 27 Dec 2020 21:29:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD4-0007X4-2N for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:34 -0500 Received: from zero.eik.bme.hu ([152.66.115.2]:57233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktiD2-0003xV-Dg for qemu-devel@nongnu.org; Sun, 27 Dec 2020 21:24:33 -0500 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 3A9387470E6; Mon, 28 Dec 2020 03:24:24 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 6C40A7470EF; Mon, 28 Dec 2020 03:24:23 +0100 (CET) Message-Id: <56a23e0638fb15b5bc4177a0bec836a7e000083c.1609121293.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v2 10/10] vt82c686: Remove unneeded includes and defines Date: Mon, 28 Dec 2020 03:08:13 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Huacai Chen , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan X-Patchwork-Original-From: BALATON Zoltan via From: BALATON Zoltan These are not used or not needed. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé --- v2: Added back a few that we get indirectly but keep it explicit hw/isa/vt82c686.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index d7ce15bf9f..02d6759c00 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -16,9 +16,7 @@ #include "hw/qdev-properties.h" #include "hw/isa/isa.h" #include "hw/isa/superio.h" -#include "hw/sysbus.h" #include "migration/vmstate.h" -#include "hw/mips/mips.h" #include "hw/isa/apm.h" #include "hw/acpi/acpi.h" #include "hw/i2c/pm_smbus.h" @@ -26,7 +24,6 @@ #include "qemu/module.h" #include "qemu/timer.h" #include "exec/address-spaces.h" -#include "qom/object.h" #include "trace.h" typedef struct SuperIOConfig { @@ -136,8 +133,6 @@ static void vt82c686b_write_config(PCIDevice *d, uint32_t addr, } } -#define ACPI_DBG_IO_ADDR 0xb044 - struct VT686PMState { PCIDevice dev; MemoryRegion io;