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.133.124]) by mx.groups.io with SMTP id smtpd.web11.29284.1685620640990738195 for ; Thu, 01 Jun 2023 04:57:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YmRg/bmh; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685620640; 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=koCbuB8u62jdgThlzoiMWK0KUFI7DYB74kvAeyWSBZQ=; b=YmRg/bmhn/yJ2iOgaedvtYD5HZ2f7tMA8dsmYhCv+s8btzp02qcESm9IrFtj9cwnu1FXeR UqyHJEYp80jYFSZFzDq/SuTHPcong5XaWH8iyC7Xx6UmC/CEnrOETE806jbbBngjBHm8VS OOWNLRpYUu0jov3V0wTs26IUdD4K5K0= 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-74-T1v3lqBcNSK25sld78kdnQ-1; Thu, 01 Jun 2023 07:57:17 -0400 X-MC-Unique: T1v3lqBcNSK25sld78kdnQ-1 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 95DE1101A55C; Thu, 1 Jun 2023 11:57:16 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5AD89492B00; Thu, 1 Jun 2023 11:57:16 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id BFDCB1800934; Thu, 1 Jun 2023 13:57:13 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Gerd Hoffmann , Leif Lindholm , Ard Biesheuvel , Oliver Steffen , Pawel Polawski , Jordan Justen , Sami Mujawar , Ard Biesheuvel Subject: [PATCH v2 2/4] ArmVirt/PlatformBootManagerLib: factor out IsVirtio() Date: Thu, 1 Jun 2023 13:57:11 +0200 Message-Id: <20230601115713.1212372-3-kraxel@redhat.com> In-Reply-To: <20230601115713.1212372-1-kraxel@redhat.com> References: <20230601115713.1212372-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 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 Reviewed-by: Ard Biesheuvel --- .../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