xref: /freebsd-src/sys/dev/mpi3mr/mpi/mpi30_pci.h (revision baabb919345f05e9892c4048a1521e5da1403060)
12d1d418eSSumit Saxena /*
2*baabb919SChandrakanth patil  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
32d1d418eSSumit Saxena  *
4*baabb919SChandrakanth patil  * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
52d1d418eSSumit Saxena  * Support: <fbsd-storage-driver.pdl@broadcom.com>
62d1d418eSSumit Saxena  *
72d1d418eSSumit Saxena  * Redistribution and use in source and binary forms, with or without
82d1d418eSSumit Saxena  * modification, are permitted provided that the following conditions are
92d1d418eSSumit Saxena  * met:
102d1d418eSSumit Saxena  *
112d1d418eSSumit Saxena  * 1. Redistributions of source code must retain the above copyright notice,
122d1d418eSSumit Saxena  *    this list of conditions and the following disclaimer.
132d1d418eSSumit Saxena  * 2. Redistributions in binary form must reproduce the above copyright notice,
142d1d418eSSumit Saxena  *    this list of conditions and the following disclaimer in the documentation and/or other
152d1d418eSSumit Saxena  *    materials provided with the distribution.
162d1d418eSSumit Saxena  * 3. Neither the name of the Broadcom Inc. nor the names of its contributors
172d1d418eSSumit Saxena  *    may be used to endorse or promote products derived from this software without
182d1d418eSSumit Saxena  *    specific prior written permission.
192d1d418eSSumit Saxena  *
202d1d418eSSumit Saxena  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
212d1d418eSSumit Saxena  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
222d1d418eSSumit Saxena  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
232d1d418eSSumit Saxena  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
242d1d418eSSumit Saxena  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
252d1d418eSSumit Saxena  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
262d1d418eSSumit Saxena  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
272d1d418eSSumit Saxena  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
282d1d418eSSumit Saxena  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
292d1d418eSSumit Saxena  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
302d1d418eSSumit Saxena  * POSSIBILITY OF SUCH DAMAGE.
312d1d418eSSumit Saxena  *
322d1d418eSSumit Saxena  * The views and conclusions contained in the software and documentation are
332d1d418eSSumit Saxena  * those of the authors and should not be interpreted as representing
342d1d418eSSumit Saxena  * official policies,either expressed or implied, of the FreeBSD Project.
352d1d418eSSumit Saxena  *
362d1d418eSSumit Saxena  * Mail to: Broadcom Inc 1320 Ridder Park Dr, San Jose, CA 95131
372d1d418eSSumit Saxena  *
382d1d418eSSumit Saxena  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
392d1d418eSSumit Saxena  *
402d1d418eSSumit Saxena  */
412d1d418eSSumit Saxena #ifndef MPI30_PCI_H
422d1d418eSSumit Saxena #define MPI30_PCI_H     1
432d1d418eSSumit Saxena 
442d1d418eSSumit Saxena /*****************************************************************************
452d1d418eSSumit Saxena  *              NVMe Encapsulated Request Message                            *
462d1d418eSSumit Saxena  ****************************************************************************/
472d1d418eSSumit Saxena #ifndef MPI3_NVME_ENCAP_CMD_MAX
482d1d418eSSumit Saxena #define MPI3_NVME_ENCAP_CMD_MAX               (1)
492d1d418eSSumit Saxena #endif  /* MPI3_NVME_ENCAP_CMD_MAX */
502d1d418eSSumit Saxena 
512d1d418eSSumit Saxena typedef struct _MPI3_NVME_ENCAPSULATED_REQUEST
522d1d418eSSumit Saxena {
532d1d418eSSumit Saxena     U16                     HostTag;                           /* 0x00 */
542d1d418eSSumit Saxena     U8                      IOCUseOnly02;                      /* 0x02 */
552d1d418eSSumit Saxena     U8                      Function;                          /* 0x03 */
562d1d418eSSumit Saxena     U16                     IOCUseOnly04;                      /* 0x04 */
572d1d418eSSumit Saxena     U8                      IOCUseOnly06;                      /* 0x06 */
582d1d418eSSumit Saxena     U8                      MsgFlags;                          /* 0x07 */
592d1d418eSSumit Saxena     U16                     ChangeCount;                       /* 0x08 */
602d1d418eSSumit Saxena     U16                     DevHandle;                         /* 0x0A */
612d1d418eSSumit Saxena     U16                     EncapsulatedCommandLength;         /* 0x0C */
622d1d418eSSumit Saxena     U16                     Flags;                             /* 0x0E */
632d1d418eSSumit Saxena     U32                     DataLength;                        /* 0x10 */
642d1d418eSSumit Saxena     U32                     Reserved14[3];                     /* 0x14 */
652d1d418eSSumit Saxena     U32                     Command[MPI3_NVME_ENCAP_CMD_MAX];  /* 0x20 */     /* variable length */
662d1d418eSSumit Saxena } MPI3_NVME_ENCAPSULATED_REQUEST, MPI3_POINTER PTR_MPI3_NVME_ENCAPSULATED_REQUEST,
672d1d418eSSumit Saxena   Mpi3NVMeEncapsulatedRequest_t, MPI3_POINTER pMpi3NVMeEncapsulatedRequest_t;
682d1d418eSSumit Saxena 
692d1d418eSSumit Saxena /**** Defines for the Flags field ****/
702d1d418eSSumit Saxena #define MPI3_NVME_FLAGS_FORCE_ADMIN_ERR_REPLY_MASK      (0x0002)
712d1d418eSSumit Saxena #define MPI3_NVME_FLAGS_FORCE_ADMIN_ERR_REPLY_FAIL_ONLY (0x0000)
722d1d418eSSumit Saxena #define MPI3_NVME_FLAGS_FORCE_ADMIN_ERR_REPLY_ALL       (0x0002)
732d1d418eSSumit Saxena #define MPI3_NVME_FLAGS_SUBMISSIONQ_MASK                (0x0001)
742d1d418eSSumit Saxena #define MPI3_NVME_FLAGS_SUBMISSIONQ_IO                  (0x0000)
752d1d418eSSumit Saxena #define MPI3_NVME_FLAGS_SUBMISSIONQ_ADMIN               (0x0001)
762d1d418eSSumit Saxena 
772d1d418eSSumit Saxena 
782d1d418eSSumit Saxena /*****************************************************************************
792d1d418eSSumit Saxena  *              NVMe Encapsulated Error Reply Message                        *
802d1d418eSSumit Saxena  ****************************************************************************/
812d1d418eSSumit Saxena typedef struct _MPI3_NVME_ENCAPSULATED_ERROR_REPLY
822d1d418eSSumit Saxena {
832d1d418eSSumit Saxena     U16                     HostTag;                    /* 0x00 */
842d1d418eSSumit Saxena     U8                      IOCUseOnly02;               /* 0x02 */
852d1d418eSSumit Saxena     U8                      Function;                   /* 0x03 */
862d1d418eSSumit Saxena     U16                     IOCUseOnly04;               /* 0x04 */
872d1d418eSSumit Saxena     U8                      IOCUseOnly06;               /* 0x06 */
882d1d418eSSumit Saxena     U8                      MsgFlags;                   /* 0x07 */
892d1d418eSSumit Saxena     U16                     IOCUseOnly08;               /* 0x08 */
902d1d418eSSumit Saxena     U16                     IOCStatus;                  /* 0x0A */
912d1d418eSSumit Saxena     U32                     IOCLogInfo;                 /* 0x0C */
922d1d418eSSumit Saxena     U32                     NVMeCompletionEntry[4];     /* 0x10 */
932d1d418eSSumit Saxena } MPI3_NVME_ENCAPSULATED_ERROR_REPLY, MPI3_POINTER PTR_MPI3_NVME_ENCAPSULATED_ERROR_REPLY,
942d1d418eSSumit Saxena   Mpi3NVMeEncapsulatedErrorReply_t, MPI3_POINTER pMpi3NVMeEncapsulatedErrorReply_t;
952d1d418eSSumit Saxena 
962d1d418eSSumit Saxena #endif  /* MPI30_PCI_H */
97