From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.25948.1685606420641335916 for ; Thu, 01 Jun 2023 01:00:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jk70H5on; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3193363AC5 for ; Thu, 1 Jun 2023 08:00:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9730AC4339C for ; Thu, 1 Jun 2023 08:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685606419; bh=8F+fvDXgUmR4kj7+UKG5m3EFZdadxvZ9FPg5n62r1PE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jk70H5onn/5hPeSJ7BgT5RZ12r6mtyrckSp49nfveAaTFqGj1RQgh3fYoVPKP7C83 O5u+etZ/XsC4IqKsDEOfB9IaGZpopPtBY/hCB8QPdBtNmDCjyuGzDDFCGe9D3CvVRU R1xnrRbWs/Cte7HdXowZqp1LrQwVblJDE0hhbelcjWfz0hV8iHoizbpPopKvdvL3aI VNW466dbqDxTj5HihDpf0P6MeGYaFL2H8nxdi9o10HwF2+Mice17XcRqd+qxzAz7uf RSNK1vN2n00aLAX7RC8yH0C7zBz5zPZUOStJQgfyhUGtAIxeN/yOVDG3lL3fc+iDpl RUYB/ZE/cqA/w== Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2af2c7f2883so7235441fa.3 for ; Thu, 01 Jun 2023 01:00:19 -0700 (PDT) X-Gm-Message-State: AC+VfDytlK6y8w1kV8eLX6Z7NdKy/IDzfkwIFEM0pTiWRgh0JrDg86W1 t944x/wHU0BIXJow/jy607mA9dymiD4liowMy7Q= X-Google-Smtp-Source: ACHHUZ536EZ2KwC9lyBU8Hj6cOa1NDedXxop5v+Snti07vZ1hFvpEuqXlwJCVzJqqQlnHGGuSm1cNs2RDoNVrTK4ZLY= X-Received: by 2002:a2e:720c:0:b0:2ae:e05e:76b4 with SMTP id n12-20020a2e720c000000b002aee05e76b4mr4170514ljc.28.1685606417646; Thu, 01 Jun 2023 01:00:17 -0700 (PDT) MIME-Version: 1.0 References: <20230512142306.1323983-1-kraxel@redhat.com> <20230512142306.1323983-4-kraxel@redhat.com> In-Reply-To: <20230512142306.1323983-4-kraxel@redhat.com> From: "Ard Biesheuvel" Date: Thu, 1 Jun 2023 10:00:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/5] ArmVirt/PlatformBootManagerLib: factor out IsVirtioPci() To: Gerd Hoffmann Cc: devel@edk2.groups.io, Jiewen Yao , Jordan Justen , Leif Lindholm , Pawel Polawski , Sami Mujawar , Oliver Steffen , Ard Biesheuvel Content-Type: text/plain; charset="UTF-8" On Fri, 12 May 2023 at 16:23, Gerd Hoffmann 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 Reviewed-by: Ard Biesheuvel > --- > .../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 >