Virtio10.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /** @file
  2. Private definitions of the VirtIo 1.0 driver.
  3. Copyright (C) 2016, Red Hat, Inc.
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _VIRTIO_1_0_DXE_H_
  7. #define _VIRTIO_1_0_DXE_H_
  8. #include <Protocol/PciIo.h>
  9. #include <Protocol/VirtioDevice.h>
  10. #define VIRTIO_1_0_SIGNATURE SIGNATURE_32 ('V', 'I', 'O', '1')
  11. //
  12. // Type of the PCI BAR that contains a VirtIo 1.0 config structure.
  13. //
  14. typedef enum {
  15. Virtio10BarTypeMem,
  16. Virtio10BarTypeIo
  17. } VIRTIO_1_0_BAR_TYPE;
  18. //
  19. // The type below defines the access to a VirtIo 1.0 config structure.
  20. //
  21. typedef struct {
  22. BOOLEAN Exists; // The device exposes this structure
  23. VIRTIO_1_0_BAR_TYPE BarType;
  24. UINT8 Bar;
  25. UINT32 Offset; // Offset into BAR where structure starts
  26. UINT32 Length; // Length of structure in BAR.
  27. } VIRTIO_1_0_CONFIG;
  28. typedef struct {
  29. UINT32 Signature;
  30. VIRTIO_DEVICE_PROTOCOL VirtIo;
  31. EFI_PCI_IO_PROTOCOL *PciIo;
  32. UINT64 OriginalPciAttributes;
  33. VIRTIO_1_0_CONFIG CommonConfig; // Common settings
  34. VIRTIO_1_0_CONFIG NotifyConfig; // Notifications
  35. UINT32 NotifyOffsetMultiplier;
  36. VIRTIO_1_0_CONFIG SpecificConfig; // Device specific settings
  37. } VIRTIO_1_0_DEV;
  38. #define VIRTIO_1_0_FROM_VIRTIO_DEVICE(Device) \
  39. CR (Device, VIRTIO_1_0_DEV, VirtIo, VIRTIO_1_0_SIGNATURE)
  40. #endif // _VIRTIO_1_0_DXE_H_