3 Internal definitions for the PVSCSI driver, which produces Extended SCSI
4 Pass Thru Protocol instances for pvscsi devices.
6 Copyright (C) 2020, Oracle and/or its affiliates.
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef __PVSCSI_DXE_H_
13 #define __PVSCSI_DXE_H_
15 #include <Library/DebugLib.h>
16 #include <Protocol/ScsiPassThruExt.h>
19 EFI_PHYSICAL_ADDRESS DeviceAddress
;
24 PVSCSI_RINGS_STATE
*RingState
;
25 PVSCSI_DMA_DESC RingStateDmaDesc
;
27 PVSCSI_RING_REQ_DESC
*RingReqs
;
28 PVSCSI_DMA_DESC RingReqsDmaDesc
;
30 PVSCSI_RING_CMP_DESC
*RingCmps
;
31 PVSCSI_DMA_DESC RingCmpsDmaDesc
;
36 // As EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET.SenseDataLength is defined
37 // as UINT8, defining here SenseData size to MAX_UINT8 will guarantee it
38 // cannot overflow when passed to device.
40 UINT8 SenseData
[MAX_UINT8
];
42 // This size of the data is arbitrarily chosen.
43 // It seems to be sufficient for all I/O requests sent through
44 // EFI_SCSI_PASS_THRU_PROTOCOL.PassThru() for common boot scenarios.
49 #define PVSCSI_SIG SIGNATURE_32 ('P', 'S', 'C', 'S')
53 EFI_PCI_IO_PROTOCOL
*PciIo
;
55 UINT64 OriginalPciAttributes
;
56 PVSCSI_RING_DESC RingDesc
;
57 PVSCSI_DMA_BUFFER
*DmaBuf
;
58 PVSCSI_DMA_DESC DmaBufDmaDesc
;
61 UINTN WaitForCmpStallInUsecs
;
62 EFI_EXT_SCSI_PASS_THRU_PROTOCOL PassThru
;
63 EFI_EXT_SCSI_PASS_THRU_MODE PassThruMode
;
66 #define PVSCSI_FROM_PASS_THRU(PassThruPointer) \
67 CR (PassThruPointer, PVSCSI_DEV, PassThru, PVSCSI_SIG)
69 #define PVSCSI_DMA_BUF_DEV_ADDR(Dev, MemberName) \
70 (Dev->DmaBufDmaDesc.DeviceAddress + OFFSET_OF(PVSCSI_DMA_BUFFER, MemberName))
72 #endif // __PVSCSI_DXE_H_