9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER START
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The contents of this file are subject to the terms of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Common Development and Distribution License (the "License").
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You may not use this file except in compliance with the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * See the License for the specific language governing permissions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and limitations under the License.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * When distributing Covered Code, include this CDDL HEADER in each
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * If applicable, add the following below this CDDL HEADER, with the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * fields enclosed by brackets "[]" replaced with your own identifying
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information: Portions Copyright [yyyy] [name of copyright owner]
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CDDL HEADER END
e9dc6bff6e018821c8c8ac7fe3e3b42e621e93aeRamaswamy Tummala * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Use is subject to license terms.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Contains all of the prototypes, #defines, and structures necessary
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * for the Tavor Firmware Command routines.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Specifically it contains the command types, command statuses and flags,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * structures used for managing Tavor mailboxes and outstanding commands,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and prototypes for most of the functions consumed by other parts of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the Tavor driver.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Defines used tavor_write_hcr() to determine the duration and number of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * times (at maximum) to poll while waiting for a Tavor firmware command to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * release the HCR resource (i.e. waiting for the command to complete)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines specify the default number of mailboxes (log 2) of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * each type and their size and alignment restrictions. By default the number
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * of both "In" and "Out" mailboxes is set to eight (with each mailbox being
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * 512 bytes in size), but both the number and sizes of each are controllable
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * through the "tavor_log_num_inmbox", "tavor_log_num_outmbox",
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "tavor_log_inmbox_size" and "tavor_log_outmbox_size" configuration
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * variables.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#define TAVOR_MBOX_SIZE (1 << TAVOR_MBOX_SIZE_SHIFT)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following macro determines whether the contents of given mailbox
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * type need to be sync'd (with ddi_dma_sync()). This decision is based
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * on whether the mailbox is in DDR memory (no sync) or system memory
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * (sync required). And it also supports the possibility that if a CQ in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * system memory is mapped DDI_DMA_CONSISTENT, it can be configured to not be
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * sync'd because of the "sync override" parameter in the config profile.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((((((state)->ts_cfg_profile->cp_streaming_consistent) && \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((state)->ts_cfg_profile->cp_consistent_syncoverride))) || \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ((&((state)->ts_rsrc_hdl[(type)]))->rsrc_loc == TAVOR_IN_DDR)) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These are the defines for the Tavor command type (opcodes). They are
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * specified by the Tavor register specification
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These are the defines for the Tavor command completion statuses. They are
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * also specified (in part) by the Tavor register specification. However,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the TAVOR_CMD_INSUFF_RSRC, TAVOR_CMD_TIMEOUT and TAVOR_CMD_INVALID_STATUS
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * codes were added for this driver specifically to indicate the conditions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * when insufficient resources are available for a command, when a command has
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * timed out (failure in the Tavor firmware) or when some other invalid result
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * was received.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These defines are used in the "special QP" allocation to indicate the type
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * of special QP (SMI, GSI, or one of the raw types). These values are
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * specified by the Tavor register specification
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * For certain Tavor QP state transition commands some optional flags are
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * allowed. These "opmask" flags are defined by the Tavor register
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * specification as a bitmask.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The Tavor RTS2SQD command can take the following flag as part of its
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * input modifier to request the Send Queue Drained event
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The Tavor TORST command can take the following flag (as part of a bitmask)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * in its opcode modifier to request that the transition to reset should
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * not go through the Error state (and, hence, should not generate "flushed-
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * in-error" completions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Some Tavor commands write an OUT mailbox entry, depending on the value of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the 'opmod' parameter. These defines provide the correct opmod value to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * write depending on whether to write an entry or not.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The Tavor SYS_EN command can take the following opcode modifier options
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to specify whether certain DDR checks should be performed.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The Tavor MAP_EQ command can take the following flags (and use the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * TAVOR_CMD_UNMAP_EQ_MASK input modifier) to indicate whether the given
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * event queue should mapped to or unmapped from the given event type.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following defines are used by the MAD_IFC command and the helper
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * routines that get PortInfo, NodeInfo, GUIDInfo, and PKeyTable entries.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The first indicates whether of not MKey checking should be enforced.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This is passed in the opcode modifier field for MAD_IFC commands.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The next set are used to define certain hardcoded management datagram (MAD)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * sizes, offsets, and header formats for each of the helper operations.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The next few defines are used to indicate the size of the "reserved" area
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * in the WRITE_MTT command, and the respective sizes of the SET_IB and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MGID_HASH commands
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This last define is used by tavor_cmn_ownership_cmd_post() to keep track
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * of the direction (from hardware ownership to software, or vice versa) of
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the requested operation
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following macros are used for handling any endianness related issues
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * that might arise from the Tavor driver's internal use of MADs.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * TAVOR_GETPORTINFO_SWAP - All the necessary swapping to handle the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * response to a GetPortInfo MAD
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * TAVOR_GETNODEINFO_SWAP - All the necessary swapping to handle the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * response to a GetNodeInfo MAD
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * TAVOR_GETGUIDINFO_SWAP - All the necessary swapping to handle the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * response to a GetGUIDInfo MAD
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * TAVOR_GETPKEYTABLE_SWAP - All the necessary swapping to handle the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * response to a GetPKeyTable MAD
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (portinfo)->M_Key = ddi_swap64((portinfo)->M_Key); \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (portinfo)->GidPrefix = ddi_swap64((portinfo)->GidPrefix); \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (portinfo)->LID = ddi_swap16((portinfo)->LID); \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (portinfo)->MasterSMLID = ddi_swap16((portinfo)->MasterSMLID); \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (portinfo)->DiagCode = ddi_swap16((portinfo)->DiagCode); \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (nodeinfo)->PortGUID = ddi_swap64((((uint64_t) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (nodeinfo)->NodeGUID = ddi_swap64((((uint64_t) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (nodeinfo)->SystemImageGUID = ddi_swap64((((uint64_t) \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor (nodeinfo)->Revision = ((uint32_t *)nodeinfo)[8]; \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor for (i = 0; i < 8; i++) { \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor for (i = 0; i < 32; i++) { \
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The Tavor MODIFY_MPT command can take the following opcode modifier
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * options to specify whether to modify for ResizeSRQ() or to swap the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * full MPT entry.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The tavor_mbox_t structure is used internally by the Tavor driver to track
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * all the information necessary to manage mailboxes for the Tavor command
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * interface. Specifically, by containing a pointer to the buffer, the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * PCI mapped address, the access handle, and a back pointer to the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * tavor_rsrc_t structure used to track this resource, it provides enough
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * information allocate, use, and free any type of mailbox.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The mb_indx, mb_next, and mb_prev fields are used only by the mailbox
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * alloc/free routines (see tavor_impl_mbox_alloc/free() for more details)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and are not read or modified by any mailbox consumers. They are used
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to implement a fast allocation mechanism.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The tavor_mboxlist_t structure is used to track all the information
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * relevant to the pools of Tavor mailboxes. Specifically, it has a pointer
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to an array of tavor_mbox_t structures, a lock and cv used for blocking
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * on alloc when mailboxes are not available, and a head, tail, and entries
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * free counter to keep track of which (if any) mailboxes are currently free.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This is used (along with the mb_indx, mb_next, and mb_prev fields in the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * tavor_mbox_t) to implement the fast allocation mechanism.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(tavor_mboxlist_t::mbl_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The tavor_mbox_info_t structure is used by mailbox allocators to specify
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the type of mailbox(es) being requested. On a call to tavor_mbox_alloc()
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the mbi_alloc_flags may be set to TAVOR_ALLOC_INMBOX, TAVOR_ALLOC_OUTMBOX,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * or both. If it is able to allocate the request type(s) of mailboxes,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * tavor_mbox_alloc() will fill in the "mbi_in" and/or "mbi_out" pointers
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to point to valid tavor_mbox_t structures from the appropriate
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * tavor_mboxlist_t (see above).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This same structure is also passed to tavor_mbox_free(). It is the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * responsibility of the caller to tavor_mbox_alloc() to return this exact
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * structure (unmodified) to tavor_mbox_free().
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Note: If both "In" and "Out" mailboxes are requested, it is assured that
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * no deadlock can result (from holding one mailbox while attempting to get
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the other). This is assured by the fact that the "In" mailbox will always
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * be allocated first before attempting to allocate the "Out"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The tavor_cmd_t structure is used internally by the Tavor driver to track
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * all the information necessary to manage outstanding firmware commands on
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the Tavor command interface.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * Each tavor_cmd_t structure contains a cv and lock which are used by the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * posting thread to block for completion (with cmd_status being overloaded
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to indicate the condition variable). The cmd_outparam field is used to
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * return additional status from those Tavor commands that specifically
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * require it.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The cmd_indx, cmd_next, and cmd_prev fields are used by the outstanding
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * command alloc/free routines (see tavor_outstanding_cmd_alloc/free() for
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * more details). They are used (in much the same way as the mb_indx,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * mb_next, and mb_prev fields in tavor_mbox_t above) to implement a fast
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * allocation mechanism.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(tavor_cmd_t::cmd_comp_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The tavor_cmdlist_t structure is used in almost exactly the same way as
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the tavor_mboxlist_t above, but instead to track all the information
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * relevant to the pool of outstanding Tavor commands. Specifically, it has
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * a pointer to an array of tavor_cmd_t structures, a lock and cv used for
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * blocking on alloc when outstanding command slots are not available, and a
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * head, tail, and entries free counter to keep track of which (if any)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * command slots are currently free. This is used (along with the cmd_indx,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * cmd_next, and cmd_prev fields in the tavor_cmd_t) to implement the fast
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * allocation mechanism.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor_NOTE(MUTEX_PROTECTS_DATA(tavor_cmdlist_t::cml_lock,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The tavor_cmd_post_t structure is used by all the Tavor Firmware Command
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * routines to post to Tavor firmware. The fields almost exactly mimic
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the fields in the Tavor HCR registers. The notable exception is the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * addition of the "cp_flags" field (which can be set to TAVOR_CMD_SPIN or
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * TAVOR_CMD_NOSPIN). This flag really controls the value of the "e" bit
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * in the HCR (i.e. the bit to indicate whether command should complete
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * "in place" - in the HCR - or whether they should have their completions
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * written to the command completion event queue. TAVOR_CMD_SPIN means
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to allow commands to complete "in place" and to poll the "go" bit in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the HCR to determine completion.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * We use TAVOR_SLEEP and TAVOR_NOSLEEP for our TAVOR_CMD_ #defines. This is
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * to maintain consistency with the rest of the SLEEP flags. Additionally,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * because TAVOR_SLEEPFLAG_FOR_CONTEXT() in tavor_rsrc.h returns TAVOR_SLEEP or
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * NOSLEEP we must be compatible with this macro.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The following are the Tavor Firmware Command routines that accessible
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * externally (i.e. throughout the rest of the Tavor driver software).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * These include the all the alloc/free routines, some initialization
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and cleanup routines, and the various specific Tavor firmware commands.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_cmd_post(tavor_state_t *state, tavor_cmd_post_t *cmdpost);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_mbox_alloc(tavor_state_t *state, tavor_mbox_info_t *mbox_info,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid tavor_mbox_free(tavor_state_t *state, tavor_mbox_info_t *mbox_info);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_cmd_complete_handler(tavor_state_t *state, tavor_eqhdl_t eq,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_inmbox_list_init(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_intr_inmbox_list_init(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_outmbox_list_init(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_intr_outmbox_list_init(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid tavor_inmbox_list_fini(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid tavor_intr_inmbox_list_fini(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid tavor_outmbox_list_fini(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid tavor_intr_outmbox_list_fini(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_outstanding_cmdlist_init(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvoid tavor_outstanding_cmdlist_fini(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * SYS_EN and SYS_DIS - used for startup and shutdown of Tavor device
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_sys_en_cmd_post(tavor_state_t *state, uint_t flags,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_sys_dis_cmd_post(tavor_state_t *state, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * INIT_HCA and CLOSE_HCA - used for initialization and teardown of Tavor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * device configuration
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_init_hca_cmd_post(tavor_state_t *state,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor tavor_hw_initqueryhca_t *inithca, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_close_hca_cmd_post(tavor_state_t *state, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * INIT_IB, CLOSE_IB, and SET_IB - used for bring Tavor ports up and down,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * and to set properties of each port (e.g. PortInfo capability mask)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor tavor_hw_initib_t *initib, uint_t port, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_close_ib_cmd_post(tavor_state_t *state, uint_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_set_ib_cmd_post(tavor_state_t *state, uint32_t capmask,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t port, uint_t reset_qkey, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This common function is used to post the following Tavor QP state
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * transition firmware commands:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * RTS2SQD, TOERR, TORST, RST2INIT, INIT2INIT, INIT2RTR, RTR2RTS, RTS2RTS,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * SQD2SQD, SQD2RTS, and SQERR2RTS.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_cmn_qp_cmd_post(tavor_state_t *state, uint_t opcode,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor tavor_hw_qpc_t *qp, uint_t qpindx, uint32_t opmask, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This common function is used to post the following Tavor query firmware
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * QUERY_DEV_LIM, QUERY_FW, QUERY_DDR, QUERY_ADAPTER, QUERY_HCA, QUERY_MPT,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * QUERY_EQ, QUERY_CQ, and QUERY_QP.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_cmn_query_cmd_post(tavor_state_t *state, uint_t opcode,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t queryindx, void *query, uint_t size, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * This common function is used to post the following Tavor resource ownership
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * firmware commands:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * HW2SW_MPT, HW2SW_EQ, HW2SW_CQ, SW2HW_MPT, SW2HW_EQ, and SW2HW_CQ
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_cmn_ownership_cmd_post(tavor_state_t *state, uint_t opcode,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor void *hwrsrc, uint_t size, uint_t hwrsrcindx, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MAD_IFC and helper functions - used for posting IB MADs to Tavor firmware.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * The helper functions are for the MADs most frequently used by the Tavor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * driver (internally).
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_mad_ifc_cmd_post(tavor_state_t *state, uint_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t sleepflag, uint32_t *mad, uint32_t *resp);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_getportinfo_cmd_post(tavor_state_t *state, uint_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_getnodeinfo_cmd_post(tavor_state_t *state, uint_t sleepflag,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_getnodedesc_cmd_post(tavor_state_t *state, uint_t sleepflag,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_getguidinfo_cmd_post(tavor_state_t *state, uint_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t guidblock, uint_t sleepflag, sm_guidinfo_t *guidinfo);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_getpkeytable_cmd_post(tavor_state_t *state, uint_t port,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t pkeyblock, uint_t sleepflag, sm_pkey_table_t *pkeytable);
e9dc6bff6e018821c8c8ac7fe3e3b42e621e93aeRamaswamy Tummalaint tavor_getperfcntr_cmd_post(tavor_state_t *state, uint_t port,
e9dc6bff6e018821c8c8ac7fe3e3b42e621e93aeRamaswamy Tummala uint_t sleepflag, tavor_hw_sm_perfcntr_t *perfinfo, int reset);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * WRITE_MTT - used for write MTT entries to the Tavor MTT table
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_write_mtt_cmd_post(tavor_state_t *state,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor tavor_mbox_info_t *mbox_info, uint_t num_mtt, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * SYNC_TPT - used to sync Tavor TPT caches
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_sync_tpt_cmd_post(tavor_state_t *state, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MAP_EQ - used for map classes of events to Tavor event queues (EQ)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_map_eq_cmd_post(tavor_state_t *state, uint_t map,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t eqcindx, uint64_t eqmapmask, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * RESIZE_CQ - used for resize completion queue (CQ)
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_resize_cq_cmd_post(tavor_state_t *state, tavor_hw_cqc_t *cqc,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t cqcindx, uint32_t *prod_indx, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * CONF_SPECIAL_QP - used to configure a pair of queue pairs for use as
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * special QP. Necessary to enable full QP0 and/or QP1 operation.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_conf_special_qp_cmd_post(tavor_state_t *state, uint_t qpindx,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MGID_HASH, READ_MGM, and WRITE_MGM - used for manipulation of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * hardware resource tables for multicast groups.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_mgid_hash_cmd_post(tavor_state_t *state, uint64_t mgid_h,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint64_t mgid_l, uint64_t *mgid_hash, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_read_mgm_cmd_post(tavor_state_t *state, tavor_hw_mcg_t *mcg,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_write_mgm_cmd_post(tavor_state_t *state, tavor_hw_mcg_t *mcg,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MOD_STAT_CFG - used to configure (override) settings set in NVRAM before
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * a call to QUERY_DEV_LIM. This is primarily used for SRQ settings in
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * the firmware.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_mod_stat_cfg_cmd_post(tavor_state_t *state);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * MODIFY_MPT - used to change MPT attributes of a memory region. This
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor * is primarily used for Resizing SRQs.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorint tavor_modify_mpt_cmd_post(tavor_state_t *state, tavor_hw_mpt_t *mpt,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor uint_t mptindx, uint_t flags, uint_t sleepflag);
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor#endif /* _SYS_IB_ADAPTERS_TAVOR_CMD_H */