From nobody Wed Sep 10 03:23:37 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1666556295; cv=none; d=zohomail.com; s=zohoarc; b=eCjBBM2FnPLHG1MzomsISo10wGE1byP1R8nmp6KyosKfGJUqIl7k3Dat3GhlcZppxMGhKW8MJPy3yBIxZ80yw+Pkk6HAjD122jVsPHkwl25FryBadZqwttd1vmQpQLVO1XtdlCYoHqwSGhRPnvJ82KFoXOHkL1aYidwpR91wLfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666556295; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jhPL8wlIPRIKRnBnBduzxivov8tVVS8NlHaF1oaIbBM=; b=j54gyC2/pjimPAMwsujSmTXjuN7SHwRhHPNru3eR4lJpZETndrjQbEHNi/EBAF3iKSbIU5XdWMgZ7n1lCSxwDETWN9VbE/AkHUEa6szYHuUkwya62HBhkzkeCZ8hwz0iks0o1Lrl9tV3y+qTf2aCMq8d3c8eupbk0ibtT4BCtOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666556295073183.78431419827916; Sun, 23 Oct 2022 13:18:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omgw6-0003W8-8h for importer@patchew.org; Sun, 23 Oct 2022 15:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1omG4l-00075W-6n; Sat, 22 Oct 2022 11:06:15 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1omG4i-00025F-Tq; Sat, 22 Oct 2022 11:06:14 -0400 Received: by mail-ed1-x52d.google.com with SMTP id r14so16107717edc.7; Sat, 22 Oct 2022 08:06:12 -0700 (PDT) Received: from localhost.localdomain (dynamic-077-191-171-138.77.191.pool.telefonica.de. [77.191.171.138]) by smtp.gmail.com with ESMTPSA id 4-20020a170906310400b00780ab5a9116sm13021558ejx.211.2022.10.22.08.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 08:06:10 -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:subject:date :message-id:reply-to; bh=jhPL8wlIPRIKRnBnBduzxivov8tVVS8NlHaF1oaIbBM=; b=CdZp3Rvd0oJYd2Fk+olbNPQH4dPZDtp4y9lQY8ZlpaZ9SGkXS5UjY8SJZBJLY4Tcsn Chu6j1XMoaFEhkipYb83iERNiqW8tHlIc5xoCRVGZDvBnH9Lhh5r+xa3p7zq7oGp6tQn 2Nfq3JP5qbMc5DT/C0P7eOrvkOHMbh/cNYgwsI15cuXbYZ+ayPuNotjwKiQ5IPHtbS3d tlEo1VuIimL2bbEa5ZdEX/1/iguYOTFC/LQZDJ4bNcKjrZS6mSgHNMb0iP8iyBTAgg+d EtEjZAs/57ImWiF1UbqYhJIUARGwW0MMAW5nMjfnPXyGnAN67TN8R4YWBBF45ISy7cbd pATQ== 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 :subject:date:message-id:reply-to; bh=jhPL8wlIPRIKRnBnBduzxivov8tVVS8NlHaF1oaIbBM=; b=zMwPcPOujOeIfC7XzqDYnER4GecqbDn1PcWgmin0ptGKe8aDc1o0OyVt6Fs1dGp7My FoZLhe7+nqjz7XyYp4njTM9pnPK5+rM99PMeDHiu+UUeKX1uRN/XlqjnT01erx8gc1JR eckPwo+zAqyShCeWtIz5q7fAyVOm7PoRQykGpQL43vKEAPpBTi550IH2/ncdfto/QQTZ 1GN6n4ejLbEaf/nqbcIIjEKybp86dZXNF9GjBjtO1y2Rqp8GGxAY1cT2codxupAlY+s1 S+1st10lvq0nU5Jm8ugILdhisBNf/dBepdmNROIWu/9yefuHvJkEs53llAiQmIqaAhpH AGXw== X-Gm-Message-State: ACrzQf31b0hwJ5mC8EyaJ62go18eLBgV7lHXHYjhyqjh5on+VnWE3GVE JwGkEqVTybBChkc2bOhv8ZgOuZIU3q2T2w== X-Google-Smtp-Source: AMsMyM7XQOtdQbZM1NIgiEnRmnOrj/KGlUVUd1O8IU71uaJSgwhDgv/bhlwrNkNFxgsDrjd9K5vZQw== X-Received: by 2002:aa7:cc8e:0:b0:457:23db:f0cc with SMTP id p14-20020aa7cc8e000000b0045723dbf0ccmr22760451edt.122.1666451170847; Sat, 22 Oct 2022 08:06:10 -0700 (PDT) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aurelien Jarno , Igor Mammedov , Gerd Hoffmann , John Snow , Jiaxun Yang , Ani Sinha , Marcel Apfelbaum , qemu-block@nongnu.org, Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , Bernhard Beschow , Mark Cave-Ayland Subject: [PATCH v2 09/43] hw/usb/hcd-uhci: Introduce TYPE_ defines for device models Date: Sat, 22 Oct 2022 17:04:34 +0200 Message-Id: <20221022150508.26830-10-shentey@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022150508.26830-1-shentey@gmail.com> References: <20221022150508.26830-1-shentey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; 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 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1666556296427100001 Content-Type: text/plain; charset="utf-8" Suggested-by: Mark Cave-Ayland Signed-off-by: Bernhard Beschow --- hw/i386/pc_piix.c | 3 ++- hw/i386/pc_q35.c | 13 +++++++------ hw/isa/piix4.c | 2 +- hw/usb/hcd-uhci.c | 16 ++++++++-------- hw/usb/hcd-uhci.h | 9 +++++++++ 5 files changed, 27 insertions(+), 16 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e26509a935..caa983d76e 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -50,6 +50,7 @@ #include "exec/memory.h" #include "hw/acpi/acpi.h" #include "hw/acpi/piix4.h" +#include "hw/usb/hcd-uhci.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/xen.h" @@ -291,7 +292,7 @@ static void pc_init1(MachineState *machine, #endif =20 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); } =20 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 a496bd6e74..fa24b5ef66 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -48,6 +48,7 @@ #include "hw/ide/pci.h" #include "hw/ide/ahci.h" #include "hw/usb.h" +#include "hw/usb/hcd-uhci.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "sysemu/numa.h" @@ -65,15 +66,15 @@ struct ehci_companions { }; =20 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 }, + { .name =3D TYPE_ICH9_USB_UHCI1, .func =3D 0, .port =3D 0 }, + { .name =3D TYPE_ICH9_USB_UHCI2, .func =3D 1, .port =3D 2 }, + { .name =3D TYPE_ICH9_USB_UHCI3, .func =3D 2, .port =3D 4 }, }; =20 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 }, + { .name =3D TYPE_ICH9_USB_UHCI4, .func =3D 0, .port =3D 0 }, + { .name =3D TYPE_ICH9_USB_UHCI5, .func =3D 1, .port =3D 2 }, + { .name =3D TYPE_ICH9_USB_UHCI6, .func =3D 2, .port =3D 4 }, }; =20 static int ehci_create_ich9_with_companions(PCIBus *bus, int slot) diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index e05e65d3bc..83b50c3a9b 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -279,7 +279,7 @@ static void piix4_init(Object *obj) =20 object_initialize_child(obj, "rtc", &s->rtc, TYPE_MC146818_RTC); object_initialize_child(obj, "ide", &s->ide, TYPE_PIIX4_IDE); - object_initialize_child(obj, "uhci", &s->uhci, "piix4-usb-uhci"); + object_initialize_child(obj, "uhci", &s->uhci, TYPE_PIIX4_USB_UHCI); =20 object_initialize_child(obj, "pm", &s->pm, TYPE_PIIX4_PM); qdev_prop_set_uint32(DEVICE(&s->pm), "smb_io_base", 0x1100); diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index d1b5657d72..0ec4cfaa52 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1292,56 +1292,56 @@ void uhci_data_class_init(ObjectClass *klass, void = *data) =20 static UHCIInfo uhci_info[] =3D { { - .name =3D "piix3-usb-uhci", + .name =3D TYPE_PIIX3_USB_UHCI, .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82371SB_2, .revision =3D 0x01, .irq_pin =3D 3, .unplug =3D true, },{ - .name =3D "piix4-usb-uhci", + .name =3D TYPE_PIIX4_USB_UHCI, .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82371AB_2, .revision =3D 0x01, .irq_pin =3D 3, .unplug =3D true, },{ - .name =3D "ich9-usb-uhci1", /* 00:1d.0 */ + .name =3D TYPE_ICH9_USB_UHCI1, /* 00:1d.0 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82801I_UHCI1, .revision =3D 0x03, .irq_pin =3D 0, .unplug =3D false, },{ - .name =3D "ich9-usb-uhci2", /* 00:1d.1 */ + .name =3D TYPE_ICH9_USB_UHCI2, /* 00:1d.1 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82801I_UHCI2, .revision =3D 0x03, .irq_pin =3D 1, .unplug =3D false, },{ - .name =3D "ich9-usb-uhci3", /* 00:1d.2 */ + .name =3D TYPE_ICH9_USB_UHCI3, /* 00:1d.2 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82801I_UHCI3, .revision =3D 0x03, .irq_pin =3D 2, .unplug =3D false, },{ - .name =3D "ich9-usb-uhci4", /* 00:1a.0 */ + .name =3D TYPE_ICH9_USB_UHCI4, /* 00:1a.0 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82801I_UHCI4, .revision =3D 0x03, .irq_pin =3D 0, .unplug =3D false, },{ - .name =3D "ich9-usb-uhci5", /* 00:1a.1 */ + .name =3D TYPE_ICH9_USB_UHCI5, /* 00:1a.1 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82801I_UHCI5, .revision =3D 0x03, .irq_pin =3D 1, .unplug =3D false, },{ - .name =3D "ich9-usb-uhci6", /* 00:1a.2 */ + .name =3D TYPE_ICH9_USB_UHCI6, /* 00:1a.2 */ .vendor_id =3D PCI_VENDOR_ID_INTEL, .device_id =3D PCI_DEVICE_ID_INTEL_82801I_UHCI6, .revision =3D 0x03, diff --git a/hw/usb/hcd-uhci.h b/hw/usb/hcd-uhci.h index c85ab7868e..22f6e6fcfc 100644 --- a/hw/usb/hcd-uhci.h +++ b/hw/usb/hcd-uhci.h @@ -91,4 +91,13 @@ typedef struct UHCIInfo { void uhci_data_class_init(ObjectClass *klass, void *data); void usb_uhci_common_realize(PCIDevice *dev, Error **errp); =20 +#define TYPE_PIIX3_USB_UHCI "piix3-usb-uhci" +#define TYPE_PIIX4_USB_UHCI "piix4-usb-uhci" +#define TYPE_ICH9_USB_UHCI1 "ich9-usb-uhci1" +#define TYPE_ICH9_USB_UHCI2 "ich9-usb-uhci2" +#define TYPE_ICH9_USB_UHCI3 "ich9-usb-uhci3" +#define TYPE_ICH9_USB_UHCI4 "ich9-usb-uhci4" +#define TYPE_ICH9_USB_UHCI5 "ich9-usb-uhci5" +#define TYPE_ICH9_USB_UHCI6 "ich9-usb-uhci6" + #endif --=20 2.38.1