From nobody Tue Nov 26 08:53:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+56544+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+56544+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1585425542; cv=none; d=zohomail.com; s=zohoarc; b=V1KSDoGSMShTEvyaBWFECgKvD43gxvs2b7YK92lLI+w2g6elLG0mQI9icFVxGtDOBBev/PlwKgd5tH2lZIYgTYcRkqb4dhsHOOS3MkqAnt10TVq5NVcLgyrviCaSyOD9Krq0J+KMoo7BsTUS7KyQUWm/DFM/ut/3BCLJiPZLsQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585425542; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=T2iKaT8f5DBGWnNxYicskngscMk5hzWxIT+Fn9B7ats=; b=Dgyu6FzoDBSICiuvj0Pl1CMSvV+hpZuya5cBtE4TxRCcN+nZCWqUjeUrZ/HYqw2cjRlMgoO5Q2ClLsABleQeHyQdt34f6UURoX0wLyUcXtCcKX1/y1/wyKXdffqpEf2hsJecp1cyDlBp5ScfIjK69ridnbVnJXbIHRTwtDjJc6g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+56544+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1585425542514165.47720814689148; Sat, 28 Mar 2020 12:59:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GK2IYY1788612xiTnaE5fOg3; Sat, 28 Mar 2020 12:59:02 -0700 X-Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web11.14079.1585425541501068302 for ; Sat, 28 Mar 2020 12:59:01 -0700 X-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02SJlFLw028015; Sat, 28 Mar 2020 19:59:01 GMT X-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 301xhkhh02-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Mar 2020 19:59:00 +0000 X-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 02SJoKGJ031927; Sat, 28 Mar 2020 19:59:00 GMT X-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 301vm90q6b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Mar 2020 19:59:00 +0000 X-Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 02SJwxWZ007274; Sat, 28 Mar 2020 19:58:59 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 28 Mar 2020 12:58:58 -0700 From: "Liran Alon" To: devel@edk2.groups.io, lersek@redhat.com Cc: nikita.leshchenko@oracle.com, aaron.young@oracle.com, jordan.l.justen@intel.com, ard.biesheuvel@linaro.org, Liran Alon Subject: [edk2-devel] [PATCH v3 11/17] OvmfPkg/PvScsiDxe: Define device interface structures and constants Date: Sat, 28 Mar 2020 23:00:54 +0300 Message-Id: <20200328200100.60786-12-liran.alon@oracle.com> In-Reply-To: <20200328200100.60786-1-liran.alon@oracle.com> References: <20200328200100.60786-1-liran.alon@oracle.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,liran.alon@oracle.com X-Gm-Message-State: ixntvQjbPdNxHw7SPC7l3zO1x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585425542; bh=r1zE8kZfAV8xD8f1Qsloug45CIrfnh/NYRxyYF0YVm0=; h=Cc:Date:From:Reply-To:Subject:To; b=dCnPSl5Z0wdQHQJdg/uH8d0pjIhaVSPTmS5vsI1Q2gEfHvZv/Mw49rg7x+wC/oQK+2A E1ngHG4+zSx3GzozP/NwhWKHAzcANAH9EjaXLzzznaRM9HuEJcpwtCkwidhhGuahPv6J8 bmJ0QxPSUQolgq7iDxOnD/IlP/eOuky1u8Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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=3D2567 Acked-by: Laszlo Ersek Signed-off-by: Liran Alon --- OvmfPkg/Include/IndustryStandard/PvScsi.h | 165 ++++++++++++++++++++++ 1 file changed, 165 insertions(+) diff --git a/OvmfPkg/Include/IndustryStandard/PvScsi.h b/OvmfPkg/Include/In= dustryStandard/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) =20 +// +// CDB (Command Descriptor Block) with size above this constant +// should be considered out-of-band +// +#define PVSCSI_CDB_MAX_SIZE (16) + +typedef enum { + PvScsiRegOffsetCommand =3D 0x0, + PvScsiRegOffsetCommandData =3D 0x4, + PvScsiRegOffsetCommandStatus =3D 0x8, + PvScsiRegOffsetLastSts0 =3D 0x100, + PvScsiRegOffsetLastSts1 =3D 0x104, + PvScsiRegOffsetLastSts2 =3D 0x108, + PvScsiRegOffsetLastSts3 =3D 0x10c, + PvScsiRegOffsetIntrStatus =3D 0x100c, + PvScsiRegOffsetIntrMask =3D 0x2010, + PvScsiRegOffsetKickNonRwIo =3D 0x3014, + PvScsiRegOffsetDebug =3D 0x3018, + PvScsiRegOffsetKickRwIo =3D 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 =3D 0, + PvScsiCmdAdapterReset =3D 1, + PvScsiCmdIssueScsi =3D 2, + PvScsiCmdSetupRings =3D 3, + PvScsiCmdResetBus =3D 4, + PvScsiCmdResetDevice =3D 5, + PvScsiCmdAbortCmd =3D 6, + PvScsiCmdConfig =3D 7, + PvScsiCmdSetupMsgRing =3D 8, + PvScsiCmdDeviceUnplug =3D 9, + PvScsiCmdLast =3D 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 =3D 0x00, // CCB complete normally with no er= rors + PvScsiBtStatLinkedCommandCompleted =3D 0x0a, + PvScsiBtStatLinkedCommandCompletedWithFlag =3D 0x0b, + PvScsiBtStatDataUnderrun =3D 0x0c, + PvScsiBtStatSelTimeout =3D 0x11, // SCSI selection timeout + PvScsiBtStatDatarun =3D 0x12, // Data overrun/underrun + PvScsiBtStatBusFree =3D 0x13, // Unexpected bus free + PvScsiBtStatInvPhase =3D 0x14, // + // Invalid bus phase or sequence requ= ested + // by target + // + PvScsiBtStatLunMismatch =3D 0x17, // + // Linked CCB has different LUN from = first + // CCB + // + PvScsiBtStatSensFailed =3D 0x1b, // Auto request sense failed + PvScsiBtStatTagReject =3D 0x1c, // + // SCSI II tagged queueing message re= jected + // by target + // + PvScsiBtStatBadMsg =3D 0x1d, // + // Unsupported message received by th= e host + // adapter + // + PvScsiBtStatHaHardware =3D 0x20, // Host adapter hardware failed + PvScsiBtStatNoResponse =3D 0x21, // + // Target did not respond to SCSI ATN= sent + // a SCSI RST + // + PvScsiBtStatSentRst =3D 0x22, // Host adapter asserted a SCSI RST + PvScsiBtStatRecvRst =3D 0x23, // Other SCSI devices asserted a SC= SI RST + PvScsiBtStatDisconnect =3D 0x24, // + // Target device reconnected improper= ly + // (w/o tag) + // + PvScsiBtStatBusReset =3D 0x25, // Host adapter issued BUS device r= eset + PvScsiBtStatAbortQueue =3D 0x26, // Abort queue generated + PvScsiBtStatHaSoftware =3D 0x27, // Host adapter software error + PvScsiBtStatHaTimeout =3D 0x30, // Host adapter hardware timeout er= ror + PvScsiBtStatScsiParity =3D 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_ --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#56544): https://edk2.groups.io/g/devel/message/56544 Mute This Topic: https://groups.io/mt/72617141/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-