OvmfPkg/PvScsiDxe: Setup requests and completions rings

These rings are shared memory buffers between host and device in which
a cyclic buffer is managed to send request descriptors from host to
device and receive completion descriptors from device to host.

Note that because device may be constrained by IOMMU or guest may be run
under AMD SEV, we make sure to map these rings to device by using
PciIo->Map().

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200328200100.60786-14-liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Liran Alon
2020-03-28 23:00:56 +03:00
committed by mergify[bot]
parent 5269c26e07
commit b654edec03
3 changed files with 237 additions and 0 deletions

View File

@@ -15,12 +15,29 @@
#include <Library/DebugLib.h>
#include <Protocol/ScsiPassThruExt.h>
typedef struct {
EFI_PHYSICAL_ADDRESS DeviceAddress;
VOID *Mapping;
} PVSCSI_DMA_DESC;
typedef struct {
PVSCSI_RINGS_STATE *RingState;
PVSCSI_DMA_DESC RingStateDmaDesc;
PVSCSI_RING_REQ_DESC *RingReqs;
PVSCSI_DMA_DESC RingReqsDmaDesc;
PVSCSI_RING_CMP_DESC *RingCmps;
PVSCSI_DMA_DESC RingCmpsDmaDesc;
} PVSCSI_RING_DESC;
#define PVSCSI_SIG SIGNATURE_32 ('P', 'S', 'C', 'S')
typedef struct {
UINT32 Signature;
EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 OriginalPciAttributes;
PVSCSI_RING_DESC RingDesc;
UINT8 MaxTarget;
UINT8 MaxLun;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru;