From patchwork Sat Jul 4 14:49:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 278587 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 F3B11C433DF for ; Sat, 4 Jul 2020 15:08:53 +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 ADF1D208D5 for ; Sat, 4 Jul 2020 15:08:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lEaSbT81" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADF1D208D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amsat.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jrjmf-0000gk-0j for qemu-devel@archiver.kernel.org; Sat, 04 Jul 2020 11:08:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jrjV3-0002ga-Rq; Sat, 04 Jul 2020 10:50:41 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:38207) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jrjV1-0003wU-V3; Sat, 04 Jul 2020 10:50:41 -0400 Received: by mail-wm1-x341.google.com with SMTP id f18so37074846wml.3; Sat, 04 Jul 2020 07:50:38 -0700 (PDT) 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=ELz2xQrwO3as8Wxs/Kn8jW0b/kVDPOkqqjBqSxetIoY=; b=lEaSbT813203f5Q/sN2DPPZEN+/cTb3ulD0Tsc1K7UiiJmuIHRljgZA5E6zal6HQzd SJ1xW7NtSAKTID6CskQvsrLb7LQCq+tEKlaGrkyTbnWVNZv0iqk/rWKNzeml32LvPYt7 wgIMupaZdxlJI/+kIl0Ql/RW5EIXIoUpP0EIn+bP7T+ouYR5fkNExvJnsPSciKAgerQW WrzFOrM8q18cFGilFsVCB9yObwLMcIHNnP0LEH05SNx5uCwKd2r1O7S/Hqo/VTdOad/w ZbUVITTYcFraCPIbBmWczqxqNUrrLd09DJk+rTPqpM+lJ6rRdSpbb8Vxn63LhDrjM5CZ kfxw== 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=ELz2xQrwO3as8Wxs/Kn8jW0b/kVDPOkqqjBqSxetIoY=; b=jgvxbrMzF2V27+9Fd7qaxjQRZhCLDKcauk32dymdQ//Dzn/XK6hnPMymf5mTbwqJR3 vp4EhnhYMRGahCALwGY8gbguRlERkhFg3fSEw6jFhWrC2f1Oe2220ypP9xUz3+g2a70a gp3nkm3sBw2/D+KdGd8/EDYHfJJ5lGT1upg7wFidxEBxaFeNlXjobq7f8KrMEvF8gI2L UvBEJPK8IhQtmPwhMK+N2J6uFencKqGPWMUNZJSfSTbgYX5l27QaNF30ZSideoifQLqS IpWm8NRAqIRED2GmZfKsEWFIntkh46ruXzct/ZMBT3kNbJc5xEXFEFOJDdQ8Tj9XSNzz Qw4g== X-Gm-Message-State: AOAM532+N9oAvWVIfy0lj/yRK/bWVUikWzghOBxV+Q+BPSPPdZ2glV5g I/EPNdG3XWxWkJk9fS2NunXHmTw3ssc= X-Google-Smtp-Source: ABdhPJxszZnIT3VKXO6NXhl+YZ/Tp7y4xXuOBdXFlI7NLcqcetxqVubOW7Z948642pU/bk7Dmf0M6w== X-Received: by 2002:a1c:e355:: with SMTP id a82mr42855621wmh.165.1593874237478; Sat, 04 Jul 2020 07:50:37 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id r10sm17135019wrm.17.2020.07.04.07.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2020 07:50:36 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, BALATON Zoltan Subject: [PATCH 24/26] hw/usb/usb-hcd: Use UHCI type definitions Date: Sat, 4 Jul 2020 16:49:41 +0200 Message-Id: <20200704144943.18292-25-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200704144943.18292-1-f4bug@amsat.org> References: <20200704144943.18292-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::341; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x341.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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: Peter Maydell , "Michael S. Tsirkin" , Mark Cave-Ayland , Gerd Hoffmann , "Edgar E. Iglesias" , Huacai Chen , Stefano Stabellini , xen-devel@lists.xenproject.org, Yoshinori Sato , Paul Durrant , Magnus Damm , Markus Armbruster , =?utf-8?q?Herv=C3=A9_Poussineau?= , Anthony Perard , Samuel Thibault , Leif Lindholm , Aleksandar Rikalo , Eduardo Habkost , Alistair Francis , "Dr. David Alan Gilbert" , Beniamino Galvani , Niek Linnenbank , qemu-arm@nongnu.org, =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Richard Henderson , Radoslaw Biernacki , Igor Mitsyanko , =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paul Zimmerman , qemu-ppc@nongnu.org, David Gibson , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Various machine/board/soc models create UHCI device instances with the generic QDEV API, and don't need to access USB internals. Simplify header inclusions by moving the QOM type names into a simple header, with no need to include other "hw/usb" headers. Suggested-by: BALATON Zoltan Signed-off-by: Philippe Mathieu-Daudé --- include/hw/usb/usb-hcd.h | 6 ++++++ hw/i386/pc_piix.c | 3 ++- hw/i386/pc_q35.c | 13 +++++++------ hw/isa/piix4.c | 3 ++- hw/mips/fuloong2e.c | 5 +++-- hw/usb/hcd-uhci.c | 19 ++++++++++--------- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/include/hw/usb/usb-hcd.h b/include/hw/usb/usb-hcd.h index 74af3a4533..c9d0a88984 100644 --- a/include/hw/usb/usb-hcd.h +++ b/include/hw/usb/usb-hcd.h @@ -24,4 +24,10 @@ #define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb" #define TYPE_CHIPIDEA "usb-chipidea" +/* UHCI */ +#define TYPE_PIIX3_USB_UHCI "piix3-usb-uhci" +#define TYPE_PIIX4_USB_UHCI "piix4-usb-uhci" +#define TYPE_VT82C686B_USB_UHCI "vt82c686b-usb-uhci" +#define TYPE_ICH9_USB_UHCI(n) "ich9-usb-uhci" #n + #endif diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 4d1de7cfab..0024c346c6 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -37,6 +37,7 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_ids.h" #include "hw/usb/usb.h" +#include "hw/usb/usb-hcd.h" #include "net/net.h" #include "hw/ide/pci.h" #include "hw/irq.h" @@ -275,7 +276,7 @@ static void pc_init1(MachineState *machine, #endif if (pcmc->pci_enabled && machine_usb(machine)) { - pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); + pci_create_simple(pci_bus, piix3_devfn + 2, TYPE_PIIX3_USB_UHCI); } if (pcmc->pci_enabled && x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index b985f5bea1..a80527e6ed 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -51,6 +51,7 @@ #include "hw/ide/pci.h" #include "hw/ide/ahci.h" #include "hw/usb/usb.h" +#include "hw/usb/usb-hcd.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/numa.h" @@ -68,15 +69,15 @@ struct ehci_companions { }; static const struct ehci_companions ich9_1d[] = { - { .name = "ich9-usb-uhci1", .func = 0, .port = 0 }, - { .name = "ich9-usb-uhci2", .func = 1, .port = 2 }, - { .name = "ich9-usb-uhci3", .func = 2, .port = 4 }, + { .name = TYPE_ICH9_USB_UHCI(1), .func = 0, .port = 0 }, + { .name = TYPE_ICH9_USB_UHCI(2), .func = 1, .port = 2 }, + { .name = TYPE_ICH9_USB_UHCI(3), .func = 2, .port = 4 }, }; static const struct ehci_companions ich9_1a[] = { - { .name = "ich9-usb-uhci4", .func = 0, .port = 0 }, - { .name = "ich9-usb-uhci5", .func = 1, .port = 2 }, - { .name = "ich9-usb-uhci6", .func = 2, .port = 4 }, + { .name = TYPE_ICH9_USB_UHCI(4), .func = 0, .port = 0 }, + { .name = TYPE_ICH9_USB_UHCI(5), .func = 1, .port = 2 }, + { .name = TYPE_ICH9_USB_UHCI(6), .func = 2, .port = 4 }, }; static int ehci_create_ich9_with_companions(PCIBus *bus, int slot) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index f634bcb2d1..e11e5fae21 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -29,6 +29,7 @@ #include "hw/southbridge/piix.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" +#include "hw/usb/usb-hcd.h" #include "hw/sysbus.h" #include "hw/intc/i8259.h" #include "hw/dma/i8257.h" @@ -255,7 +256,7 @@ DeviceState *piix4_create(PCIBus *pci_bus, ISABus **isa_bus, I2CBus **smbus) pci = pci_create_simple(pci_bus, devfn + 1, "piix4-ide"); pci_ide_create_devs(pci); - pci_create_simple(pci_bus, devfn + 2, "piix4-usb-uhci"); + pci_create_simple(pci_bus, devfn + 2, TYPE_PIIX4_USB_UHCI); if (smbus) { *smbus = piix4_pm_init(pci_bus, devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 8ca31e5162..b6d33dd2cd 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -33,6 +33,7 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" +#include "hw/usb/usb-hcd.h" #include "qemu/log.h" #include "hw/loader.h" #include "hw/ide/pci.h" @@ -258,8 +259,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq intc, dev = pci_create_simple(pci_bus, PCI_DEVFN(slot, 1), "via-ide"); pci_ide_create_devs(dev); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); - pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), "vt82c686b-usb-uhci"); + 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); *i2c_bus = vt82c686b_pm_init(pci_bus, PCI_DEVFN(slot, 4), 0xeee1, NULL); diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 1d4dd33b6c..da078dc3fa 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -39,6 +39,7 @@ #include "qemu/main-loop.h" #include "qemu/module.h" #include "usb-internal.h" +#include "hw/usb/usb-hcd.h" #define FRAME_TIMER_FREQ 1000 @@ -1358,21 +1359,21 @@ static void uhci_data_class_init(ObjectClass *klass, void *data) static UHCIInfo uhci_info[] = { { - .name = "piix3-usb-uhci", + .name = TYPE_PIIX3_USB_UHCI, .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82371SB_2, .revision = 0x01, .irq_pin = 3, .unplug = true, },{ - .name = "piix4-usb-uhci", + .name = TYPE_PIIX4_USB_UHCI, .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82371AB_2, .revision = 0x01, .irq_pin = 3, .unplug = true, },{ - .name = "vt82c686b-usb-uhci", + .name = TYPE_VT82C686B_USB_UHCI, .vendor_id = PCI_VENDOR_ID_VIA, .device_id = PCI_DEVICE_ID_VIA_UHCI, .revision = 0x01, @@ -1380,42 +1381,42 @@ static UHCIInfo uhci_info[] = { .realize = usb_uhci_vt82c686b_realize, .unplug = true, },{ - .name = "ich9-usb-uhci1", /* 00:1d.0 */ + .name = TYPE_ICH9_USB_UHCI(1), /* 00:1d.0 */ .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI1, .revision = 0x03, .irq_pin = 0, .unplug = false, },{ - .name = "ich9-usb-uhci2", /* 00:1d.1 */ + .name = TYPE_ICH9_USB_UHCI(2), /* 00:1d.1 */ .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI2, .revision = 0x03, .irq_pin = 1, .unplug = false, },{ - .name = "ich9-usb-uhci3", /* 00:1d.2 */ + .name = TYPE_ICH9_USB_UHCI(3), /* 00:1d.2 */ .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI3, .revision = 0x03, .irq_pin = 2, .unplug = false, },{ - .name = "ich9-usb-uhci4", /* 00:1a.0 */ + .name = TYPE_ICH9_USB_UHCI(4), /* 00:1a.0 */ .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI4, .revision = 0x03, .irq_pin = 0, .unplug = false, },{ - .name = "ich9-usb-uhci5", /* 00:1a.1 */ + .name = TYPE_ICH9_USB_UHCI(5), /* 00:1a.1 */ .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI5, .revision = 0x03, .irq_pin = 1, .unplug = false, },{ - .name = "ich9-usb-uhci6", /* 00:1a.2 */ + .name = TYPE_ICH9_USB_UHCI(6), /* 00:1a.2 */ .vendor_id = PCI_VENDOR_ID_INTEL, .device_id = PCI_DEVICE_ID_INTEL_82801I_UHCI6, .revision = 0x03,