From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, liran.alon@oracle.com
Cc: nikita.leshchenko@oracle.com, aaron.young@oracle.com,
jordan.l.justen@intel.com, ard.biesheuvel@linaro.org
Subject: Re: [edk2-devel] [PATCH v2 11/17] OvmfPkg/PvScsiDxe: Define device interface structures and constants
Date: Thu, 26 Mar 2020 18:19:33 +0100 [thread overview]
Message-ID: <57713bb7-a41a-6135-8247-ea84bdd7d1d9@redhat.com> (raw)
In-Reply-To: <20200325161005.16743-12-liran.alon@oracle.com>
On 03/25/20 17:09, Liran Alon wrote:
> These definitions will be used by the following commits to complete the
> implementation of PVSCSI device driver.
>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
> Signed-off-by: Liran Alon <liran.alon@oracle.com>
> ---
> OvmfPkg/Include/IndustryStandard/PvScsi.h | 165 ++++++++++++++++++++++
> 1 file changed, 165 insertions(+)
>
> diff --git a/OvmfPkg/Include/IndustryStandard/PvScsi.h b/OvmfPkg/Include/IndustryStandard/PvScsi.h
> index 004c0af84989..a4d6634f3ba0 100644
> --- a/OvmfPkg/Include/IndustryStandard/PvScsi.h
> +++ b/OvmfPkg/Include/IndustryStandard/PvScsi.h
> @@ -18,4 +18,169 @@
> #define PCI_VENDOR_ID_VMWARE (0x15ad)
> #define PCI_DEVICE_ID_VMWARE_PVSCSI (0x07c0)
>
> +//
> +// CDB (Command Descriptor Block) with size above this constant
> +// should be considered out-of-band
> +//
> +#define PVSCSI_CDB_MAX_SIZE (16)
> +
> +typedef enum {
> + PvScsiRegOffsetCommand = 0x0,
> + PvScsiRegOffsetCommandData = 0x4,
> + PvScsiRegOffsetCommandStatus = 0x8,
> + PvScsiRegOffsetLastSts0 = 0x100,
> + PvScsiRegOffsetLastSts1 = 0x104,
> + PvScsiRegOffsetLastSts2 = 0x108,
> + PvScsiRegOffsetLastSts3 = 0x10c,
> + PvScsiRegOffsetIntrStatus = 0x100c,
> + PvScsiRegOffsetIntrMask = 0x2010,
> + PvScsiRegOffsetKickNonRwIo = 0x3014,
> + PvScsiRegOffsetDebug = 0x3018,
> + PvScsiRegOffsetKickRwIo = 0x4018,
> +} PVSCSI_BAR0_OFFSETS;
> +
> +//
> +// Define Interrupt-Status register flags
> +//
> +#define PVSCSI_INTR_CMPL_0 BIT0
> +#define PVSCSI_INTR_CMPL_1 BIT1
> +#define PVSCSI_INTR_CMPL_MASK (PVSCSI_INTR_CMPL_0 | PVSCSI_INTR_CMPL_1)
> +
> +typedef enum {
> + PvScsiCmdFirst = 0,
> + PvScsiCmdAdapterReset = 1,
> + PvScsiCmdIssueScsi = 2,
> + PvScsiCmdSetupRings = 3,
> + PvScsiCmdResetBus = 4,
> + PvScsiCmdResetDevice = 5,
> + PvScsiCmdAbortCmd = 6,
> + PvScsiCmdConfig = 7,
> + PvScsiCmdSetupMsgRing = 8,
> + PvScsiCmdDeviceUnplug = 9,
> + PvScsiCmdLast = 10
> +} PVSCSI_COMMANDS;
> +
> +#define PVSCSI_SETUP_RINGS_MAX_NUM_PAGES (32)
> +
> +#pragma pack (1)
> +typedef struct {
> + UINT32 ReqRingNumPages;
> + UINT32 CmpRingNumPages;
> + UINT64 RingsStatePPN;
> + UINT64 ReqRingPPNs[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
> + UINT64 CmpRingPPNs[PVSCSI_SETUP_RINGS_MAX_NUM_PAGES];
> +} PVSCSI_CMD_DESC_SETUP_RINGS;
> +#pragma pack ()
> +
> +#define PVSCSI_MAX_CMD_DATA_WORDS \
> + (sizeof (PVSCSI_CMD_DESC_SETUP_RINGS) / sizeof (UINT32))
> +
> +#pragma pack (1)
> +typedef struct {
> + UINT32 ReqProdIdx;
> + UINT32 ReqConsIdx;
> + UINT32 ReqNumEntriesLog2;
> +
> + UINT32 CmpProdIdx;
> + UINT32 CmpConsIdx;
> + UINT32 CmpNumEntriesLog2;
> +
> + UINT8 Pad[104];
> +
> + UINT32 MsgProdIdx;
> + UINT32 MsgConsIdx;
> + UINT32 MsgNumEntriesLog2;
> +} PVSCSI_RINGS_STATE;
> +#pragma pack ()
> +
> +//
> +// Define PVSCSI request descriptor tags
> +//
> +#define PVSCSI_SIMPLE_QUEUE_TAG (0x20)
> +
> +//
> +// Define PVSCSI request descriptor flags
> +//
> +#define PVSCSI_FLAG_CMD_WITH_SG_LIST BIT0
> +#define PVSCSI_FLAG_CMD_OUT_OF_BAND_CDB BIT1
> +#define PVSCSI_FLAG_CMD_DIR_NONE BIT2
> +#define PVSCSI_FLAG_CMD_DIR_TOHOST BIT3
> +#define PVSCSI_FLAG_CMD_DIR_TODEVICE BIT4
> +
> +#pragma pack (1)
> +typedef struct {
> + UINT64 Context;
> + UINT64 DataAddr;
> + UINT64 DataLen;
> + UINT64 SenseAddr;
> + UINT32 SenseLen;
> + UINT32 Flags;
> + UINT8 Cdb[16];
> + UINT8 CdbLen;
> + UINT8 Lun[8];
> + UINT8 Tag;
> + UINT8 Bus;
> + UINT8 Target;
> + UINT8 VcpuHint;
> + UINT8 Unused[59];
> +} PVSCSI_RING_REQ_DESC;
> +#pragma pack ()
> +
> +//
> +// Host adapter status/error codes
> +//
> +typedef enum {
> + PvScsiBtStatSuccess = 0x00, // CCB complete normally with no errors
> + PvScsiBtStatLinkedCommandCompleted = 0x0a,
> + PvScsiBtStatLinkedCommandCompletedWithFlag = 0x0b,
> + PvScsiBtStatDataUnderrun = 0x0c,
> + PvScsiBtStatSelTimeout = 0x11, // SCSI selection timeout
> + PvScsiBtStatDatarun = 0x12, // Data overrun/underrun
> + PvScsiBtStatBusFree = 0x13, // Unexpected bus free
> + PvScsiBtStatInvPhase = 0x14, //
> + // Invalid bus phase or sequence requested
> + // by target
> + //
> + PvScsiBtStatLunMismatch = 0x17, //
> + // Linked CCB has different LUN from first
> + // CCB
> + //
> + PvScsiBtStatSensFailed = 0x1b, // Auto request sense failed
> + PvScsiBtStatTagReject = 0x1c, //
> + // SCSI II tagged queueing message rejected
> + // by target
> + //
> + PvScsiBtStatBadMsg = 0x1d, //
> + // Unsupported message received by the host
> + // adapter
> + //
> + PvScsiBtStatHaHardware = 0x20, // Host adapter hardware failed
> + PvScsiBtStatNoResponse = 0x21, //
> + // Target did not respond to SCSI ATN sent
> + // a SCSI RST
> + //
> + PvScsiBtStatSentRst = 0x22, // Host adapter asserted a SCSI RST
> + PvScsiBtStatRecvRst = 0x23, // Other SCSI devices asserted a SCSI RST
> + PvScsiBtStatDisconnect = 0x24, //
> + // Target device reconnected improperly
> + // (w/o tag)
> + //
> + PvScsiBtStatBusReset = 0x25, // Host adapter issued BUS device reset
> + PvScsiBtStatAbortQueue = 0x26, // Abort queue generated
> + PvScsiBtStatHaSoftware = 0x27, // Host adapter software error
> + PvScsiBtStatHaTimeout = 0x30, // Host adapter hardware timeout error
> + PvScsiBtStatScsiParity = 0x34, // SCSI parity error detected
> +} PVSCSI_HOST_BUS_ADAPTER_STATUS;
> +
> +#pragma pack (1)
> +typedef struct {
> + UINT64 Context;
> + UINT64 DataLen;
> + UINT32 SenseLen;
> + UINT16 HostStatus;
> + UINT16 ScsiStatus;
> + UINT32 Pad[2];
> +} PVSCSI_RING_CMP_DESC;
> +#pragma pack ()
> +
> #endif // __PVSCSI_H_
>
Acked-by: Laszlo Ersek <lersek@redhat.com>
(Not an R-b because I haven't validated the various structures and
constants against the device model. But stylistically, this patch can
certainly be merged, now.)
Thanks,
Laszlo
next prev parent reply other threads:[~2020-03-26 17:19 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 16:09 [PATCH v2 00/17] OvmfPkg: Support booting from VMware PVSCSI controller Liran Alon
2020-03-25 16:09 ` [PATCH v2 01/17] OvmfPkg/PvScsiDxe: Create empty driver Liran Alon
2020-03-26 14:44 ` [edk2-devel] " Laszlo Ersek
2020-03-25 16:09 ` [PATCH v2 02/17] OvmfPkg/PvScsiDxe: Install DriverBinding protocol Liran Alon
2020-03-25 16:09 ` [PATCH v2 03/17] OvmfPkg/PvScsiDxe: Report name of driver Liran Alon
2020-03-25 16:09 ` [PATCH v2 04/17] OvmfPkg/PvScsiDxe: Probe PCI devices and look for PvScsi Liran Alon
2020-03-25 16:09 ` [PATCH v2 05/17] OvmfPkg/PvScsiDxe: Install stubbed EXT_SCSI_PASS_THRU Liran Alon
2020-03-25 16:09 ` [PATCH v2 06/17] OvmfPkg/PvScsiDxe: Report the number of targets and LUNs Liran Alon
2020-03-25 16:09 ` [PATCH v2 07/17] OvmfPkg/PvScsiDxe: Translate Target & LUN to/from DevicePath Liran Alon
2020-03-25 16:09 ` [PATCH v2 08/17] OvmfPkg/PvScsiDxe: Open PciIo protocol for later use Liran Alon
2020-03-25 16:09 ` [PATCH v2 09/17] OvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit Liran Alon
2020-03-26 17:04 ` [edk2-devel] " Laszlo Ersek
2020-03-25 16:09 ` [PATCH v2 10/17] OvmfPkg/PvScsiDxe: Enable MMIO-Space & Bus-Mastering in PCI attributes Liran Alon
2020-03-26 17:12 ` Laszlo Ersek
2020-03-25 16:09 ` [PATCH v2 11/17] OvmfPkg/PvScsiDxe: Define device interface structures and constants Liran Alon
2020-03-26 17:19 ` Laszlo Ersek [this message]
2020-03-25 16:10 ` [PATCH v2 12/17] OvmfPkg/PvScsiDxe: Reset adapter on init Liran Alon
2020-03-26 18:25 ` [edk2-devel] " Laszlo Ersek
2020-03-25 16:10 ` [PATCH v2 13/17] OvmfPkg/PvScsiDxe: Setup requests and completions rings Liran Alon
2020-03-26 20:51 ` Laszlo Ersek
2020-03-25 16:10 ` [PATCH v2 14/17] OvmfPkg/PvScsiDxe: Introduce DMA communication buffer Liran Alon
2020-03-26 22:17 ` Laszlo Ersek
2020-03-27 0:05 ` Liran Alon
2020-03-27 13:35 ` Laszlo Ersek
2020-03-27 21:31 ` Liran Alon
2020-03-30 11:29 ` Laszlo Ersek
2020-03-25 16:10 ` [PATCH v2 15/17] OvmfPkg/PvScsiDxe: Support sending SCSI request and receive response Liran Alon
2020-03-27 11:26 ` [edk2-devel] " Laszlo Ersek
2020-03-27 13:04 ` Liran Alon
2020-03-27 13:20 ` Liran Alon
2020-03-27 21:05 ` Laszlo Ersek
2020-03-27 21:05 ` Laszlo Ersek
2020-03-27 22:04 ` Liran Alon
2020-03-27 22:17 ` Liran Alon
2020-03-28 19:18 ` Liran Alon
2020-03-30 11:23 ` Laszlo Ersek
2020-03-30 11:12 ` Laszlo Ersek
2020-03-30 10:30 ` Laszlo Ersek
2020-03-25 16:10 ` [PATCH v2 16/17] OvmfPkg/PvScsiDxe: Reset device on ExitBootServices() Liran Alon
2020-03-25 16:10 ` [PATCH v2 17/17] OvmfPkg/PvScsiDxe: Enable device 64-bit DMA addresses Liran Alon
2020-03-26 22:29 ` [edk2-devel] " Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57713bb7-a41a-6135-8247-ea84bdd7d1d9@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox