diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-02-19 11:43:12 +0100 |
---|---|---|
committer | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-02-24 12:07:32 +0100 |
commit | 5528732a51bc998702ee49f6b8c86f076521d394 (patch) | |
tree | 26031e04cbea11722f3504c802432753dfb3eaa6 /OvmfPkg/VirtioRngDxe/VirtioRng.h | |
parent | 8bc951a26419c7d3fa45f8e583318690b108a6cd (diff) | |
download | edk2-platforms-5528732a51bc998702ee49f6b8c86f076521d394.tar.xz |
OvmfPkg: implement UEFI driver for Virtio RNG devices
This implements a UEFI driver model driver for Virtio devices of type
VIRTIO_SUBSYSTEM_ENTROPY_SOURCE, and exposes them via instances of
the EFI_RNG_PROTOCOL protocol, supporting the EFI_RNG_ALGORITHM_RAW
algorithm only.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/VirtioRngDxe/VirtioRng.h')
-rw-r--r-- | OvmfPkg/VirtioRngDxe/VirtioRng.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/OvmfPkg/VirtioRngDxe/VirtioRng.h b/OvmfPkg/VirtioRngDxe/VirtioRng.h new file mode 100644 index 0000000000..844550a00c --- /dev/null +++ b/OvmfPkg/VirtioRngDxe/VirtioRng.h @@ -0,0 +1,46 @@ +/** @file + + Private definitions of the VirtioRng RNG driver + + Copyright (C) 2016, Linaro Ltd. + + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef _VIRTIO_RNG_DXE_H_ +#define _VIRTIO_RNG_DXE_H_ + +#include <Protocol/ComponentName.h> +#include <Protocol/DriverBinding.h> +#include <Protocol/Rng.h> + +#include <IndustryStandard/Virtio.h> + +#define VIRTIO_RNG_SIG SIGNATURE_32 ('V', 'R', 'N', 'G') + +typedef struct { + // + // Parts of this structure are initialized / torn down in various functions + // at various call depths. The table to the right should make it easier to + // track them. + // + // field init function init depth + // ---------------- ------------------ ---------- + UINT32 Signature; // DriverBindingStart 0 + VIRTIO_DEVICE_PROTOCOL *VirtIo; // DriverBindingStart 0 + EFI_EVENT ExitBoot; // DriverBindingStart 0 + VRING Ring; // VirtioRingInit 2 + EFI_RNG_PROTOCOL Rng; // VirtioRngInit 1 +} VIRTIO_RNG_DEV; + +#define VIRTIO_ENTROPY_SOURCE_FROM_RNG(RngPointer) \ + CR (RngPointer, VIRTIO_RNG_DEV, Rng, VIRTIO_RNG_SIG) + +#endif |