emlxs_mbox.c revision 825277341c15b6b0d2c4b8b622ae7b1d2bdc0390
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * Copyright 2009 Emulex. All rights reserved.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Use is subject to license terms.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanstatic void emlxs_mb_part_slim(emlxs_hba_t *hba, MAILBOXQ *mbq,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanstatic void emlxs_mb_set_mask(emlxs_hba_t *hba, MAILBOXQ *mbq,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanstatic void emlxs_mb_set_debug(emlxs_hba_t *hba, MAILBOXQ *mbq,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan uint32_t word0, uint32_t word1, uint32_t word2);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanstatic void emlxs_mb_write_nv(emlxs_hba_t *hba, MAILBOXQ *mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan {MBX_CONFIG_HBQ, "CONFIG_HBQ"}, /* SLI3 */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan {MBX_UNREG_VPI, "UNREG_VPI"}, /* NPIV */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan {MBX_READ_EVENT_LOG_STATUS, "READ_EVENT_LOG_STATUS"},
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan {MBX_WRITE_EVENT_LOG, "WRITE_EVENT_LOG"},
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan {MBX_PORT_CAPABILITIES, "PORT_CAPABILITIES"},
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan {MBX_REQUEST_FEATURES, "REQUEST_FEATURES"},
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan}; /* emlxs_mb_cmd_table */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * emlxs_mb_resetport Issue a Port Reset mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_resetport(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.payload_length = IOCTL_HEADER_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = COMMON_OPCODE_RESET;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_resetport() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * emlxs_mb_request_features Issue a REQUEST FEATURES mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_request_features(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varReqFeatures.featuresRequested |=
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varReqFeatures.featuresRequested |=
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_request_features() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * emlxs_mb_resume_rpi Issue a RESUME_RPI mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_resume_rpi(emlxs_hba_t *hba, emlxs_buf_t *sbp, uint16_t rpi)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varResumeRPI.EventTag = hba->link_event_tag;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_resume_rpi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_noop(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.payload_length = sizeof (IOCTL_COMMON_NOP) +
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = COMMON_OPCODE_NOP;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan nop = (IOCTL_COMMON_NOP *)&mb->un.varSLIConfig.payload;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_noop() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mbext_noop(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Save address for completion
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies a non-embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->req_length = sizeof (IOCTL_COMMON_NOP);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan nop = (IOCTL_COMMON_NOP *)(hdr_req + 1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mbext_noop() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_read_fcf_table(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL read fcf: stats: %x %x %x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->mbxStatus, hdr_rsp->status, hdr_rsp->extra_status);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Wait for FCF found async event */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Only support 1 FCF for now, so we don't need to walk
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * thru the FCF table.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcf = (IOCTL_FCOE_READ_FCF_TABLE *)(hdr_rsp + 1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec = &fcf->params.response.fcf_entry[0];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Fix up data in FCF record */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan BE_SWAP32_BUFFER(&fcfrec->fabric_name_identifier[0], 8);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan BE_SWAP32_BUFFER(&fcfrec->switch_name_identifier[0], 8);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan BE_SWAP32_BUFFER(&fcfrec->vlan_bitmap[0], 512);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan iptr = (uint32_t *)&fcfrec->fcf_mac_address_hi[0];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sptr = (uint16_t *)&fcfrec->fcf_mac_address_low[0];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Assign a FCFI object for the fcf_index */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfp = emlxs_sli4_assign_fcfi(hba, fcfrec);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfp->EventTag = fcf->params.response.event_tag;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL read fcf: info: x%x x%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfp->EventTag, fcf->params.response.next_valid_fcf_index);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * In this phase, if we successfully bind to just
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * 1 FCFI we are done.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (fcf->params.response.next_valid_fcf_index == 0xffff) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Waiting for a valid FCF to be discovered");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Get the next one */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(fcfmbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = emlxs_mbext_read_fcf_table(hba, fcfmbq,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcf->params.response.next_valid_fcf_index);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)fcfmbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = EMLXS_SLI_ISSUE_MBOX_CMD(hba, fcfmbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)fcfmbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_read_fcf_table() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mbext_read_fcf_table(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t index)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Save address for completion
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies a non-embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = emlxs_cmpl_read_fcf_table;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->opcode = FCOE_OPCODE_READ_FCF_TABLE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->req_length = sizeof (IOCTL_FCOE_READ_FCF_TABLE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcf = (IOCTL_FCOE_READ_FCF_TABLE *)(hdr_req + 1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mbext_read_fcf_table() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_add_fcf_table(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL add fcf: stats: %x %x %x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->mbxStatus, hdr_rsp->status, hdr_rsp->extra_status);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_BUF, (uint8_t *)mbq->nonembed);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* In nonFIP mode, FCF Entries are persistent */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (hdr_rsp->status != MGMT_STATUS_FCF_IN_USE)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Now that we have a fcf table entry, read it back
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * to fall into the normal link up processing.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL add fcf: Cannot alloc mbox");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = emlxs_mbext_read_fcf_table(hba, mq, -1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL add fcf: Cannot build read fcf mbox");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL add fcf: Cannot issue read fcf mbox");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_add_fcf_table() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mbext_add_fcf_table(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t index)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Save address for completion
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies a non-embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = emlxs_cmpl_add_fcf_table;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->subsystem = IOCTL_SUBSYSTEM_FCOE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->opcode = FCOE_OPCODE_ADD_FCF_TABLE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hdr_req->req_length = sizeof (IOCTL_FCOE_ADD_FCF_TABLE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcf = (IOCTL_FCOE_ADD_FCF_TABLE *)(hdr_req + 1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec = &fcf->params.request.fcf_entry;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->max_recv_size = EMLXS_FCOE_MAX_RCV_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[0] = FCOE_FCF_MAC3;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[1] = FCOE_FCF_MAC2;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[2] = FCOE_FCF_MAC1;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[3] = FCOE_FCF_MAC0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_low[0] = FCOE_FCF_MAC5;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_low[1] = FCOE_FCF_MAC4;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fc_map[0] = hba->sli.sli4.cfgFCOE.FCMap[2];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fc_map[1] = hba->sli.sli4.cfgFCOE.FCMap[1];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fc_map[2] = hba->sli.sli4.cfgFCOE.FCMap[0];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[0] = FCOE_FCF_MAC0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[1] = FCOE_FCF_MAC1;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[2] = FCOE_FCF_MAC2;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_hi[3] = FCOE_FCF_MAC3;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_low[0] = FCOE_FCF_MAC4;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fcf_mac_address_low[1] = FCOE_FCF_MAC5;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fc_map[0] = hba->sli.sli4.cfgFCOE.FCMap[0];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fc_map[1] = hba->sli.sli4.cfgFCOE.FCMap[1];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan fcfrec->fc_map[2] = hba->sli.sli4.cfgFCOE.FCMap[2];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli.sli4.cfgFCOE.fip_flags & TLV_FCOE_VLAN) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan BE_SWAP32_BCOPY(bitmap, fcfrec->vlan_bitmap, 512);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "ADD FCF %d: av: %x %x ste %x macp %x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "addr: %02x:%02x:%02x:%02x:%02x:%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mbext_add_fcf_table() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_eq_create(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t num)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sizeof (IOCTL_COMMON_EQ_CREATE) + IOCTL_HEADER_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = COMMON_OPCODE_EQ_CREATE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp = (IOCTL_COMMON_EQ_CREATE *)&mb->un.varSLIConfig.payload;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* 1024 * 4 bytes = 4K */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.EQContext.Count = EQ_ELEMENT_COUNT_1024;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.EQContext.NoDelay = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.EQContext.DelayMult = EQ_DELAY_MULT;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrLow = PADDR_LO(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrHigh = PADDR_HI(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_eq_create() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_cq_create(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t num)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sizeof (IOCTL_COMMON_CQ_CREATE) + IOCTL_HEADER_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = COMMON_OPCODE_CQ_CREATE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp = (IOCTL_COMMON_CQ_CREATE *)&mb->un.varSLIConfig.payload;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* 256 * 16 bytes = 4K */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.CQContext.Count = CQ_ELEMENT_COUNT_256;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.CQContext.EQId = hba->sli.sli4.cq[num].eqid;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.CQContext.Eventable = 1;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.CQContext.NoDelay = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrLow = PADDR_LO(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrHigh = PADDR_HI(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_cq_create() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_wq_create(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t num)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sizeof (IOCTL_FCOE_WQ_CREATE) + IOCTL_HEADER_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = FCOE_OPCODE_WQ_CREATE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp = (IOCTL_FCOE_WQ_CREATE *)&mb->un.varSLIConfig.payload;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.CQId = hba->sli.sli4.wq[num].cqid;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.NumPages = EMLXS_NUM_WQ_PAGES;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (i = 0; i < EMLXS_NUM_WQ_PAGES; i++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[i].addrLow = PADDR_LO(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[i].addrHigh = PADDR_HI(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_wq_create() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_rq_create(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t num)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sizeof (IOCTL_FCOE_RQ_CREATE) + IOCTL_HEADER_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = FCOE_OPCODE_RQ_CREATE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp = (IOCTL_FCOE_RQ_CREATE *)&mb->un.varSLIConfig.payload;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.RQContext.RQSize = RQ_DEPTH_EXPONENT;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.RQContext.BufferSize = RQB_DATA_SIZE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.RQContext.CQIdRecv = hba->sli.sli4.rq[num].cqid;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrLow = PADDR_LO(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrHigh = PADDR_HI(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_rq_create() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_mq_create(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * Signifies an embedded command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sizeof (IOCTL_COMMON_MQ_CREATE) + IOCTL_HEADER_SZ;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.subsystem =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.opcode = COMMON_OPCODE_MQ_CREATE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.timeout = 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSLIConfig.be.un_hdr.hdr_req.req_length =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp = (IOCTL_COMMON_MQ_CREATE *)&mb->un.varSLIConfig.payload;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.MQContext.Size = MQ_ELEMENT_COUNT_16;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.MQContext.CQId = hba->sli.sli4.mq.cqid;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrLow = PADDR_LO(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan qp->params.request.Pages[0].addrHigh = PADDR_HI(addr);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_mq_create() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_reg_fcfi(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL reg fcfi: status: %x", mb->mbxStatus);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_failed_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to register FCFI for FCFI %d index %d",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.FCFI, mb->un.varRegFCFI.InfoIndex);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_failed_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to alloc VFI for Fabric, fcf index %d",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Declare the linkup here */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(fcfp->state & RESOURCE_FCFI_DISC)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_reg_fcfi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_reg_fcfi(emlxs_hba_t *hba, MAILBOXQ *mbq, FCFIobj_t *fcfp)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.FCFI = 0; /* FCFI will be returned by firmware */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.InfoIndex = fcfp->FCF_index;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.RQId0 = hba->sli.sli4.rq[EMLXS_FCFI_RQ0_INDEX].qid;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.Id0_rctl_mask = EMLXS_FCFI_RQ0_RMASK;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.Id0_rctl = EMLXS_FCFI_RQ0_RCTL;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.Id0_type_mask = EMLXS_FCFI_RQ0_TMASK;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.Id0_type = EMLXS_FCFI_RQ0_TYPE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (fcfp->state & RESOURCE_FCFI_VLAN_ID) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.vlanTag = fcfp->vlan_id;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Ignore the fcf record and force FPMA */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegFCFI.mam = EMLXS_REG_FCFI_MAM_FPMA;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_reg_fcfi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_unreg_fcfi(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL unreg fcfi: status: %x", mb->mbxStatus);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_init_failed_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to unregister FCFI %d index %d",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Make sure link is declared down */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_unreg_fcfi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_unreg_fcfi(emlxs_hba_t *hba, FCFIobj_t *fcfp)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_unreg_fcfi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_cmpl_reg_vfi(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "REG_VFI failed. status=x%x", mb->mbxStatus);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Attempt to create a node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((ndlp = (NODELIST *)emlxs_mem_get(hba, MEM_NLP, 0))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((uint8_t *)sp, (uint8_t *)&ndlp->sparm,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_ct] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_els] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_fcp] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_ip] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Add the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Open the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ct);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_els);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ip);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_fcp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to allocate node. did=%06x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->sparm, sizeof (SERV_PARM));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->nlp_nodename, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->nlp_portname, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_update_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "node=%p did=%06x rpi=%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp, ndlp->nlp_DID, ndlp->nlp_Rpi, wwn[0],
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan wwn[1], wwn[2], wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Open the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ct);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_els);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ip);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_fcp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((char *)&vvl, sizeof (emlxs_vvl_fmt_t));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t *)&vvl, sizeof (emlxs_vvl_fmt_t));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vvl.un0.word0 = LE_SWAP32(vvl.un0.word0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vvl.un1.word1 = LE_SWAP32(vvl.un1.word1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mbox = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If link not already down then */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* declare it down now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (emlxs_mb_read_sparam(hba, mbox) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Since this is a fabric login */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * If NPIV Fabric support has just been established on
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * the physical port, then notify the vports of the
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_STATE_CHANGE_LOCKED(hba, FC_READY);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Skip the physical port */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(vport->flag & EMLXS_PORT_BOUND) ||
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (mbq->sbp && ((emlxs_buf_t *)mbq->sbp)->fct_cmd) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_buf_t *cmd_sbp = (emlxs_buf_t *)mbq->sbp;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (cmd_sbp->fct_state == EMLXS_FCT_REG_PENDING) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* SFCT_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_cmpl_reg_vfi */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_reg_vfi(emlxs_hba_t *hba, MAILBOXQ *mbq, VFIobj_t *vfip,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(port->flag & EMLXS_PORT_REGISTERED)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVFI4.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVFI4.edtov = fcfp->fcf_sparam.cmn.e_d_tov;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Convert to seconds */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVFI4.ratov = (fcfp->fcf_sparam.cmn.w2.r_a_tov +
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVFI4.bde.tus.f.bdeSize = sizeof (SERV_PARM);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVFI4.bde.addrHigh = PADDR_HI(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVFI4.bde.addrLow = PADDR_LO(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint32_t *)mp->virt, sizeof (SERV_PARM));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * save address for completion
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_reg_vfi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_unreg_vfi(emlxs_hba_t *hba, VFIobj_t *vfip)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(vfip->state & RESOURCE_VFI_REG)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_unreg_vfi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_async_event(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_async_event() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_heartbeat(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed for hbeat */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_heartbeat() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_config_msi(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t *intr_map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set the default message id to zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* EMLXS_BIG_ENDIAN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Accounts for half word swap of LE architecture */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_config_msi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_config_msix(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t *intr_map,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set the default message id to zero */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* EMLXS_BIG_ENDIAN */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Accounts for word swap of LE architecture */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* EMLXS_LITTLE_ENDIAN */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_config_msix() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* MSI_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_reset_ring(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t ringno)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_reset_ring() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_dump_vpd(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t offset)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Clear the local dump_region */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp4.region_id = DMP_VPD_REGION;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp4.available_cnt = hba->sli.sli4.dump_region.size;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan PADDR_HI(hba->sli.sli4.dump_region.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan PADDR_LO(hba->sli.sli4.dump_region.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp.region_id = DMP_VPD_REGION;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* limited by mailbox size */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp.word_cnt = DMP_VPD_DUMP_WCOUNT;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_dump_vpd() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_dump_fcoe(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t offset)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Clear the local dump_region */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp4.region_id = DMP_FCOE_REGION;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp4.available_cnt = hba->sli.sli4.dump_region.size;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan PADDR_HI(hba->sli.sli4.dump_region.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan PADDR_LO(hba->sli.sli4.dump_region.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_dump_fcoe() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_dump(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t offset, uint32_t words)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Clear the local dump_region */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varDmp4.available_cnt = min((words*4),
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan PADDR_HI(hba->sli.sli4.dump_region.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan PADDR_LO(hba->sli.sli4.dump_region.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_dump() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * emlxs_mb_read_nv Issue a READ NVPARAM mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_nv(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_read_nv() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * emlxs_mb_read_rev Issue a READ REV mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_rev(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t v3)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_read_rev() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * emlxs_mb_run_biu_diag Issue a RUN_BIU_DIAG mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_run_biu_diag(emlxs_hba_t *hba, MAILBOXQ *mbq, uint64_t out,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varBIUdiag.un.s2.xmit_bde64.tus.f.bdeSize = MEM_ELSBUF_SIZE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varBIUdiag.un.s2.xmit_bde64.addrHigh = PADDR_HI(out);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varBIUdiag.un.s2.xmit_bde64.addrLow = PADDR_LO(out);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varBIUdiag.un.s2.rcv_bde64.tus.f.bdeSize = MEM_ELSBUF_SIZE;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varBIUdiag.un.s2.rcv_bde64.addrHigh = PADDR_HI(in);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varBIUdiag.un.s2.rcv_bde64.addrLow = PADDR_LO(in);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_run_biu_diag() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* This should only be called with active MBX_NOWAIT mailboxes */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_retry(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbox = (MAILBOX *)emlxs_mem_get(hba, MEM_MBOX, 1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((uint8_t *)mb, (uint8_t *)mbox, MAILBOX_CMD_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rc = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbox, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbox);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_retry() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_read_la(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (mb->mbxStatus == MBXERR_NO_RESOURCES) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan control = mb->un.varReadLA.un.lilpBde64.tus.f.bdeSize;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Enable Link Attention interrupts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(hba->sli.sli3.hc_copy & HC_LAINT_ENA)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Access handle validation */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* FMA_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((uint32_t *)((char *)mb + sizeof (uint32_t)),
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((caddr_t)mp->virt, (caddr_t)port->alpa_map, 128);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_linkup_atten_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "tag=%d -> %d ALPA=%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_linkdown_atten_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "tag=%d -> %d ALPA=%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->link_event_tag == la.eventTag) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan } else if (hba->link_event_tag + 1 < la.eventTag) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Make sure link is declared down */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If link not already up then declare it up now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((la.attType == AT_LINK_UP) && (hba->state < FC_LINK_UP)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((hba->model_info.device_id == PCI_DEVICE_ID_LP21000_M) &&
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (hba->flag & (FC_ILB_MODE | FC_ELB_MODE))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* MENLO_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Save the linkspeed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check for old model adapters that only */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* supported 1Gb */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (hba->model_info.chip & EMLXS_DRAGONFLY_CHIP)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((hba->topology = la.topology) == TOPOLOGY_LOOP) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check number of devices in map */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "alpa_map: %d device(s): "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "%02x %02x %02x %02x %02x %02x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "%02x %02x %02x %02x %02x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "%02x %02x %02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check if Menlo maintenance mode is enabled */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Maintenance Mode enabled.");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Maintenance Mode disabled.");
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check FCoE attention bit */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* MENLO_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mbox = (MAILBOXQ *)emlxs_mem_get(hba,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* This should turn on DELAYED ABTS for */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* ELS timeouts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_mb_set_var(hba, mbox, 0x00052198, 0x1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mbox = (MAILBOXQ *)emlxs_mem_get(hba,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If link not already down then */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* declare it down now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (emlxs_mb_read_sparam(hba, mbox) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mbox = (MAILBOXQ *)emlxs_mem_get(hba,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Declare the linkup here */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If link not already down then declare it down now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Make sure link is declared down */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Enable Link attention interrupt */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(hba->sli.sli3.hc_copy & HC_LAINT_ENA)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan WRITE_CSR_REG(hba, FC_HC_REG(hba), hba->sli.sli3.hc_copy);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Access handle validation */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_CHK_ACC_HANDLE(hba, hba->sli.sli3.csr_acc_handle);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* FMA_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Log the link event */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_read_la() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_la Issue a READ LA mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_la(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varReadLA.un.lilpBde64.tus.f.bdeSize = 128;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varReadLA.un.lilpBde64.addrHigh = PADDR_HI(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varReadLA.un.lilpBde64.addrLow = PADDR_LO(mp->phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * save address for completion
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_read_la() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_clear_la(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Get a buffer which will be used for */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* mailbox commands */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mbox = (MAILBOXQ *)emlxs_mem_get(hba,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Get link attention message */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(hba->sli.sli3.hc_copy & HC_LAINT_ENA)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Enable Link Attention interrupts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Access handle validation */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* FMA_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli.sli3.hc_copy & HC_LAINT_ENA) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Disable Link Attention interrupts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Access handle validation */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* FMA_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Enable on Link Attention interrupts */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(hba->sli.sli3.hc_copy & HC_LAINT_ENA)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan WRITE_CSR_REG(hba, FC_HC_REG(hba), hba->sli.sli3.hc_copy);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Access handle validation */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_CHK_ACC_HANDLE(hba, hba->sli.sli3.csr_acc_handle);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* FMA_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_STATE_CHANGE_LOCKED(hba, FC_READY);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Adapter is now ready for FCP traffic */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Register vpi's for all ports that have did's */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (i = 0; i < MAX_VPORTS; i++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(vport->flag & EMLXS_PORT_BOUND) ||
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Attempt to send any pending IO */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_SLI_ISSUE_IOCB_CMD(hba, &hba->chan[hba->channel_fcp], 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_clear_la() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_clear_la Issue a CLEAR LA mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_clear_la(emlxs_hba_t *hba, MAILBOXQ *mbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* FC_RPI_CHECK */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varClearLA.eventTag = hba->link_event_tag;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_clear_la() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_status Issue a READ STATUS mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_status(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* fc_read_status() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_lnk_stat Issue a LINK STATUS mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_lnk_stat(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_read_lnk_stat() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_write_nv Issue a WRITE NVPARAM mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_emb_mb_write_nv(emlxs_hba_t *hba, MAILBOXQ *mbq)
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (void *)mb->un.varWTnvp.nodename, sizeof (NAME_TYPE));
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (void *)mb->un.varWTnvp.portname, sizeof (NAME_TYPE));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varWTnvp.hardAL_PA = (uint8_t)cfg[CFG_ASSIGN_ALPA].current;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 21; i++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_write_nv() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_part_slim Issue a PARTITION SLIM mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_part_slim(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t hbainit)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varSlim.numRing = hba->chan_count;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_part_slim() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_config_ring Issue a CONFIG RING mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_config_ring(emlxs_hba_t *hba, int32_t ring, MAILBOXQ *mbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < ring; i++) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan for (i = 0; i < hba->sli.sli3.ring_masks[ring]; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((j + i) >= 6) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varCfgRing.numMask = hba->sli.sli3.ring_masks[ring];
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_config_ring() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_config_link Issue a CONFIG LINK mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_config_link(emlxs_hba_t *hba, MAILBOXQ *mbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NEW_FEATURE SLI-2, Coalescing Response Feature.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varCfgLnk.cr_delay = cfg[CFG_CR_DELAY].current;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varCfgLnk.cr_count = cfg[CFG_CR_COUNT].current;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_config_link() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_init_link(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Retry only MBX_NOWAIT requests */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((cfg[CFG_LINK_SPEED].current > 0) &&
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Retrying. %s: status=%x. Auto-speed set.",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_init_link() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_init_link Issue an INIT LINK mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_init_link(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t topology,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->mbxCommand = (volatile uint8_t) MBX_INIT_LINK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_LOOP;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_LOOP;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags |= FLAGS_TOPOLOGY_FAILOVER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_LOOP;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags = FLAGS_TOPOLOGY_MODE_PT_PT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags |= FLAGS_TOPOLOGY_FAILOVER;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Disable LIRP/LILP support */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Setting up the link speed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((linkspeed > 0) && (vpd->feaLevelHigh >= 0x02)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varInitLnk.link_flags |= FLAGS_PREABORT_RETURN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->mbxCommand = (volatile uint8_t) MBX_INIT_LINK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_init_link() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_down_link Issue a DOWN LINK mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_down_link(emlxs_hba_t *hba, MAILBOXQ *mbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_down_link() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_read_sparam(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (mb->mbxStatus == MBXERR_NO_RESOURCES) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan control = mb->un.varRdSparm.un.sp64.tus.f.bdeSize;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((caddr_t)mp->virt, (caddr_t)&hba->sparam, sizeof (SERV_PARM));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Initialize the node name and port name only once */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((bcmp((caddr_t)&hba->wwnn, (caddr_t)null_wwn, 8) == 0) &&
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (bcmp((caddr_t)&hba->wwpn, (caddr_t)null_wwn, 8) == 0)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t)&hba->wwnn, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t)&hba->wwpn, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t)&hba->sparam.nodeName, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t)&hba->sparam.portName, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "SPARAM: EDTOV hba=x%x mbox_csp=x%x, BBC=x%x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan hba->sparam.cmn.e_d_tov = hba->fc_edtov;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Initialize the physical port */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t)&port->sparam, sizeof (SERV_PARM));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((caddr_t)&hba->wwpn, (caddr_t)&port->wwpn,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((caddr_t)&hba->wwnn, (caddr_t)&port->wwnn,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Initialize the virtual ports */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_read_sparam() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_sparam Issue a READ SPARAM mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_sparam(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varRdSparm.un.sp64.tus.f.bdeSize = sizeof (SERV_PARM);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRdSparm.un.sp64.addrHigh = PADDR_HI(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRdSparm.un.sp64.addrLow = PADDR_LO(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = emlxs_cmpl_read_sparam;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * save address for completion
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_read_sparam() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_rpi Issue a READ RPI mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_rpi(emlxs_hba_t *hba, uint32_t rpi, MAILBOXQ *mbq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set flag to issue action on cmpl
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varRdRPI.reqRpi = (volatile uint16_t) rpi;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_read_rpi() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_xri Issue a READ XRI mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_xri(emlxs_hba_t *hba, uint32_t xri, MAILBOXQ *mbq,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Set flag to issue action on cmpl
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan mb->un.varRdXRI.reqXri = (volatile uint16_t)xri;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_read_xri() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_check_sparm(emlxs_hba_t *hba, SERV_PARM *nsp)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Validate the service parameters */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ((nsp->cls2.rcvDataSizeMsb & 0x0f) << 8) | nsp->cls2.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If the receive data length is zero then set it to */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* the CSP value */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan nsp->cls2.rcvDataSizeMsb = nsp->cmn.bbRcvSizeMsb;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan nsp->cls2.rcvDataSizeLsb = nsp->cmn.bbRcvSizeLsb;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ((nsp->cls3.rcvDataSizeMsb & 0x0f) << 8) | nsp->cls3.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If the receive data length is zero then set it to */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* the CSP value */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan nsp->cls3.rcvDataSizeMsb = nsp->cmn.bbRcvSizeMsb;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan nsp->cls3.rcvDataSizeLsb = nsp->cmn.bbRcvSizeLsb;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_check_sparm() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_reg_did(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (mb->mbxStatus == MBXERR_NO_RESOURCES) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan control = mb->un.varRegLogin.un.sp.bdeSize;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Special handle for vport PLOGI */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan port = &VPORT((mb->un.varRegLogin.vpi - hba->vpi_base));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Limit reached. count=%d", port->node_count);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Special handle for vport PLOGI */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan lvpi = (ldata & 0xffff) - hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* First copy command data */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ldata = mb->un.varWords[0]; /* get rpi */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ldata = mb->un.varWords[1]; /* get did */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Attempt to create a node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((ndlp = (NODELIST *)emlxs_mem_get(hba, MEM_NLP, 0))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((uint8_t *)sp, (uint8_t *)&ndlp->sparm,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_ct] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_els] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_fcp] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_ip] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Add the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Open the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ct);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_els);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ip);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_fcp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to allocate node. did=%06x rpi=%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->sparm, sizeof (SERV_PARM));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->nlp_nodename, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->nlp_portname, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_update_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "node=%p did=%06x rpi=%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp, ndlp->nlp_DID, ndlp->nlp_Rpi, wwn[0],
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan wwn[1], wwn[2], wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Open the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ct);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_els);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_ip);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(port, ndlp, hba->channel_fcp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((char *)&vvl, sizeof (emlxs_vvl_fmt_t));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (caddr_t *)&vvl, sizeof (emlxs_vvl_fmt_t));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vvl.un0.word0 = LE_SWAP32(vvl.un0.word0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vvl.un1.word1 = LE_SWAP32(vvl.un1.word1);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((hba->sli_mode == EMLXS_HBA_SLI4_MODE) &&
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_STATE_CHANGE_LOCKED(hba, FC_READY);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If this was a fabric login */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* If CLEAR_LA has been sent, then attempt to */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* register the vpi now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * If NPIV Fabric support has just been established on
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * the physical port, then notify the vports of the
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Skip the physical port */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(vport->flag & EMLXS_PORT_BOUND) ||
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mb_unreg_did(port, ldid, NULL, NULL, NULL);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (emlxs_dhc_auth_start(port, ndlp, mbq->sbp,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Auth started - auth completion will */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* handle sbp and ubp now */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* DHCHAP_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (mbq->sbp && ((emlxs_buf_t *)mbq->sbp)->fct_cmd) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_buf_t *cmd_sbp = (emlxs_buf_t *)mbq->sbp;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (cmd_sbp->fct_state == EMLXS_FCT_REG_PENDING) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan#endif /* SFCT_SUPPORT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_reg_did() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_reg_did Issue a REG_LOGIN mailbox command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_mb_reg_did(emlxs_port_t *port, uint32_t did, SERV_PARM *param,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte emlxs_buf_t *sbp, fc_unsol_buf_t *ubp, IOCBQ *iocbq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for invalid node ids to register */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan if ((did == 0) && (!(hba->flag & FC_LOOPBACK_MODE))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_create_failed_msg,
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan "Invalid service parameters. did=%06x rval=%d", did,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check if the node limit has been reached */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_create_failed_msg,
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan "Limit reached. did=%06x count=%d", did,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_create_failed_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to allocate mailbox. did=%x", did);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Build login request */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((mp = (MATCHMAP *)emlxs_mem_get(hba, MEM_BUF, 1)) == 0) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_create_failed_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to allocate buffer. did=%x", did);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * If we are SLI4, the RPI number gets assigned by the driver.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * For SLI3, the firmware assigns the RPI number.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_create_failed_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan bcopy((void *)param, (void *)mp->virt, sizeof (SERV_PARM));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varRegLogin.un.sp64.tus.f.bdeSize = sizeof (SERV_PARM);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegLogin.un.sp64.addrHigh = PADDR_HI(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegLogin.un.sp64.addrLow = PADDR_LO(mp->phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegLogin.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegLogin.rpi = (rp)? rp->RPI: 0;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_reg_did() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_unreg_rpi Issue a UNREG_LOGIN mailbox command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_mb_unreg_rpi(emlxs_port_t *port, uint32_t rpi, emlxs_buf_t *sbp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure the node does already exist */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * If we just unregistered the host node then
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * clear the host DID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { /* Unreg all */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((hba->sli_mode == EMLXS_HBA_SLI4_MODE) && (rpi == 0xffff)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varUnregLogin.ll = INDEX_INDICATOR_VPI;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varUnregLogin.rpi = (uint16_t)port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varUnregLogin.rpi = (uint16_t)rpi;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varUnregLogin.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* No more RPIs so unreg the VPI */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_unreg_rpi() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_unreg_did Issue a UNREG_DID mailbox command
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_mb_unreg_did(emlxs_port_t *port, uint32_t did, emlxs_buf_t *sbp,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Unregister all default RPIs if did == 0xffffffff
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for base node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* just flush base node */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_tx_node_flush(port, &port->node_base,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return now */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A zero DID means that we are trying to unreg the host node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * after a link bounce
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If the prev_did == 0 then the adapter has been reset and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * there is no need in unregistering
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * If the prev_did != 0 then we can look for the hosts
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * last known DID node
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Make sure the node does already exist */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Use UNREG_RPI for SLI4 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove it */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * If we just unregistered the host node then
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * clear the host DID
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* SLI4 doesn't have dflt RPIs in SLI Port */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varUnregDID.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_unreg_did() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_set_mask Issue a SET MASK mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_set_mask(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t mask,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varWords[0] = 0x11223344; /* set passwd */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_set_mask() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_set_debug Issue a special debug mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_set_debug(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t word0,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_set_debug() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_set_var Issue a special debug mbox command to write slim
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_set_var(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* addr = 0x090597 is AUTO ABTS disable for ELS commands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* addr = 0x052198 is DELAYED ABTS enable for ELS commands */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* addr = 0x100506 is for setting PCI MAX READ value */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Always turn on DELAYED ABTS for ELS timeouts
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_set_var() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Disable Traffic Cop
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_disable_tc(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_disable_tc() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_config_hbq(emlxs_hba_t *hba, MAILBOXQ *mbq, int hbq_id)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varCfgHbq.numEntries = hbq->HBQ_numEntries;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varCfgHbq.recvNotify = hbq->HBQ_recvNotify;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varCfgHbq.hbqaddrLow = PADDR_LO(hbq->HBQ_host_buf.phys);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varCfgHbq.hbqaddrHigh = PADDR_HI(hbq->HBQ_host_buf.phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Copy info for profiles 2,3,5. Other profiles this area is reserved */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((hbq->HBQ_profile == 2) || (hbq->HBQ_profile == 3) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Return if no rctl / type masks for this HBQ */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Otherwise we setup specific rctl / type masks for this HBQ */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mb->un.varCfgHbq.hbqMasks[i].tmask = hbq->HBQ_Masks[i].tmask;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_config_hbq() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_init_vpi(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vport = &VPORT((mb->un.varInitVPI4.vpi - hba->vpi_base));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vport->flag |= EMLXS_PORT_INIT_VPI_CMPL;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL init_vpi: stats: %x", mb->mbxStatus);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_init_vpi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varInitVPI4.vfi = phy_port->VFIp->VFI;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varInitVPI4.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_init_vpi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Leadville wll start sending PLOGI right after */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* FDISC completion, we need to wait for REG_VPI */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* completion, before sending back the FDISK request */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan/* Also, allocate a node structure for Fabric port */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_reg_vpi(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sli_detail_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "CMPL reg_vpi: stats: %x", mb->mbxStatus);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vport = &VPORT((mb->un.varRegVpi.vpi - hba->vpi_base));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan sp = (SERV_PARM *)((caddr_t)pkt->pkt_resp + sizeof (uint32_t));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp = emlxs_node_find_did(vport, ldid);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Attempt to create a node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((ndlp = (NODELIST *)emlxs_mem_get(hba, MEM_NLP, 0))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bcopy((uint8_t *)sp, (uint8_t *)&ndlp->sparm,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_ct] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_els] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_fcp] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp->nlp_flag[hba->channel_ip] |= NLP_CLOSED;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Add the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Open the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_ct);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_els);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_ip);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_fcp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "Unable to allocate node. did=%06x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->sparm, sizeof (SERV_PARM));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->nlp_nodename, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (uint8_t *)&ndlp->nlp_portname, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_node_update_msg,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "node=%p did=%06x rpi=%x "
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan "wwpn=%02x%02x%02x%02x%02x%02x%02x%02x",
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan ndlp, ndlp->nlp_DID, ndlp->nlp_Rpi, wwn[0],
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan wwn[1], wwn[2], wwn[3], wwn[4], wwn[5], wwn[6], wwn[7]);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Open the node */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_ct);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_els);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_ip);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_node_open(vport, ndlp, hba->channel_fcp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_reg_vpi */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_reg_vpi(emlxs_port_t *port, emlxs_buf_t *sbp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Can't reg vpi until ClearLA is sent */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Must have port id */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varRegVpi.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_reg_vpi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_cmpl_unreg_vpi(void *arg1, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vport->flag &= ~EMLXS_PORT_INIT_VPI_CMPL;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan vport->flag &= ~EMLXS_PORT_REG_VPI_CMPL;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_cmpl_unreg_vpi() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (!(mbq = (MAILBOXQ *)emlxs_mem_get(hba, MEM_MBOX, 1))) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mb->un.varUnregVpi.vpi = port->vpi + hba->vpi_base;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan rval = EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_NOWAIT, 0);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if ((rval != MBX_BUSY) && (rval != MBX_SUCCESS)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) emlxs_mem_put(hba, MEM_MBOX, (uint8_t *)mbq);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* No more VPIs so unreg the VFI */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_unreg_vpi() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_config_farp Issue a CONFIG FARP mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_config_farp(emlxs_hba_t *hba, MAILBOXQ *mbq)
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (uint8_t *)&mb->un.varCfgFarp.portname, sizeof (NAME_TYPE));
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan (uint8_t *)&mb->un.varCfgFarp.nodename, sizeof (NAME_TYPE));
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_config_farp() */
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * emlxs_mb_read_nv Issue a READ CONFIG mailbox command
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathanemlxs_mb_read_config(emlxs_hba_t *hba, MAILBOXQ *mbq)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbq->mbox_cmpl = NULL; /* no cmpl needed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_read_config() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NAME: emlxs_mb_put
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: put mailbox cmd onto the mailbox queue.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EXECUTION ENVIRONMENT: process and interrupt level.
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan * CALLED FROM: EMLXS_SLI_ISSUE_MBOX_CMD
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * INPUT: hba - pointer to the device info area
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan * mbp - pointer to mailbox queue entry of mailbox cmd
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS: NULL - command queued
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * queue command to end of list
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan ((MAILBOXQ *)hba->mbox_queue.q_last)->next = mbq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * add command to empty list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_put() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NAME: emlxs_mb_get
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * FUNCTION: get a mailbox command from mailbox command queue
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * EXECUTION ENVIRONMENT: interrupt level.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CALLED FROM: emlxs_handle_mb_event
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * INPUT: hba - pointer to the device info area
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * RETURNS: NULL - no match found mb pointer - pointer to a mailbox command
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan p_first = (MAILBOXQ *)hba->mbox_queue.q_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hba->mbox_queue.q_first = (uint8_t *)p_first->next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_get() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* EMLXS_PORT_LOCK must be held when calling this */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_mb_init(emlxs_hba_t *hba, MAILBOXQ *mbq, uint32_t flag, uint32_t tmo)
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* FMA_SUPPORT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set the Mailbox timer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Initialize mailbox */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MPDATA_SYNC(mp->dma_handle, 0, mp->size,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_MPDATA_SYNC(mp->dma_handle, 0, mp->size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_init() */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteemlxs_mb_fini(emlxs_hba_t *hba, MAILBOX *mb, uint32_t mbxStatus)
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbox_nonembed = (MATCHMAP *)mbox_mbq->nonembed;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbox_sbp = (emlxs_buf_t *)mbox_mbq->sbp;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbox_ubp = (fc_unsol_buf_t *)mbox_mbq->ubp;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check for deferred MBUF cleanup */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan (void) emlxs_mem_put(hba, MEM_BUF, (uint8_t *)mbox_bp);
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan } else { /* MBX_WAIT */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Copy the local mailbox provided back into */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* the original mailbox */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Mark mailbox complete */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Wake up the sleeping thread */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan if (mb && mbox_sbp && mbox_sbp->fct_cmd) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "FCT mailbox: %s: status=%x",
291a2b48b9adcd7b3666c34e80ba6411929afe7fSukumar Swaminathan#endif /* SFCT_SUPPORT */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for deferred pkt completion */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set error status */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte emlxs_set_pkt_state(mbox_sbp, IOSTAT_LOCAL_REJECT,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for deferred ub completion */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Special handling for vport PLOGI */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check for deferred iocb tx */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Check for driver special codes */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* These indicate the mailbox is being flushed */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Set the error status and return it */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbox_iocbq->iocb.ULPSTATUS = IOSTAT_LOCAL_REJECT;
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbox_iocbq->iocb.un.grsp.perr.statLocalError =
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan emlxs_proc_channel_event(hba, mbox_iocbq->channel,
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan EMLXS_SLI_ISSUE_IOCB_CMD(hba, mbox_iocbq->channel,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_fini() */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan mbxStatus = (hba->flag & FC_HARDWARE_ERROR) ?
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Flush out the active mbox command */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan /* Flush out the queued mbox commands */
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan while (mbq = (MAILBOXQ *)emlxs_mb_get(hba)) {
825277341c15b6b0d2c4b8b622ae7b1d2bdc0390Sukumar Swaminathan} /* emlxs_mb_flush */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte count = sizeof (emlxs_mb_cmd_table) / sizeof (emlxs_table_t);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < count; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} /* emlxs_mb_cmd_xlate() */