xref: /freebsd/sys/dev/mpi3mr/mpi/mpi30_pci.h (revision baabb919345f05e9892c4048a1521e5da1403060)
1 /*
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
5  * Support: <fbsd-storage-driver.pdl@broadcom.com>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  *    this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  *    this list of conditions and the following disclaimer in the documentation and/or other
15  *    materials provided with the distribution.
16  * 3. Neither the name of the Broadcom Inc. nor the names of its contributors
17  *    may be used to endorse or promote products derived from this software without
18  *    specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  * The views and conclusions contained in the software and documentation are
33  * those of the authors and should not be interpreted as representing
34  * official policies,either expressed or implied, of the FreeBSD Project.
35  *
36  * Mail to: Broadcom Inc 1320 Ridder Park Dr, San Jose, CA 95131
37  *
38  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
39  *
40  */
41 #ifndef MPI30_PCI_H
42 #define MPI30_PCI_H     1
43 
44 /*****************************************************************************
45  *              NVMe Encapsulated Request Message                            *
46  ****************************************************************************/
47 #ifndef MPI3_NVME_ENCAP_CMD_MAX
48 #define MPI3_NVME_ENCAP_CMD_MAX               (1)
49 #endif  /* MPI3_NVME_ENCAP_CMD_MAX */
50 
51 typedef struct _MPI3_NVME_ENCAPSULATED_REQUEST
52 {
53     U16                     HostTag;                           /* 0x00 */
54     U8                      IOCUseOnly02;                      /* 0x02 */
55     U8                      Function;                          /* 0x03 */
56     U16                     IOCUseOnly04;                      /* 0x04 */
57     U8                      IOCUseOnly06;                      /* 0x06 */
58     U8                      MsgFlags;                          /* 0x07 */
59     U16                     ChangeCount;                       /* 0x08 */
60     U16                     DevHandle;                         /* 0x0A */
61     U16                     EncapsulatedCommandLength;         /* 0x0C */
62     U16                     Flags;                             /* 0x0E */
63     U32                     DataLength;                        /* 0x10 */
64     U32                     Reserved14[3];                     /* 0x14 */
65     U32                     Command[MPI3_NVME_ENCAP_CMD_MAX];  /* 0x20 */     /* variable length */
66 } MPI3_NVME_ENCAPSULATED_REQUEST, MPI3_POINTER PTR_MPI3_NVME_ENCAPSULATED_REQUEST,
67   Mpi3NVMeEncapsulatedRequest_t, MPI3_POINTER pMpi3NVMeEncapsulatedRequest_t;
68 
69 /**** Defines for the Flags field ****/
70 #define MPI3_NVME_FLAGS_FORCE_ADMIN_ERR_REPLY_MASK      (0x0002)
71 #define MPI3_NVME_FLAGS_FORCE_ADMIN_ERR_REPLY_FAIL_ONLY (0x0000)
72 #define MPI3_NVME_FLAGS_FORCE_ADMIN_ERR_REPLY_ALL       (0x0002)
73 #define MPI3_NVME_FLAGS_SUBMISSIONQ_MASK                (0x0001)
74 #define MPI3_NVME_FLAGS_SUBMISSIONQ_IO                  (0x0000)
75 #define MPI3_NVME_FLAGS_SUBMISSIONQ_ADMIN               (0x0001)
76 
77 
78 /*****************************************************************************
79  *              NVMe Encapsulated Error Reply Message                        *
80  ****************************************************************************/
81 typedef struct _MPI3_NVME_ENCAPSULATED_ERROR_REPLY
82 {
83     U16                     HostTag;                    /* 0x00 */
84     U8                      IOCUseOnly02;               /* 0x02 */
85     U8                      Function;                   /* 0x03 */
86     U16                     IOCUseOnly04;               /* 0x04 */
87     U8                      IOCUseOnly06;               /* 0x06 */
88     U8                      MsgFlags;                   /* 0x07 */
89     U16                     IOCUseOnly08;               /* 0x08 */
90     U16                     IOCStatus;                  /* 0x0A */
91     U32                     IOCLogInfo;                 /* 0x0C */
92     U32                     NVMeCompletionEntry[4];     /* 0x10 */
93 } MPI3_NVME_ENCAPSULATED_ERROR_REPLY, MPI3_POINTER PTR_MPI3_NVME_ENCAPSULATED_ERROR_REPLY,
94   Mpi3NVMeEncapsulatedErrorReply_t, MPI3_POINTER pMpi3NVMeEncapsulatedErrorReply_t;
95 
96 #endif  /* MPI30_PCI_H */
97