Home | History | Annotate | Download | only in VirtioRngDxe
      1 /** @file
      2 
      3   Private definitions of the VirtioRng RNG driver
      4 
      5   Copyright (C) 2016, Linaro Ltd.
      6 
      7   This program and the accompanying materials are licensed and made available
      8   under the terms and conditions of the BSD License which accompanies this
      9   distribution. The full text of the license may be found at
     10   http://opensource.org/licenses/bsd-license.php
     11 
     12   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
     13   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     14 
     15 **/
     16 
     17 #ifndef _VIRTIO_RNG_DXE_H_
     18 #define _VIRTIO_RNG_DXE_H_
     19 
     20 #include <Protocol/ComponentName.h>
     21 #include <Protocol/DriverBinding.h>
     22 #include <Protocol/Rng.h>
     23 
     24 #include <IndustryStandard/Virtio.h>
     25 
     26 #define VIRTIO_RNG_SIG SIGNATURE_32 ('V', 'R', 'N', 'G')
     27 
     28 typedef struct {
     29   //
     30   // Parts of this structure are initialized / torn down in various functions
     31   // at various call depths. The table to the right should make it easier to
     32   // track them.
     33   //
     34   //                        field              init function       init depth
     35   //                        ----------------   ------------------  ----------
     36   UINT32                    Signature;      // DriverBindingStart   0
     37   VIRTIO_DEVICE_PROTOCOL    *VirtIo;        // DriverBindingStart   0
     38   EFI_EVENT                 ExitBoot;       // DriverBindingStart   0
     39   VRING                     Ring;           // VirtioRingInit       2
     40   EFI_RNG_PROTOCOL          Rng;            // VirtioRngInit        1
     41 } VIRTIO_RNG_DEV;
     42 
     43 #define VIRTIO_ENTROPY_SOURCE_FROM_RNG(RngPointer) \
     44           CR (RngPointer, VIRTIO_RNG_DEV, Rng, VIRTIO_RNG_SIG)
     45 
     46 #endif
     47