xref: /freebsd-src/sys/dev/mpr/mpi/mpi2_pci.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
167feec50SStephen McConnell /*-
2*8736c018SKashyap D Desai  *  Copyright 2000-2020 Broadcom Inc. All rights reserved.
367feec50SStephen McConnell  *
467feec50SStephen McConnell  * Redistribution and use in source and binary forms, with or without
567feec50SStephen McConnell  * modification, are permitted provided that the following conditions
667feec50SStephen McConnell  * are met:
767feec50SStephen McConnell  * 1. Redistributions of source code must retain the above copyright
867feec50SStephen McConnell  *    notice, this list of conditions and the following disclaimer.
967feec50SStephen McConnell  * 2. Redistributions in binary form must reproduce the above copyright
1067feec50SStephen McConnell  *    notice, this list of conditions and the following disclaimer in the
1167feec50SStephen McConnell  *    documentation and/or other materials provided with the distribution.
1267feec50SStephen McConnell  * 3. Neither the name of the author nor the names of any co-contributors
1367feec50SStephen McConnell  *    may be used to endorse or promote products derived from this software
1467feec50SStephen McConnell  *    without specific prior written permission.
1567feec50SStephen McConnell  *
1667feec50SStephen McConnell  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1767feec50SStephen McConnell  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1867feec50SStephen McConnell  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1967feec50SStephen McConnell  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2067feec50SStephen McConnell  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2167feec50SStephen McConnell  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2267feec50SStephen McConnell  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2367feec50SStephen McConnell  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2467feec50SStephen McConnell  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2567feec50SStephen McConnell  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2667feec50SStephen McConnell  * SUCH DAMAGE.
2767feec50SStephen McConnell  *
28*8736c018SKashyap D Desai  * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD
2967feec50SStephen McConnell  */
3067feec50SStephen McConnell 
3167feec50SStephen McConnell /*
32*8736c018SKashyap D Desai  *  Copyright 2000-2020 Broadcom Inc. All rights reserved.
3367feec50SStephen McConnell  *
3467feec50SStephen McConnell  *
3567feec50SStephen McConnell  *           Name:  mpi2_pci.h
3667feec50SStephen McConnell  *          Title:  MPI PCIe Attached Devices structures and definitions.
3767feec50SStephen McConnell  *  Creation Date:  October 9, 2012
3867feec50SStephen McConnell  *
39*8736c018SKashyap D Desai  *  mpi2_pci.h Version:  02.00.03
4067feec50SStephen McConnell  *
4167feec50SStephen McConnell  *  NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
4267feec50SStephen McConnell  *        prefix are for use only on MPI v2.5 products, and must not be used
4367feec50SStephen McConnell  *        with MPI v2.0 products. Unless otherwise noted, names beginning with
4467feec50SStephen McConnell  *        MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
4567feec50SStephen McConnell  *
4667feec50SStephen McConnell  *  Version History
4767feec50SStephen McConnell  *  ---------------
4867feec50SStephen McConnell  *
4967feec50SStephen McConnell  *  Date      Version   Description
5067feec50SStephen McConnell  *  --------  --------  ------------------------------------------------------
5167feec50SStephen McConnell  *  03-16-15  02.00.00  Initial version.
5267feec50SStephen McConnell  *  02-17-16  02.00.01  Removed AHCI support.
5367feec50SStephen McConnell  *                      Removed SOP support.
5467feec50SStephen McConnell  *  07-01-16  02.00.02  Added MPI26_NVME_FLAGS_FORCE_ADMIN_ERR_RESP to
5567feec50SStephen McConnell  *                      NVME Encapsulated Request.
56*8736c018SKashyap D Desai  *  07-22-18  02.00.03  Updted flags field for NVME Encapsulated req
5767feec50SStephen McConnell  *  --------------------------------------------------------------------------
5867feec50SStephen McConnell  */
5967feec50SStephen McConnell 
6067feec50SStephen McConnell #ifndef MPI2_PCI_H
6167feec50SStephen McConnell #define MPI2_PCI_H
6267feec50SStephen McConnell 
6367feec50SStephen McConnell /*
6467feec50SStephen McConnell  * Values for the PCIe DeviceInfo field used in PCIe Device Status Change Event
6567feec50SStephen McConnell  * data and PCIe Configuration pages.
6667feec50SStephen McConnell  */
6767feec50SStephen McConnell #define MPI26_PCIE_DEVINFO_DIRECT_ATTACH        (0x00000010)
6867feec50SStephen McConnell 
6967feec50SStephen McConnell #define MPI26_PCIE_DEVINFO_MASK_DEVICE_TYPE     (0x0000000F)
7067feec50SStephen McConnell #define MPI26_PCIE_DEVINFO_NO_DEVICE            (0x00000000)
7167feec50SStephen McConnell #define MPI26_PCIE_DEVINFO_PCI_SWITCH           (0x00000001)
7267feec50SStephen McConnell #define MPI26_PCIE_DEVINFO_NVME                 (0x00000003)
7367feec50SStephen McConnell 
7467feec50SStephen McConnell /****************************************************************************
7567feec50SStephen McConnell *  NVMe Encapsulated message
7667feec50SStephen McConnell ****************************************************************************/
7767feec50SStephen McConnell 
7867feec50SStephen McConnell /* NVME Encapsulated Request Message */
7967feec50SStephen McConnell typedef struct _MPI26_NVME_ENCAPSULATED_REQUEST
8067feec50SStephen McConnell {
8167feec50SStephen McConnell     U16                     DevHandle;                      /* 0x00 */
8267feec50SStephen McConnell     U8                      ChainOffset;                    /* 0x02 */
8367feec50SStephen McConnell     U8                      Function;                       /* 0x03 */
8467feec50SStephen McConnell     U16                     EncapsulatedCommandLength;      /* 0x04 */
8567feec50SStephen McConnell     U8                      Reserved1;                      /* 0x06 */
8667feec50SStephen McConnell     U8                      MsgFlags;                       /* 0x07 */
8767feec50SStephen McConnell     U8                      VP_ID;                          /* 0x08 */
8867feec50SStephen McConnell     U8                      VF_ID;                          /* 0x09 */
8967feec50SStephen McConnell     U16                     Reserved2;                      /* 0x0A */
9067feec50SStephen McConnell     U32                     Reserved3;                      /* 0x0C */
9167feec50SStephen McConnell     U64                     ErrorResponseBaseAddress;       /* 0x10 */
9267feec50SStephen McConnell     U16                     ErrorResponseAllocationLength;  /* 0x18 */
9367feec50SStephen McConnell     U16                     Flags;                          /* 0x1A */
9467feec50SStephen McConnell     U32                     DataLength;                     /* 0x1C */
9567feec50SStephen McConnell     U8                      NVMe_Command[4];                /* 0x20 */ /* variable length */
9667feec50SStephen McConnell 
9767feec50SStephen McConnell } MPI26_NVME_ENCAPSULATED_REQUEST, MPI2_POINTER PTR_MPI26_NVME_ENCAPSULATED_REQUEST,
9867feec50SStephen McConnell   Mpi26NVMeEncapsulatedRequest_t, MPI2_POINTER pMpi26NVMeEncapsulatedRequest_t;
9967feec50SStephen McConnell 
10067feec50SStephen McConnell /* defines for the Flags field */
10167feec50SStephen McConnell #define MPI26_NVME_FLAGS_FORCE_ADMIN_ERR_RESP       (0x0020)
10267feec50SStephen McConnell /* Submission Queue Type*/
10367feec50SStephen McConnell #define MPI26_NVME_FLAGS_SUBMISSIONQ_MASK           (0x0010)
10467feec50SStephen McConnell #define MPI26_NVME_FLAGS_SUBMISSIONQ_IO             (0x0000)
10567feec50SStephen McConnell #define MPI26_NVME_FLAGS_SUBMISSIONQ_ADMIN          (0x0010)
10667feec50SStephen McConnell /* Error Response Address Space */
10767feec50SStephen McConnell #define MPI26_NVME_FLAGS_MASK_ERROR_RSP_ADDR        (0x000C)
108*8736c018SKashyap D Desai #define MPI26_NVME_FLAGS_MASK_ERROR_RSP_ADDR_MASK   (0x000C)
10967feec50SStephen McConnell #define MPI26_NVME_FLAGS_SYSTEM_RSP_ADDR            (0x0000)
110*8736c018SKashyap D Desai #define MPI26_NVME_FLAGS_IOCCTL_RSP_ADDR            (0x0008)
11167feec50SStephen McConnell /* Data Direction*/
11267feec50SStephen McConnell #define MPI26_NVME_FLAGS_DATADIRECTION_MASK         (0x0003)
11367feec50SStephen McConnell #define MPI26_NVME_FLAGS_NODATATRANSFER             (0x0000)
11467feec50SStephen McConnell #define MPI26_NVME_FLAGS_WRITE                      (0x0001)
11567feec50SStephen McConnell #define MPI26_NVME_FLAGS_READ                       (0x0002)
11667feec50SStephen McConnell #define MPI26_NVME_FLAGS_BIDIRECTIONAL              (0x0003)
11767feec50SStephen McConnell 
11867feec50SStephen McConnell /* NVMe Encapuslated Reply Message */
11967feec50SStephen McConnell typedef struct _MPI26_NVME_ENCAPSULATED_ERROR_REPLY
12067feec50SStephen McConnell {
12167feec50SStephen McConnell     U16                     DevHandle;                      /* 0x00 */
12267feec50SStephen McConnell     U8                      MsgLength;                      /* 0x02 */
12367feec50SStephen McConnell     U8                      Function;                       /* 0x03 */
12467feec50SStephen McConnell     U16                     EncapsulatedCommandLength;      /* 0x04 */
12567feec50SStephen McConnell     U8                      Reserved1;                      /* 0x06 */
12667feec50SStephen McConnell     U8                      MsgFlags;                       /* 0x07 */
12767feec50SStephen McConnell     U8                      VP_ID;                          /* 0x08 */
12867feec50SStephen McConnell     U8                      VF_ID;                          /* 0x09 */
12967feec50SStephen McConnell     U16                     Reserved2;                      /* 0x0A */
13067feec50SStephen McConnell     U16                     Reserved3;                      /* 0x0C */
13167feec50SStephen McConnell     U16                     IOCStatus;                      /* 0x0E */
13267feec50SStephen McConnell     U32                     IOCLogInfo;                     /* 0x10 */
13367feec50SStephen McConnell     U16                     ErrorResponseCount;             /* 0x14 */
13467feec50SStephen McConnell     U16                     Reserved4;                      /* 0x16 */
13567feec50SStephen McConnell } MPI26_NVME_ENCAPSULATED_ERROR_REPLY,
13667feec50SStephen McConnell   MPI2_POINTER PTR_MPI26_NVME_ENCAPSULATED_ERROR_REPLY,
13767feec50SStephen McConnell   Mpi26NVMeEncapsulatedErrorReply_t,
13867feec50SStephen McConnell   MPI2_POINTER pMpi26NVMeEncapsulatedErrorReply_t;
13967feec50SStephen McConnell 
14067feec50SStephen McConnell #endif
141