From nobody Mon Sep 16 19:03:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104802+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104802+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683901398; cv=none; d=zohomail.com; s=zohoarc; b=IGq2wjedSLGZyXvK4t9pDljiRnQNPDmNiCXZ60EvuAD6w/GZV+06O5vTWzKuU/0eakvR2NCPi6QXY89Y9KRnvXtwdKLFRxnqhVXw3MuXVp54yVbkkiJFQopi1yH1yzY1emIaf9SsRuKbp+iZTgDrDXBzqUw5Lvi9wkrJ8Q51tgc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683901398; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=y2lM6Puk2mFh9pQTCu34PAga6ZKOya6Zw+eO7c5O830=; b=Xrt3SIY4D1/YQIGGZy+jLsKzHfNmdlHit3HT5LmU101Y/GcLDFXhJlcxnl1XiyDuZWTCK16UO+ajdj1asRgjYg00fvASmZMA6RIqqByqaFu0VB8C/6b0atHVM3xCoKf/dVjdt7P2Q0GuhKLJRPhj+yP0XaYYJpmmgwLDywWRtms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104802+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683901398298260.3976131037074; Fri, 12 May 2023 07:23:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zTb8YY1788612xBsROz9hX5E; Fri, 12 May 2023 07:23:17 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.26218.1683901397233772850 for ; Fri, 12 May 2023 07:23:17 -0700 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-634-u4-alTkUNUuKoEtmb24YZw-1; Fri, 12 May 2023 10:23:11 -0400 X-MC-Unique: u4-alTkUNUuKoEtmb24YZw-1 X-Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C61B101A54F; Fri, 12 May 2023 14:23:11 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E9C1400E89; Fri, 12 May 2023 14:23:10 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B59221800908; Fri, 12 May 2023 16:23:06 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Gerd Hoffmann , Jiewen Yao , Jordan Justen , Leif Lindholm , Pawel Polawski , Sami Mujawar , Oliver Steffen , Ard Biesheuvel Subject: [edk2-devel] [PATCH 3/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtioPci() Date: Fri, 12 May 2023 16:23:04 +0200 Message-Id: <20230512142306.1323983-4-kraxel@redhat.com> In-Reply-To: <20230512142306.1323983-1-kraxel@redhat.com> References: <20230512142306.1323983-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,kraxel@redhat.com X-Gm-Message-State: 4QPU8sX26F5aQ7kAiIL1gNUhx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683901397; bh=09WH1hNpHhwTD0sLj9eBxOeWXy3CnqObcCdwH/7wDrQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=jCw2H/UEY6B6wsm8LK/FQ3hMvun06l7P4weqBjy7CdvD7f4dIZzKmrrgdIIFqLnG8V/ tzXEi5sf1IOnjyRrf++2p48IckDGcvDqjv8p7WA/+5cH9U+1Ul8r85hiUKqDmC9EKm0R5 cFMjl074gyLIu6EayaQWjJSzxBQ8olcX5EY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683901400165100003 Content-Type: text/plain; charset="utf-8"; x-default="true" IsVirtioPciRng() becomes just a thin wrapper for IsVirtioPci(). This allows to add similar thin wrappers for other virtio devices in the future. Signed-off-by: Gerd Hoffmann Reviewed-by: Ard Biesheuvel --- .../PlatformBootManagerLib/PlatformBm.c | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVi= rtPkg/Library/PlatformBootManagerLib/PlatformBm.c index 5eb6f0f9c14a..ed38c42a43ee 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -313,15 +313,16 @@ IsVirtioRng ( } =20 /** - This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG devi= ce at - the EFI_PCI_IO_PROTOCOL level. + This function checks if a handle corresponds to the Virtio Device ID giv= en + at the EFI_PCI_IO_PROTOCOL level. **/ STATIC BOOLEAN EFIAPI -IsVirtioPciRng ( +IsVirtioPci ( IN EFI_HANDLE Handle, - IN CONST CHAR16 *ReportText + IN CONST CHAR16 *ReportText, + IN UINT16 VirtIoDeviceId ) { EFI_STATUS Status; @@ -387,11 +388,11 @@ IsVirtioPciRng ( // // From DeviceId and RevisionId, determine whether the device is a // modern-only Virtio 1.0 device. In case of Virtio 1.0, DeviceId can - // immediately be restricted to VIRTIO_SUBSYSTEM_ENTROPY_SOURCE, and + // immediately be restricted to VirtIoDeviceId, and // SubsystemId will only play a sanity-check role. Otherwise, DeviceId c= an // only be sanity-checked, and SubsystemId will decide. // - if ((DeviceId =3D=3D 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) && + if ((DeviceId =3D=3D 0x1040 + VirtIoDeviceId) && (RevisionId >=3D 0x01)) { Virtio10 =3D TRUE; @@ -419,7 +420,7 @@ IsVirtioPciRng ( return TRUE; } =20 - if (!Virtio10 && (SubsystemId =3D=3D VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) { + if (!Virtio10 && (SubsystemId =3D=3D VirtIoDeviceId)) { return TRUE; } =20 @@ -430,6 +431,21 @@ IsVirtioPciRng ( return FALSE; } =20 +/** + This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG devi= ce at + the EFI_PCI_IO_PROTOCOL level. +**/ +STATIC +BOOLEAN +EFIAPI +IsVirtioPciRng ( + IN EFI_HANDLE Handle, + IN CONST CHAR16 *ReportText + ) +{ + return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE); +} + /** This CALLBACK_FUNCTION attempts to connect a handle non-recursively, ask= ing the matching driver to produce all first-level child handles. --=20 2.40.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104802): https://edk2.groups.io/g/devel/message/104802 Mute This Topic: https://groups.io/mt/98850081/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-