From patchwork Wed Aug 31 15:46:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Beschow X-Patchwork-Id: 1672383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=YhjTlwkW; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MHpct2q36z1ygc for ; Thu, 1 Sep 2022 01:53:50 +1000 (AEST) Received: from localhost ([::1]:42208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTQ2G-0001wu-8D for incoming@patchwork.ozlabs.org; Wed, 31 Aug 2022 11:53:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTPvK-0002p5-VN; Wed, 31 Aug 2022 11:46:39 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:40450) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTPvJ-00038R-0Z; Wed, 31 Aug 2022 11:46:38 -0400 Received: by mail-ed1-x52d.google.com with SMTP id m1so18964848edb.7; Wed, 31 Aug 2022 08:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=RWj9GRHrzzr15/ZkR3tiTCwed+rhxbgqjltEgakH7eA=; b=YhjTlwkWnueSRT0qYX4GZicEDSO11zD8pBuNI9P9gMu9f6hglrSo0h+H3cmcCKmApW 1ly1oJwAtLEYOjHx9K0kPUtsMQCMaGykh8qGvCfNGy5cDCb7SvnKomAw9mbtaJcj80yX VskQif962d2J+7Ng/jq35CBKdQNf0O9HVc7Tk2k0Wh2oXk6CxsE8T9C7imtPleuMDUNe 4bxu1eOtGPigZaS5OVUDXNWraEI0Y7x8olcAIznD9O16U5RuZxJu8oEfbNHdsuVxAIHE EdxjYhZotZHP/l/yMOjD27jIo/H88bHDiT9Lth363VpRHMzatTwFc9qbRdaE24ztSKzP /r5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=RWj9GRHrzzr15/ZkR3tiTCwed+rhxbgqjltEgakH7eA=; b=gG9oNkM6PuyZ/X2/uMJkZdIOe8WVgP7NqcwIHPQAmJ5KgwUiJFqfOnnWsiMYwxNk1o D3xj53yDyAtBi08QFY0wnq0PWi6SXOao4TGMkt9LpvfAZqHmmk6Pf0wkgEAEEfc7FQsl mQAus7pulnSLYK5xapeP31G0zVT54PTXKiRl5UgOAiO7usR6Hxq9crTZLqRFoMMufa9L KIUL7YZ8fwe5A1QLE97+FSg8dKX6wYkN8BHbR5EvutOiguJafdD+Zpgjdmr4DkjmPndN FOsP34QJrJ98u1MWnRr8hsi0+nD8HusenjuktwjzdwmqWfUQXdmb/O7UpARTMvjG/j/m dtCA== X-Gm-Message-State: ACgBeo2kjpX0jm7RYNv5ivru3SN/JU9fVgND+ejDEFfmhw6qfmjqVhCQ AgMaX78DaHYywm+Fodx3UyfwBs7aY30= X-Google-Smtp-Source: AA6agR7reuJRftJi7ba9H4waIHQZbW7K2/FcdmwWZM2N3pyH+sySTAPmQWNWr7eS1yAlSY5f+MP++w== X-Received: by 2002:a05:6402:360d:b0:445:bd16:803b with SMTP id el13-20020a056402360d00b00445bd16803bmr24754102edb.318.1661960793596; Wed, 31 Aug 2022 08:46:33 -0700 (PDT) Received: from osoxes.fritz.box (p200300faaf0bb2009c4947838afc41b6.dip0.t-ipconnect.de. [2003:fa:af0b:b200:9c49:4783:8afc:41b6]) by smtp.gmail.com with ESMTPSA id k9-20020a508ac9000000b00445e930e20esm9252123edk.64.2022.08.31.08.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 08:46:33 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: BALATON Zoltan , John Snow , qemu-ppc@nongnu.org, Huacai Chen , qemu-block@nongnu.org, Jiaxun Yang , Gerd Hoffmann , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Bernhard Beschow Subject: [PATCH v4 08/12] hw/isa/vt82c686: Instantiate USB functions in host device Date: Wed, 31 Aug 2022 17:46:01 +0200 Message-Id: <20220831154605.12773-9-shentey@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220831154605.12773-1-shentey@gmail.com> References: <20220831154605.12773-1-shentey@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=shentey@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The USB functions can be enabled/disabled through the ISA function. Also its interrupt routing can be influenced there. Signed-off-by: Bernhard Beschow --- hw/isa/vt82c686.c | 12 ++++++++++++ hw/mips/fuloong2e.c | 3 --- hw/ppc/pegasos2.c | 4 ---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 63c1e3b8ce..f05fd9948a 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -23,6 +23,7 @@ #include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/dma/i8257.h" +#include "hw/usb/hcd-uhci.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" #include "migration/vmstate.h" @@ -546,6 +547,7 @@ struct ViaISAState { qemu_irq *isa_irqs; ViaSuperIOState via_sio; PCIIDEState ide; + UHCIState uhci[2]; }; static const VMStateDescription vmstate_via = { @@ -563,6 +565,8 @@ static void via_isa_init(Object *obj) ViaISAState *s = VIA_ISA(obj); object_initialize_child(obj, "ide", &s->ide, TYPE_VIA_IDE); + object_initialize_child(obj, "uhci1", &s->uhci[0], TYPE_VT82C686B_USB_UHCI); + object_initialize_child(obj, "uhci2", &s->uhci[1], TYPE_VT82C686B_USB_UHCI); } static const TypeInfo via_isa_info = { @@ -629,6 +633,14 @@ static void via_isa_realize(PCIDevice *d, Error **errp) if (!qdev_realize(DEVICE(&s->ide), BUS(pci_bus), errp)) { return; } + + /* Functions 2-3: USB Ports */ + for (i = 0; i < ARRAY_SIZE(s->uhci); i++) { + qdev_prop_set_int32(DEVICE(&s->uhci[i]), "addr", d->devfn + 2 + i); + if (!qdev_realize(DEVICE(&s->uhci[i]), BUS(pci_bus), errp)) { + return; + } + } } /* TYPE_VT82C686B_ISA */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 6b7370f2aa..dc92223b76 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -208,9 +208,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), TYPE_VT82C686B_USB_UHCI); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), TYPE_VT82C686B_USB_UHCI); - dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 4), TYPE_VT82C686B_PM); *i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c")); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 70776558c9..85cca6f7a6 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -168,10 +168,6 @@ static void pegasos2_init(MachineState *machine) dev = PCI_DEVICE(object_resolve_path_component(OBJECT(via), "ide")); pci_ide_create_devs(dev); - /* VT8231 function 2-3: USB Ports */ - pci_create_simple(pci_bus, PCI_DEVFN(12, 2), TYPE_VT82C686B_USB_UHCI); - pci_create_simple(pci_bus, PCI_DEVFN(12, 3), TYPE_VT82C686B_USB_UHCI); - /* VT8231 function 4: Power Management Controller */ dev = pci_create_simple(pci_bus, PCI_DEVFN(12, 4), TYPE_VT8231_PM); i2c_bus = I2C_BUS(qdev_get_child_bus(DEVICE(dev), "i2c"));