ArmVirt/PlatformBootManagerLib: factor out IsVirtioPci()
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>
This commit is contained in:
committed by
mergify[bot]
parent
a196b04926
commit
aaf546879a
@@ -313,15 +313,16 @@ IsVirtioRng (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at
|
This function checks if a handle corresponds to the Virtio Device ID given
|
||||||
the EFI_PCI_IO_PROTOCOL level.
|
at the EFI_PCI_IO_PROTOCOL level.
|
||||||
**/
|
**/
|
||||||
STATIC
|
STATIC
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IsVirtioPciRng (
|
IsVirtioPci (
|
||||||
IN EFI_HANDLE Handle,
|
IN EFI_HANDLE Handle,
|
||||||
IN CONST CHAR16 *ReportText
|
IN CONST CHAR16 *ReportText,
|
||||||
|
IN UINT16 VirtIoDeviceId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@@ -387,11 +388,11 @@ IsVirtioPciRng (
|
|||||||
//
|
//
|
||||||
// From DeviceId and RevisionId, determine whether the device is a
|
// From DeviceId and RevisionId, determine whether the device is a
|
||||||
// modern-only Virtio 1.0 device. In case of Virtio 1.0, DeviceId can
|
// 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
|
// SubsystemId will only play a sanity-check role. Otherwise, DeviceId can
|
||||||
// only be sanity-checked, and SubsystemId will decide.
|
// only be sanity-checked, and SubsystemId will decide.
|
||||||
//
|
//
|
||||||
if ((DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&
|
if ((DeviceId == 0x1040 + VirtIoDeviceId) &&
|
||||||
(RevisionId >= 0x01))
|
(RevisionId >= 0x01))
|
||||||
{
|
{
|
||||||
Virtio10 = TRUE;
|
Virtio10 = TRUE;
|
||||||
@@ -419,7 +420,7 @@ IsVirtioPciRng (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {
|
if (!Virtio10 && (SubsystemId == VirtIoDeviceId)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +431,21 @@ PciError:
|
|||||||
return FALSE;
|
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
|
This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
|
||||||
the matching driver to produce all first-level child handles.
|
the matching driver to produce all first-level child handles.
|
||||||
|
Reference in New Issue
Block a user