public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Gerd Hoffmann <kraxel@redhat.com>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Pawel Polawski <ppolawsk@redhat.com>,
	Sami Mujawar <sami.mujawar@arm.com>,
	Oliver Steffen <osteffen@redhat.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>
Subject: [PATCH 2/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtio()
Date: Fri, 12 May 2023 16:23:03 +0200	[thread overview]
Message-ID: <20230512142306.1323983-3-kraxel@redhat.com> (raw)
In-Reply-To: <20230512142306.1323983-1-kraxel@redhat.com>

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 <kraxel@redhat.com>
---
 .../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


  parent reply	other threads:[~2023-05-12 14:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 14:23 [PATCH 0/5] ArmVirt: add VirtioSerialDxe Gerd Hoffmann
2023-05-12 14:23 ` [PATCH 1/5] ArmVirt: add VirtioSerialDxe to ArmVirtQemu builds Gerd Hoffmann
2023-06-01  7:58   ` [edk2-devel] " Ard Biesheuvel
2023-05-12 14:23 ` Gerd Hoffmann [this message]
2023-06-01  7:57   ` [PATCH 2/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtio() Ard Biesheuvel
2023-05-12 14:23 ` [PATCH 3/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtioPci() Gerd Hoffmann
2023-06-01  8:00   ` Ard Biesheuvel
2023-05-12 14:23 ` [PATCH 4/5] ArmVirt/PlatformBootManagerLib: set up virtio serial as console Gerd Hoffmann
2023-06-01  8:13   ` Ard Biesheuvel
2023-05-12 14:23 ` [PATCH 5/5] OvmfPkg/VirtioSerialDxe: use TPL_NOTIFY Gerd Hoffmann
2023-06-01  7:56   ` Ard Biesheuvel
2023-06-01  9:07     ` Ard Biesheuvel
2023-06-01  6:17 ` [PATCH 0/5] ArmVirt: add VirtioSerialDxe Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230512142306.1323983-3-kraxel@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox