825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * CDDL HEADER START
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * The contents of this file are subject to the terms of the
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Common Development and Distribution License (the "License").
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * You may not use this file except in compliance with the License.
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * You can obtain a copy of the license at
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * http://www.opensource.org/licenses/cddl1.txt.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * See the License for the specific language governing permissions
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * and limitations under the License.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * When distributing Covered Code, include this CDDL HEADER in each
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * If applicable, add the following below this CDDL HEADER, with the
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * fields enclosed by brackets "[]" replaced with your own identifying
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * information: Portions Copyright [yyyy] [name of copyright owner]
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * CDDL HEADER END
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld * Copyright (c) 2004-2012 Emulex. All rights reserved.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Use is subject to license terms.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Queue entry defines */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* EQ entries */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define EQE_VALID 0x00000001 /* Mask for EQE valid */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define EQE_CQID 0xFFFF0000 /* Mask for EQE CQID */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* CQ entries */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Status defines */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define CQE_VALID 0x80000000 /* Mask for CQE valid */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Defines for CQE Codes */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* topology */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* att_type */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* shared_link_status */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* port_fault */
a9800beb32c1006bb21c8da39e0180ea440b7badGarrett D'Amore /* Words 0-2 */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* port_speed defines */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* event_code defines */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* FC Event */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* LINK_STATE - link_status defines */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* FCOE_FIP - evt_type defines */
a9800beb32c1006bb21c8da39e0180ea440b7badGarrett D'Amore/* GRP_5 - evt_type defines */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* PORT - evt_type defines */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Group 1 types */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Group 2 types */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* RQ entries */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Definitions for WQEs */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 2 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 2 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 2 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 2 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 2 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 2 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 4 - 5 */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define ABORT_XRI_TAG 1 /* Abort tag is a XRITag */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define ABORT_ABT_TAG 2 /* Abort tag is a AbortTag */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define ABORT_REQ_TAG 3 /* Abort tag is a RequestTag */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Word 0 - 4 */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Words 0-5 */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t word[6]; /* Words 0-5: cmd specific */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ELS_REQ_WQE ElsCmd; /* ELS command overlay */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan GEN_REQ_WQE GenReq; /* CT command overlay */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan FCP_WQE FcpCmd; /* FCP command overlay */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ELS_RSP_WQE ElsRsp; /* ELS response overlay */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan CREATE_XRI_WQE CreateXri; /* Create XRI */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan XMIT_SEQ_WQE XmitSeq; /* Xmit Sequence */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld uint32_t BsType: 3; /* DIF Block Size type */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t ContextType: 2; /* Context Type */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint16_t OXId; /* OXId on xmitted rsp */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* The following 16 bits may be */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* overwritten by PHWQ */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t WQEC: 1; /* Request WQE consumed CQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t ContextType: 2; /* Context Type */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld uint32_t BsType: 3; /* DIF Block Size type */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint16_t OXId; /* OXId on xmitted rsp */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* The following 16 bits may be */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* overwritten by PHWQ */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t WQEC: 1; /* Request WQE consumed CQE */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Words 12 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld uint32_t CmdSpecific; /* Command specific information */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld /* Words 13-15 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld/* Used if PHWQ is enabled */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld#define WQE_PHWQ_WQID(wqe, qid) *(((uint16_t *)(wqe)) + 21) = \
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld#define WQE_PHWQ_WQID(wqe, qid) *(((uint16_t *)(wqe)) + 20) = \
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Defines for ContextType */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Defines for CmdType */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Defines for ELSId */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld#define CQ_DEPTH_V2 ((4096/CQE_SIZE) * EMLXS_NUM_CQ_PAGES_V2) /* 1024 */
8f23e9fa8abcb5857661066b954e63400d589b65Hans Rosenfeld#define WQ_DEPTH ((4096/WQE_SIZE) * EMLXS_NUM_WQ_PAGES) /* 256 */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#define RQ_DEPTH 512 /* Multiple of RQB_COUNT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Principal doorbell register layouts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:14; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:10; /* RQ id for posted RQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_BIG_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:10; /* RQ id for posted RQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:14; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:8; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Index:8; /* Queue index for posted command */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:10; /* WQ id for posted WQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_BIG_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:10; /* WQ id for posted WQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Index:8; /* Queue index for posted command */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:8; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:2; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPopped:13; /* Number of CQ entries processed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Event:1; /* 1 if processed entry is EQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* 0 if processed entry is CQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:10; /* CQ id for posted CQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_BIG_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:10; /* CQ id for posted CQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Event:1; /* 1 if processed entry is EQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* 0 if processed entry is CQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPopped:13; /* Number of CQ entries processed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:2; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPopped:13; /* Number of CQ entries processed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Event:1; /* True iff processed entry is EQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Clear:1; /* clears EQ interrupt when set */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:9; /* EQ id for posted EQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_BIG_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:9; /* EQ id for posted EQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Clear:1; /* clears EQ interrupt when set */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Event:1; /* True iff processed entry is EQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPopped:13; /* Number of CQ entries processed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:14; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:11; /* MQ id for posted MQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_BIG_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t Qid:11; /* MQ id for posted MQE */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t NumPosted:14; /* Number of entries posted */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* _EMLXS_QUEUE_H */