/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2004-2012 Emulex. All rights reserved.
* Use is subject to license terms.
*/
#include <emlxs.h>
/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */
/* Walking ones */
0x80000000, 0x40000000, 0x20000000, 0x10000000,
0x08000000, 0x04000000, 0x02000000, 0x01000000,
0x00800000, 0x00400000, 0x00200000, 0x00100000,
0x00080000, 0x00040000, 0x00020000, 0x00010000,
0x00008000, 0x00004000, 0x00002000, 0x00001000,
0x00000800, 0x00000400, 0x00000200, 0x00000100,
0x00000080, 0x00000040, 0x00000020, 0x00000010,
0x00000008, 0x00000004, 0x00000002, 0x00000001,
/* Walking zeros */
0x7fffffff, 0xbfffffff, 0xdfffffff, 0xefffffff,
0xf7ffffff, 0xfbffffff, 0xfdffffff, 0xfeffffff,
0xff7fffff, 0xffbfffff, 0xffdfffff, 0xffefffff,
0xfff7ffff, 0xfffbffff, 0xfffdffff, 0xfffeffff,
0xffff7fff, 0xffffbfff, 0xffffdfff, 0xffffefff,
0xfffff7ff, 0xfffffbff, 0xfffffdff, 0xfffffeff,
0xffffff7f, 0xffffffbf, 0xffffffdf, 0xffffffef,
0xfffffff7, 0xfffffffb, 0xfffffffd, 0xfffffffe,
/* all zeros */
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
/* all ones */
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
/* all 5's */
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
0x55555555, 0x55555555, 0x55555555, 0x55555555,
/* all a's */
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa,
/* all 5a's */
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a, 0x5a5a5a5a,
/* all a5's */
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5,
0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5, 0xa5a5a5a5
};
/* Default pkt callback routine */
static void
{
/* Set the completed flag and wake up sleeping threads */
return;
} /* emlxs_diag_pkt_callback() */
extern uint32_t
{
uint32_t i = 0;
char *pattern_buffer;
/* Check did */
if (did == 0) {
}
/* Check if device is ready */
"ECHO: HBA not ready.");
return (FC_TRAN_BUSY);
}
/* Check for the host node */
"ECHO: HBA not ready.");
return (FC_TRAN_BUSY);
}
length = 124;
/* Prepare ECHO pkt */
"ECHO: Unable to allocate packet. size=%x",
return (FC_NOMEM);
}
/* pkt initialization */
/* Build the fc header */
/* Build the command */
if (pattern) {
/* Fill the transmit buffer with the pattern */
for (i = 0; i < length; i += 4) {
}
} else {
/* Program the default echo pattern */
"Emulex. We network storage. Emulex. We network storage. "
"Emulex. We network storage. Emulex. We network storage.");
}
/* Send ECHO pkt */
"ECHO: Packet send failed.");
goto done;
}
/* Wait for ECHO completion */
pkt_ret = 0;
pkt_ret =
}
if (pkt_ret == -1) {
"Packet timed out.");
return (FC_ABORTED);
}
"Transport error.");
goto done;
}
/* Check response payload */
rval = FC_SUCCESS;
"Data miscompare. did=%06x length=%d. Offset %d "
break;
}
}
if (rval == FC_SUCCESS) {
"did=%06x length=%d pattern=%02x,%02x,%02x,%02x...",
}
done:
/* Free the echo pkt */
return (rval);
} /* emlxs_diag_echo_run() */
extern uint32_t
{
uint32_t i;
/* Check if device is ready */
"BIU: HBA not ready.");
return (FC_TRAN_BUSY);
}
/*
* Get a buffer which will be used for the mailbox command
*/
"BIU: Mailbox allocation failed.");
goto done;
}
/*
* Setup and issue mailbox RUN BIU DIAG command Setup test buffers
*/
"BIU: Buffer allocation failed.");
goto done;
}
if (pattern) {
/* Fill the transmit buffer with the pattern */
for (i = 0; i < MEM_ELSBUF_SIZE; i += 4) {
}
} else {
/* Copy the default pattern into the trasmit buffer */
}
/* Create the biu diag request */
if (rval == MBX_TIMEOUT) {
"BUI diagnostic timed out.");
goto done;
}
"Data miscompare. Offset %d value %02x should "
goto done;
}
}
/* Wait half second before returning */
rval = FC_SUCCESS;
done:
if (mp) {
#ifdef FMA_SUPPORT
!= DDI_FM_OK) {
"diag_biu_run: hdl=%p",
mp->dma_handle);
}
#endif /* FMA_SUPPORT */
}
if (mp1) {
#ifdef FMA_SUPPORT
!= DDI_FM_OK) {
"diag_biu_run: hdl=%p",
mp1->dma_handle);
}
#endif /* FMA_SUPPORT */
}
if (mbq) {
}
return (rval);
} /* emlxs_diag_biu_run() */
extern uint32_t
{
"POST: HBA shutdown.");
return (FC_TRAN_BUSY);
}
/* Take board offline */
"Unable to take adapter offline.");
rval = FC_RESETFAIL;
}
/* Restart the adapter */
switch (rval) {
case 0:
(void) emlxs_online(hba);
"Status good.");
rval = FC_SUCCESS;
break;
case 1: /* failed */
"HBA reset failed.");
rval = FC_RESETFAIL;
break;
case 2: /* failed */
"HBA busy. Quiece and retry.");
break;
}
return (rval);
} /* emlxs_diag_post_run() */