emlxs_diag.c (a9800beb) | emlxs_diag.c (8f23e9fa) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * |
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. | 8 * You can obtain a copy of the license at 9 * http://www.opensource.org/licenses/cddl1.txt. |
10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* | 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22/* |
23 * Copyright 2010 Emulex. All rights reserved. | 23 * Copyright (c) 2004-2012 Emulex. All rights reserved. |
24 * Use is subject to license terms. 25 */ 26 | 24 * Use is subject to license terms. 25 */ 26 |
27 | |
28#include <emlxs.h> 29 30 31/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */ 32EMLXS_MSG_DEF(EMLXS_DIAG_C); 33 34uint32_t emlxs_diag_pattern[256] = { 35 /* Walking ones */ --- 121 unchanged lines hidden (view full) --- 157 if ((hba->state < FC_LINK_UP) || (port->did == 0)) { 158 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 159 "ECHO: HBA not ready."); 160 161 return (FC_TRAN_BUSY); 162 } 163 164 /* Check for the host node */ | 27#include <emlxs.h> 28 29 30/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */ 31EMLXS_MSG_DEF(EMLXS_DIAG_C); 32 33uint32_t emlxs_diag_pattern[256] = { 34 /* Walking ones */ --- 121 unchanged lines hidden (view full) --- 156 if ((hba->state < FC_LINK_UP) || (port->did == 0)) { 157 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 158 "ECHO: HBA not ready."); 159 160 return (FC_TRAN_BUSY); 161 } 162 163 /* Check for the host node */ |
165 ndlp = emlxs_node_find_did(port, port->did); | 164 ndlp = emlxs_node_find_did(port, port->did, 1); |
166 167 if (!ndlp || !ndlp->nlp_active) { 168 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 169 "ECHO: HBA not ready."); 170 171 return (FC_TRAN_BUSY); 172 } 173 --- 38 unchanged lines hidden (view full) --- 212 lptr = (uint32_t *)pattern_buffer; 213 214 for (i = 0; i < length; i += 4) { 215 *lptr++ = pattern; 216 } 217 } else { 218 /* Program the default echo pattern */ 219 bzero(pattern_buffer, length); | 165 166 if (!ndlp || !ndlp->nlp_active) { 167 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 168 "ECHO: HBA not ready."); 169 170 return (FC_TRAN_BUSY); 171 } 172 --- 38 unchanged lines hidden (view full) --- 211 lptr = (uint32_t *)pattern_buffer; 212 213 for (i = 0; i < length; i += 4) { 214 *lptr++ = pattern; 215 } 216 } else { 217 /* Program the default echo pattern */ 218 bzero(pattern_buffer, length); |
220 (void) sprintf(pattern_buffer, "Emulex. We network storage. " | 219 (void) snprintf(pattern_buffer, length, |
221 "Emulex. We network storage. Emulex. We network storage. " | 220 "Emulex. We network storage. Emulex. We network storage. " |
222 "Emulex. We network storage."); | 221 "Emulex. We network storage. Emulex. We network storage."); |
223 } 224 225 /* Send ECHO pkt */ 226 if ((rval = emlxs_pkt_send(pkt, 1)) != FC_SUCCESS) { 227 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 228 "ECHO: Packet send failed."); 229 230 goto done; --- 60 unchanged lines hidden (view full) --- 291 292} /* emlxs_diag_echo_run() */ 293 294 295extern uint32_t 296emlxs_diag_biu_run(emlxs_hba_t *hba, uint32_t pattern) 297{ 298 emlxs_port_t *port = &PPORT; | 222 } 223 224 /* Send ECHO pkt */ 225 if ((rval = emlxs_pkt_send(pkt, 1)) != FC_SUCCESS) { 226 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 227 "ECHO: Packet send failed."); 228 229 goto done; --- 60 unchanged lines hidden (view full) --- 290 291} /* emlxs_diag_echo_run() */ 292 293 294extern uint32_t 295emlxs_diag_biu_run(emlxs_hba_t *hba, uint32_t pattern) 296{ 297 emlxs_port_t *port = &PPORT; |
299 MAILBOXQ *mbq; 300 MATCHMAP *mp; 301 MATCHMAP *mp1; | 298 MAILBOXQ *mbq = NULL; 299 MATCHMAP *mp = NULL; 300 MATCHMAP *mp1 = NULL; |
302 uint32_t i; 303 uint8_t *inptr; 304 uint8_t *outptr; 305 int32_t rval = FC_SUCCESS; 306 uint32_t *lptr; 307 | 301 uint32_t i; 302 uint8_t *inptr; 303 uint8_t *outptr; 304 int32_t rval = FC_SUCCESS; 305 uint32_t *lptr; 306 |
308 mp1 = 0; 309 mbq = 0; 310 | |
311 /* Check if device is ready */ 312 if (hba->state < FC_LINK_DOWN) { 313 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 314 "BIU: HBA not ready."); 315 316 return (FC_TRAN_BUSY); 317 } 318 319 /* 320 * Get a buffer which will be used for the mailbox command 321 */ | 307 /* Check if device is ready */ 308 if (hba->state < FC_LINK_DOWN) { 309 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 310 "BIU: HBA not ready."); 311 312 return (FC_TRAN_BUSY); 313 } 314 315 /* 316 * Get a buffer which will be used for the mailbox command 317 */ |
322 if ((mbq = (MAILBOXQ *) emlxs_mem_get(hba, MEM_MBOX, 1)) == 0) { | 318 if ((mbq = (MAILBOXQ *) emlxs_mem_get(hba, MEM_MBOX)) == 0) { |
323 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 324 "BIU: Mailbox allocation failed."); 325 326 rval = FC_NOMEM; 327 goto done; 328 } 329 330 /* 331 * Setup and issue mailbox RUN BIU DIAG command Setup test buffers 332 */ | 319 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 320 "BIU: Mailbox allocation failed."); 321 322 rval = FC_NOMEM; 323 goto done; 324 } 325 326 /* 327 * Setup and issue mailbox RUN BIU DIAG command Setup test buffers 328 */ |
333 if (((mp = (MATCHMAP *) emlxs_mem_get(hba, MEM_BUF, 1)) == 0) || 334 ((mp1 = (MATCHMAP *) emlxs_mem_get(hba, MEM_BUF, 1)) == 0)) { | 329 if (((mp = (MATCHMAP *) emlxs_mem_get(hba, MEM_BUF)) == 0) || 330 ((mp1 = (MATCHMAP *) emlxs_mem_get(hba, MEM_BUF)) == 0)) { |
335 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 336 "BIU: Buffer allocation failed."); 337 338 rval = FC_NOMEM; 339 goto done; 340 } 341 342 if (pattern) { --- 54 unchanged lines hidden (view full) --- 397done: 398 399 if (mp) { 400#ifdef FMA_SUPPORT 401 if (emlxs_fm_check_dma_handle(hba, mp->dma_handle) 402 != DDI_FM_OK) { 403 EMLXS_MSGF(EMLXS_CONTEXT, 404 &emlxs_invalid_dma_handle_msg, | 331 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 332 "BIU: Buffer allocation failed."); 333 334 rval = FC_NOMEM; 335 goto done; 336 } 337 338 if (pattern) { --- 54 unchanged lines hidden (view full) --- 393done: 394 395 if (mp) { 396#ifdef FMA_SUPPORT 397 if (emlxs_fm_check_dma_handle(hba, mp->dma_handle) 398 != DDI_FM_OK) { 399 EMLXS_MSGF(EMLXS_CONTEXT, 400 &emlxs_invalid_dma_handle_msg, |
405 "emlxs_diag_biu_run: hdl=%p", | 401 "diag_biu_run: hdl=%p", |
406 mp->dma_handle); 407 rval = EMLXS_TEST_FAILED; 408 } 409#endif /* FMA_SUPPORT */ 410 emlxs_mem_put(hba, MEM_BUF, (void *)mp); 411 } 412 if (mp1) { 413#ifdef FMA_SUPPORT 414 if (emlxs_fm_check_dma_handle(hba, mp1->dma_handle) 415 != DDI_FM_OK) { 416 EMLXS_MSGF(EMLXS_CONTEXT, 417 &emlxs_invalid_dma_handle_msg, | 402 mp->dma_handle); 403 rval = EMLXS_TEST_FAILED; 404 } 405#endif /* FMA_SUPPORT */ 406 emlxs_mem_put(hba, MEM_BUF, (void *)mp); 407 } 408 if (mp1) { 409#ifdef FMA_SUPPORT 410 if (emlxs_fm_check_dma_handle(hba, mp1->dma_handle) 411 != DDI_FM_OK) { 412 EMLXS_MSGF(EMLXS_CONTEXT, 413 &emlxs_invalid_dma_handle_msg, |
418 "emlxs_diag_biu_run: hdl=%p", | 414 "diag_biu_run: hdl=%p", |
419 mp1->dma_handle); 420 rval = EMLXS_TEST_FAILED; 421 } 422#endif /* FMA_SUPPORT */ 423 emlxs_mem_put(hba, MEM_BUF, (void *)mp1); 424 } 425 if (mbq) { 426 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq); --- 13 unchanged lines hidden (view full) --- 440 if (hba->flag & (FC_OFFLINE_MODE | FC_OFFLINING_MODE)) { 441 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 442 "POST: HBA shutdown."); 443 444 return (FC_TRAN_BUSY); 445 } 446 447 /* Take board offline */ | 415 mp1->dma_handle); 416 rval = EMLXS_TEST_FAILED; 417 } 418#endif /* FMA_SUPPORT */ 419 emlxs_mem_put(hba, MEM_BUF, (void *)mp1); 420 } 421 if (mbq) { 422 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq); --- 13 unchanged lines hidden (view full) --- 436 if (hba->flag & (FC_OFFLINE_MODE | FC_OFFLINING_MODE)) { 437 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_diag_error_msg, 438 "POST: HBA shutdown."); 439 440 return (FC_TRAN_BUSY); 441 } 442 443 /* Take board offline */ |
448 if ((rval = emlxs_offline(hba))) { | 444 if ((rval = emlxs_offline(hba, 0))) { |
449 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_post_failed_msg, 450 "Unable to take adapter offline."); 451 452 rval = FC_RESETFAIL; 453 } 454 455 /* Restart the adapter */ 456 rval = EMLXS_SLI_HBA_RESET(hba, 1, 1, 0); --- 37 unchanged lines hidden --- | 445 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_post_failed_msg, 446 "Unable to take adapter offline."); 447 448 rval = FC_RESETFAIL; 449 } 450 451 /* Restart the adapter */ 452 rval = EMLXS_SLI_HBA_RESET(hba, 1, 1, 0); --- 37 unchanged lines hidden --- |