emlxs_mbox.c revision 291a2b48b9adcd7b3666c34e80ba6411929afe7f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Emulex. All rights reserved.
* Use is subject to License terms.
*/
#include <emlxs.h>
/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
{MBX_SHUTDOWN, "SHUTDOWN"},
{MBX_LOAD_SM, "LOAD_SM"},
{MBX_READ_NV, "READ_NV"},
{MBX_WRITE_NV, "WRITE_NV"},
{MBX_RUN_BIU_DIAG, "RUN_BIU_DIAG"},
{MBX_INIT_LINK, "INIT_LINK"},
{MBX_DOWN_LINK, "DOWN_LINK"},
{MBX_CONFIG_LINK, "CONFIG_LINK"},
{MBX_PART_SLIM, "PART_SLIM"},
{MBX_CONFIG_RING, "CONFIG_RING"},
{MBX_RESET_RING, "RESET_RING"},
{MBX_READ_CONFIG, "READ_CONFIG"},
{MBX_READ_RCONFIG, "READ_RCONFIG"},
{MBX_READ_SPARM, "READ_SPARM"},
{MBX_READ_STATUS, "READ_STATUS"},
{MBX_READ_RPI, "READ_RPI"},
{MBX_READ_XRI, "READ_XRI"},
{MBX_READ_REV, "READ_REV"},
{MBX_READ_LNK_STAT, "READ_LNK_STAT"},
{MBX_REG_LOGIN, "REG_LOGIN"},
{MBX_UNREG_LOGIN, "UNREG_LOGIN"},
{MBX_READ_LA, "READ_LA"},
{MBX_CLEAR_LA, "CLEAR_LA"},
{MBX_DUMP_MEMORY, "DUMP_MEMORY"},
{MBX_DUMP_CONTEXT, "DUMP_CONTEXT"},
{MBX_RUN_DIAGS, "RUN_DIAGS"},
{MBX_RESTART, "RESTART"},
{MBX_UPDATE_CFG, "UPDATE_CFG"},
{MBX_DOWN_LOAD, "DOWN_LOAD"},
{MBX_DEL_LD_ENTRY, "DEL_LD_ENTRY"},
{MBX_RUN_PROGRAM, "RUN_PROGRAM"},
{MBX_SET_MASK, "SET_MASK"},
{MBX_SET_VARIABLE, "SET_VARIABLE"},
{MBX_UNREG_D_ID, "UNREG_D_ID"},
{MBX_KILL_BOARD, "KILL_BOARD"},
{MBX_CONFIG_FARP, "CONFIG_FARP"},
{MBX_LOAD_AREA, "LOAD_AREA"},
{MBX_RUN_BIU_DIAG64, "RUN_BIU_DIAG64"},
{MBX_CONFIG_PORT, "CONFIG_PORT"},
{MBX_READ_SPARM64, "READ_SPARM64"},
{MBX_READ_RPI64, "READ_RPI64"},
{MBX_CONFIG_MSI, "CONFIG_MSI"},
{MBX_CONFIG_MSIX, "CONFIG_MSIX"},
{MBX_REG_LOGIN64, "REG_LOGIN64"},
{MBX_READ_LA64, "READ_LA64"},
{MBX_FLASH_WR_ULA, "FLASH_WR_ULA"},
{MBX_SET_DEBUG, "SET_DEBUG"},
{MBX_GET_DEBUG, "GET_DEBUG"},
{MBX_LOAD_EXP_ROM, "LOAD_EXP_ROM"},
{MBX_BEACON, "BEACON"},
{MBX_ASYNC_EVENT, "ASYNC_EVENT"},
{MBX_HEARTBEAT, "HEARTBEAT"},
{MBX_READ_EVENT_LOG_STATUS, "READ_EVENT_LOG_STATUS"},
{MBX_READ_EVENT_LOG, "READ_EVENT_LOG"},
{MBX_WRITE_EVENT_LOG, "WRITE_EVENT_LOG"},
{MBX_NV_LOG, "NV_LOG"},
{MBX_PORT_CAPABILITIES, "PORT_CAPABILITIES"},
{MBX_IOV_CONTROL, "IOV_CONTROL"},
{MBX_IOV_MBX, "IOV_MBX"}
}; /* emlxs_mb_cmd_table */
/*ARGSUSED*/
extern void
{
return;
} /* emlxs_mb_async_event() */
/*ARGSUSED*/
extern void
{
return;
} /* emlxs_mb_heartbeat() */
#ifdef MSI_SUPPORT
/*ARGSUSED*/
extern void
{
uint32_t i;
/* Set the default message id to zero */
for (i = 1; i < intr_count; i++) {
#ifdef EMLXS_BIG_ENDIAN
}
}
}
}
}
}
}
#endif /* EMLXS_BIG_ENDIAN */
#ifdef EMLXS_LITTLE_ENDIAN
/* Accounts for half word swap of LE architecture */
}
}
}
}
}
}
}
#endif /* EMLXS_LITTLE_ENDIAN */
}
return;
} /* emlxs_mb_config_msi() */
/*ARGSUSED*/
extern void
{
uint32_t i;
/* Set the default message id to zero */
for (i = 1; i < intr_count; i++) {
#ifdef EMLXS_BIG_ENDIAN
}
}
}
}
}
}
}
#endif /* EMLXS_BIG_ENDIAN */
#ifdef EMLXS_LITTLE_ENDIAN
/* Accounts for word swap of LE architecture */
}
}
}
}
}
}
}
#endif /* EMLXS_LITTLE_ENDIAN */
}
return;
} /* emlxs_mb_config_msix() */
#endif /* MSI_SUPPORT */
/*ARGSUSED*/
extern void
{
return;
} /* emlxs_mb_reset_ring() */
/*
* emlxs_mb_dump_vpd Issue a DUMP MEMORY mailbox command
*/
/*ARGSUSED*/
extern void
{
/*
* Setup to dump VPD region
*/
/* limited by mailbox size */
} /* emlxs_mb_dump_vpd() */
/*ARGSUSED*/
extern void
{
return;
} /* emlxs_mb_dump() */
/*
* emlxs_mb_read_nv Issue a READ NVPARAM mailbox command
*/
/*ARGSUSED*/
extern void
{
} /* End emlxs_mb_read_nv */
/*
* emlxs_mb_read_rev Issue a READ REV mailbox command
*/
/*ARGSUSED*/
extern void
{
if (v3) {
}
} /* End emlxs_mb_read_rev */
/*
* emlxs_mb_run_biu_diag Issue a RUN_BIU_DIAG mailbox command
*/
/*ARGSUSED*/
extern uint32_t
{
return (0);
} /* End emlxs_mb_run_biu_diag */
/*
* emlxs_mb_read_la Issue a READ LA mailbox command
*/
extern uint32_t
{
return (1);
}
/*
* save address for completion
*/
return (0);
} /* emlxs_mb_read_la() */
/*
* emlxs_mb_clear_la Issue a CLEAR LA mailbox command
*/
extern void
{
#ifdef FC_RPI_CHECK
#endif /* FC_RPI_CHECK */
return;
} /* End emlxs_mb_clear_la */
/*
* emlxs_mb_read_status Issue a READ STATUS mailbox command
*/
/*ARGSUSED*/
extern void
{
} /* End fc_read_status */
/*
* emlxs_mb_read_lnk_stat Issue a LINK STATUS mailbox command
*/
/*ARGSUSED*/
extern void
{
} /* End emlxs_mb_read_lnk_stat */
/*
* emlxs_mb_write_nv Issue a WRITE NVPARAM mailbox command
*/
static void
{
int32_t i;
for (i = 0; i < 21; i++) {
}
} /* End emlxs_mb_write_nv */
/*
* emlxs_mb_part_slim Issue a PARTITION SLIM mailbox command
*/
static void
{
} /* End emlxs_mb_part_slim */
/*
* emlxs_mb_config_ring Issue a CONFIG RING mailbox command
*/
extern void
{
int32_t i;
int32_t j;
j = 0;
for (i = 0; i < ring; i++) {
j += hba->ring_masks[i];
}
if ((j + i) >= 6) {
break;
}
}
return;
} /* End emlxs_mb_config_ring */
/*
* emlxs_mb_config_link Issue a CONFIG LINK mailbox command
*/
extern void
{
/*
* NEW_FEATURE SLI-2, Coalescing Response Feature.
*/
}
return;
} /* emlxs_mb_config_link() */
/*
* emlxs_mb_init_link Issue an INIT LINK mailbox command
*/
extern void
{
switch (topology) {
case FLAGS_LOCAL_LB:
break;
break;
break;
case FLAGS_TOPOLOGY_MODE_LOOP:
break;
break;
}
}
/*
* Setting up the link speed
*/
switch (linkspeed) {
case 0:
break;
case 1:
linkspeed = 0;
}
break;
case 2:
linkspeed = 0;
}
break;
case 4:
linkspeed = 0;
}
break;
case 8:
linkspeed = 0;
}
break;
case 10:
linkspeed = 0;
}
break;
default:
linkspeed = 0;
break;
}
}
return;
} /* emlxs_mb_init_link() */
/*
* emlxs_mb_down_link Issue a DOWN LINK mailbox command
*/
/*ARGSUSED*/
extern void
{
return;
} /* emlxs_mb_down_link() */
/*
* emlxs_mb_read_sparam Issue a READ SPARAM mailbox command
*/
extern uint32_t
{
return (1);
}
/*
* save address for completion
*/
return (0);
} /* emlxs_mb_read_sparam() */
/*
* emlxs_mb_read_rpi Issue a READ RPI mailbox command
*/
/*ARGSUSED*/
extern uint32_t
{
/*
* Set flag to issue action on cmpl
*/
return (0);
} /* End emlxs_mb_read_rpi */
/*
* emlxs_mb_read_xri Issue a READ XRI mailbox command
*/
/*ARGSUSED*/
extern uint32_t
{
/*
* Set flag to issue action on cmpl
*/
return (0);
} /* End emlxs_mb_read_xri */
/*ARGSUSED*/
extern int32_t
{
return (0);
}
/* Validate the service parameters */
return (1);
}
return (2);
}
/* If the receive data length is zero then set it to */
/* the CSP value */
if (!nsp_value) {
return (0);
}
}
/* If the receive data length is zero then set it to */
/* the CSP value */
if (!nsp_value) {
return (0);
}
}
return (0);
} /* emlxs_mb_check_sparm() */
/*
* emlxs_mb_reg_did Issue a REG_LOGIN mailbox command
*/
extern uint32_t
{
/* Check for invalid node ids to register */
return (1);
}
if (did & 0xff000000) {
return (1);
}
"Invalid service parameters. did=%06x rval=%d", did,
rval);
return (1);
}
/* Check if the node limit has been reached */
"Limit reached. did=%06x count=%d", did,
port->node_count);
return (1);
}
return (1);
}
/* Build login request */
return (1);
}
#ifdef SLI3_SUPPORT
#endif /* SLI3_SUPPORT */
}
return (0);
} /* emlxs_mb_reg_did() */
/*
* emlxs_mb_unreg_rpi Issue a UNREG_LOGIN mailbox command
*/
extern uint32_t
{
if (rpi != 0xffff) {
/* Make sure the node does already exist */
if (ndlp) {
/*
* If we just unregistered the host node then
* clear the host DID
*/
}
/* remove it */
} else {
return (1);
}
} else { /* Unreg all */
}
return (1);
}
#ifdef SLI3_SUPPORT
#endif /* SLI3_SUPPORT */
}
return (0);
} /* emlxs_mb_unreg_rpi() */
/*
* emlxs_mb_unreg_did Issue a UNREG_DID mailbox command
*/
extern uint32_t
{
/*
* Unregister all default RPIs if did == 0xffffffff
*/
if (did != 0xffffffff) {
/* Check for base node */
/* just flush base node */
0, 0, 0);
(void) emlxs_chipq_node_flush(port, 0,
/* Return now */
return (1);
}
/*
* A zero DID means that we are trying to unreg the host node
* after a link bounce
*/
/*
* If the prev_did == 0 then the adapter has been reset and
* there is no need in unregistering
*/
/*
* If the prev_did != 0 then we can look for the hosts
* last known DID node
*/
if (did == 0) {
return (1);
}
}
/* Make sure the node does already exist */
if (ndlp) {
/* remove it */
/*
* If we just unregistered the host node then
* clear the host DID
*/
}
} else {
return (1);
}
}
return (1);
}
#ifdef SLI3_SUPPORT
#endif /* SLI3_SUPPORT */
}
return (0);
} /* End emlxs_mb_unreg_did */
/*
* emlxs_mb_set_mask Issue a SET MASK mailbox command
*/
/*ARGSUSED*/
static void
{
} /* End emlxs_mb_set_mask */
/*
* emlxs_mb_set_debug Issue a special debug mailbox command
*/
/*ARGSUSED*/
static void
{
} /* End emlxs_mb_set_debug */
/*
* emlxs_mb_set_var Issue a special debug mbox command to write slim
*/
/*ARGSUSED*/
extern void
{
/* addr = 0x090597 is AUTO ABTS disable for ELS commands */
/* addr = 0x052198 is DELAYED ABTS enable for ELS commands */
/* addr = 0x100506 is for setting PCI MAX READ value */
/*
* Always turn on DELAYED ABTS for ELS timeouts
*/
value = 1;
}
} /* End emlxs_mb_set_var */
/*
* Disable Traffic Cop
*/
/*ARGSUSED*/
extern void
{
} /* End emlxs_disable_tc */
#ifdef SLI3_SUPPORT
extern void
{
int i;
/* Copy info for profiles 2,3,5. Other profiles this area is reserved */
}
/* Return if no rctl / type masks for this HBQ */
if (!hbq->HBQ_num_mask) {
return;
}
/* Otherwise we setup specific rctl / type masks for this HBQ */
for (i = 0; i < hbq->HBQ_num_mask; i++) {
}
return;
} /* emlxs_mb_config_hbq() */
#endif /* SLI3_SUPPORT */
extern uint32_t
{
return (0);
}
/* Can't reg vpi until ClearLA is sent */
return (1);
}
/* Must have port id */
return (1);
}
return (1);
}
}
return (0);
} /* emlxs_mb_reg_vpi() */
extern uint32_t
{
return (0);
}
return (1);
}
}
return (0);
} /* emlxs_mb_unreg_vpi() */
/*
* emlxs_mb_config_farp Issue a CONFIG FARP mailbox command
*/
extern void
{
} /* emlxs_mb_config_farp() */
/*
* emlxs_mb_read_nv Issue a READ CONFIG mailbox command
*/
/*ARGSUSED*/
extern void
{
} /* emlxs_mb_read_config() */
/*
* NAME: emlxs_mb_put
*
* FUNCTION: put mailbox cmd onto the mailbox queue.
*
* EXECUTION ENVIRONMENT: process and interrupt level.
*
* NOTES:
*
* CALLED FROM: emlxs_sli_issue_mbox_cmd
*
* INPUT: hba - pointer to the device info area
* mbp - pointer to mailbox queue entry of mailbox cmd
*
* RETURNS: NULL - command queued
*/
extern void
{
/*
* queue command to end of list
*/
} else {
/*
* add command to empty list
*/
}
} /* emlxs_mb_put() */
/*
* NAME: emlxs_mb_get
*
* FUNCTION: get a mailbox command from mailbox command queue
*
* EXECUTION ENVIRONMENT: interrupt level.
*
* NOTES:
*
* CALLED FROM: emlxs_handle_mb_event
*
* INPUT: hba - pointer to the device info area
*
* RETURNS: NULL - no match found mb pointer - pointer to a mailbox command
*/
extern MAILBOXQ *
{
} else {
}
}
return (p_first);
} /* emlxs_mb_get() */
/* EMLXS_PORT_LOCK must be held when calling this */
void
{
#ifdef FMA_SUPPORT
#endif /* FMA_SUPPORT */
/* Set the Mailbox timer */
/* Initialize mailbox */
if (flag == MBX_NOWAIT) {
} else {
}
}
}
}
}
#ifdef MBOX_EXT_SUPPORT
}
#endif /* MBOX_EXT_SUPPORT */
return;
} /* emlxs_mb_init() */
extern void
{
if (hba->mbox_queue_flag) {
if (mbxStatus != MBX_SUCCESS) {
} else {
}
}
#ifdef MBOX_EXT_SUPPORT
hba->mbox_ext_size = 0;
#endif /* MBOX_EXT_SUPPORT */
hba->mbox_iocbq = 0;
hba->mbox_mbqflag = 0;
hba->mbox_timer = 0;
hba->mbox_queue_flag = 0;
if (mbox_mbq) {
if (mb) {
/* Copy the local mailbox provided back into */
/* the original mailbox */
}
/* Mark mailbox complete */
/* Wake up the sleeping thread */
if (mbox_queue_flag == MBX_SLEEP) {
}
}
/* Check for deferred MBUF cleanup */
}
#ifdef SFCT_SUPPORT
"FCT mailbox: %s: status=%x",
}
#endif /* SFCT_SUPPORT */
/* Check for deferred pkt completion */
if (mbox_sbp) {
if (mbxStatus != MBX_SUCCESS) {
/* Set error status */
IOERR_NO_RESOURCES, 1);
}
}
/* Check for deferred ub completion */
if (mbox_ubp) {
}
/* Check for deferred iocb tx */
if (mbox_iocbq) {
}
return;
} /* emlxs_mb_fini() */
/* This should only be called with active MBX_NOWAIT mailboxes */
void
{
} else {
}
hba->mbox_iocbq = 0;
hba->mbox_mbqflag = 0;
hba->mbox_queue_flag = 0;
return;
} /* emlxs_mb_retry() */
extern char *
{
static char buffer[32];
uint32_t i;
for (i = 0; i < count; i++) {
return (emlxs_mb_cmd_table[i].string);
}
}
return (buffer);
} /* emlxs_mb_cmd_xlate() */