xref: /onnv-gate/usr/src/uts/common/sys/ib/adapters/hermon/hermon_cmd.h (revision 12965:b65a8427f8fe)
19517SBill.Taylor@Sun.COM /*
29517SBill.Taylor@Sun.COM  * CDDL HEADER START
39517SBill.Taylor@Sun.COM  *
49517SBill.Taylor@Sun.COM  * The contents of this file are subject to the terms of the
59517SBill.Taylor@Sun.COM  * Common Development and Distribution License (the "License").
69517SBill.Taylor@Sun.COM  * You may not use this file except in compliance with the License.
79517SBill.Taylor@Sun.COM  *
89517SBill.Taylor@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99517SBill.Taylor@Sun.COM  * or http://www.opensolaris.org/os/licensing.
109517SBill.Taylor@Sun.COM  * See the License for the specific language governing permissions
119517SBill.Taylor@Sun.COM  * and limitations under the License.
129517SBill.Taylor@Sun.COM  *
139517SBill.Taylor@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
149517SBill.Taylor@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
159517SBill.Taylor@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
169517SBill.Taylor@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
179517SBill.Taylor@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
189517SBill.Taylor@Sun.COM  *
199517SBill.Taylor@Sun.COM  * CDDL HEADER END
209517SBill.Taylor@Sun.COM  */
219517SBill.Taylor@Sun.COM 
229517SBill.Taylor@Sun.COM /*
23*12965SWilliam.Taylor@Oracle.COM  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
249517SBill.Taylor@Sun.COM  */
259517SBill.Taylor@Sun.COM 
269517SBill.Taylor@Sun.COM #ifndef	_SYS_IB_ADAPTERS_HERMON_CMD_H
279517SBill.Taylor@Sun.COM #define	_SYS_IB_ADAPTERS_HERMON_CMD_H
289517SBill.Taylor@Sun.COM 
299517SBill.Taylor@Sun.COM /*
309517SBill.Taylor@Sun.COM  * hermon_cmd.h
319517SBill.Taylor@Sun.COM  *    Contains all of the prototypes, #defines, and structures necessary
329517SBill.Taylor@Sun.COM  *    for the Hermon Firmware Command routines.
339517SBill.Taylor@Sun.COM  *    Specifically it contains the command types, command statuses and flags,
349517SBill.Taylor@Sun.COM  *    structures used for managing Hermon mailboxes and outstanding commands,
359517SBill.Taylor@Sun.COM  *    and prototypes for most of the functions consumed by other parts of
369517SBill.Taylor@Sun.COM  *    the Hermon driver.
379517SBill.Taylor@Sun.COM  */
389517SBill.Taylor@Sun.COM 
399517SBill.Taylor@Sun.COM #include <sys/types.h>
409517SBill.Taylor@Sun.COM #include <sys/conf.h>
419517SBill.Taylor@Sun.COM #include <sys/ddi.h>
429517SBill.Taylor@Sun.COM #include <sys/sunddi.h>
439517SBill.Taylor@Sun.COM 
449517SBill.Taylor@Sun.COM #include <sys/ib/mgt/sm_attr.h>
459517SBill.Taylor@Sun.COM 
469517SBill.Taylor@Sun.COM #ifdef __cplusplus
479517SBill.Taylor@Sun.COM extern "C" {
489517SBill.Taylor@Sun.COM #endif
499517SBill.Taylor@Sun.COM 
509517SBill.Taylor@Sun.COM 
519517SBill.Taylor@Sun.COM /*
529517SBill.Taylor@Sun.COM  * Defines used hermon_write_hcr() to determine the duration and number of
539517SBill.Taylor@Sun.COM  * times (at maximum) to poll while waiting for a Hermon firmware command to
549517SBill.Taylor@Sun.COM  * release the HCR resource (i.e. waiting for the command to complete)
559517SBill.Taylor@Sun.COM  */
569517SBill.Taylor@Sun.COM #define	HERMON_CMD_POLL_DELAY		1
579517SBill.Taylor@Sun.COM #define	HERMON_CMD_POLL_MAX		3000000
589517SBill.Taylor@Sun.COM 
599517SBill.Taylor@Sun.COM /*
609517SBill.Taylor@Sun.COM  * The following defines specify the default number of mailboxes (log 2) of
619517SBill.Taylor@Sun.COM  * each type and their size and alignment restrictions.  By default the number
629517SBill.Taylor@Sun.COM  * of both "In" and "Out" mailboxes is set to 1024 (with each mailbox being
639517SBill.Taylor@Sun.COM  * 4KB in size), but both the number and sizes of each are controllable
649517SBill.Taylor@Sun.COM  * through the "hermon_log_num_inmbox", "hermon_log_num_outmbox",
659517SBill.Taylor@Sun.COM  * "hermon_log_inmbox_size" and "hermon_log_outmbox_size" configuration
669517SBill.Taylor@Sun.COM  * variables. Also, we have a define that is used to allocate interrupt
679517SBill.Taylor@Sun.COM  * mailboxes (1 in, 1 out).
689517SBill.Taylor@Sun.COM  */
699517SBill.Taylor@Sun.COM #define	HERMON_NUM_MAILBOXES_SHIFT	0xA
709517SBill.Taylor@Sun.COM #define	HERMON_NUM_INTR_MAILBOXES_SHIFT	0
719517SBill.Taylor@Sun.COM #define	HERMON_MBOX_SIZE_SHIFT		0xC
729517SBill.Taylor@Sun.COM #define	HERMON_MBOX_SIZE			(1 << HERMON_MBOX_SIZE_SHIFT)
739517SBill.Taylor@Sun.COM #define	HERMON_MBOX_ALIGN		HERMON_MBOX_SIZE
749517SBill.Taylor@Sun.COM 
759517SBill.Taylor@Sun.COM /*
769517SBill.Taylor@Sun.COM  * These are the defines for the Hermon command type (opcodes).  They are
779517SBill.Taylor@Sun.COM  * specified by the Hermon PRM
789517SBill.Taylor@Sun.COM  */
799517SBill.Taylor@Sun.COM 
809517SBill.Taylor@Sun.COM /* Init Commands */
819517SBill.Taylor@Sun.COM #define	QUERY_DEV_LIM			0x3
829517SBill.Taylor@Sun.COM #define	QUERY_DEV_CAP			0x3
839517SBill.Taylor@Sun.COM #define	QUERY_FW			0x4
849517SBill.Taylor@Sun.COM #define	QUERY_ADAPTER			0x6
859517SBill.Taylor@Sun.COM #define	INIT_HCA			0x7
869517SBill.Taylor@Sun.COM #define	CLOSE_HCA			0x8
879517SBill.Taylor@Sun.COM #define	INIT_IB				0x9
889517SBill.Taylor@Sun.COM #define	INIT_PORT			0x9
899517SBill.Taylor@Sun.COM #define	CLOSE_IB			0xA
909517SBill.Taylor@Sun.COM #define	CLOSE_PORT			0xA
919517SBill.Taylor@Sun.COM #define	QUERY_HCA			0xB
929517SBill.Taylor@Sun.COM #define	SET_IB				0xC
939517SBill.Taylor@Sun.COM #define	SET_PORT			0xC
949517SBill.Taylor@Sun.COM /* added late in tavor for SRQ support */
959517SBill.Taylor@Sun.COM #define	MOD_STAT_CFG			0x34
969517SBill.Taylor@Sun.COM /* added late in Hermon (PRM 0.35) */
979517SBill.Taylor@Sun.COM #define	QUERY_PORT			0x43
989517SBill.Taylor@Sun.COM 
999517SBill.Taylor@Sun.COM 
1009517SBill.Taylor@Sun.COM /* TPT Commands */
1019517SBill.Taylor@Sun.COM #define	SW2HW_MPT			0xD
1029517SBill.Taylor@Sun.COM #define	QUERY_MPT			0xE
1039517SBill.Taylor@Sun.COM #define	HW2SW_MPT			0xF
1049517SBill.Taylor@Sun.COM #define	READ_MTT			0x10
1059517SBill.Taylor@Sun.COM #define	WRITE_MTT			0x11
1069517SBill.Taylor@Sun.COM #define	SYNC_TPT			0x2F
1079517SBill.Taylor@Sun.COM #define	MODIFY_MPT			0x39
1089517SBill.Taylor@Sun.COM 
1099517SBill.Taylor@Sun.COM /* EQ Commands */
1109517SBill.Taylor@Sun.COM #define	MAP_EQ				0x12
1119517SBill.Taylor@Sun.COM #define	SW2HW_EQ			0x13
1129517SBill.Taylor@Sun.COM #define	HW2SW_EQ			0x14
1139517SBill.Taylor@Sun.COM #define	QUERY_EQ			0x15
1149517SBill.Taylor@Sun.COM 
1159517SBill.Taylor@Sun.COM /* CQ Commands */
1169517SBill.Taylor@Sun.COM #define	SW2HW_CQ			0x16
1179517SBill.Taylor@Sun.COM #define	HW2SW_CQ			0x17
1189517SBill.Taylor@Sun.COM #define	QUERY_CQ			0x18
1199517SBill.Taylor@Sun.COM #define	MODIFY_CQ			0x2C
1209517SBill.Taylor@Sun.COM 
1219517SBill.Taylor@Sun.COM /* Modify CQ Command - opcode modifiers */
1229517SBill.Taylor@Sun.COM #define	RESIZE_CQ			0x0
1239517SBill.Taylor@Sun.COM #define	MODIFY_MODERATION_CQ		0x1
1249517SBill.Taylor@Sun.COM #define	MODIFY_EQN			0x2
1259517SBill.Taylor@Sun.COM 
1269517SBill.Taylor@Sun.COM /* QP Commands */
1279517SBill.Taylor@Sun.COM #define	RST2INIT_QP			0x19
1289517SBill.Taylor@Sun.COM #define	INIT2INIT_QP			0x2D
1299517SBill.Taylor@Sun.COM #define	INIT2RTR_QP			0x1A
1309517SBill.Taylor@Sun.COM #define	RTR2RTS_QP			0x1B
1319517SBill.Taylor@Sun.COM #define	RTS2RTS_QP			0x1C
1329517SBill.Taylor@Sun.COM #define	SQERR2RTS_QP			0x1D
1339517SBill.Taylor@Sun.COM #define	TOERR_QP			0x1E
1349517SBill.Taylor@Sun.COM #define	RTS2SQD_QP			0x1F
1359517SBill.Taylor@Sun.COM #define	SQD2SQD_QP			0x38
1369517SBill.Taylor@Sun.COM #define	SQD2RTS_QP			0x20
1379517SBill.Taylor@Sun.COM #define	TORST_QP			0x21
1389517SBill.Taylor@Sun.COM #define	QUERY_QP			0x22
1399517SBill.Taylor@Sun.COM #define	SUSPEND_QP			0x32	/* new w/ hermon driver */
1409517SBill.Taylor@Sun.COM #define	UNSUSPEND_QP			0x33	/* new w/ hermon driver */
1419517SBill.Taylor@Sun.COM 
1429517SBill.Taylor@Sun.COM /* SPECIAL QPs Commands */
1439517SBill.Taylor@Sun.COM #define	CONF_SPECIAL_QP			0x23
1449517SBill.Taylor@Sun.COM #define	MAD_IFC				0x24
1459517SBill.Taylor@Sun.COM 
1469517SBill.Taylor@Sun.COM /* added late in tavor for SRQ support */
1479517SBill.Taylor@Sun.COM /* SRQ Commands */
1489517SBill.Taylor@Sun.COM #define	SW2HW_SRQ			0x35
1499517SBill.Taylor@Sun.COM #define	HW2SW_SRQ			0x36
1509517SBill.Taylor@Sun.COM #define	QUERY_SRQ			0x37
151*12965SWilliam.Taylor@Oracle.COM /* new in hermon, replaces part of modify MPT */
1529517SBill.Taylor@Sun.COM #define	RESIZE_SRQ			0X44
1539517SBill.Taylor@Sun.COM /* new in hermon, set limit water mark */
1549517SBill.Taylor@Sun.COM #define	ARM_RQ				0X40
155*12965SWilliam.Taylor@Oracle.COM /* new in hermon (PRM 0.36) configure interrupt moderation */
156*12965SWilliam.Taylor@Oracle.COM #define	CONFIG_INT_MOD			0X45
157*12965SWilliam.Taylor@Oracle.COM #define	HW_HEALTH_CHECK			0X50
1589517SBill.Taylor@Sun.COM 
1599517SBill.Taylor@Sun.COM /* Multicast Group Commands */
1609517SBill.Taylor@Sun.COM #define	READ_MGM			0x25
1619517SBill.Taylor@Sun.COM #define	READ_MCG			0x25
1629517SBill.Taylor@Sun.COM #define	WRITE_MGM			0x26
1639517SBill.Taylor@Sun.COM #define	WRITE_MCG			0x26
1649517SBill.Taylor@Sun.COM #define	MGID_HASH			0x27
1659517SBill.Taylor@Sun.COM 
1669517SBill.Taylor@Sun.COM /* Debug/Diagnostic Commands */
1679517SBill.Taylor@Sun.COM #define	QUERY_DEBUG_MSG			0x2A
1689517SBill.Taylor@Sun.COM #define	SET_DEBUG_MSG			0x2B
1699517SBill.Taylor@Sun.COM #define	DIAG_RPRT			0x30
1709517SBill.Taylor@Sun.COM #define	CMD_NOP				0x31
1719517SBill.Taylor@Sun.COM 
172*12965SWilliam.Taylor@Oracle.COM #define	SET_VLAN_FLTR			0x47
173*12965SWilliam.Taylor@Oracle.COM #define	SET_MCAST_FLTR			0x48
174*12965SWilliam.Taylor@Oracle.COM 
175*12965SWilliam.Taylor@Oracle.COM #define	CONFIG_FC			0x4A
176*12965SWilliam.Taylor@Oracle.COM #define	QUERY_FC			0x4B
177*12965SWilliam.Taylor@Oracle.COM #define	HEART_BEAT_RQ			0x4C
178*12965SWilliam.Taylor@Oracle.COM 
179*12965SWilliam.Taylor@Oracle.COM #define	SENSE_PORT			0x4D
1809517SBill.Taylor@Sun.COM 
1819517SBill.Taylor@Sun.COM /* ICM and related commands - w/out LAM commands from Arbel */
1829517SBill.Taylor@Sun.COM #define	RUN_FW				0xFF6
1839517SBill.Taylor@Sun.COM #define	UNMAP_ICM			0xFF9
1849517SBill.Taylor@Sun.COM #define	MAP_ICM				0xFFA
1859517SBill.Taylor@Sun.COM #define	UNMAP_ICM_AUX			0xFFB
1869517SBill.Taylor@Sun.COM #define	MAP_ICM_AUX			0xFFC
1879517SBill.Taylor@Sun.COM #define	SET_ICM_SIZE			0xFFD
1889517SBill.Taylor@Sun.COM #define	UNMAP_FA			0xFFE
1899517SBill.Taylor@Sun.COM #define	MAP_FA				0xFFF
1909517SBill.Taylor@Sun.COM 
1919517SBill.Taylor@Sun.COM /*
1929517SBill.Taylor@Sun.COM  * Commands mentioned but not defined in PRM v35
1939517SBill.Taylor@Sun.COM  *	REL_ICM_AUX
1949517SBill.Taylor@Sun.COM  *	INIT_VM
1959517SBill.Taylor@Sun.COM  */
1969517SBill.Taylor@Sun.COM 
1979517SBill.Taylor@Sun.COM /*
1989517SBill.Taylor@Sun.COM  * These are the defines for the Hermon command completion statuses.  They are
1999517SBill.Taylor@Sun.COM  * also specified (in part) by the Hermon PRM.  However,
2009517SBill.Taylor@Sun.COM  * the HERMON_CMD_INSUFF_RSRC, HERMON_CMD_TIMEOUT and HERMON_CMD_INVALID_STATUS
2019517SBill.Taylor@Sun.COM  * codes were added for this driver specifically to indicate the conditions
2029517SBill.Taylor@Sun.COM  * when insufficient resources are available for a command, when a command has
2039517SBill.Taylor@Sun.COM  * timed out (failure in the Hermon firmware) or when some other invalid result
2049517SBill.Taylor@Sun.COM  * was received.
2059517SBill.Taylor@Sun.COM  */
2069517SBill.Taylor@Sun.COM #define	HERMON_CMD_TIMEOUT_TOGGLE	0xFFFC 	/* -4 */
2079517SBill.Taylor@Sun.COM #define	HERMON_CMD_INSUFF_RSRC		0xFFFD	/* -3 */
2089517SBill.Taylor@Sun.COM #define	HERMON_CMD_TIMEOUT_GOBIT	0xFFFE 	/* -2 */
2099517SBill.Taylor@Sun.COM #define	HERMON_CMD_INVALID_STATUS	0xFFFF  /* -1 */
2109517SBill.Taylor@Sun.COM #define	HERMON_CMD_SUCCESS		0x00
2119517SBill.Taylor@Sun.COM #define	HERMON_CMD_INTERNAL_ERR		0x01
2129517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_OP		0x02
2139517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_PARAM		0x03
2149517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_SYS_STATE		0x04
2159517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_RESOURCE		0x05
2169517SBill.Taylor@Sun.COM #define	HERMON_CMD_RESOURCE_BUSY		0x06
2179517SBill.Taylor@Sun.COM #define	HERMON_CMD_EXCEED_LIM		0x08
2189517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_RES_STATE		0x09
2199517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_INDEX		0x0A
2209517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_NVMEM		0x0B
2219517SBill.Taylor@Sun.COM #define	HERMON_CMD_ICM_ERROR		0x0C
2229517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_QP_STATE		0x10
2239517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_SEG_PARAM		0x20
2249517SBill.Taylor@Sun.COM #define	HERMON_CMD_REG_BOUND		0x21
2259517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_PKT		0x30
2269517SBill.Taylor@Sun.COM #define	HERMON_CMD_BAD_SIZE		0x40
2279517SBill.Taylor@Sun.COM 
2289517SBill.Taylor@Sun.COM /*
2299517SBill.Taylor@Sun.COM  * These defines are used in the "special QP" allocation to indicate the type
2309517SBill.Taylor@Sun.COM  * of special QP (SMI, GSI, or one of the raw types).  These values are
2319517SBill.Taylor@Sun.COM  * specified by the Hermon PRM
2329517SBill.Taylor@Sun.COM  */
2339517SBill.Taylor@Sun.COM #define	HERMON_CMD_QP_SMI		0
2349517SBill.Taylor@Sun.COM #define	HERMON_CMD_QP_GSI		1
2359517SBill.Taylor@Sun.COM #define	HERMON_CMD_QP_RAW_IPV6		2
2369517SBill.Taylor@Sun.COM #define	HERMON_CMD_QP_RAW_ETH		3
2379517SBill.Taylor@Sun.COM 
2389517SBill.Taylor@Sun.COM #define	HERMON_CMD_SPEC_QP_OPMOD(smi, gsi) \
2399517SBill.Taylor@Sun.COM 	((smi & 0x01) | ((gsi & 0x01) << 1))
2409517SBill.Taylor@Sun.COM 
2419517SBill.Taylor@Sun.COM /*
2429517SBill.Taylor@Sun.COM  * For certain Hermon QP state transition commands some optional flags are
2439517SBill.Taylor@Sun.COM  * allowed.  These "opmask" flags are defined by the Hermon PRM
2449517SBill.Taylor@Sun.COM  * as a bitmask.
2459517SBill.Taylor@Sun.COM  */
2469517SBill.Taylor@Sun.COM 
2479517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_ALT_PATH		(1 << 0)
2489517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_RRE		(1 << 1)
2499517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_RAE		(1 << 2)
2509517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_RWE		(1 << 3)
2519517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_PKEYINDX		(1 << 4) /* primary path */
2529517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_QKEY		(1 << 5)
2539517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_MINRNRNAK		(1 << 6)
2549517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_PRIM_PATH		(1 << 7)
2559517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_SRA_SET		(1 << 8)
2569517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_RRA_SET		(1 << 9)
2579517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_PM_STATE		(1 << 10) /* migration */
2589517SBill.Taylor@Sun.COM /* HERMON_CMD_OP_PRIM_PORT is obsolete, instead use HERMON_CMD_OP_SCHEDQUEUE */
2599517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_PRIM_PORT		(1 << 11)
2609517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_RETRYCNT		(1 << 12) /* Global */
2619517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_ALT_RNRRETRY	(1 << 13)
2629517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_ACKTIMEOUT	(1 << 14) /* primary path */
2639517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_PRIM_RNRRETRY	(1 << 15) /* reserved in HERMON */
2649517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_SCHEDQUEUE	(1 << 16)
2659517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_RSSCONTEXT	(1 << 17)
2669517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_SRQN		(1 << 18) /* for rss balancing */
2679517SBill.Taylor@Sun.COM #define	HERMON_CMD_OP_CQN_RCV		(1 << 19) /* for rss balancing */
2689517SBill.Taylor@Sun.COM /* Bits 20 - 31 RESERVED - per PRM 0.35c */
2699517SBill.Taylor@Sun.COM 
2709517SBill.Taylor@Sun.COM 
2719517SBill.Taylor@Sun.COM 
2729517SBill.Taylor@Sun.COM /*
2739517SBill.Taylor@Sun.COM  * The Hermon RTS2SQD command can take the following flag as part of its
2749517SBill.Taylor@Sun.COM  * input modifier to request the Send Queue Drained event
2759517SBill.Taylor@Sun.COM  */
2769517SBill.Taylor@Sun.COM #define	HERMON_CMD_REQ_SQD_EVENT		0x80000000
2779517SBill.Taylor@Sun.COM 
2789517SBill.Taylor@Sun.COM /*
2799517SBill.Taylor@Sun.COM  * The Hermon TORST command can take the following flag (as part of a bitmask)
2809517SBill.Taylor@Sun.COM  * in its opcode modifier to request that the transition to reset should
2819517SBill.Taylor@Sun.COM  * not go through the Error state (and, hence, should not generate "flushed-
2829517SBill.Taylor@Sun.COM  * in-error" completions
2839517SBill.Taylor@Sun.COM  */
2849517SBill.Taylor@Sun.COM #define	HERMON_CMD_DIRECT_TO_RESET	(1 << 1)
2859517SBill.Taylor@Sun.COM 
2869517SBill.Taylor@Sun.COM /*
2879517SBill.Taylor@Sun.COM  * Some Hermon commands write an OUT mailbox entry, depending on the value of
2889517SBill.Taylor@Sun.COM  * the 'opmod' parameter.  These defines provide the correct opmod value to
2899517SBill.Taylor@Sun.COM  * write depending on whether to write an entry or not.
2909517SBill.Taylor@Sun.COM  */
2919517SBill.Taylor@Sun.COM #define	HERMON_CMD_DO_OUTMBOX		(0)
2929517SBill.Taylor@Sun.COM #define	HERMON_CMD_NO_OUTMBOX		(1 << 0)
2939517SBill.Taylor@Sun.COM 
2949517SBill.Taylor@Sun.COM 
2959517SBill.Taylor@Sun.COM /*
2969517SBill.Taylor@Sun.COM  * The Hermon MAP_EQ command can take the following flags (and use the
2979517SBill.Taylor@Sun.COM  * HERMON_CMD_UNMAP_EQ_MASK input modifier) to indicate whether the given
2989517SBill.Taylor@Sun.COM  * event queue should mapped to or unmapped from the given event type.
2999517SBill.Taylor@Sun.COM  */
3009517SBill.Taylor@Sun.COM 
3019517SBill.Taylor@Sun.COM 
3029517SBill.Taylor@Sun.COM #define	HERMON_CMD_MAP_EQ_EVT_MAP	0
3039517SBill.Taylor@Sun.COM #define	HERMON_CMD_MAP_EQ_EVT_UNMAP	1
3049517SBill.Taylor@Sun.COM #define	HERMON_CMD_UNMAP_EQ_MASK	0x80000000
3059517SBill.Taylor@Sun.COM 
3069517SBill.Taylor@Sun.COM /*
3079517SBill.Taylor@Sun.COM  * The following defines are used by the MAD_IFC command and the helper
3089517SBill.Taylor@Sun.COM  * routines that get PortInfo, NodeInfo, GUIDInfo, and PKeyTable entries.
3099517SBill.Taylor@Sun.COM  *
3109517SBill.Taylor@Sun.COM  * The first indicates whether of not MKey checking should be enforced.
3119517SBill.Taylor@Sun.COM  * This is passed in the opcode modifier field for MAD_IFC commands.
3129517SBill.Taylor@Sun.COM  *
3139517SBill.Taylor@Sun.COM  * The next set are used to define certain hardcoded management datagram (MAD)
3149517SBill.Taylor@Sun.COM  * sizes, offsets, and header formats for each of the helper operations.
3159517SBill.Taylor@Sun.COM  */
3169517SBill.Taylor@Sun.COM #define	HERMON_CMD_MKEY_CHECK		0
3179517SBill.Taylor@Sun.COM #define	HERMON_CMD_MKEY_DONTCHECK	1
31811190SRamaswamy.Tummala@Sun.COM #define	HERMON_CMD_BKEY_DONTCHECK	2
3199517SBill.Taylor@Sun.COM 
3209517SBill.Taylor@Sun.COM #define	HERMON_CMD_MAD_IFC_SIZE		0x100
3219517SBill.Taylor@Sun.COM #define	HERMON_CMD_MADDATA_OFFSET	0x40
3229517SBill.Taylor@Sun.COM #define	HERMON_CMD_MADHDR0		0x01010101
3239517SBill.Taylor@Sun.COM #define	HERMON_CMD_MADHDR1		0x00000000
3249517SBill.Taylor@Sun.COM #define	HERMON_CMD_MADHDR2		0x00000000
3259517SBill.Taylor@Sun.COM #define	HERMON_CMD_MADHDR3		0x00000000
3269517SBill.Taylor@Sun.COM 
3279517SBill.Taylor@Sun.COM #define	HERMON_CMD_PORTINFO		0x00150000
3289517SBill.Taylor@Sun.COM #define	HERMON_CMD_NODEINFO		0x00110000
3299517SBill.Taylor@Sun.COM #define	HERMON_CMD_NODEDESC		0x00100000
3309517SBill.Taylor@Sun.COM #define	HERMON_CMD_GUIDINFO		0x00140000
3319517SBill.Taylor@Sun.COM #define	HERMON_CMD_PKEYTBLE		0x00160000
3329517SBill.Taylor@Sun.COM 
3339879SRamaswamy.Tummala@Sun.COM #define	HERMON_CMD_PERF_GET		0x01040101
3349879SRamaswamy.Tummala@Sun.COM #define	HERMON_CMD_PERF_SET		0x01040102
33511190SRamaswamy.Tummala@Sun.COM #define	HERMON_CMD_CLASSPORTINFO	0x00010000
3369517SBill.Taylor@Sun.COM #define	HERMON_CMD_PERFCNTRS		0x00120000
33711190SRamaswamy.Tummala@Sun.COM #define	HERMON_CMD_EXTPERFCNTRS		0x001D0000
3389517SBill.Taylor@Sun.COM #define	HERMON_CMD_PERFATTR		0x00000000
3399517SBill.Taylor@Sun.COM 
34011190SRamaswamy.Tummala@Sun.COM #define	HERMON_IS_EXT_WIDTH_SUPPORTED		0x0000020000000000
34111190SRamaswamy.Tummala@Sun.COM #define	HERMON_IS_EXT_WIDTH_SUPPORTED_NOIETF	0x0000040000000000
34211190SRamaswamy.Tummala@Sun.COM 
3439517SBill.Taylor@Sun.COM 
3449517SBill.Taylor@Sun.COM /*
3459517SBill.Taylor@Sun.COM  * The next few defines are used to indicate the size of the "reserved" area
3469517SBill.Taylor@Sun.COM  * in the WRITE_MTT command, and the respective sizes of the SET_PORT and
3479517SBill.Taylor@Sun.COM  * MGID_HASH commands
3489517SBill.Taylor@Sun.COM  */
3499517SBill.Taylor@Sun.COM #define	HERMON_CMD_WRITEMTT_RSVD_SZ	0x10
3509517SBill.Taylor@Sun.COM #define	HERMON_CMD_SETPORT_SZ		0x8
3519517SBill.Taylor@Sun.COM #define	HERMON_CMD_MGIDHASH_SZ		0x10
3529517SBill.Taylor@Sun.COM 
3539517SBill.Taylor@Sun.COM /*
3549517SBill.Taylor@Sun.COM  * This last define is used by hermon_cmn_ownership_cmd_post() to keep track
3559517SBill.Taylor@Sun.COM  * of the direction (from hardware ownership to software, or vice versa) of
3569517SBill.Taylor@Sun.COM  * the requested operation
3579517SBill.Taylor@Sun.COM  */
3589517SBill.Taylor@Sun.COM #define	HERMON_CMD_RSRC_HW2SW		0
3599517SBill.Taylor@Sun.COM #define	HERMON_CMD_RSRC_SW2HW		1
3609517SBill.Taylor@Sun.COM 
3619517SBill.Taylor@Sun.COM /*
3629517SBill.Taylor@Sun.COM  * The following macros are used for handling any endianness related issues
3639517SBill.Taylor@Sun.COM  * that might arise from the Hermon driver's internal use of MADs.
3649517SBill.Taylor@Sun.COM  *
3659517SBill.Taylor@Sun.COM  *    HERMON_GETPORTINFO_SWAP	- All the necessary swapping to handle the
3669517SBill.Taylor@Sun.COM  *				    response to a GetPortInfo MAD
3679517SBill.Taylor@Sun.COM  *    HERMON_GETNODEINFO_SWAP	- All the necessary swapping to handle the
3689517SBill.Taylor@Sun.COM  *				    response to a GetNodeInfo MAD
3699517SBill.Taylor@Sun.COM  *    HERMON_GETGUIDINFO_SWAP	- All the necessary swapping to handle the
3709517SBill.Taylor@Sun.COM  *				    response to a GetGUIDInfo MAD
3719517SBill.Taylor@Sun.COM  *    HERMON_GETPKEYTABLE_SWAP	- All the necessary swapping to handle the
3729517SBill.Taylor@Sun.COM  *				    response to a GetPKeyTable MAD
3739517SBill.Taylor@Sun.COM  */
3749517SBill.Taylor@Sun.COM 
3759517SBill.Taylor@Sun.COM 
3769517SBill.Taylor@Sun.COM #ifdef	_LITTLE_ENDIAN
3779517SBill.Taylor@Sun.COM #define	HERMON_GETPORTINFO_SWAP(portinfo)				\
3789517SBill.Taylor@Sun.COM {									\
3799517SBill.Taylor@Sun.COM 	(portinfo)->M_Key = ddi_swap64((portinfo)->M_Key);		\
3809517SBill.Taylor@Sun.COM 	(portinfo)->GidPrefix = ddi_swap64((portinfo)->GidPrefix);	\
3819517SBill.Taylor@Sun.COM 	(portinfo)->LID = ddi_swap16((portinfo)->LID);			\
3829517SBill.Taylor@Sun.COM 	(portinfo)->MasterSMLID = ddi_swap16((portinfo)->MasterSMLID);	\
3839517SBill.Taylor@Sun.COM 	(portinfo)->CapabilityMask =					\
3849517SBill.Taylor@Sun.COM 	    ddi_swap32((portinfo)->CapabilityMask);			\
3859517SBill.Taylor@Sun.COM 	(portinfo)->DiagCode = ddi_swap16((portinfo)->DiagCode);	\
3869517SBill.Taylor@Sun.COM 	(portinfo)->M_KeyLeasePeriod =					\
3879517SBill.Taylor@Sun.COM 	    ddi_swap16((portinfo)->M_KeyLeasePeriod);			\
3889517SBill.Taylor@Sun.COM 	(portinfo)->M_KeyViolations =					\
3899517SBill.Taylor@Sun.COM 	    ddi_swap16((portinfo)->M_KeyViolations);			\
3909517SBill.Taylor@Sun.COM 	(portinfo)->P_KeyViolations =					\
3919517SBill.Taylor@Sun.COM 	    ddi_swap16((portinfo)->P_KeyViolations);			\
3929517SBill.Taylor@Sun.COM 	(portinfo)->Q_KeyViolations =					\
3939517SBill.Taylor@Sun.COM 	    ddi_swap16((portinfo)->Q_KeyViolations);			\
3949517SBill.Taylor@Sun.COM }
3959517SBill.Taylor@Sun.COM #else
3969517SBill.Taylor@Sun.COM #define	HERMON_GETPORTINFO_SWAP(portinfo)
3979517SBill.Taylor@Sun.COM #endif
3989517SBill.Taylor@Sun.COM 
3999517SBill.Taylor@Sun.COM #ifdef	_LITTLE_ENDIAN
4009517SBill.Taylor@Sun.COM #define	HERMON_GETNODEINFO_SWAP(nodeinfo)				\
4019517SBill.Taylor@Sun.COM {									\
4029517SBill.Taylor@Sun.COM 	uint32_t	tmp;						\
4039517SBill.Taylor@Sun.COM 									\
4049517SBill.Taylor@Sun.COM 	tmp = ddi_swap32(((uint32_t *)nodeinfo)[9]);			\
4059517SBill.Taylor@Sun.COM 	(nodeinfo)->VendorID	 = tmp & 0xFFFFFF;			\
4069517SBill.Taylor@Sun.COM 	(nodeinfo)->LocalPortNum = tmp >> 24;				\
4079517SBill.Taylor@Sun.COM 	(nodeinfo)->Revision	 =					\
4089517SBill.Taylor@Sun.COM 	    ddi_swap32(((uint32_t *)nodeinfo)[8]);			\
4099517SBill.Taylor@Sun.COM 	tmp = ddi_swap32(((uint32_t *)nodeinfo)[7]);			\
4109517SBill.Taylor@Sun.COM 	(nodeinfo)->PartitionCap = tmp >> 16;				\
4119517SBill.Taylor@Sun.COM 	(nodeinfo)->DeviceID	 = tmp & 0xFFFF;			\
4129517SBill.Taylor@Sun.COM 	(nodeinfo)->PortGUID = ddi_swap64((((uint64_t)			\
4139517SBill.Taylor@Sun.COM 	    (((uint32_t *)nodeinfo)[6]) << 32) |			\
4149517SBill.Taylor@Sun.COM 	    ((uint32_t *)nodeinfo)[5]));				\
4159517SBill.Taylor@Sun.COM 	(nodeinfo)->NodeGUID = ddi_swap64((((uint64_t)			\
4169517SBill.Taylor@Sun.COM 	    (((uint32_t *)nodeinfo)[4]) << 32) |			\
4179517SBill.Taylor@Sun.COM 	    ((uint32_t *)nodeinfo)[3]));				\
4189517SBill.Taylor@Sun.COM 	(nodeinfo)->SystemImageGUID = ddi_swap64((((uint64_t)		\
4199517SBill.Taylor@Sun.COM 	    (((uint32_t *)nodeinfo)[2]) << 32) |			\
4209517SBill.Taylor@Sun.COM 	    ((uint32_t *)nodeinfo)[1]));				\
4219517SBill.Taylor@Sun.COM }
4229517SBill.Taylor@Sun.COM #else
4239517SBill.Taylor@Sun.COM #define	HERMON_GETNODEINFO_SWAP(nodeinfo)				\
4249517SBill.Taylor@Sun.COM {									\
4259517SBill.Taylor@Sun.COM 	uint32_t	tmp;						\
4269517SBill.Taylor@Sun.COM 									\
4279517SBill.Taylor@Sun.COM 	tmp = ((uint32_t *)nodeinfo)[9];				\
4289517SBill.Taylor@Sun.COM 	(nodeinfo)->VendorID	 = tmp & 0xFFFFFF;			\
4299517SBill.Taylor@Sun.COM 	(nodeinfo)->LocalPortNum = tmp >> 24;				\
4309517SBill.Taylor@Sun.COM 	(nodeinfo)->Revision	 = ((uint32_t *)nodeinfo)[8];		\
4319517SBill.Taylor@Sun.COM 	tmp = ((uint32_t *)nodeinfo)[7];				\
4329517SBill.Taylor@Sun.COM 	(nodeinfo)->PartitionCap = tmp >> 16;				\
4339517SBill.Taylor@Sun.COM 	(nodeinfo)->DeviceID	 = tmp & 0xFFFF;			\
4349517SBill.Taylor@Sun.COM 	(nodeinfo)->PortGUID = (((uint64_t)				\
4359517SBill.Taylor@Sun.COM 	    (((uint32_t *)nodeinfo)[5]) << 32) |			\
4369517SBill.Taylor@Sun.COM 	    ((uint32_t *)nodeinfo)[6]);					\
4379517SBill.Taylor@Sun.COM 	(nodeinfo)->NodeGUID = (((uint64_t)				\
4389517SBill.Taylor@Sun.COM 	    (((uint32_t *)nodeinfo)[3]) << 32) |			\
4399517SBill.Taylor@Sun.COM 	    ((uint32_t *)nodeinfo)[4]);					\
4409517SBill.Taylor@Sun.COM 	(nodeinfo)->SystemImageGUID = (((uint64_t)			\
4419517SBill.Taylor@Sun.COM 	    (((uint32_t *)nodeinfo)[1]) << 32) |			\
4429517SBill.Taylor@Sun.COM 	    ((uint32_t *)nodeinfo)[2]);					\
4439517SBill.Taylor@Sun.COM }
4449517SBill.Taylor@Sun.COM #endif
4459517SBill.Taylor@Sun.COM 
4469517SBill.Taylor@Sun.COM #ifdef	_LITTLE_ENDIAN
4479517SBill.Taylor@Sun.COM #define	HERMON_GETGUIDINFO_SWAP(guidinfo)				\
4489517SBill.Taylor@Sun.COM {									\
4499517SBill.Taylor@Sun.COM 	int	i;							\
4509517SBill.Taylor@Sun.COM 									\
4519517SBill.Taylor@Sun.COM 	for (i = 0; i < 8; i++) {					\
4529517SBill.Taylor@Sun.COM 		(guidinfo)->GUIDBlocks[i] =				\
4539517SBill.Taylor@Sun.COM 		    ddi_swap64((guidinfo)->GUIDBlocks[i]);		\
4549517SBill.Taylor@Sun.COM 	}								\
4559517SBill.Taylor@Sun.COM }
4569517SBill.Taylor@Sun.COM #else
4579517SBill.Taylor@Sun.COM #define	HERMON_GETGUIDINFO_SWAP(guidinfo)
4589517SBill.Taylor@Sun.COM #endif
4599517SBill.Taylor@Sun.COM 
4609517SBill.Taylor@Sun.COM #ifdef	_LITTLE_ENDIAN
4619517SBill.Taylor@Sun.COM #define	HERMON_GETPKEYTABLE_SWAP(pkeytable)				\
4629517SBill.Taylor@Sun.COM {									\
4639517SBill.Taylor@Sun.COM 	int	i;							\
4649517SBill.Taylor@Sun.COM 									\
4659517SBill.Taylor@Sun.COM 	for (i = 0; i < 32; i++) {					\
4669517SBill.Taylor@Sun.COM 		(pkeytable)->P_KeyTableBlocks[i] =			\
4679517SBill.Taylor@Sun.COM 		    ddi_swap16((pkeytable)->P_KeyTableBlocks[i]);	\
4689517SBill.Taylor@Sun.COM 	}								\
4699517SBill.Taylor@Sun.COM }
4709517SBill.Taylor@Sun.COM #else
4719517SBill.Taylor@Sun.COM #define	HERMON_GETPKEYTABLE_SWAP(pkeytable)
4729517SBill.Taylor@Sun.COM #endif
4739517SBill.Taylor@Sun.COM 
4749517SBill.Taylor@Sun.COM /*
4759517SBill.Taylor@Sun.COM  * The Hermon MODIFY_MPT command can take the following opcode modifier
4769517SBill.Taylor@Sun.COM  * options to specify whether to modify for ResizeSRQ() or to swap the
4779517SBill.Taylor@Sun.COM  * full MPT entry.
4789517SBill.Taylor@Sun.COM  */
4799517SBill.Taylor@Sun.COM #define	HERMON_CMD_MODIFY_MPT_RESIZESRQ	3
4809517SBill.Taylor@Sun.COM #define	HERMON_CMD_MODIFY_MPT_SWAPFULL	5
4819517SBill.Taylor@Sun.COM 
4829517SBill.Taylor@Sun.COM /*
4839517SBill.Taylor@Sun.COM  * Hermon MOD_STAT_CFG Opcode Modifier
4849517SBill.Taylor@Sun.COM  */
4859517SBill.Taylor@Sun.COM #define	HERMON_MOD_STAT_CFG_PTR		0x0
4869517SBill.Taylor@Sun.COM #define	HERMON_MOD_STAT_CFG_INLINE	0x1
4879517SBill.Taylor@Sun.COM #define	HERMON_MOD_STAT_CFG_DEFAULTS	0xF
4889517SBill.Taylor@Sun.COM 
4899517SBill.Taylor@Sun.COM 
4909517SBill.Taylor@Sun.COM /*
4919517SBill.Taylor@Sun.COM  * The hermon_mbox_t structure is used internally by the Hermon driver to track
4929517SBill.Taylor@Sun.COM  * all the information necessary to manage mailboxes for the Hermon command
4939517SBill.Taylor@Sun.COM  * interface.  Specifically, by containing a pointer to the buffer, the
4949517SBill.Taylor@Sun.COM  * PCI mapped address, the access handle, and a back pointer to the
4959517SBill.Taylor@Sun.COM  * hermon_rsrc_t structure used to track this resource, it provides enough
4969517SBill.Taylor@Sun.COM  * information allocate, use, and free any type of mailbox.
4979517SBill.Taylor@Sun.COM  *
4989517SBill.Taylor@Sun.COM  * The mb_indx, mb_next, and mb_prev fields are used only by the mailbox
4999517SBill.Taylor@Sun.COM  * alloc/free routines (see hermon_impl_mbox_alloc/free() for more details)
5009517SBill.Taylor@Sun.COM  * and are not read or modified by any mailbox consumers.  They are used
5019517SBill.Taylor@Sun.COM  * to implement a fast allocation mechanism.
5029517SBill.Taylor@Sun.COM  */
5039517SBill.Taylor@Sun.COM typedef struct hermon_mbox_s {
5049517SBill.Taylor@Sun.COM 	void			*mb_addr;
5059517SBill.Taylor@Sun.COM 	uint64_t		mb_mapaddr;
5069517SBill.Taylor@Sun.COM 	ddi_acc_handle_t	mb_acchdl;
5079517SBill.Taylor@Sun.COM 	hermon_rsrc_t		*mb_rsrcptr;
5089517SBill.Taylor@Sun.COM 	uint_t			mb_indx;
5099517SBill.Taylor@Sun.COM 	uint_t			mb_next;
5109517SBill.Taylor@Sun.COM 	uint_t			mb_prev;
5119517SBill.Taylor@Sun.COM } hermon_mbox_t;
5129517SBill.Taylor@Sun.COM 
5139517SBill.Taylor@Sun.COM /*
5149517SBill.Taylor@Sun.COM  * The hermon_mboxlist_t structure is used to track all the information
5159517SBill.Taylor@Sun.COM  * relevant to the pools of Hermon mailboxes.  Specifically, it has a pointer
5169517SBill.Taylor@Sun.COM  * to an array of hermon_mbox_t structures, a lock and cv used for blocking
5179517SBill.Taylor@Sun.COM  * on alloc when mailboxes are not available, and a head, tail, and entries
5189517SBill.Taylor@Sun.COM  * free counter to keep track of which (if any) mailboxes are currently free.
5199517SBill.Taylor@Sun.COM  * This is used (along with the mb_indx, mb_next, and mb_prev fields in the
5209517SBill.Taylor@Sun.COM  * hermon_mbox_t) to implement the fast allocation mechanism.
5219517SBill.Taylor@Sun.COM  */
5229517SBill.Taylor@Sun.COM typedef struct hermon_mboxlist_s {
5239517SBill.Taylor@Sun.COM 	kmutex_t		mbl_lock;
5249517SBill.Taylor@Sun.COM 	kcondvar_t		mbl_cv;
5259517SBill.Taylor@Sun.COM 	hermon_mbox_t		*mbl_mbox;
5269517SBill.Taylor@Sun.COM 	uint_t			mbl_list_sz;
5279517SBill.Taylor@Sun.COM 	uint_t			mbl_num_alloc;
5289517SBill.Taylor@Sun.COM 	uint_t			mbl_head_indx;
5299517SBill.Taylor@Sun.COM 	uint_t			mbl_tail_indx;
5309517SBill.Taylor@Sun.COM 	uint_t			mbl_entries_free;
5319517SBill.Taylor@Sun.COM 	uint_t			mbl_waiters;
5329517SBill.Taylor@Sun.COM 	uint_t			mbl_pollers;
5339517SBill.Taylor@Sun.COM 	uint_t			mbl_signal;
5349517SBill.Taylor@Sun.COM } hermon_mboxlist_t;
5359517SBill.Taylor@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(hermon_mboxlist_t::mbl_lock,
5369517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_mbox
5379517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_list_sz
5389517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_num_alloc
5399517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_cv
5409517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_head_indx
5419517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_tail_indx
5429517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_entries_free
5439517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_waiters
5449517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_pollers
5459517SBill.Taylor@Sun.COM     hermon_mboxlist_t::mbl_signal
5469517SBill.Taylor@Sun.COM     hermon_mbox_t::mb_next
5479517SBill.Taylor@Sun.COM     hermon_mbox_t::mb_prev))
5489517SBill.Taylor@Sun.COM 
5499517SBill.Taylor@Sun.COM /*
5509517SBill.Taylor@Sun.COM  * The hermon_mbox_info_t structure is used by mailbox allocators to specify
5519517SBill.Taylor@Sun.COM  * the type of mailbox(es) being requested.  On a call to hermon_mbox_alloc()
5529517SBill.Taylor@Sun.COM  * the mbi_alloc_flags may be set to HERMON_ALLOC_INMBOX, HERMON_ALLOC_OUTMBOX,
5539517SBill.Taylor@Sun.COM  * or both.  If it is able to allocate the request type(s) of mailboxes,
5549517SBill.Taylor@Sun.COM  * hermon_mbox_alloc() will fill in the "mbi_in" and/or "mbi_out" pointers
5559517SBill.Taylor@Sun.COM  * to point to valid hermon_mbox_t structures from the appropriate
5569517SBill.Taylor@Sun.COM  * hermon_mboxlist_t (see above).
5579517SBill.Taylor@Sun.COM  * This same structure is also passed to hermon_mbox_free().  It is the
5589517SBill.Taylor@Sun.COM  * responsibility of the caller to hermon_mbox_alloc() to return this exact
5599517SBill.Taylor@Sun.COM  * structure (unmodified) to hermon_mbox_free().
5609517SBill.Taylor@Sun.COM  *
5619517SBill.Taylor@Sun.COM  * Note: If both "In" and "Out" mailboxes are requested, it is assured that
5629517SBill.Taylor@Sun.COM  * no deadlock can result (from holding one mailbox while attempting to get
5639517SBill.Taylor@Sun.COM  * the other).  This is assured by the fact that the "In" mailbox will always
5649517SBill.Taylor@Sun.COM  * be allocated first before attempting to allocate the "Out"
5659517SBill.Taylor@Sun.COM  */
5669517SBill.Taylor@Sun.COM typedef struct hermon_mbox_info_s {
5679517SBill.Taylor@Sun.COM 	uint_t			mbi_alloc_flags;
5689517SBill.Taylor@Sun.COM 	uint_t			mbi_sleep_context;
5699517SBill.Taylor@Sun.COM 	hermon_mbox_t		*mbi_in;
5709517SBill.Taylor@Sun.COM 	hermon_mbox_t		*mbi_out;
5719517SBill.Taylor@Sun.COM } hermon_mbox_info_t;
5729517SBill.Taylor@Sun.COM #define	HERMON_ALLOC_INMBOX	(1 << 0)
5739517SBill.Taylor@Sun.COM #define	HERMON_ALLOC_OUTMBOX	(1 << 1)
5749517SBill.Taylor@Sun.COM 
5759517SBill.Taylor@Sun.COM 
5769517SBill.Taylor@Sun.COM /*
5779517SBill.Taylor@Sun.COM  * The hermon_cmd_t structure is used internally by the Hermon driver to track
5789517SBill.Taylor@Sun.COM  * all the information necessary to manage outstanding firmware commands on
5799517SBill.Taylor@Sun.COM  * the Hermon command interface.
5809517SBill.Taylor@Sun.COM  *
5819517SBill.Taylor@Sun.COM  * Each hermon_cmd_t structure contains a cv and lock which are used by the
5829517SBill.Taylor@Sun.COM  * posting thread to block for completion (with cmd_status being overloaded
5839517SBill.Taylor@Sun.COM  * to indicate the condition variable).  The cmd_outparam field is used to
5849517SBill.Taylor@Sun.COM  * return additional status from those Hermon commands that specifically
5859517SBill.Taylor@Sun.COM  * require it.
5869517SBill.Taylor@Sun.COM  *
5879517SBill.Taylor@Sun.COM  * The cmd_indx, cmd_next, and cmd_prev fields are used by the outstanding
5889517SBill.Taylor@Sun.COM  * command alloc/free routines (see hermon_outstanding_cmd_alloc/free() for
5899517SBill.Taylor@Sun.COM  * more details).  They are used (in much the same way as the mb_indx,
5909517SBill.Taylor@Sun.COM  * mb_next, and mb_prev fields in hermon_mbox_t above) to implement a fast
5919517SBill.Taylor@Sun.COM  * allocation mechanism.
5929517SBill.Taylor@Sun.COM  */
5939517SBill.Taylor@Sun.COM typedef struct hermon_cmd_s {
5949517SBill.Taylor@Sun.COM 	kmutex_t		cmd_comp_lock;
5959517SBill.Taylor@Sun.COM 	kcondvar_t		cmd_comp_cv;
5969517SBill.Taylor@Sun.COM 	uint64_t		cmd_outparm;
5979517SBill.Taylor@Sun.COM 	uint_t			cmd_status;
5989517SBill.Taylor@Sun.COM 	uint_t			cmd_indx;
5999517SBill.Taylor@Sun.COM 	uint_t			cmd_next;
6009517SBill.Taylor@Sun.COM 	uint_t			cmd_prev;
6019517SBill.Taylor@Sun.COM } hermon_cmd_t;
6029517SBill.Taylor@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(hermon_cmd_t::cmd_comp_lock,
6039517SBill.Taylor@Sun.COM     hermon_cmd_t::cmd_comp_cv
6049517SBill.Taylor@Sun.COM     hermon_cmd_t::cmd_status))
6059517SBill.Taylor@Sun.COM 
6069517SBill.Taylor@Sun.COM /*
6079517SBill.Taylor@Sun.COM  * The hermon_cmdlist_t structure is used in almost exactly the same way as
6089517SBill.Taylor@Sun.COM  * the hermon_mboxlist_t above, but instead to track all the information
6099517SBill.Taylor@Sun.COM  * relevant to the pool of outstanding Hermon commands.  Specifically, it has
6109517SBill.Taylor@Sun.COM  * a pointer to an array of hermon_cmd_t structures, a lock and cv used for
6119517SBill.Taylor@Sun.COM  * blocking on alloc when outstanding command slots are not available, and a
6129517SBill.Taylor@Sun.COM  * head, tail, and entries free counter to keep track of which (if any)
6139517SBill.Taylor@Sun.COM  * command slots are currently free.  This is used (along with the cmd_indx,
6149517SBill.Taylor@Sun.COM  * cmd_next, and cmd_prev fields in the hermon_cmd_t) to implement the fast
6159517SBill.Taylor@Sun.COM  * allocation mechanism.
6169517SBill.Taylor@Sun.COM  */
6179517SBill.Taylor@Sun.COM typedef struct hermon_cmdlist_s {
6189517SBill.Taylor@Sun.COM 	kmutex_t		cml_lock;
6199517SBill.Taylor@Sun.COM 	kcondvar_t		cml_cv;
6209517SBill.Taylor@Sun.COM 	hermon_cmd_t		*cml_cmd;
6219517SBill.Taylor@Sun.COM 	uint_t			cml_list_sz;
6229517SBill.Taylor@Sun.COM 	uint_t			cml_num_alloc;
6239517SBill.Taylor@Sun.COM 	uint_t			cml_head_indx;
6249517SBill.Taylor@Sun.COM 	uint_t			cml_tail_indx;
6259517SBill.Taylor@Sun.COM 	uint_t			cml_entries_free;
6269517SBill.Taylor@Sun.COM 	uint_t			cml_waiters;
6279517SBill.Taylor@Sun.COM } hermon_cmdlist_t;
6289517SBill.Taylor@Sun.COM _NOTE(MUTEX_PROTECTS_DATA(hermon_cmdlist_t::cml_lock,
6299517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_cv
6309517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_cmd
6319517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_list_sz
6329517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_num_alloc
6339517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_head_indx
6349517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_tail_indx
6359517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_entries_free
6369517SBill.Taylor@Sun.COM     hermon_cmdlist_t::cml_waiters
6379517SBill.Taylor@Sun.COM     hermon_cmd_t::cmd_next
6389517SBill.Taylor@Sun.COM     hermon_cmd_t::cmd_prev))
6399517SBill.Taylor@Sun.COM _NOTE(LOCK_ORDER(hermon_cmdlist_t::cml_lock
6409517SBill.Taylor@Sun.COM     hermon_cmd_t::cmd_comp_lock))
6419517SBill.Taylor@Sun.COM 
6429517SBill.Taylor@Sun.COM /*
6439517SBill.Taylor@Sun.COM  * The hermon_cmd_post_t structure is used by all the Hermon Firmware Command
6449517SBill.Taylor@Sun.COM  * routines to post to Hermon firmware.  The fields almost exactly mimic
6459517SBill.Taylor@Sun.COM  * the fields in the Hermon HCR registers.  The notable exception is the
6469517SBill.Taylor@Sun.COM  * addition of the "cp_flags" field (which can be set to HERMON_CMD_SPIN or
6479517SBill.Taylor@Sun.COM  * HERMON_CMD_NOSPIN).  This flag really controls the value of the "e" bit
6489517SBill.Taylor@Sun.COM  * in the HCR (i.e. the bit to indicate whether command should complete
6499517SBill.Taylor@Sun.COM  * "in place" - in the HCR - or whether they should have their completions
6509517SBill.Taylor@Sun.COM  * written to the command completion event queue.  HERMON_CMD_SPIN means
6519517SBill.Taylor@Sun.COM  * to allow commands to complete "in place" and to poll the "go" bit in
6529517SBill.Taylor@Sun.COM  * the HCR to determine completion.
6539517SBill.Taylor@Sun.COM  *
6549517SBill.Taylor@Sun.COM  * We use HERMON_SLEEP and HERMON_NOSLEEP for our HERMON_CMD_ #defines.  This is
6559517SBill.Taylor@Sun.COM  * to maintain consistency with the rest of the SLEEP flags.  Additionally,
6569517SBill.Taylor@Sun.COM  * because HERMON_SLEEPFLAG_FOR_CONTEXT() in hermon_rsrc.h returns HERMON_SLEEP
6579517SBill.Taylor@Sun.COM  * or NOSLEEP we must be compatible with this macro.
6589517SBill.Taylor@Sun.COM  */
6599517SBill.Taylor@Sun.COM typedef struct hermon_cmd_post_s {
6609517SBill.Taylor@Sun.COM 	uint64_t		cp_inparm;
6619517SBill.Taylor@Sun.COM 	uint64_t		cp_outparm;
6629517SBill.Taylor@Sun.COM 	uint32_t		cp_inmod;
6639517SBill.Taylor@Sun.COM 	uint16_t		cp_opcode;
6649517SBill.Taylor@Sun.COM 	uint16_t		cp_opmod;
6659517SBill.Taylor@Sun.COM 	uint32_t		cp_flags;
6669517SBill.Taylor@Sun.COM } hermon_cmd_post_t;
6679517SBill.Taylor@Sun.COM #define	HERMON_CMD_SLEEP_NOSPIN		HERMON_SLEEP
6689517SBill.Taylor@Sun.COM #define	HERMON_CMD_NOSLEEP_SPIN		HERMON_NOSLEEP
6699517SBill.Taylor@Sun.COM 
6709517SBill.Taylor@Sun.COM 
6719517SBill.Taylor@Sun.COM /*
6729517SBill.Taylor@Sun.COM  * The following are the Hermon Firmware Command routines that accessible
6739517SBill.Taylor@Sun.COM  * externally (i.e. throughout the rest of the Hermon driver software).
6749517SBill.Taylor@Sun.COM  * These include the all the alloc/free routines, some initialization
6759517SBill.Taylor@Sun.COM  * and cleanup routines, and the various specific Hermon firmware commands.
6769517SBill.Taylor@Sun.COM  */
6779517SBill.Taylor@Sun.COM int hermon_cmd_post(hermon_state_t *state, hermon_cmd_post_t *cmdpost);
6789517SBill.Taylor@Sun.COM int hermon_mbox_alloc(hermon_state_t *state, hermon_mbox_info_t *mbox_info,
6799517SBill.Taylor@Sun.COM     uint_t mbox_wait);
6809517SBill.Taylor@Sun.COM void hermon_mbox_free(hermon_state_t *state, hermon_mbox_info_t *mbox_info);
6819517SBill.Taylor@Sun.COM int hermon_cmd_complete_handler(hermon_state_t *state, hermon_eqhdl_t eq,
6829517SBill.Taylor@Sun.COM     hermon_hw_eqe_t *eqe);
6839517SBill.Taylor@Sun.COM int hermon_inmbox_list_init(hermon_state_t *state);
6849517SBill.Taylor@Sun.COM int hermon_intr_inmbox_list_init(hermon_state_t *state);
6859517SBill.Taylor@Sun.COM int hermon_outmbox_list_init(hermon_state_t *state);
6869517SBill.Taylor@Sun.COM int hermon_intr_outmbox_list_init(hermon_state_t *state);
6879517SBill.Taylor@Sun.COM void hermon_inmbox_list_fini(hermon_state_t *state);
6889517SBill.Taylor@Sun.COM void hermon_intr_inmbox_list_fini(hermon_state_t *state);
6899517SBill.Taylor@Sun.COM void hermon_outmbox_list_fini(hermon_state_t *state);
6909517SBill.Taylor@Sun.COM void hermon_intr_outmbox_list_fini(hermon_state_t *state);
6919517SBill.Taylor@Sun.COM int hermon_outstanding_cmdlist_init(hermon_state_t *state);
6929517SBill.Taylor@Sun.COM void hermon_outstanding_cmdlist_fini(hermon_state_t *state);
6939517SBill.Taylor@Sun.COM 
6949517SBill.Taylor@Sun.COM /* Added for MemFree */
6959517SBill.Taylor@Sun.COM int hermon_map_cmd_post(hermon_state_t *state, hermon_dma_info_t *dinfo,
6969517SBill.Taylor@Sun.COM     uint16_t opcode, ddi_dma_cookie_t cookie, uint_t ccount);
6979517SBill.Taylor@Sun.COM int hermon_map_fa_cmd_post(hermon_state_t *state);
6989517SBill.Taylor@Sun.COM int hermon_run_fw_cmd_post(hermon_state_t *state);
6999517SBill.Taylor@Sun.COM int hermon_set_icm_size_cmd_post(hermon_state_t *state);
7009517SBill.Taylor@Sun.COM int hermon_map_icm_aux_cmd_post(hermon_state_t *state);
7019517SBill.Taylor@Sun.COM int hermon_map_icm_cmd_post(hermon_state_t *state);
7029517SBill.Taylor@Sun.COM int hermon_disable_lam_cmd_post(hermon_state_t *state);
7039517SBill.Taylor@Sun.COM int hermon_unmap_icm_cmd_post(hermon_state_t *state,
7049517SBill.Taylor@Sun.COM     hermon_dma_info_t *dma_info);
7059517SBill.Taylor@Sun.COM int hermon_unmap_icm_aux_cmd_post(hermon_state_t *state);
7069517SBill.Taylor@Sun.COM int hermon_unmap_fa_cmd_post(hermon_state_t *state);
7079517SBill.Taylor@Sun.COM 
7089517SBill.Taylor@Sun.COM /*
7099517SBill.Taylor@Sun.COM  * INIT_HCA and CLOSE_HCA - used for initialization and teardown of Hermon
7109517SBill.Taylor@Sun.COM  * device configuration
7119517SBill.Taylor@Sun.COM  */
7129517SBill.Taylor@Sun.COM int hermon_init_hca_cmd_post(hermon_state_t *state,
7139517SBill.Taylor@Sun.COM     hermon_hw_initqueryhca_t *inithca, uint_t sleepflag);
7149517SBill.Taylor@Sun.COM int hermon_close_hca_cmd_post(hermon_state_t *state, uint_t sleepflag);
7159517SBill.Taylor@Sun.COM 
7169517SBill.Taylor@Sun.COM /*
7179517SBill.Taylor@Sun.COM  * INIT_PORT, CLOSE_PORT, and SET_PORT - used for bring Hermon ports up and
7189517SBill.Taylor@Sun.COM  * down, and to set properties of each port (e.g. PortInfo capability mask)
7199517SBill.Taylor@Sun.COM  * NOTE:  New names for the commands in Hermon (previously init_ close_ and
7209517SBill.Taylor@Sun.COM  * set_ib
7219517SBill.Taylor@Sun.COM  */
7229517SBill.Taylor@Sun.COM int hermon_set_port_cmd_post(hermon_state_t *state,
7239517SBill.Taylor@Sun.COM     hermon_hw_set_port_t *initport, uint_t port, uint_t sleepflag);
7249517SBill.Taylor@Sun.COM int hermon_init_port_cmd_post(hermon_state_t *state, uint_t port,
7259517SBill.Taylor@Sun.COM     uint_t sleepflag);
7269517SBill.Taylor@Sun.COM int hermon_close_port_cmd_post(hermon_state_t *state, uint_t port,
7279517SBill.Taylor@Sun.COM     uint_t sleepflag);
7289517SBill.Taylor@Sun.COM 
7299517SBill.Taylor@Sun.COM /*
7309517SBill.Taylor@Sun.COM  * This common function is used to post the following Hermon QP state
7319517SBill.Taylor@Sun.COM  * transition firmware commands:
7329517SBill.Taylor@Sun.COM  * RTS2SQD, TOERR, TORST, RST2INIT, INIT2INIT, INIT2RTR, RTR2RTS, RTS2RTS,
7339517SBill.Taylor@Sun.COM  * SQD2SQD, SQD2RTS, and SQERR2RTS.
7349517SBill.Taylor@Sun.COM  */
7359517SBill.Taylor@Sun.COM int hermon_cmn_qp_cmd_post(hermon_state_t *state, uint_t opcode,
7369517SBill.Taylor@Sun.COM     hermon_hw_qpc_t *qp, uint_t qpindx, uint32_t opmask, uint_t sleepflag);
7379517SBill.Taylor@Sun.COM 
7389517SBill.Taylor@Sun.COM /*
7399517SBill.Taylor@Sun.COM  * This common function is used to post the following Hermon query firmware
7409517SBill.Taylor@Sun.COM  * commands:
7419517SBill.Taylor@Sun.COM  * QUERY_DEV_LIM/CAP, QUERY_FW, QUERY_ADAPTER, QUERY_HCA, QUERY_MPT,
7429517SBill.Taylor@Sun.COM  * QUERY_EQ, QUERY_CQ, and QUERY_QP.
743*12965SWilliam.Taylor@Oracle.COM  * New with FCoIB, QUERY_FC
7449517SBill.Taylor@Sun.COM  */
7459517SBill.Taylor@Sun.COM int hermon_cmn_query_cmd_post(hermon_state_t *state, uint_t opcode,
7469517SBill.Taylor@Sun.COM     uint_t opmod, uint_t queryindx, void *query, uint_t size, uint_t sleepflag);
7479517SBill.Taylor@Sun.COM 
7489517SBill.Taylor@Sun.COM /*
7499517SBill.Taylor@Sun.COM  * This common function is used to post the following Hermon resource ownership
7509517SBill.Taylor@Sun.COM  * firmware commands:
7519517SBill.Taylor@Sun.COM  * HW2SW_MPT, HW2SW_EQ, HW2SW_CQ, SW2HW_MPT, SW2HW_EQ, and SW2HW_CQ
7529517SBill.Taylor@Sun.COM  */
7539517SBill.Taylor@Sun.COM int hermon_cmn_ownership_cmd_post(hermon_state_t *state, uint_t opcode,
7549517SBill.Taylor@Sun.COM     void *hwrsrc, uint_t size, uint_t hwrsrcindx, uint_t sleepflag);
7559517SBill.Taylor@Sun.COM 
7569517SBill.Taylor@Sun.COM /*
7579517SBill.Taylor@Sun.COM  * MAD_IFC and helper functions - used for posting IB MADs to Hermon firmware.
7589517SBill.Taylor@Sun.COM  * The helper functions are for the MADs most frequently used by the Hermon
7599517SBill.Taylor@Sun.COM  * driver (internally).
7609517SBill.Taylor@Sun.COM  */
7619517SBill.Taylor@Sun.COM int hermon_mad_ifc_cmd_post(hermon_state_t *state, uint_t port,
7629517SBill.Taylor@Sun.COM     uint_t sleepflag, uint32_t *mad, uint32_t *resp);
7639517SBill.Taylor@Sun.COM int hermon_getportinfo_cmd_post(hermon_state_t *state, uint_t port,
7649517SBill.Taylor@Sun.COM     uint_t sleepflag, sm_portinfo_t *portinfo);
7659517SBill.Taylor@Sun.COM int hermon_getnodeinfo_cmd_post(hermon_state_t *state, uint_t sleepflag,
7669517SBill.Taylor@Sun.COM     sm_nodeinfo_t *nodeinfo);
7679517SBill.Taylor@Sun.COM int hermon_getnodedesc_cmd_post(hermon_state_t *state, uint_t sleepflag,
7689517SBill.Taylor@Sun.COM     sm_nodedesc_t *nodedesc);
7699517SBill.Taylor@Sun.COM int hermon_getguidinfo_cmd_post(hermon_state_t *state, uint_t port,
7709517SBill.Taylor@Sun.COM     uint_t guidblock, uint_t sleepflag, sm_guidinfo_t *guidinfo);
7719517SBill.Taylor@Sun.COM int hermon_getpkeytable_cmd_post(hermon_state_t *state, uint_t port,
7729517SBill.Taylor@Sun.COM     uint_t pkeyblock, uint_t sleepflag, sm_pkey_table_t *pkeytable);
77311190SRamaswamy.Tummala@Sun.COM int hermon_is_ext_port_counters_supported(hermon_state_t *state, uint_t port,
77411190SRamaswamy.Tummala@Sun.COM     uint_t sleepflag, int *ext_width_supported);
77511190SRamaswamy.Tummala@Sun.COM int hermon_getextperfcntr_cmd_post(hermon_state_t *state, uint_t port,
77611190SRamaswamy.Tummala@Sun.COM     uint_t sleepflag, hermon_hw_sm_extperfcntr_t *perfinfo);
7779517SBill.Taylor@Sun.COM int hermon_getperfcntr_cmd_post(hermon_state_t *state, uint_t port,
7789879SRamaswamy.Tummala@Sun.COM     uint_t sleepflag, hermon_hw_sm_perfcntr_t *perfinfo, int reset);
7799517SBill.Taylor@Sun.COM /*
7809517SBill.Taylor@Sun.COM  * WRITE_MTT - used for write MTT entries to the Hermon MTT table
7819517SBill.Taylor@Sun.COM  */
7829517SBill.Taylor@Sun.COM int hermon_write_mtt_cmd_post(hermon_state_t *state, hermon_rsrc_t *mtt,
7839517SBill.Taylor@Sun.COM     uint64_t start_addr, uint_t nummtt, uint_t sleepflag);
7849517SBill.Taylor@Sun.COM 
7859517SBill.Taylor@Sun.COM /*
7869517SBill.Taylor@Sun.COM  * SYNC_TPT - used to sync Hermon TPT caches
7879517SBill.Taylor@Sun.COM  */
7889517SBill.Taylor@Sun.COM int hermon_sync_tpt_cmd_post(hermon_state_t *state, uint_t sleepflag);
7899517SBill.Taylor@Sun.COM 
7909517SBill.Taylor@Sun.COM /*
7919517SBill.Taylor@Sun.COM  * MAP_EQ - used for map classes of events to Hermon event queues (EQ)
7929517SBill.Taylor@Sun.COM  */
7939517SBill.Taylor@Sun.COM int hermon_map_eq_cmd_post(hermon_state_t *state, uint_t map,
7949517SBill.Taylor@Sun.COM     uint_t eqcindx, uint64_t eqmapmask, uint_t sleepflag);
7959517SBill.Taylor@Sun.COM 
7969517SBill.Taylor@Sun.COM /*
7979517SBill.Taylor@Sun.COM  * RESIZE_CQ - used for resize completion queue (CQ)
7989517SBill.Taylor@Sun.COM  *	opmod 0 is resize cq.  opmod 1 is modify interrupt moderation.
7999517SBill.Taylor@Sun.COM  */
8009517SBill.Taylor@Sun.COM int hermon_resize_cq_cmd_post(hermon_state_t *state, hermon_hw_cqc_t *cqc,
8019517SBill.Taylor@Sun.COM     uint_t cqcindx, uint32_t *prod_indx, uint_t sleepflag);
8029517SBill.Taylor@Sun.COM int hermon_modify_cq_cmd_post(hermon_state_t *state, hermon_hw_cqc_t *cqc,
8039517SBill.Taylor@Sun.COM     uint_t cqcindx, uint_t opmod, uint_t sleepflag);
8049517SBill.Taylor@Sun.COM 
8059517SBill.Taylor@Sun.COM /*
8069517SBill.Taylor@Sun.COM  * CONF_SPECIAL_QP - used to configure a pair of queue pairs for use as
8079517SBill.Taylor@Sun.COM  * special QP.  Necessary to enable full QP0 and/or QP1 operation.
8089517SBill.Taylor@Sun.COM  */
8099517SBill.Taylor@Sun.COM int hermon_conf_special_qp_cmd_post(hermon_state_t *state, uint_t qpindx,
8109517SBill.Taylor@Sun.COM     uint_t qptype, uint_t sleepflag, uint_t opmod);
8119517SBill.Taylor@Sun.COM 
8129517SBill.Taylor@Sun.COM /*
813*12965SWilliam.Taylor@Oracle.COM  * Get FEXCH HEART BEAT
814*12965SWilliam.Taylor@Oracle.COM  */
815*12965SWilliam.Taylor@Oracle.COM int hermon_get_heart_beat_rq_cmd_post(hermon_state_t *state, uint_t qpindx,
816*12965SWilliam.Taylor@Oracle.COM     uint64_t *outparm);
817*12965SWilliam.Taylor@Oracle.COM 
818*12965SWilliam.Taylor@Oracle.COM /*
8199517SBill.Taylor@Sun.COM  * MGID_HASH, READ_MGM, and WRITE_MGM - used for manipulation of the
8209517SBill.Taylor@Sun.COM  * hardware resource tables for multicast groups.
8219517SBill.Taylor@Sun.COM  *	NOTE: for intial implementation these functions retain their original
8229517SBill.Taylor@Sun.COM  *		names, though the proper hermon terminology is READ_MCG and
8239517SBill.Taylor@Sun.COM  *		WRITE_MCG - MGID_HASH retains its original name
8249517SBill.Taylor@Sun.COM  */
8259517SBill.Taylor@Sun.COM int hermon_mgid_hash_cmd_post(hermon_state_t *state, uint64_t mgid_h,
8269517SBill.Taylor@Sun.COM     uint64_t mgid_l, uint64_t *mgid_hash, uint_t sleepflag);
8279517SBill.Taylor@Sun.COM int hermon_read_mgm_cmd_post(hermon_state_t *state, hermon_hw_mcg_t *mcg,
8289517SBill.Taylor@Sun.COM     uint_t mcgindx, uint_t sleepflag);
8299517SBill.Taylor@Sun.COM int hermon_write_mgm_cmd_post(hermon_state_t *state, hermon_hw_mcg_t *mcg,
8309517SBill.Taylor@Sun.COM     uint_t mcgindx, uint_t sleepflag);
8319517SBill.Taylor@Sun.COM 
8329517SBill.Taylor@Sun.COM /*
8339517SBill.Taylor@Sun.COM  * MOD_STAT_CFG - used to configure (override) settings set in NVRAM before
8349517SBill.Taylor@Sun.COM  * a call to QUERY_DEV_LIM.  This is primarily used for SRQ settings in
8359517SBill.Taylor@Sun.COM  * the firmware.
8369517SBill.Taylor@Sun.COM  */
8379517SBill.Taylor@Sun.COM int hermon_mod_stat_cfg_cmd_post(hermon_state_t *state);
8389517SBill.Taylor@Sun.COM 
8399517SBill.Taylor@Sun.COM /*
8409517SBill.Taylor@Sun.COM  * MODIFY_MPT - used to change MPT attributes of a memory region.  This
8419517SBill.Taylor@Sun.COM  * was (Tavor/Arbel) primarily used for Resizing SRQs -- now may be used
8429517SBill.Taylor@Sun.COM  * to modify MPT paramters
8439517SBill.Taylor@Sun.COM  */
8449517SBill.Taylor@Sun.COM int hermon_modify_mpt_cmd_post(hermon_state_t *state, hermon_hw_dmpt_t *mpt,
8459517SBill.Taylor@Sun.COM     uint_t mptindx, uint_t flags, uint_t sleepflag);
8469517SBill.Taylor@Sun.COM 
8479517SBill.Taylor@Sun.COM /*
8489517SBill.Taylor@Sun.COM  * RESIZE_SRQ is new in hermon, replacing opcodes in modify_mpt.  It is used
8499517SBill.Taylor@Sun.COM  * to resize the SRQ, by passing the new information in the same format as
8509517SBill.Taylor@Sun.COM  * the original srqc, which the HCA will update appropriately
8519517SBill.Taylor@Sun.COM  */
8529517SBill.Taylor@Sun.COM int hermon_resize_srq_cmd_post(hermon_state_t *state, hermon_hw_srqc_t *srq,
8539517SBill.Taylor@Sun.COM     uint_t srqnum, uint_t sleepflag);
8549517SBill.Taylor@Sun.COM 
8559517SBill.Taylor@Sun.COM /*
8569517SBill.Taylor@Sun.COM  * CMD_NOP - used to test the interrupt/Event Queue mechanism.
8579517SBill.Taylor@Sun.COM  */
8589517SBill.Taylor@Sun.COM int hermon_nop_post(hermon_state_t *state, uint_t interval, uint_t sleep);
8599517SBill.Taylor@Sun.COM int hermon_setdebug_post(hermon_state_t *state);
860*12965SWilliam.Taylor@Oracle.COM 
8619517SBill.Taylor@Sun.COM /*
8629517SBill.Taylor@Sun.COM  * READ_MTT - used to read an mtt entry at address.
8639517SBill.Taylor@Sun.COM  */
8649517SBill.Taylor@Sun.COM int hermon_read_mtt_cmd_post(hermon_state_t *state, uint64_t mtt_addr,
8659517SBill.Taylor@Sun.COM     hermon_hw_mtt_t *mtt);
8669517SBill.Taylor@Sun.COM 
867*12965SWilliam.Taylor@Oracle.COM /*
868*12965SWilliam.Taylor@Oracle.COM  * SENSE_PORT - used to send protocol running on a port
869*12965SWilliam.Taylor@Oracle.COM  */
870*12965SWilliam.Taylor@Oracle.COM int hermon_sense_port_post(hermon_state_t *state, uint_t portnum,
871*12965SWilliam.Taylor@Oracle.COM     uint32_t *protocol);
872*12965SWilliam.Taylor@Oracle.COM 
873*12965SWilliam.Taylor@Oracle.COM /*
874*12965SWilliam.Taylor@Oracle.COM  * CONFIG_FC - used to do either a basic config passing in
875*12965SWilliam.Taylor@Oracle.COM  * 	*hermon_hw_config_fc_basic_s, or config the N_Port table.
876*12965SWilliam.Taylor@Oracle.COM  *	passing in pointer to an array of 32-bit id's
877*12965SWilliam.Taylor@Oracle.COM  *	Note that either one needs to be cast to void *
878*12965SWilliam.Taylor@Oracle.COM  */
879*12965SWilliam.Taylor@Oracle.COM int hermon_config_fc_cmd_post(hermon_state_t *state, void *cfginfo, int enable,
880*12965SWilliam.Taylor@Oracle.COM     int selector, int n_ports, int portnum, uint_t sleepflag);
881*12965SWilliam.Taylor@Oracle.COM 
882*12965SWilliam.Taylor@Oracle.COM /*
883*12965SWilliam.Taylor@Oracle.COM  * CONFIG_INT_MOD - used to configure INTERRUPT moderation
884*12965SWilliam.Taylor@Oracle.COM  */
885*12965SWilliam.Taylor@Oracle.COM int hermon_config_int_mod(hermon_state_t *state, uint_t min_delay,
886*12965SWilliam.Taylor@Oracle.COM     uint_t vector);
887*12965SWilliam.Taylor@Oracle.COM 
888*12965SWilliam.Taylor@Oracle.COM /*
889*12965SWilliam.Taylor@Oracle.COM  * HW_HEALTH_CHECK - tests state of the HCA
890*12965SWilliam.Taylor@Oracle.COM  *	if command fails, *health is invalid/undefined
891*12965SWilliam.Taylor@Oracle.COM  */
892*12965SWilliam.Taylor@Oracle.COM int hermon_hw_health_check(hermon_state_t *state, int *health);
893*12965SWilliam.Taylor@Oracle.COM 
8949517SBill.Taylor@Sun.COM #ifdef __cplusplus
8959517SBill.Taylor@Sun.COM }
8969517SBill.Taylor@Sun.COM #endif
8979517SBill.Taylor@Sun.COM 
8989517SBill.Taylor@Sun.COM #endif	/* _SYS_IB_ADAPTERS_HERMON_CMD_H */
899