public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: devel@edk2.groups.io, 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: Re: [PATCH 3/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtioPci()
Date: Thu, 1 Jun 2023 10:00:06 +0200	[thread overview]
Message-ID: <CAMj1kXE6Nw4wu43Kr_yTKGShFq-Za4Hc1K4M_GBGxgFR_zqSng@mail.gmail.com> (raw)
In-Reply-To: <20230512142306.1323983-4-kraxel@redhat.com>

On Fri, 12 May 2023 at 16:23, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> 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 <kraxel@redhat.com>

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

> ---
>  .../PlatformBootManagerLib/PlatformBm.c       | 30 ++++++++++++++-----
>  1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/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 (
>  }
>
>  /**
> -  This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
> -  the EFI_PCI_IO_PROTOCOL level.
> +  This function checks if a handle corresponds to the Virtio Device ID given
> +  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 can
>    // only be sanity-checked, and SubsystemId will decide.
>    //
> -  if ((DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&
> +  if ((DeviceId == 0x1040 + VirtIoDeviceId) &&
>        (RevisionId >= 0x01))
>    {
>      Virtio10 = TRUE;
> @@ -419,7 +420,7 @@ IsVirtioPciRng (
>      return TRUE;
>    }
>
> -  if (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {
> +  if (!Virtio10 && (SubsystemId == VirtIoDeviceId)) {
>      return TRUE;
>    }
>
> @@ -430,6 +431,21 @@ IsVirtioPciRng (
>    return FALSE;
>  }
>
> +/**
> +  This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device 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, asking
>    the matching driver to produce all first-level child handles.
> --
> 2.40.1
>

  reply	other threads:[~2023-06-01  8:00 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 ` [PATCH 2/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtio() Gerd Hoffmann
2023-06-01  7:57   ` Ard Biesheuvel
2023-05-12 14:23 ` [PATCH 3/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtioPci() Gerd Hoffmann
2023-06-01  8:00   ` Ard Biesheuvel [this message]
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=CAMj1kXE6Nw4wu43Kr_yTKGShFq-Za4Hc1K4M_GBGxgFR_zqSng@mail.gmail.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