From nobody Fri Nov 7 07:34:22 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1546963292956190.9884795880622; Tue, 8 Jan 2019 08:01:32 -0800 (PST) Received: from localhost ([127.0.0.1]:51711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggtoo-0001oI-GG for importer@patchew.org; Tue, 08 Jan 2019 11:01:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggthl-0003zf-Nl for qemu-devel@nongnu.org; Tue, 08 Jan 2019 10:54:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggthk-0006u1-Op for qemu-devel@nongnu.org; Tue, 08 Jan 2019 10:54:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16656) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ggthk-0006lm-GQ for qemu-devel@nongnu.org; Tue, 08 Jan 2019 10:54:12 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C427380F6B; Tue, 8 Jan 2019 15:54:08 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-98.ams2.redhat.com [10.36.116.98]) by smtp.corp.redhat.com (Postfix) with ESMTP id 434671C936; Tue, 8 Jan 2019 15:54:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 179EE981D; Tue, 8 Jan 2019 16:53:55 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 8 Jan 2019 16:53:54 +0100 Message-Id: <20190108155354.8591-6-kraxel@redhat.com> In-Reply-To: <20190108155354.8591-1-kraxel@redhat.com> References: <20190108155354.8591-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 08 Jan 2019 15:54:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/5] usb: move ehci_create_ich9_with_companions to hw/i386 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 , "Michael S. Tsirkin" , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini This function is only needed when Q35 is in use. Moving it to the same file that uses it lets you disable the entire USB subsystem in x86_64-softmmu.mak; of course doing that will cause -usb to break horribly, but one thing at a time. Signed-off-by: Paolo Bonzini Message-id: 1545064358-4601-1-git-send-email-pbonzini@redhat.com Signed-off-by: Gerd Hoffmann --- include/hw/usb.h | 2 -- hw/i386/pc_q35.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/usb/hcd-ehci-pci.c | 53 -----------------------------------------------= ---- 3 files changed, 53 insertions(+), 55 deletions(-) diff --git a/include/hw/usb.h b/include/hw/usb.h index a5080adecc..4961405fa0 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -593,8 +593,6 @@ const char *usb_device_get_product_desc(USBDevice *dev); =20 const USBDesc *usb_device_get_usb_desc(USBDevice *dev); =20 -int ehci_create_ich9_with_companions(PCIBus *bus, int slot); - /* quirks.c */ =20 /* In bulk endpoints are streaming data sources (iow behave like isoc eps)= */ diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 0a3f3f18e4..f8efae8236 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -58,6 +58,59 @@ /* ICH9 AHCI has 6 ports */ #define MAX_SATA_PORTS 6 =20 +struct ehci_companions { + const char *name; + int func; + int port; +}; + +static const struct ehci_companions ich9_1d[] =3D { + { .name =3D "ich9-usb-uhci1", .func =3D 0, .port =3D 0 }, + { .name =3D "ich9-usb-uhci2", .func =3D 1, .port =3D 2 }, + { .name =3D "ich9-usb-uhci3", .func =3D 2, .port =3D 4 }, +}; + +static const struct ehci_companions ich9_1a[] =3D { + { .name =3D "ich9-usb-uhci4", .func =3D 0, .port =3D 0 }, + { .name =3D "ich9-usb-uhci5", .func =3D 1, .port =3D 2 }, + { .name =3D "ich9-usb-uhci6", .func =3D 2, .port =3D 4 }, +}; + +static int ehci_create_ich9_with_companions(PCIBus *bus, int slot) +{ + const struct ehci_companions *comp; + PCIDevice *ehci, *uhci; + BusState *usbbus; + const char *name; + int i; + + switch (slot) { + case 0x1d: + name =3D "ich9-usb-ehci1"; + comp =3D ich9_1d; + break; + case 0x1a: + name =3D "ich9-usb-ehci2"; + comp =3D ich9_1a; + break; + default: + return -1; + } + + ehci =3D pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name); + qdev_init_nofail(&ehci->qdev); + usbbus =3D QLIST_FIRST(&ehci->qdev.child_bus); + + for (i =3D 0; i < 3; i++) { + uhci =3D pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].fun= c), + true, comp[i].name); + qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name); + qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port); + qdev_init_nofail(&uhci->qdev); + } + return 0; +} + /* PC hardware initialisation */ static void pc_q35_init(MachineState *machine) { diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c index 8c0fc53a26..69abbf7b7b 100644 --- a/hw/usb/hcd-ehci-pci.c +++ b/hw/usb/hcd-ehci-pci.c @@ -230,56 +230,3 @@ static void ehci_pci_register_types(void) } =20 type_init(ehci_pci_register_types) - -struct ehci_companions { - const char *name; - int func; - int port; -}; - -static const struct ehci_companions ich9_1d[] =3D { - { .name =3D "ich9-usb-uhci1", .func =3D 0, .port =3D 0 }, - { .name =3D "ich9-usb-uhci2", .func =3D 1, .port =3D 2 }, - { .name =3D "ich9-usb-uhci3", .func =3D 2, .port =3D 4 }, -}; - -static const struct ehci_companions ich9_1a[] =3D { - { .name =3D "ich9-usb-uhci4", .func =3D 0, .port =3D 0 }, - { .name =3D "ich9-usb-uhci5", .func =3D 1, .port =3D 2 }, - { .name =3D "ich9-usb-uhci6", .func =3D 2, .port =3D 4 }, -}; - -int ehci_create_ich9_with_companions(PCIBus *bus, int slot) -{ - const struct ehci_companions *comp; - PCIDevice *ehci, *uhci; - BusState *usbbus; - const char *name; - int i; - - switch (slot) { - case 0x1d: - name =3D "ich9-usb-ehci1"; - comp =3D ich9_1d; - break; - case 0x1a: - name =3D "ich9-usb-ehci2"; - comp =3D ich9_1a; - break; - default: - return -1; - } - - ehci =3D pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name); - qdev_init_nofail(&ehci->qdev); - usbbus =3D QLIST_FIRST(&ehci->qdev.child_bus); - - for (i =3D 0; i < 3; i++) { - uhci =3D pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].fun= c), - true, comp[i].name); - qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name); - qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port); - qdev_init_nofail(&uhci->qdev); - } - return 0; -} --=20 2.9.3