From patchwork Mon Feb 13 07:08:04 2023 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: 653169 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2266090wrr; Sun, 12 Feb 2023 23:08:53 -0800 (PST) X-Google-Smtp-Source: AK7set9ICdAt+wsCXJqfNQ6AuxDTeB5kPh+Cuic48yLzM+l1qkUxu/ohJr5JxIBoVMZoMQ7ImQjz X-Received: by 2002:a05:622a:651:b0:3b6:3a7a:d3c8 with SMTP id a17-20020a05622a065100b003b63a7ad3c8mr37221035qtb.17.1676272133236; Sun, 12 Feb 2023 23:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676272133; cv=none; d=google.com; s=arc-20160816; b=uwGSibR8XL2Oa0PPckn9R7uJy8rwfmKttz+WHtZDM3LP5s6cpRegpqTg+j/u5XZOSO S9Yh9QLkKlW3agPUYtqIBahrSifprbPNAxrZIS3oebYUcno4Oi1AM4xdbg2cacy9qc2D y5uMOjVOyk19dc0prFsoKRh7cT2UIwiM++CNCIe5NNPCfGuatlXOjEp4IzMizVEQLWae 4AHmuzmoV3XCaeaaexJqoKXE9JvQT/MBRUt/+p0YAwjJTyWZXh61R2xtOzF+x+lFxISu TfnRzuYoUhk+mEq0DlZoZ8P3AiHSokA6CIMHJXjyV7+iwV90dgz4IBN5y0phtW+pqOOO MwDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=KoEftpCltd/436jbsCfBQPYaWZGdOc52uix1GP+YG53Yn2MBtUbyifjhwSpBmyj0R4 +rdDuxSV/NPcNqzPCYM1TqANVXZT+0Sa6PyKUJ92yVhyWm5n1mf16pnI11GbvEX9pnwx cB6/etFidvOXmy5R65axegjtkBEPqCFeWc4q4qWlYS0cqFWBGsBi6ESfMi1VvQFx5g/i frO6QRxjtiwZpoTVfuLdeorNoA+YNvS8r1gs2tDx5waqbrJ6O9mGXa6R8BPw4nZr2xvV D4+2Q380WRcWPyNyHF1i1zPtP9X9PZCFPxRM+EkfkPQxD7dnriQWa/2FoNI+RjUoAudh NhpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=APYH9iN5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c5-20020ac80085000000b003b688677fc1si8036550qtg.732.2023.02.12.23.08.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 12 Feb 2023 23:08:53 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=APYH9iN5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRSx9-0000OI-Ly; Mon, 13 Feb 2023 02:08:43 -0500 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 1pRSx7-0000MA-N3 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:41 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRSx5-0001mt-Ij for qemu-devel@nongnu.org; Mon, 13 Feb 2023 02:08:41 -0500 Received: by mail-wm1-x32a.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso10562826wms.0 for ; Sun, 12 Feb 2023 23:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=APYH9iN5Yuli2RTervmm7poWJgfdpSWNr20Bc7I0/Ru50f4lng5oJTyPtYcpccs85O 6ZdRj2Qyh/oVsctPVYGy9W3OVyYfhOhwNaipyUXjuF2/RADbZRgSPy0OQxvF+ayJYeik FueHekoNAt9sLAhrA/ZbH3eTJ9hfNKohUjivB2P/8R5Av7u/LdtolUzuKR3rxsyi36bV X6tXwydt3wngsoqSyOuvgrxn+MKvcIj1UB0zGf6BOvhv5JwANJxzvfprcDOytVt4UUSw P4wTFkZUlkZN8TdWX1uMHexMJ6spjsnDXB/p2QC+3coe3Cmh17PYNNeo956/bEcj5qUH 6BCQ== 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=HT2d2u/vjaA1vHLklOaaqzhfI86GF9Vdz9cSYHww3bI=; b=SlAkOoxXyJrCAq3yQnxvHMfUQlYDQTJgmitAXlOBBJUej5jDxCYIbHArWhrX+JwDFc 5rQpO2oQv5WTAr9+lKIIO57MKWSQDr9dRUKbeKcnl2TF7akeRKX1ucCiuG85tl40or1k sympjuc/Atc+0Pxdp8k/zB+peH4yzF0zWr9UPDYDGe13nrzMV/al1/xPbI2jdirbYHG3 D2B3En5PDoIZ1BfG00fVVEDG6AY8IQeLT3Gk0+ABkaN1sgnGQNMYkJOV8FkYAqaZYxgh Va1d441gRXCsT3JIZT/kKIBFeOfYloL3PEEuw8QSfqj0GRTLZZITgByQHTQ5zycntqt5 LPfQ== X-Gm-Message-State: AO0yUKUmIoul6l++6ESeWP7d4nXT9LQG6Yov2vMgPyQssb7CYU3WZJYs nenUjDSnqoHrI/QDK0EcsPeadDXp5SpHBlxX X-Received: by 2002:a05:600c:2ac8:b0:3db:66e:cfdd with SMTP id t8-20020a05600c2ac800b003db066ecfddmr17990179wme.9.1676272118072; Sun, 12 Feb 2023 23:08:38 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id z4-20020a05600c220400b003dfe8c4c497sm16214893wml.39.2023.02.12.23.08.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 12 Feb 2023 23:08:37 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Thomas Huth , Li Qiang , qemu-s390x@nongnu.org, Hu Tao , Gonglei Arei , Cao jin , xiaoqiang zhao , Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , "Michael S. Tsirkin" , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v2 03/19] hw/char/serial-pci-multi: Introduce PCI_MULTISERIAL QOM abstract parent Date: Mon, 13 Feb 2023 08:08:04 +0100 Message-Id: <20230213070820.76881-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213070820.76881-1-philmd@linaro.org> References: <20230213070820.76881-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Introduce PCI_MULTISERIAL ("pci-serial"), QOM abstract parent of "pci-serial-2x" and "pci-serial-4x". Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 54768d3d53..faeb0a9476 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -38,8 +38,15 @@ #define PCI_SERIAL_MAX_PORTS 4 -typedef struct PCIMultiSerialState { +#define TYPE_PCI_MULTISERIAL "pci-serial" + +OBJECT_DECLARE_SIMPLE_TYPE(PCIMultiSerialState, PCI_MULTISERIAL) + +struct PCIMultiSerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion iobar; uint32_t ports; char *name[PCI_SERIAL_MAX_PORTS]; @@ -47,7 +54,7 @@ typedef struct PCIMultiSerialState { uint32_t level[PCI_SERIAL_MAX_PORTS]; qemu_irq *irqs; uint8_t prog_if; -} PCIMultiSerialState; +}; static void multi_serial_pci_exit(PCIDevice *dev) { @@ -191,25 +198,23 @@ static void multi_serial_init(Object *o) static const TypeInfo multi_serial_pci_types[] = { { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { + .name = TYPE_PCI_MULTISERIAL, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .abstract = true, + .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, }, + }, { + .name = "pci-serial-2x", + .parent = TYPE_PCI_MULTISERIAL, + .class_init = multi_2x_serial_pci_class_initfn, }, { .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, + .parent = TYPE_PCI_MULTISERIAL, .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, } };