18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2000-2020 Broadcom Inc. All rights reserved.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *          Name:  mpi2_pci.h
68c2ecf20Sopenharmony_ci *         Title:  MPI PCIe Attached Devices structures and definitions.
78c2ecf20Sopenharmony_ci * Creation Date:  October 9, 2012
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * mpi2_pci.h Version:  02.00.04
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
128c2ecf20Sopenharmony_ci *       prefix are for use only on MPI v2.5 products, and must not be used
138c2ecf20Sopenharmony_ci *       with MPI v2.0 products. Unless otherwise noted, names beginning with
148c2ecf20Sopenharmony_ci *       MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
158c2ecf20Sopenharmony_ci *
168c2ecf20Sopenharmony_ci * Version History
178c2ecf20Sopenharmony_ci * ---------------
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * Date      Version   Description
208c2ecf20Sopenharmony_ci * --------  --------  ------------------------------------------------------
218c2ecf20Sopenharmony_ci * 03-16-15  02.00.00  Initial version.
228c2ecf20Sopenharmony_ci * 02-17-16  02.00.01  Removed AHCI support.
238c2ecf20Sopenharmony_ci *                     Removed SOP support.
248c2ecf20Sopenharmony_ci * 07-01-16  02.00.02  Added MPI26_NVME_FLAGS_FORCE_ADMIN_ERR_RESP to
258c2ecf20Sopenharmony_ci *                     NVME Encapsulated Request.
268c2ecf20Sopenharmony_ci * 07-22-18  02.00.03  Updted flags field for NVME Encapsulated req
278c2ecf20Sopenharmony_ci * 12-17-18  02.00.04  Added MPI26_PCIE_DEVINFO_SCSI
288c2ecf20Sopenharmony_ci *			Shortten some defines to be compatible with DOS
298c2ecf20Sopenharmony_ci * --------------------------------------------------------------------------
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifndef MPI2_PCI_H
338c2ecf20Sopenharmony_ci#define MPI2_PCI_H
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci *Values for the PCIe DeviceInfo field used in PCIe Device Status Change Event
388c2ecf20Sopenharmony_ci *data and PCIe Configuration pages.
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci#define MPI26_PCIE_DEVINFO_DIRECT_ATTACH        (0x00000010)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define MPI26_PCIE_DEVINFO_MASK_DEVICE_TYPE     (0x0000000F)
438c2ecf20Sopenharmony_ci#define MPI26_PCIE_DEVINFO_NO_DEVICE            (0x00000000)
448c2ecf20Sopenharmony_ci#define MPI26_PCIE_DEVINFO_PCI_SWITCH           (0x00000001)
458c2ecf20Sopenharmony_ci#define MPI26_PCIE_DEVINFO_NVME                 (0x00000003)
468c2ecf20Sopenharmony_ci#define MPI26_PCIE_DEVINFO_SCSI                 (0x00000004)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/****************************************************************************
498c2ecf20Sopenharmony_ci*  NVMe Encapsulated message
508c2ecf20Sopenharmony_ci****************************************************************************/
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/*NVME Encapsulated Request Message */
538c2ecf20Sopenharmony_citypedef struct _MPI26_NVME_ENCAPSULATED_REQUEST {
548c2ecf20Sopenharmony_ci	U16	DevHandle;                      /*0x00 */
558c2ecf20Sopenharmony_ci	U8	ChainOffset;                    /*0x02 */
568c2ecf20Sopenharmony_ci	U8	Function;                       /*0x03 */
578c2ecf20Sopenharmony_ci	U16	EncapsulatedCommandLength;      /*0x04 */
588c2ecf20Sopenharmony_ci	U8	Reserved1;                      /*0x06 */
598c2ecf20Sopenharmony_ci	U8	MsgFlags;                       /*0x07 */
608c2ecf20Sopenharmony_ci	U8	VP_ID;                          /*0x08 */
618c2ecf20Sopenharmony_ci	U8	VF_ID;                          /*0x09 */
628c2ecf20Sopenharmony_ci	U16	Reserved2;                      /*0x0A */
638c2ecf20Sopenharmony_ci	U32	Reserved3;                      /*0x0C */
648c2ecf20Sopenharmony_ci	U64	ErrorResponseBaseAddress;       /*0x10 */
658c2ecf20Sopenharmony_ci	U16	ErrorResponseAllocationLength;  /*0x18 */
668c2ecf20Sopenharmony_ci	U16	Flags;                          /*0x1A */
678c2ecf20Sopenharmony_ci	U32	DataLength;                     /*0x1C */
688c2ecf20Sopenharmony_ci	U8	NVMe_Command[4];                /*0x20 */
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci} MPI26_NVME_ENCAPSULATED_REQUEST, *PTR_MPI26_NVME_ENCAPSULATED_REQUEST,
718c2ecf20Sopenharmony_ci	Mpi26NVMeEncapsulatedRequest_t, *pMpi26NVMeEncapsulatedRequest_t;
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/*defines for the Flags field */
748c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_FORCE_ADMIN_ERR_RESP       (0x0020)
758c2ecf20Sopenharmony_ci/*Submission Queue Type*/
768c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_SUBMISSIONQ_MASK           (0x0010)
778c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_SUBMISSIONQ_IO             (0x0000)
788c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_SUBMISSIONQ_ADMIN          (0x0010)
798c2ecf20Sopenharmony_ci/*Error Response Address Space */
808c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_ERR_RSP_ADDR_MASK          (0x000C)
818c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_ERR_RSP_ADDR_SYSTEM        (0x0000)
828c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_ERR_RSP_ADDR_IOCTL         (0x0008)
838c2ecf20Sopenharmony_ci/* Data Direction*/
848c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_DATADIRECTION_MASK         (0x0003)
858c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_NODATATRANSFER             (0x0000)
868c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_WRITE                      (0x0001)
878c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_READ                       (0x0002)
888c2ecf20Sopenharmony_ci#define MPI26_NVME_FLAGS_BIDIRECTIONAL              (0x0003)
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/*NVMe Encapuslated Reply Message */
928c2ecf20Sopenharmony_citypedef struct _MPI26_NVME_ENCAPSULATED_ERROR_REPLY {
938c2ecf20Sopenharmony_ci	U16	DevHandle;                      /*0x00 */
948c2ecf20Sopenharmony_ci	U8	MsgLength;                      /*0x02 */
958c2ecf20Sopenharmony_ci	U8	Function;                       /*0x03 */
968c2ecf20Sopenharmony_ci	U16	EncapsulatedCommandLength;      /*0x04 */
978c2ecf20Sopenharmony_ci	U8	Reserved1;                      /*0x06 */
988c2ecf20Sopenharmony_ci	U8	MsgFlags;                       /*0x07 */
998c2ecf20Sopenharmony_ci	U8	VP_ID;                          /*0x08 */
1008c2ecf20Sopenharmony_ci	U8	VF_ID;                          /*0x09 */
1018c2ecf20Sopenharmony_ci	U16	Reserved2;                      /*0x0A */
1028c2ecf20Sopenharmony_ci	U16	Reserved3;                      /*0x0C */
1038c2ecf20Sopenharmony_ci	U16	IOCStatus;                      /*0x0E */
1048c2ecf20Sopenharmony_ci	U32	IOCLogInfo;                     /*0x10 */
1058c2ecf20Sopenharmony_ci	U16	ErrorResponseCount;             /*0x14 */
1068c2ecf20Sopenharmony_ci	U16	Reserved4;                      /*0x16 */
1078c2ecf20Sopenharmony_ci} MPI26_NVME_ENCAPSULATED_ERROR_REPLY,
1088c2ecf20Sopenharmony_ci	*PTR_MPI26_NVME_ENCAPSULATED_ERROR_REPLY,
1098c2ecf20Sopenharmony_ci	Mpi26NVMeEncapsulatedErrorReply_t,
1108c2ecf20Sopenharmony_ci	*pMpi26NVMeEncapsulatedErrorReply_t;
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#endif
114