From nobody Wed Nov 19 08:46:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.208.42 as permitted sender) client-ip=209.85.208.42; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-ed1-f42.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615316903; cv=none; d=zohomail.com; s=zohoarc; b=Xy9nJZxvFwinmKJjFwkBYNZdqZdrOrCT9Aqtab/pPtMdY4ahVRhctjJIFI9LJ7x/53U/bNWxh54jLZm0EAVekfbgORAaCrcepOC8+8sYVudPMmYrTv3ZPZ6LEiVDYVvurkdn5urch+UyZrk3zShkjsyLzUBNLzh5hxxzRHVwKQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615316903; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JlWRzP7BEt7P68aDoGigCLgcJlZLTJDqyDnSuE3SPXE=; b=gU0nq6UAvmuOLrVYGFDYKFV8ng0sFWyqHX9FWreEFotzNs5mjSBXM5E6/RHuQAfVH6+fH//29ObLVlmm6mCKuF62bjLcmac8NEvLg42EXUdqn3XXIYTig56TffAalknJaLdt0N+ClPRIPt2rIWc1iKm+Z9+Wyha24Q9chsJfV9k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by mx.zohomail.com with SMTPS id 1615316903225409.9569578541999; Tue, 9 Mar 2021 11:08:23 -0800 (PST) Received: by mail-ed1-f42.google.com with SMTP id b13so22531223edx.1 for ; Tue, 09 Mar 2021 11:08:22 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id c7sm3403695edk.50.2021.03.09.11.08.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 11:08:20 -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=JlWRzP7BEt7P68aDoGigCLgcJlZLTJDqyDnSuE3SPXE=; b=G14L+VoIPwURp8R0lB3ymUTv2j79m52/BMzNQZK1nsH2t6FzItEz0rpVmUetYkxwFw MpvLcUcWGaannciMJJPaul9XIZl8t+kD0yF5+nzqjO+IWII86yecKg3xsHgHvhAxwkr4 2yBV0sTmrwOje7AAq/sf42z0go4tzVE1PMwND44avkWWnpjumXHODh8swKthzgPvdO/K aYwLInj/899KpiJ6mj1cxUgU/WpFV/WjjKu9R7gZKfcoJ+eJgkWFo0+KxjUcKOL01TDB 8pz/GtByuv+96Gd81/AKfWy76WRDOfEcI9XlVwDKp3jzmpoWV/5doWLazyDMn4Vi5/Qv FWsA== 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=JlWRzP7BEt7P68aDoGigCLgcJlZLTJDqyDnSuE3SPXE=; b=s11CClXanKfSgXnWp0TMaEsR1XLAkUIW6FqwdakTuD354Qlh/2j7dEZ6NvI3Imhviq 4BGj4AX63JnziRvHMtz2X3EyOo5GUWGs0+jkUZJ0hURQsSmUzBuRkObQeta0hzBCNXEO uRBpDYS79P0sYpNeNgHNJoffOtRlzyxgKOouRq3hgKFomhO/8Hbe0fnxoqVhQx4uuoid rLljM4w0wNxGoiNAhKE+x0lxOfnjW8wuc/pzzaBxuSnLWNPJYtzhhdy0ZCw9SC+HbOrv FrYEfxz3RhtJtS4/t9yQbjS5LUBKMsDexZpKKTXW1z1xNJrwcxRoyb0cGd4yxmkLSZGq VRjg== X-Gm-Message-State: AOAM532gk/Bss8URpcUrtNcilI2zM3nyX4B+AmCtzekjkaN1+dwM87+4 hPzfJ3AeqpUp7g+IWkfI++8= X-Google-Smtp-Source: ABdhPJzy32OZSVDrtf0NDfQk6ouNddtI8j3TK9hk4SWeSTjFARsHeaV5T+7dvK6gPZgM4z1SJ1LqNg== X-Received: by 2002:a50:ec0e:: with SMTP id g14mr5995286edr.264.1615316901354; Tue, 09 Mar 2021 11:08:21 -0800 (PST) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , David Gibson , Huacai Chen , "Dr . David Alan Gilbert" , Gerd Hoffmann Subject: [PATCH 3/3] hw/usb: Extract VT82C686 UHCI PCI function into a new unit Date: Tue, 9 Mar 2021 20:08:02 +0100 Message-Id: <20210309190802.830969-4-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210309190802.830969-1-f4bug@amsat.org> References: <20210309190802.830969-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) Extract the VT82C686 PCI UHCI function into a new unit so it is only build when the VT82C686 south bridge is selected. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/usb/hcd-uhci.c | 23 -------------------- hw/usb/vt82c686-uhci-pci.c | 43 ++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + hw/usb/meson.build | 1 + 4 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 hw/usb/vt82c686-uhci-pci.c diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index d6338c33d86..0cb02a64321 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1207,21 +1207,6 @@ void usb_uhci_common_realize(PCIDevice *dev, Error *= *errp) pci_register_bar(&s->dev, 4, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar); } =20 -static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp) -{ - UHCIState *s =3D UHCI(dev); - uint8_t *pci_conf =3D s->dev.config; - - /* USB misc control 1/2 */ - pci_set_long(pci_conf + 0x40,0x00001000); - /* PM capability */ - pci_set_long(pci_conf + 0x80,0x00020001); - /* USB legacy support */ - pci_set_long(pci_conf + 0xc0,0x00002000); - - usb_uhci_common_realize(dev, errp); -} - static void usb_uhci_exit(PCIDevice *dev) { UHCIState *s =3D UHCI(dev); @@ -1318,14 +1303,6 @@ static UHCIInfo uhci_info[] =3D { .revision =3D 0x01, .irq_pin =3D 3, .unplug =3D true, - },{ - .name =3D "vt82c686b-usb-uhci", - .vendor_id =3D PCI_VENDOR_ID_VIA, - .device_id =3D PCI_DEVICE_ID_VIA_UHCI, - .revision =3D 0x01, - .irq_pin =3D 3, - .realize =3D usb_uhci_vt82c686b_realize, - .unplug =3D true, },{ .name =3D "ich9-usb-uhci1", /* 00:1d.0 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, diff --git a/hw/usb/vt82c686-uhci-pci.c b/hw/usb/vt82c686-uhci-pci.c new file mode 100644 index 00000000000..b109c216033 --- /dev/null +++ b/hw/usb/vt82c686-uhci-pci.c @@ -0,0 +1,43 @@ +#include "qemu/osdep.h" +#include "hcd-uhci.h" + +static void usb_uhci_vt82c686b_realize(PCIDevice *dev, Error **errp) +{ + UHCIState *s =3D UHCI(dev); + uint8_t *pci_conf =3D s->dev.config; + + /* USB misc control 1/2 */ + pci_set_long(pci_conf + 0x40, 0x00001000); + /* PM capability */ + pci_set_long(pci_conf + 0x80, 0x00020001); + /* USB legacy support */ + pci_set_long(pci_conf + 0xc0, 0x00002000); + + usb_uhci_common_realize(dev, errp); +} + +static UHCIInfo uhci_info[] =3D { + { + .name =3D "vt82c686b-usb-uhci", + .vendor_id =3D PCI_VENDOR_ID_VIA, + .device_id =3D PCI_DEVICE_ID_VIA_UHCI, + .revision =3D 0x01, + .irq_pin =3D 3, + .realize =3D usb_uhci_vt82c686b_realize, + .unplug =3D true, + } +}; + +static const TypeInfo vt82c686b_usb_uhci_type_info =3D { + .parent =3D TYPE_UHCI, + .name =3D "vt82c686b-usb-uhci", + .class_init =3D uhci_data_class_init, + .class_data =3D uhci_info, +}; + +static void vt82c686b_usb_uhci_register_types(void) +{ + type_register_static(&vt82c686b_usb_uhci_type_info); +} + +type_init(vt82c686b_usb_uhci_register_types) diff --git a/MAINTAINERS b/MAINTAINERS index f22d83c1782..6fd55c0a40c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1173,6 +1173,7 @@ S: Odd Fixes F: hw/mips/fuloong2e.c F: hw/isa/vt82c686.c F: hw/pci-host/bonito.c +F: hw/usb/vt82c686-uhci-pci.c F: include/hw/isa/vt82c686.h =20 Loongson-3 virtual platforms diff --git a/hw/usb/meson.build b/hw/usb/meson.build index 653192cff6f..6e3159798e9 100644 --- a/hw/usb/meson.build +++ b/hw/usb/meson.build @@ -32,6 +32,7 @@ softmmu_ss.add(when: 'CONFIG_TUSB6010', if_true: files('tusb6010.c')) softmmu_ss.add(when: 'CONFIG_IMX', if_true: files('chipidea.c')) softmmu_ss.add(when: 'CONFIG_IMX_USBPHY', if_true: files('imx-usb-phy.c')) +softmmu_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686-uhci-pci.= c')) specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-us= b2-ctrl-regs.c')) specific_ss.add(when: 'CONFIG_XLNX_USB_SUBSYS', if_true: files('xlnx-usb-s= ubsystem.c')) =20 --=20 2.26.2