From nobody Thu May 2 23:37:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1545066529882911.3902470632603; Mon, 17 Dec 2018 09:08:49 -0800 (PST) Received: from localhost ([::1]:47785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYvtU-0004Ys-RK for importer@patchew.org; Mon, 17 Dec 2018 11:37:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gYvoz-0001dO-US for qemu-devel@nongnu.org; Mon, 17 Dec 2018 11:32:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gYvow-0000Hy-JZ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 11:32:45 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:33948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gYvow-0000FH-CE for qemu-devel@nongnu.org; Mon, 17 Dec 2018 11:32:42 -0500 Received: by mail-wr1-x442.google.com with SMTP id j2so12972952wrw.1 for ; Mon, 17 Dec 2018 08:32:42 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id c7sm941105wre.64.2018.12.17.08.32.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 08:32:39 -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; bh=10Z2qDgo7XrYcMivE8sdn7BIYooT7bu7rN6ZUIrvSro=; b=HPwx4htTzEzSfrerZD3K3LNAvwBTkD02FjQw07v0wEjk1cFx4RzWKh2sZl8M6Beqh7 Wlk0ZVbyRYWIv8arDpiA0/G85GSN96tMWGUOqDGUr4nrKF3jk4qLGyI6aVnrPfITMthH ohW2DDXoGnM4UOqir7qRIJcsnEPARFYH+wN8nqOzFaIRI3pc05dSIExekUQHJYLM5C+c WzkAeh1OYcmqRXcSOtSt0T5weVlPdUbcOF9DckbEYVwp6DUIIn7yGj8IxER+/EOfjp8x XEGHIvmV3DlJiaSjJQGYfLoxpD0AnvwZJIamsiUUN8fFb08iQ5EvML/19a/b5Fn8IkU7 7VDw== 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; bh=10Z2qDgo7XrYcMivE8sdn7BIYooT7bu7rN6ZUIrvSro=; b=V3hWBB0+AgmzAVa/BVZeaOZvjYBAItXPcIvSZrD+PBPFZZIa3+LBZFSJEEvG+5aSGU br3grCuPF6azZJUv+8leibv1B3b1b0mrEep27yiDvJCqIbYzGs17T24bHppdLloaeAaE v0J6TTUFL3YBJPu106XuKzOXIQaBhk10zHExb+wWfJWeXi2v0cemtV3gwRo7bOAmobcB ReW1jY4EDlJ+BvQmPycxYTTVvp+moKavs/9+K/auIfHWy/yrs45uWhumVpztXgVt53/4 vQwflLHnxmc/OfNKVaAjZxe9TSaXnhHTk+BzjHaIla71zMbwBXniAqifr1fMPVsRFbNn ee5g== X-Gm-Message-State: AA+aEWZi4MYSvvTZSGGb0LyD9gbLGOqKLO69XpgV112Q63Ed1tiGF2PW 8rrjhb0zbrLkFt7tJmSIQnVtxJpT X-Google-Smtp-Source: AFSGD/UcoBIDLf0k4LXhQqe6YrczFXD2oRjEm9n34a6zt/WntW5qpSexrT+3Fo+QsngE4aQabB68Hg== X-Received: by 2002:adf:f8cf:: with SMTP id f15mr11384880wrq.265.1545064360614; Mon, 17 Dec 2018 08:32:40 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2018 17:32:38 +0100 Message-Id: <1545064358-4601-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 Subject: [Qemu-devel] [PATCH v2] 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: kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- hw/i386/pc_q35.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/usb/hcd-ehci-pci.c | 53 -----------------------------------------------= ---- include/hw/usb.h | 2 -- 3 files changed, 53 insertions(+), 55 deletions(-) diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 58459bd..6eaad21 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 8c0fc53..69abbf7 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; -} diff --git a/include/hw/usb.h b/include/hw/usb.h index f9431a0..c21f41c 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)= */ --=20 1.8.3.1