From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.26250.1683901393029621354 for ; Fri, 12 May 2023 07:23:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Bz5j6o0w; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683901392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/tzQ8vwMA8Xds4ZKesr0duUVmybzryB+WKblHBsXNA=; b=Bz5j6o0wm0HCQLsGkVf7pUzRx2EjmRu625/MVPvtAzHGv+s31cs2k5WMsRQJIATmUGJy5i 3RPnOIigevCI2YRBNHd8GNhP+kVFWdKOCSEgYR3Xw7Yi4ONilMEarE4fYgSBfctkWcvWcl Jb1c8ufWeZ1sMDBUVNZJot+8019Mb74= 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-397-RQ9iPL0aP6G_PotkWlGduw-1; Fri, 12 May 2023 10:23:10 -0400 X-MC-Unique: RQ9iPL0aP6G_PotkWlGduw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 73C7585A588; Fri, 12 May 2023 14:23:10 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 260222166B26; Fri, 12 May 2023 14:23:10 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AFFB91800850; 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: [PATCH 2/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtio() Date: Fri, 12 May 2023 16:23:03 +0200 Message-Id: <20230512142306.1323983-3-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.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true IsVirtioRng() becomes just a thin wrapper for IsVirtio(). This allows to add similar thin wrappers for other virtio devices in the future. Signed-off-by: Gerd Hoffmann --- .../PlatformBootManagerLib/PlatformBm.c | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c index 10c815378cd5..5eb6f0f9c14a 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -269,15 +269,16 @@ IsPciDisplay ( } /** - This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at - the VIRTIO_DEVICE_PROTOCOL level. + This function checks if a handle corresponds to the Virtio Device ID given + at the VIRTIO_DEVICE_PROTOCOL level. **/ STATIC BOOLEAN EFIAPI -IsVirtioRng ( +IsVirtio ( IN EFI_HANDLE Handle, - IN CONST CHAR16 *ReportText + IN CONST CHAR16 *ReportText, + IN UINT16 VirtIoDeviceId ) { EFI_STATUS Status; @@ -293,7 +294,22 @@ IsVirtioRng ( } return (BOOLEAN)(VirtIo->SubSystemDeviceId == - VIRTIO_SUBSYSTEM_ENTROPY_SOURCE); + VirtIoDeviceId); +} + +/** + This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at + the VIRTIO_DEVICE_PROTOCOL level. +**/ +STATIC +BOOLEAN +EFIAPI +IsVirtioRng ( + IN EFI_HANDLE Handle, + IN CONST CHAR16 *ReportText + ) +{ + return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE); } /** -- 2.40.1