emlxs_download.c (a9800beb) | emlxs_download.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/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */ 31EMLXS_MSG_DEF(EMLXS_DOWNLOAD_C); 32 33#define MAX_BOOTID 10 34 35static uint32_t emlxs_erase_fcode_flash(emlxs_hba_t *hba); --- 85 unchanged lines hidden (view full) --- 121 emlxs_fw_file_t *file, uint32_t id, uint32_t type, 122 char *file_type); 123static uint32_t emlxs_be2_validate_image(emlxs_hba_t *hba, caddr_t buffer, 124 uint32_t len, emlxs_be_fw_image_t *fw_image); 125static uint32_t emlxs_be3_validate_image(emlxs_hba_t *hba, caddr_t buffer, 126 uint32_t len, emlxs_be_fw_image_t *fw_image); 127 128 | 27#include <emlxs.h> 28 29/* Required for EMLXS_CONTEXT in EMLXS_MSGF calls */ 30EMLXS_MSG_DEF(EMLXS_DOWNLOAD_C); 31 32#define MAX_BOOTID 10 33 34static uint32_t emlxs_erase_fcode_flash(emlxs_hba_t *hba); --- 85 unchanged lines hidden (view full) --- 120 emlxs_fw_file_t *file, uint32_t id, uint32_t type, 121 char *file_type); 122static uint32_t emlxs_be2_validate_image(emlxs_hba_t *hba, caddr_t buffer, 123 uint32_t len, emlxs_be_fw_image_t *fw_image); 124static uint32_t emlxs_be3_validate_image(emlxs_hba_t *hba, caddr_t buffer, 125 uint32_t len, emlxs_be_fw_image_t *fw_image); 126 127 |
129static int32_t emlxs_sli4_verify_crc(emlxs_hba_t *hba, | 128static int32_t emlxs_be_verify_phy(emlxs_hba_t *hba, emlxs_be_fw_file_t *file, 129 MAILBOXQ *mbq, MATCHMAP *mp); 130static int32_t emlxs_be_verify_crc(emlxs_hba_t *hba, |
130 emlxs_be_fw_file_t *file, 131 MAILBOXQ *mbq, MATCHMAP *mp); | 131 emlxs_be_fw_file_t *file, 132 MAILBOXQ *mbq, MATCHMAP *mp); |
132static int32_t emlxs_sli4_flash_image(emlxs_hba_t *hba, caddr_t buffer, | 133static int32_t emlxs_be_flash_image(emlxs_hba_t *hba, caddr_t buffer, |
133 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp); | 134 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp); |
134static int32_t emlxs_sli4_fw_download(emlxs_hba_t *hba, caddr_t buffer, | 135static int32_t emlxs_be_fw_download(emlxs_hba_t *hba, caddr_t buffer, |
135 uint32_t len, uint32_t offline); | 136 uint32_t len, uint32_t offline); |
137static int32_t emlxs_obj_fw_download(emlxs_hba_t *hba, caddr_t buffer, 138 uint32_t len, uint32_t offline); 139static int32_t emlxs_obj_flash_image(emlxs_hba_t *hba, caddr_t buffer, 140 uint32_t size, MAILBOXQ *mbq, MATCHMAP *mp, 141 uint32_t *change_status); 142static uint32_t emlxs_obj_validate_image(emlxs_hba_t *hba, caddr_t buffer, 143 uint32_t len, emlxs_obj_header_t *obj_hdr); |
|
136static uint32_t emlxs_be_version(caddr_t buffer, uint32_t size, 137 uint32_t *plus_flag); 138static uint32_t emlxs_proc_rel_2mb(emlxs_hba_t *hba, caddr_t buffer, 139 emlxs_fw_image_t *fw_image); 140static uint32_t emlxs_delete_load_entry(emlxs_hba_t *hba, PROG_ID *progId); 141 142static void emlxs_verify_image(emlxs_hba_t *hba, emlxs_fw_image_t *image); 143 --- 19 unchanged lines hidden (view full) --- 163 164#ifdef EMLXS_LITTLE_ENDIAN 165 caddr_t local_buffer; 166 uint32_t *bptr1; 167 uint32_t *bptr2; 168#endif /* EMLXS_LITTLE_ENDIAN */ 169 170 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { | 144static uint32_t emlxs_be_version(caddr_t buffer, uint32_t size, 145 uint32_t *plus_flag); 146static uint32_t emlxs_proc_rel_2mb(emlxs_hba_t *hba, caddr_t buffer, 147 emlxs_fw_image_t *fw_image); 148static uint32_t emlxs_delete_load_entry(emlxs_hba_t *hba, PROG_ID *progId); 149 150static void emlxs_verify_image(emlxs_hba_t *hba, emlxs_fw_image_t *image); 151 --- 19 unchanged lines hidden (view full) --- 171 172#ifdef EMLXS_LITTLE_ENDIAN 173 caddr_t local_buffer; 174 uint32_t *bptr1; 175 uint32_t *bptr2; 176#endif /* EMLXS_LITTLE_ENDIAN */ 177 178 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { |
171 rval = emlxs_sli4_fw_download(hba, buffer, len, offline); | 179 if (hba->model_info.chip & EMLXS_BE_CHIPS) { 180 rval = emlxs_be_fw_download(hba, buffer, len, offline); 181 } else { 182 rval = emlxs_obj_fw_download(hba, buffer, len, offline); 183 } |
172 return (rval); 173 } 174 175 if (buffer == NULL || len == 0) { 176 return (EMLXS_IMAGE_BAD); 177 } 178 179#ifdef EMLXS_LITTLE_ENDIAN --- 14 unchanged lines hidden (view full) --- 194 } 195 196 /* Replace the original buffer */ 197 buffer = local_buffer; 198#endif /* EMLXS_LITTLE_ENDIAN */ 199 200 bzero(&fw_image, sizeof (emlxs_fw_image_t)); 201 for (i = 0; i < MAX_PROG_TYPES; i++) { | 184 return (rval); 185 } 186 187 if (buffer == NULL || len == 0) { 188 return (EMLXS_IMAGE_BAD); 189 } 190 191#ifdef EMLXS_LITTLE_ENDIAN --- 14 unchanged lines hidden (view full) --- 206 } 207 208 /* Replace the original buffer */ 209 buffer = local_buffer; 210#endif /* EMLXS_LITTLE_ENDIAN */ 211 212 bzero(&fw_image, sizeof (emlxs_fw_image_t)); 213 for (i = 0; i < MAX_PROG_TYPES; i++) { |
202 (void) strcpy(fw_image.prog[i].label, "none"); | 214 (void) strlcpy(fw_image.prog[i].label, "none", 215 sizeof (fw_image.prog[i].label)); |
203 } 204 205 /* Validate image */ 206 if ((rval = emlxs_validate_image(hba, buffer, len, &fw_image))) { 207 goto done; 208 } 209 210 /* Verify image */ --- 36 unchanged lines hidden (view full) --- 247 } else { /* PRG file */ 248 bzero((void *)&AifHdr, sizeof (AIF_HDR)); 249 bcopy(buffer, &ImageHdr, sizeof (IMAGE_HDR)); 250 } 251 252 /* Everything checks out, now to just do it */ 253 254 if (offline) { | 216 } 217 218 /* Validate image */ 219 if ((rval = emlxs_validate_image(hba, buffer, len, &fw_image))) { 220 goto done; 221 } 222 223 /* Verify image */ --- 36 unchanged lines hidden (view full) --- 260 } else { /* PRG file */ 261 bzero((void *)&AifHdr, sizeof (AIF_HDR)); 262 bcopy(buffer, &ImageHdr, sizeof (IMAGE_HDR)); 263 } 264 265 /* Everything checks out, now to just do it */ 266 267 if (offline) { |
255 if (emlxs_offline(hba) != FC_SUCCESS) { | 268 if (emlxs_offline(hba, 0) != FC_SUCCESS) { |
256 offline = 0; 257 258 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 259 "Unable to take adapter offline."); 260 261 rval = EMLXS_OFFLINE_FAILED; 262 goto SLI_DOWNLOAD_EXIT; 263 } --- 98 unchanged lines hidden (view full) --- 362 while (size--) { 363 *buffer++ = value; 364 } 365 366} /* emlxs_memset () */ 367 368 369static int32_t | 269 offline = 0; 270 271 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 272 "Unable to take adapter offline."); 273 274 rval = EMLXS_OFFLINE_FAILED; 275 goto SLI_DOWNLOAD_EXIT; 276 } --- 98 unchanged lines hidden (view full) --- 375 while (size--) { 376 *buffer++ = value; 377 } 378 379} /* emlxs_memset () */ 380 381 382static int32_t |
370emlxs_sli4_flash_image(emlxs_hba_t *hba, caddr_t buffer, | 383emlxs_be_flash_image(emlxs_hba_t *hba, caddr_t buffer, |
371 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp) 372{ 373 emlxs_port_t *port = &PPORT; 374 uint8_t *image_ptr; 375 uint32_t *wptr; 376 uint8_t *payload; 377 MAILBOX4 *mb; 378 IOCTL_COMMON_FLASHROM *flashrom; --- 34 unchanged lines hidden (view full) --- 413 hdr_req = (mbox_req_hdr_t *)mp->virt; 414 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON; 415 hdr_req->opcode = COMMON_OPCODE_WRITE_FLASHROM; 416 hdr_req->timeout = 0; 417 hdr_req->req_length = sizeof (IOCTL_COMMON_FLASHROM) + 418 xfer_size; 419 420 flashrom = (IOCTL_COMMON_FLASHROM *)(hdr_req + 1); | 384 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp) 385{ 386 emlxs_port_t *port = &PPORT; 387 uint8_t *image_ptr; 388 uint32_t *wptr; 389 uint8_t *payload; 390 MAILBOX4 *mb; 391 IOCTL_COMMON_FLASHROM *flashrom; --- 34 unchanged lines hidden (view full) --- 426 hdr_req = (mbox_req_hdr_t *)mp->virt; 427 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON; 428 hdr_req->opcode = COMMON_OPCODE_WRITE_FLASHROM; 429 hdr_req->timeout = 0; 430 hdr_req->req_length = sizeof (IOCTL_COMMON_FLASHROM) + 431 xfer_size; 432 433 flashrom = (IOCTL_COMMON_FLASHROM *)(hdr_req + 1); |
421 flashrom->params.opcode = ((block_size == xfer_size)? 422 MGMT_FLASHROM_OPCODE_FLASH:MGMT_FLASHROM_OPCODE_SAVE); 423 flashrom->params.optype = file->type; | 434 435 if (file->type == MGMT_FLASHROM_OPTYPE_PHY_FIRMWARE) { 436 flashrom->params.opcode = ((block_size == xfer_size)? 437 MGMT_PHY_FLASHROM_OPCODE_FLASH: 438 MGMT_PHY_FLASHROM_OPCODE_SAVE); 439 flashrom->params.optype = 0; /* ignored */ 440 } else { 441 flashrom->params.opcode = ((block_size == xfer_size)? 442 MGMT_FLASHROM_OPCODE_FLASH: 443 MGMT_FLASHROM_OPCODE_SAVE); 444 flashrom->params.optype = file->type; 445 } 446 |
424 flashrom->params.data_buffer_size = xfer_size; 425 flashrom->params.offset = block_offset; 426 427 /* Build data buffer payload */ 428 payload = (uint8_t *)(&flashrom->params.data_buffer); 429 emlxs_memset(payload, 0xff, xfer_size); 430 431 /* Copy remaining image into payload */ 432 if (image_size) { 433 count = min(image_size, xfer_size); 434 BE_SWAP32_BCOPY(image_ptr, payload, count); 435 image_size -= count; 436 image_ptr += count; 437 } 438 | 447 flashrom->params.data_buffer_size = xfer_size; 448 flashrom->params.offset = block_offset; 449 450 /* Build data buffer payload */ 451 payload = (uint8_t *)(&flashrom->params.data_buffer); 452 emlxs_memset(payload, 0xff, xfer_size); 453 454 /* Copy remaining image into payload */ 455 if (image_size) { 456 count = min(image_size, xfer_size); 457 BE_SWAP32_BCOPY(image_ptr, payload, count); 458 image_size -= count; 459 image_ptr += count; 460 } 461 |
439 if (flashrom->params.opcode == MGMT_FLASHROM_OPCODE_FLASH) { | 462 if ((flashrom->params.opcode == MGMT_FLASHROM_OPCODE_FLASH) || 463 (flashrom->params.opcode == 464 MGMT_PHY_FLASHROM_OPCODE_FLASH)) { |
440 wptr = (uint32_t *)&payload[(xfer_size - 12)]; 441 442 wptr[0] = file->load_address; 443 wptr[1] = file->image_size; 444 wptr[2] = file->block_crc; 445 } 446 447 /* Send write request */ --- 11 unchanged lines hidden (view full) --- 459 } 460 461 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_msg, 462 "%s: Download complete.", file->label); 463done: 464 465 return (rval); 466 | 465 wptr = (uint32_t *)&payload[(xfer_size - 12)]; 466 467 wptr[0] = file->load_address; 468 wptr[1] = file->image_size; 469 wptr[2] = file->block_crc; 470 } 471 472 /* Send write request */ --- 11 unchanged lines hidden (view full) --- 484 } 485 486 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_msg, 487 "%s: Download complete.", file->label); 488done: 489 490 return (rval); 491 |
467} /* emlxs_sli4_flash_image() */ | 492} /* emlxs_be_flash_image() */ |
468 469 470 471 472static int32_t | 493 494 495 496 497static int32_t |
473emlxs_sli4_verify_crc(emlxs_hba_t *hba, | 498emlxs_be_verify_crc(emlxs_hba_t *hba, |
474 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp) 475{ 476 emlxs_port_t *port = &PPORT; 477 uint32_t *wptr; 478 uint8_t *payload; 479 MAILBOX4 *mb; 480 IOCTL_COMMON_FLASHROM *flashrom; 481 mbox_req_hdr_t *hdr_req; 482 uint32_t xfer_size; 483 uint32_t block_offset; 484 uint32_t rval = 0; 485 uint32_t value; 486 | 499 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp) 500{ 501 emlxs_port_t *port = &PPORT; 502 uint32_t *wptr; 503 uint8_t *payload; 504 MAILBOX4 *mb; 505 IOCTL_COMMON_FLASHROM *flashrom; 506 mbox_req_hdr_t *hdr_req; 507 uint32_t xfer_size; 508 uint32_t block_offset; 509 uint32_t rval = 0; 510 uint32_t value; 511 |
512 if (file->type == MGMT_FLASHROM_OPTYPE_PHY_FIRMWARE) { 513 /* PHY Firmware can't be verified */ 514 return (1); 515 } 516 |
|
487 xfer_size = 8; 488 block_offset = file->block_size - xfer_size; 489 mb = (MAILBOX4*)mbq; 490 491 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 492 "%s: Verifying CRC...", file->label); 493 494 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE); --- 57 unchanged lines hidden (view full) --- 552 553 if (rval == 0) { 554 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 555 "%s: CRC verified.", file->label); 556 } 557 558 return (rval); 559 | 517 xfer_size = 8; 518 block_offset = file->block_size - xfer_size; 519 mb = (MAILBOX4*)mbq; 520 521 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 522 "%s: Verifying CRC...", file->label); 523 524 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE); --- 57 unchanged lines hidden (view full) --- 582 583 if (rval == 0) { 584 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 585 "%s: CRC verified.", file->label); 586 } 587 588 return (rval); 589 |
560} /* emlxs_sli4_verify_crc() */ | 590} /* emlxs_be_verify_crc() */ |
561 562 | 591 592 |
593static int32_t 594emlxs_be_verify_phy(emlxs_hba_t *hba, 595 emlxs_be_fw_file_t *file, MAILBOXQ *mbq, MATCHMAP *mp) 596{ 597 emlxs_port_t *port = &PPORT; 598 MAILBOX4 *mb; 599 IOCTL_COMMON_GET_PHY_DETAILS *phy; 600 mbox_req_hdr_t *hdr_req; 601 uint32_t rval = 0; 602 603 if (file->type != MGMT_FLASHROM_OPTYPE_PHY_FIRMWARE) { 604 return (1); 605 } 606 607 mb = (MAILBOX4*)mbq; 608 609 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 610 "%s: Getting PHY Details...", file->label); 611 612 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE); 613 bzero((void *) mp->virt, mp->size); 614 615 mb->un.varSLIConfig.be.embedded = 0; 616 mbq->nonembed = (void *)mp; 617 mbq->mbox_cmpl = NULL; 618 619 mb->mbxCommand = MBX_SLI_CONFIG; 620 mb->mbxOwner = OWN_HOST; 621 622 hdr_req = (mbox_req_hdr_t *)mp->virt; 623 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON; 624 hdr_req->opcode = COMMON_OPCODE_GET_PHY_DETAILS; 625 hdr_req->timeout = 0; 626 hdr_req->req_length = sizeof (IOCTL_COMMON_GET_PHY_DETAILS); 627 628 phy = (IOCTL_COMMON_GET_PHY_DETAILS *)(hdr_req + 1); 629 630 /* Send read request */ 631 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) != 632 MBX_SUCCESS) { 633 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 634 "%s: Unable to get PHY details. status=%x", 635 file->label, mb->mbxStatus); 636 637 rval = 2; 638 goto done; 639 } 640 641 if ((phy->params.response.phy_type != PHY_TN_8022) || 642 (phy->params.response.interface_type != BASET_10GB_TYPE)) { 643 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 644 "%s: PHY not applicable. %08x,%08x", 645 file->label, 646 phy->params.response.phy_type, 647 phy->params.response.interface_type); 648 649 rval = 1; 650 } 651 652done: 653 654 if (rval == 0) { 655 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 656 "%s: PHY verified. %x,%x", 657 file->label, 658 phy->params.response.phy_type, 659 phy->params.response.interface_type); 660 } 661 662 return (rval); 663 664} /* emlxs_be_verify_phy() */ 665 666 |
|
563extern int32_t | 667extern int32_t |
564emlxs_sli4_read_fw_version(emlxs_hba_t *hba, emlxs_firmware_t *fw) | 668emlxs_be_read_fw_version(emlxs_hba_t *hba, emlxs_firmware_t *fw) |
565{ 566 emlxs_port_t *port = &PPORT; 567 MAILBOXQ *mbq = NULL; 568 MATCHMAP *mp = NULL; 569 MAILBOX4 *mb; 570 uint32_t *wptr; 571 uint8_t *payload; 572 IOCTL_COMMON_FLASHROM *flashrom; --- 122 unchanged lines hidden (view full) --- 695 } 696 697 if (mp) { 698 emlxs_mem_buf_free(hba, mp); 699 } 700 701 return (rval); 702 | 669{ 670 emlxs_port_t *port = &PPORT; 671 MAILBOXQ *mbq = NULL; 672 MATCHMAP *mp = NULL; 673 MAILBOX4 *mb; 674 uint32_t *wptr; 675 uint8_t *payload; 676 IOCTL_COMMON_FLASHROM *flashrom; --- 122 unchanged lines hidden (view full) --- 799 } 800 801 if (mp) { 802 emlxs_mem_buf_free(hba, mp); 803 } 804 805 return (rval); 806 |
703} /* emlxs_sli4_read_fw_version() */ | 807} /* emlxs_be_read_fw_version() */ |
704 705 706static uint32_t 707emlxs_be_version(caddr_t buffer, uint32_t size, uint32_t *plus_flag) 708{ 709 emlxs_be2_ufi_header_t *ufi_hdr; 710 char signature[BE2_SIGNATURE_SIZE]; 711 uint32_t be_version = 0; 712 713 if (size < sizeof (emlxs_be2_ufi_header_t)) { 714 return (0); 715 } 716 ufi_hdr = (emlxs_be2_ufi_header_t *)buffer; 717 | 808 809 810static uint32_t 811emlxs_be_version(caddr_t buffer, uint32_t size, uint32_t *plus_flag) 812{ 813 emlxs_be2_ufi_header_t *ufi_hdr; 814 char signature[BE2_SIGNATURE_SIZE]; 815 uint32_t be_version = 0; 816 817 if (size < sizeof (emlxs_be2_ufi_header_t)) { 818 return (0); 819 } 820 ufi_hdr = (emlxs_be2_ufi_header_t *)buffer; 821 |
718 (void) sprintf(signature, "%s+", BE_SIGNATURE); | 822 (void) snprintf(signature, BE2_SIGNATURE_SIZE, "%s+", BE_SIGNATURE); |
719 720 /* Check if this is a UFI image */ 721 if (strncmp(signature, (char *)ufi_hdr->signature, 722 strlen(BE_SIGNATURE)) != 0) { 723 return (0); 724 } 725 726 /* Check if this is a UFI plus image */ --- 214 unchanged lines hidden (view full) --- 941 (entry->type == (uint32_t)-1) || 942 (entry->image_size == 0)) { 943 continue; 944 } 945 946 switch (entry->type) { 947 case BE_FLASHTYPE_REDBOOT: 948 file = &fw_image->file[REDBOOT_FLASHTYPE]; | 823 824 /* Check if this is a UFI image */ 825 if (strncmp(signature, (char *)ufi_hdr->signature, 826 strlen(BE_SIGNATURE)) != 0) { 827 return (0); 828 } 829 830 /* Check if this is a UFI plus image */ --- 214 unchanged lines hidden (view full) --- 1045 (entry->type == (uint32_t)-1) || 1046 (entry->image_size == 0)) { 1047 continue; 1048 } 1049 1050 switch (entry->type) { 1051 case BE_FLASHTYPE_REDBOOT: 1052 file = &fw_image->file[REDBOOT_FLASHTYPE]; |
949 (void) strcpy(file->label, "REDBOOT"); | 1053 (void) strlcpy(file->label, "REDBOOT", 1054 sizeof (file->label)); |
950 file->type = MGMT_FLASHROM_OPTYPE_REDBOOT; 951 break; 952 case BE_FLASHTYPE_ISCSI_BIOS: 953 file = &fw_image->file[ISCSI_BIOS_FLASHTYPE]; | 1055 file->type = MGMT_FLASHROM_OPTYPE_REDBOOT; 1056 break; 1057 case BE_FLASHTYPE_ISCSI_BIOS: 1058 file = &fw_image->file[ISCSI_BIOS_FLASHTYPE]; |
954 (void) strcpy(file->label, "ISCSI BIOS"); | 1059 (void) strlcpy(file->label, "ISCSI BIOS", 1060 sizeof (file->label)); |
955 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_BIOS; 956 break; 957 case BE_FLASHTYPE_PXE_BIOS: 958 file = &fw_image->file[PXE_BIOS_FLASHTYPE]; | 1061 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_BIOS; 1062 break; 1063 case BE_FLASHTYPE_PXE_BIOS: 1064 file = &fw_image->file[PXE_BIOS_FLASHTYPE]; |
959 (void) strcpy(file->label, "PXE BIOS"); | 1065 (void) strlcpy(file->label, "PXE BIOS", 1066 sizeof (file->label)); |
960 file->type = MGMT_FLASHROM_OPTYPE_PXE_BIOS; 961 break; 962 case BE_FLASHTYPE_FCOE_BIOS: 963 file = &fw_image->file[FCOE_BIOS_FLASHTYPE]; | 1067 file->type = MGMT_FLASHROM_OPTYPE_PXE_BIOS; 1068 break; 1069 case BE_FLASHTYPE_FCOE_BIOS: 1070 file = &fw_image->file[FCOE_BIOS_FLASHTYPE]; |
964 (void) strcpy(file->label, "FCOE BIOS"); | 1071 (void) strlcpy(file->label, "FCOE BIOS", 1072 sizeof (file->label)); |
965 file->type = MGMT_FLASHROM_OPTYPE_FCOE_BIOS; 966 break; 967 case BE_FLASHTYPE_ISCSI_FIRMWARE: 968 file = &fw_image->file[ISCSI_FIRMWARE_FLASHTYPE]; | 1073 file->type = MGMT_FLASHROM_OPTYPE_FCOE_BIOS; 1074 break; 1075 case BE_FLASHTYPE_ISCSI_FIRMWARE: 1076 file = &fw_image->file[ISCSI_FIRMWARE_FLASHTYPE]; |
969 (void) strcpy(file->label, "ISCSI FIRMWARE"); | 1077 (void) strlcpy(file->label, "ISCSI FIRMWARE", 1078 sizeof (file->label)); |
970 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE; 971 break; 972 case BE_FLASHTYPE_FCOE_FIRMWARE: 973 file = &fw_image->file[FCOE_FIRMWARE_FLASHTYPE]; | 1079 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE; 1080 break; 1081 case BE_FLASHTYPE_FCOE_FIRMWARE: 1082 file = &fw_image->file[FCOE_FIRMWARE_FLASHTYPE]; |
974 (void) strcpy(file->label, "FCOE FIRMWARE"); | 1083 (void) strlcpy(file->label, "FCOE FIRMWARE", 1084 sizeof (file->label)); |
975 file->type = MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE; 976 break; 977 case BE_FLASHTYPE_FCOE_BACKUP: 978 case BE_FLASHTYPE_ISCSI_BACKUP: 979 continue; 980 981 default: 982 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, --- 62 unchanged lines hidden (view full) --- 1045 1046 /* Automatically create a backup file entry for firmware */ 1047 if (file->type == MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE) { 1048 file2 = &fw_image->file[FCOE_BACKUP_FLASHTYPE]; 1049 1050 bcopy((uint8_t *)file, (uint8_t *)file2, 1051 sizeof (emlxs_be_fw_file_t)); 1052 file2->type = MGMT_FLASHROM_OPTYPE_FCOE_BACKUP; | 1085 file->type = MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE; 1086 break; 1087 case BE_FLASHTYPE_FCOE_BACKUP: 1088 case BE_FLASHTYPE_ISCSI_BACKUP: 1089 continue; 1090 1091 default: 1092 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, --- 62 unchanged lines hidden (view full) --- 1155 1156 /* Automatically create a backup file entry for firmware */ 1157 if (file->type == MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE) { 1158 file2 = &fw_image->file[FCOE_BACKUP_FLASHTYPE]; 1159 1160 bcopy((uint8_t *)file, (uint8_t *)file2, 1161 sizeof (emlxs_be_fw_file_t)); 1162 file2->type = MGMT_FLASHROM_OPTYPE_FCOE_BACKUP; |
1053 (void) strcpy(file2->label, "FCOE BACKUP"); | 1163 (void) strlcpy(file2->label, "FCOE BACKUP", 1164 sizeof (file2->label)); |
1054 1055 /* Save FCOE version info */ 1056 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1057 (void) strncpy(fw_image->fcoe_label, (char *)bptr, 1058 BE_VERSION_SIZE); 1059 fw_image->fcoe_version = file->block_crc; 1060 1061 } else if (file->type == 1062 MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE) { 1063 file2 = &fw_image->file[ISCSI_BACKUP_FLASHTYPE]; 1064 1065 bcopy((uint8_t *)file, (uint8_t *)file2, 1066 sizeof (emlxs_be_fw_file_t)); 1067 file2->type = MGMT_FLASHROM_OPTYPE_ISCSI_BACKUP; | 1165 1166 /* Save FCOE version info */ 1167 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1168 (void) strncpy(fw_image->fcoe_label, (char *)bptr, 1169 BE_VERSION_SIZE); 1170 fw_image->fcoe_version = file->block_crc; 1171 1172 } else if (file->type == 1173 MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE) { 1174 file2 = &fw_image->file[ISCSI_BACKUP_FLASHTYPE]; 1175 1176 bcopy((uint8_t *)file, (uint8_t *)file2, 1177 sizeof (emlxs_be_fw_file_t)); 1178 file2->type = MGMT_FLASHROM_OPTYPE_ISCSI_BACKUP; |
1068 (void) strcpy(file2->label, "ISCSI BACKUP"); | 1179 (void) strlcpy(file2->label, "ISCSI BACKUP", 1180 sizeof (file2->label)); |
1069 1070 /* Save ISCSI version info */ 1071 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1072 (void) strncpy(fw_image->iscsi_label, (char *)bptr, 1073 BE_VERSION_SIZE); 1074 fw_image->iscsi_version = file->block_crc; 1075 } 1076 } --- 232 unchanged lines hidden (view full) --- 1309 (entry->type == (uint32_t)-1) || 1310 (entry->image_size == 0)) { 1311 continue; 1312 } 1313 1314 switch (entry->type) { 1315 case BE_FLASHTYPE_REDBOOT: 1316 file = &fw_image->file[REDBOOT_FLASHTYPE]; | 1181 1182 /* Save ISCSI version info */ 1183 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1184 (void) strncpy(fw_image->iscsi_label, (char *)bptr, 1185 BE_VERSION_SIZE); 1186 fw_image->iscsi_version = file->block_crc; 1187 } 1188 } --- 232 unchanged lines hidden (view full) --- 1421 (entry->type == (uint32_t)-1) || 1422 (entry->image_size == 0)) { 1423 continue; 1424 } 1425 1426 switch (entry->type) { 1427 case BE_FLASHTYPE_REDBOOT: 1428 file = &fw_image->file[REDBOOT_FLASHTYPE]; |
1317 (void) strcpy(file->label, "REDBOOT"); | 1429 (void) strlcpy(file->label, "REDBOOT", 1430 sizeof (file->label)); |
1318 file->type = MGMT_FLASHROM_OPTYPE_REDBOOT; 1319 break; 1320 case BE_FLASHTYPE_ISCSI_BIOS: 1321 file = &fw_image->file[ISCSI_BIOS_FLASHTYPE]; | 1431 file->type = MGMT_FLASHROM_OPTYPE_REDBOOT; 1432 break; 1433 case BE_FLASHTYPE_ISCSI_BIOS: 1434 file = &fw_image->file[ISCSI_BIOS_FLASHTYPE]; |
1322 (void) strcpy(file->label, "ISCSI BIOS"); | 1435 (void) strlcpy(file->label, "ISCSI BIOS", 1436 sizeof (file->label)); |
1323 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_BIOS; 1324 break; 1325 case BE_FLASHTYPE_PXE_BIOS: 1326 file = &fw_image->file[PXE_BIOS_FLASHTYPE]; | 1437 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_BIOS; 1438 break; 1439 case BE_FLASHTYPE_PXE_BIOS: 1440 file = &fw_image->file[PXE_BIOS_FLASHTYPE]; |
1327 (void) strcpy(file->label, "PXE BIOS"); | 1441 (void) strlcpy(file->label, "PXE BIOS", 1442 sizeof (file->label)); |
1328 file->type = MGMT_FLASHROM_OPTYPE_PXE_BIOS; 1329 break; 1330 case BE_FLASHTYPE_FCOE_BIOS: 1331 file = &fw_image->file[FCOE_BIOS_FLASHTYPE]; | 1443 file->type = MGMT_FLASHROM_OPTYPE_PXE_BIOS; 1444 break; 1445 case BE_FLASHTYPE_FCOE_BIOS: 1446 file = &fw_image->file[FCOE_BIOS_FLASHTYPE]; |
1332 (void) strcpy(file->label, "FCOE BIOS"); | 1447 (void) strlcpy(file->label, "FCOE BIOS", 1448 sizeof (file->label)); |
1333 file->type = MGMT_FLASHROM_OPTYPE_FCOE_BIOS; 1334 break; 1335 case BE_FLASHTYPE_ISCSI_FIRMWARE: 1336 file = &fw_image->file[ISCSI_FIRMWARE_FLASHTYPE]; | 1449 file->type = MGMT_FLASHROM_OPTYPE_FCOE_BIOS; 1450 break; 1451 case BE_FLASHTYPE_ISCSI_FIRMWARE: 1452 file = &fw_image->file[ISCSI_FIRMWARE_FLASHTYPE]; |
1337 (void) strcpy(file->label, "ISCSI FIRMWARE"); | 1453 (void) strlcpy(file->label, "ISCSI FIRMWARE", 1454 sizeof (file->label)); |
1338 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE; 1339 break; 1340 case BE_FLASHTYPE_FCOE_FIRMWARE: 1341 file = &fw_image->file[FCOE_FIRMWARE_FLASHTYPE]; | 1455 file->type = MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE; 1456 break; 1457 case BE_FLASHTYPE_FCOE_FIRMWARE: 1458 file = &fw_image->file[FCOE_FIRMWARE_FLASHTYPE]; |
1342 (void) strcpy(file->label, "FCOE FIRMWARE"); | 1459 (void) strlcpy(file->label, "FCOE FIRMWARE", 1460 sizeof (file->label)); |
1343 file->type = MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE; 1344 break; 1345 case BE_FLASHTYPE_NCSI_FIRMWARE: 1346 file = &fw_image->file[NCSI_FIRMWARE_FLASHTYPE]; | 1461 file->type = MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE; 1462 break; 1463 case BE_FLASHTYPE_NCSI_FIRMWARE: 1464 file = &fw_image->file[NCSI_FIRMWARE_FLASHTYPE]; |
1347 (void) strcpy(file->label, "NCSI FIRMWARE"); | 1465 (void) strlcpy(file->label, "NCSI FIRMWARE", 1466 sizeof (file->label)); |
1348 file->type = MGMT_FLASHROM_OPTYPE_NCSI_FIRMWARE; 1349 break; 1350 case BE_FLASHTYPE_FLASH_ISM: 1351 case BE_FLASHTYPE_FCOE_BACKUP: 1352 case BE_FLASHTYPE_ISCSI_BACKUP: 1353 continue; | 1467 file->type = MGMT_FLASHROM_OPTYPE_NCSI_FIRMWARE; 1468 break; 1469 case BE_FLASHTYPE_FLASH_ISM: 1470 case BE_FLASHTYPE_FCOE_BACKUP: 1471 case BE_FLASHTYPE_ISCSI_BACKUP: 1472 continue; |
1473 case BE_FLASHTYPE_PHY_FIRMWARE: 1474 file = &fw_image->file[PHY_FIRMWARE_FLASHTYPE]; 1475 (void) strlcpy(file->label, "PHY FIRMWARE", 1476 sizeof (file->label)); 1477 file->type = MGMT_FLASHROM_OPTYPE_PHY_FIRMWARE; 1478 break; |
|
1354 1355 default: 1356 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 1357 "Unknown image type found. type=%x", 1358 entry->type); 1359 continue; 1360 } 1361 --- 35 unchanged lines hidden (view full) --- 1397 1398 /* Automatically create a backup file entry for firmware */ 1399 if (file->type == MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE) { 1400 file2 = &fw_image->file[FCOE_BACKUP_FLASHTYPE]; 1401 1402 bcopy((uint8_t *)file, (uint8_t *)file2, 1403 sizeof (emlxs_be_fw_file_t)); 1404 file2->type = MGMT_FLASHROM_OPTYPE_FCOE_BACKUP; | 1479 1480 default: 1481 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 1482 "Unknown image type found. type=%x", 1483 entry->type); 1484 continue; 1485 } 1486 --- 35 unchanged lines hidden (view full) --- 1522 1523 /* Automatically create a backup file entry for firmware */ 1524 if (file->type == MGMT_FLASHROM_OPTYPE_FCOE_FIRMWARE) { 1525 file2 = &fw_image->file[FCOE_BACKUP_FLASHTYPE]; 1526 1527 bcopy((uint8_t *)file, (uint8_t *)file2, 1528 sizeof (emlxs_be_fw_file_t)); 1529 file2->type = MGMT_FLASHROM_OPTYPE_FCOE_BACKUP; |
1405 (void) strcpy(file2->label, "FCOE BACKUP"); | 1530 (void) strlcpy(file2->label, "FCOE BACKUP", 1531 sizeof (file2->label)); |
1406 1407 /* Save FCOE version info */ 1408 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1409 (void) strncpy(fw_image->fcoe_label, (char *)bptr, 1410 BE_VERSION_SIZE); 1411 fw_image->fcoe_version = file->block_crc; 1412 1413 } else if (file->type == 1414 MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE) { 1415 file2 = &fw_image->file[ISCSI_BACKUP_FLASHTYPE]; 1416 1417 bcopy((uint8_t *)file, (uint8_t *)file2, 1418 sizeof (emlxs_be_fw_file_t)); 1419 file2->type = MGMT_FLASHROM_OPTYPE_ISCSI_BACKUP; | 1532 1533 /* Save FCOE version info */ 1534 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1535 (void) strncpy(fw_image->fcoe_label, (char *)bptr, 1536 BE_VERSION_SIZE); 1537 fw_image->fcoe_version = file->block_crc; 1538 1539 } else if (file->type == 1540 MGMT_FLASHROM_OPTYPE_ISCSI_FIRMWARE) { 1541 file2 = &fw_image->file[ISCSI_BACKUP_FLASHTYPE]; 1542 1543 bcopy((uint8_t *)file, (uint8_t *)file2, 1544 sizeof (emlxs_be_fw_file_t)); 1545 file2->type = MGMT_FLASHROM_OPTYPE_ISCSI_BACKUP; |
1420 (void) strcpy(file2->label, "ISCSI BACKUP"); | 1546 (void) strlcpy(file2->label, "ISCSI BACKUP", 1547 sizeof (file->label)); |
1421 1422 /* Save ISCSI version info */ 1423 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1424 (void) strncpy(fw_image->iscsi_label, (char *)bptr, 1425 BE_VERSION_SIZE); 1426 fw_image->iscsi_version = file->block_crc; 1427 } 1428 } --- 27 unchanged lines hidden (view full) --- 1456 } 1457 1458 return (0); 1459 1460} /* emlxs_be3_validate_image() */ 1461 1462 1463static int32_t | 1548 1549 /* Save ISCSI version info */ 1550 bptr = (uint8_t *)buffer + file->image_offset + 0x30; 1551 (void) strncpy(fw_image->iscsi_label, (char *)bptr, 1552 BE_VERSION_SIZE); 1553 fw_image->iscsi_version = file->block_crc; 1554 } 1555 } --- 27 unchanged lines hidden (view full) --- 1583 } 1584 1585 return (0); 1586 1587} /* emlxs_be3_validate_image() */ 1588 1589 1590static int32_t |
1464emlxs_sli4_fw_download(emlxs_hba_t *hba, caddr_t buffer, uint32_t len, | 1591emlxs_be_fw_download(emlxs_hba_t *hba, caddr_t buffer, uint32_t len, |
1465 uint32_t offline) 1466{ 1467 emlxs_port_t *port = &PPORT; 1468 uint32_t i; 1469 uint32_t update = 0; 1470 uint32_t rval = 0; 1471 MAILBOXQ *mbq = NULL; 1472 MATCHMAP *mp = NULL; --- 5 unchanged lines hidden (view full) --- 1478 offline = 0; 1479 1480 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) { 1481 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1482 "Invalid sli_mode. mode=%d", hba->sli_mode); 1483 return (EMLXS_IMAGE_INCOMPATIBLE); 1484 } 1485 | 1592 uint32_t offline) 1593{ 1594 emlxs_port_t *port = &PPORT; 1595 uint32_t i; 1596 uint32_t update = 0; 1597 uint32_t rval = 0; 1598 MAILBOXQ *mbq = NULL; 1599 MATCHMAP *mp = NULL; --- 5 unchanged lines hidden (view full) --- 1605 offline = 0; 1606 1607 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) { 1608 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1609 "Invalid sli_mode. mode=%d", hba->sli_mode); 1610 return (EMLXS_IMAGE_INCOMPATIBLE); 1611 } 1612 |
1613 if (!(hba->model_info.chip & EMLXS_BE_CHIPS)) { 1614 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1615 "Invalid adapter model. chip=%x", hba->model_info.chip); 1616 return (EMLXS_IMAGE_INCOMPATIBLE); 1617 } 1618 |
|
1486 if (buffer == NULL || len == 0) { 1487 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 1488 "Empty buffer provided. buf=%p size=%d", buffer, len); 1489 return (EMLXS_IMAGE_BAD); 1490 } 1491 1492 be_version = emlxs_be_version(buffer, len, 0); 1493 --- 46 unchanged lines hidden (view full) --- 1540 /* Check if update is required */ 1541 for (i = 0; i < BE_MAX_FLASHTYPES; i++) { 1542 file = &fw_image.file[i]; 1543 1544 if (file->image_size == 0) { 1545 continue; 1546 } 1547 | 1619 if (buffer == NULL || len == 0) { 1620 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 1621 "Empty buffer provided. buf=%p size=%d", buffer, len); 1622 return (EMLXS_IMAGE_BAD); 1623 } 1624 1625 be_version = emlxs_be_version(buffer, len, 0); 1626 --- 46 unchanged lines hidden (view full) --- 1673 /* Check if update is required */ 1674 for (i = 0; i < BE_MAX_FLASHTYPES; i++) { 1675 file = &fw_image.file[i]; 1676 1677 if (file->image_size == 0) { 1678 continue; 1679 } 1680 |
1548 rval = emlxs_sli4_verify_crc(hba, file, mbq, mp); | 1681 if (file->type == MGMT_FLASHROM_OPTYPE_PHY_FIRMWARE) { 1682 rval = emlxs_be_verify_phy(hba, file, mbq, mp); |
1549 | 1683 |
1550 if (rval == 0) { 1551 /* Do not update */ 1552 file->image_size = 0; 1553 continue; | 1684 if (rval != 0) { 1685 /* Do not update */ 1686 file->image_size = 0; 1687 continue; 1688 } 1689 } else { 1690 rval = emlxs_be_verify_crc(hba, file, mbq, mp); 1691 if (rval == 0) { 1692 /* Do not update */ 1693 file->image_size = 0; 1694 continue; 1695 } |
1554 } 1555 1556 update++; 1557 } 1558 1559 if (!update) { 1560 offline = 0; 1561 rval = 0; 1562 goto done; 1563 } 1564 1565 /* 1566 * Everything checks out, now to just do it 1567 */ 1568 if (offline) { | 1696 } 1697 1698 update++; 1699 } 1700 1701 if (!update) { 1702 offline = 0; 1703 rval = 0; 1704 goto done; 1705 } 1706 1707 /* 1708 * Everything checks out, now to just do it 1709 */ 1710 if (offline) { |
1569 if (emlxs_offline(hba) != FC_SUCCESS) { | 1711 if (emlxs_offline(hba, 0) != FC_SUCCESS) { |
1570 1571 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1572 "Unable to take adapter offline."); 1573 1574 offline = 0; 1575 rval = EMLXS_OFFLINE_FAILED; 1576 goto done; 1577 } 1578 } 1579 1580 /* Download entries which require update */ 1581 for (i = 0; i < BE_MAX_FLASHTYPES; i++) { 1582 file = &fw_image.file[i]; 1583 1584 if (file->image_size == 0) { 1585 continue; 1586 } 1587 | 1712 1713 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1714 "Unable to take adapter offline."); 1715 1716 offline = 0; 1717 rval = EMLXS_OFFLINE_FAILED; 1718 goto done; 1719 } 1720 } 1721 1722 /* Download entries which require update */ 1723 for (i = 0; i < BE_MAX_FLASHTYPES; i++) { 1724 file = &fw_image.file[i]; 1725 1726 if (file->image_size == 0) { 1727 continue; 1728 } 1729 |
1588 rval = emlxs_sli4_flash_image(hba, buffer, file, mbq, mp); | 1730 rval = emlxs_be_flash_image(hba, buffer, file, mbq, mp); |
1589 1590 if (rval != 0) { 1591 goto done; 1592 } 1593 } 1594 1595done: 1596 if (mbq) { --- 9 unchanged lines hidden (view full) --- 1606 } 1607 1608 if (rval == 0) { 1609 if (update) { 1610 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_complete_msg, 1611 "Status good."); 1612 1613 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_updated_msg, | 1731 1732 if (rval != 0) { 1733 goto done; 1734 } 1735 } 1736 1737done: 1738 if (mbq) { --- 9 unchanged lines hidden (view full) --- 1748 } 1749 1750 if (rval == 0) { 1751 if (update) { 1752 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_complete_msg, 1753 "Status good."); 1754 1755 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_updated_msg, |
1614 "Please reboot system or power cycle adapter " 1615 "to activate new firmware: %s", | 1756 "The new firmware will not be activated until " 1757 "the adapter is power cycled: %s", |
1616 fw_image.fcoe_label); 1617 1618 } else { 1619 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_detail_msg, 1620 "No firmware update required."); 1621 } 1622 } 1623 1624 return (rval); 1625 | 1758 fw_image.fcoe_label); 1759 1760 } else { 1761 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_detail_msg, 1762 "No firmware update required."); 1763 } 1764 } 1765 1766 return (rval); 1767 |
1626} /* emlxs_sli4_fw_download() */ | 1768} /* emlxs_be_fw_download() */ |
1627 1628 | 1769 1770 |
1771static int32_t 1772emlxs_obj_flash_image(emlxs_hba_t *hba, caddr_t buffer, uint32_t size, 1773 MAILBOXQ *mbq, MATCHMAP *mp, uint32_t *change_status) 1774{ 1775 emlxs_port_t *port = &PPORT; 1776 uint8_t *image_ptr; 1777 MAILBOX4 *mb; 1778 mbox_req_hdr_t *hdr_req; 1779 mbox_rsp_hdr_t *hdr_rsp; 1780 uint32_t image_size; 1781 uint32_t xfer_size; 1782 uint32_t image_offset; 1783 uint32_t rval = 0; 1784 IOCTL_COMMON_WRITE_OBJECT *write_obj; 1785 uint32_t cstatus = 0; 1786 1787 if (!buffer || size == 0) { 1788 return (0); 1789 } 1790 1791 image_ptr = (uint8_t *)buffer; 1792 image_size = size; 1793 image_offset = 0; 1794 mb = (MAILBOX4*)mbq; 1795 1796 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_msg, 1797 "OBJ File: Downloading..."); 1798 1799 while (image_size) { 1800 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE); 1801 bzero((void *) mp->virt, mp->size); 1802 1803 xfer_size = min(OBJ_MAX_XFER_SIZE, image_size); 1804 1805 mb->un.varSLIConfig.be.embedded = 1; 1806 mbq->nonembed = NULL; 1807 mbq->mbox_cmpl = NULL; 1808 1809 mb->mbxCommand = MBX_SLI_CONFIG; 1810 mb->mbxOwner = OWN_HOST; 1811 1812 hdr_req = (mbox_req_hdr_t *) 1813 &mb->un.varSLIConfig.be.un_hdr.hdr_req; 1814 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON; 1815 hdr_req->opcode = COMMON_OPCODE_WRITE_OBJ; 1816 hdr_req->timeout = 0; 1817 1818 write_obj = (IOCTL_COMMON_WRITE_OBJECT *)(hdr_req + 1); 1819 write_obj->params.request.EOF = 1820 ((xfer_size == image_size)? 1:0); 1821 write_obj->params.request.desired_write_length = xfer_size; 1822 write_obj->params.request.write_offset = image_offset; 1823 1824 (void) strlcpy((char *)write_obj->params.request.object_name, 1825 "/prg", sizeof (write_obj->params.request.object_name)); 1826 BE_SWAP32_BUFFER((uint8_t *) 1827 write_obj->params.request.object_name, 1828 sizeof (write_obj->params.request.object_name)); 1829 1830 write_obj->params.request.buffer_desc_count = 1; 1831 write_obj->params.request.buffer_length = xfer_size; 1832 write_obj->params.request.buffer_addrlo = PADDR_LO(mp->phys); 1833 write_obj->params.request.buffer_addrhi = PADDR_HI(mp->phys); 1834 1835 hdr_req->req_length = 116 + 1836 (write_obj->params.request.buffer_desc_count * 12); 1837 1838 bcopy(image_ptr, mp->virt, xfer_size); 1839 1840 hdr_rsp = (mbox_rsp_hdr_t *) 1841 &mb->un.varSLIConfig.be.un_hdr.hdr_rsp; 1842 write_obj = (IOCTL_COMMON_WRITE_OBJECT *)(hdr_rsp + 1); 1843 1844 /* Send write request */ 1845 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) != 1846 MBX_SUCCESS) { 1847 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1848 "OBJ File: Unable to download image. status=%x " 1849 "(%x,%x)", 1850 mb->mbxStatus, hdr_rsp->status, 1851 hdr_rsp->extra_status); 1852 1853 return (EMLXS_IMAGE_FAILED); 1854 } 1855 1856 /* Check header status */ 1857 if (hdr_rsp->status) { 1858 if ((hdr_rsp->status == MBX_RSP_STATUS_FAILED) && 1859 (hdr_rsp->extra_status == 1860 MGMT_ADDI_STATUS_INCOMPATIBLE)) { 1861 EMLXS_MSGF(EMLXS_CONTEXT, 1862 &emlxs_download_failed_msg, 1863 "OBJ File: Image file incompatible with " 1864 "adapter hardware."); 1865 return (EMLXS_IMAGE_INCOMPATIBLE); 1866 } 1867 1868 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1869 "OBJ File: Unable to download image. " 1870 "hdr_status=%x,%x size=%d,%d", 1871 hdr_rsp->status, hdr_rsp->extra_status, 1872 write_obj->params.response.actual_write_length, 1873 xfer_size); 1874 1875 return (EMLXS_IMAGE_FAILED); 1876 } 1877 1878 /* Check response length */ 1879 if (write_obj->params.response.actual_write_length == 0) { 1880 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1881 "OBJ File: No data actually written."); 1882 1883 return (EMLXS_IMAGE_FAILED); 1884 } 1885 1886 if (write_obj->params.response.actual_write_length > 1887 xfer_size) { 1888 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1889 "OBJ File: Mismatch in data xfer size. " 1890 "size=%d,%d offset=%d", 1891 write_obj->params.response.actual_write_length, 1892 xfer_size, image_offset); 1893 1894 return (EMLXS_IMAGE_FAILED); 1895 } 1896 1897 /* Set xfer_size to actual write length */ 1898 xfer_size = write_obj->params.response.actual_write_length; 1899 1900 image_ptr += xfer_size; 1901 image_offset += xfer_size; 1902 image_size -= xfer_size; 1903 1904 if (image_size == 0) { 1905 cstatus = write_obj->params.response.change_status; 1906 } 1907 } 1908 1909 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_msg, 1910 "OBJ File: Download complete. (cstatus=%d)", 1911 cstatus); 1912 1913 if (change_status) { 1914 *change_status = cstatus; 1915 } 1916 1917 return (rval); 1918 1919} /* emlxs_obj_flash_image() */ 1920 1921 1922static uint32_t 1923emlxs_obj_validate_image(emlxs_hba_t *hba, caddr_t buffer, uint32_t len, 1924 emlxs_obj_header_t *obj_hdr_in) 1925{ 1926 emlxs_port_t *port = &PPORT; 1927 emlxs_obj_header_t obj_hdr; 1928 1929 if (obj_hdr_in) { 1930 bzero(obj_hdr_in, sizeof (emlxs_obj_header_t)); 1931 } 1932 1933 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) { 1934 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1935 "Invalid sli_mode. mode=%d", hba->sli_mode); 1936 return (EMLXS_IMAGE_INCOMPATIBLE); 1937 } 1938 1939 if (hba->model_info.chip & EMLXS_BE_CHIPS) { 1940 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1941 "Invalid adapter model. chip=%x", hba->model_info.chip); 1942 return (EMLXS_IMAGE_INCOMPATIBLE); 1943 } 1944 1945 if (len < sizeof (emlxs_obj_header_t)) { 1946 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 1947 "Image too small. (%d < %d)", 1948 len, sizeof (emlxs_obj_header_t)); 1949 1950 return (EMLXS_IMAGE_BAD); 1951 } 1952 1953 bcopy(buffer, (uint8_t *)&obj_hdr, sizeof (emlxs_obj_header_t)); 1954 1955 /* Swap first 3 words */ 1956 LE_SWAP32_BUFFER((uint8_t *)&obj_hdr, 12); 1957 1958 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_detail_msg, 1959 "Object Header: size=%d magic=%04x,%04x type=%02x id=%02x", 1960 obj_hdr.FileSize, 1961 obj_hdr.MagicNumHi, obj_hdr.MagicNumLo, 1962 obj_hdr.FileType, 1963 obj_hdr.Id); 1964 1965 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_detail_msg, 1966 "Object Header: Date=%s Rev=%s", 1967 obj_hdr.Date, 1968 obj_hdr.Revision); 1969 1970 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_detail_msg, 1971 "Object Header: Name=%s", 1972 obj_hdr.RevName); 1973 1974 if ((obj_hdr.MagicNumHi != OBJ_MAGIC_NUM_HI) || 1975 (obj_hdr.MagicNumLo != OBJ_MAGIC_NUM_LO)) { 1976 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1977 "Wrong Magic Number: %x,%x", 1978 obj_hdr.MagicNumHi, obj_hdr.MagicNumLo); 1979 1980 return (EMLXS_IMAGE_INCOMPATIBLE); 1981 } 1982 1983 if (obj_hdr.FileSize != len) { 1984 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 1985 "Image too small. (%d < %d)", 1986 len, obj_hdr.FileSize); 1987 1988 return (EMLXS_IMAGE_BAD); 1989 } 1990 1991 if ((hba->model_info.chip & EMLXS_LANCER_CHIP) && 1992 (obj_hdr.Id != OBJ_LANCER_ID)) { 1993 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 1994 "Invalid adapter model. chip=%x fwid=%x", 1995 hba->model_info.chip, 1996 obj_hdr.Id); 1997 return (EMLXS_IMAGE_INCOMPATIBLE); 1998 } 1999 2000 if (obj_hdr_in) { 2001 bcopy(&obj_hdr, obj_hdr_in, sizeof (emlxs_obj_header_t)); 2002 } 2003 2004 return (0); 2005 2006} /* emlxs_obj_validate_image() */ 2007 2008 2009static int32_t 2010emlxs_obj_fw_download(emlxs_hba_t *hba, caddr_t buffer, uint32_t len, 2011 uint32_t offline) 2012{ 2013 emlxs_port_t *port = &PPORT; 2014 uint32_t rval = 0; 2015 MAILBOXQ *mbq = NULL; 2016 MATCHMAP *mp = NULL; 2017 uint32_t change_status = 0; 2018 2019 /* For now we will not take the driver offline during a download */ 2020 offline = 0; 2021 2022 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) { 2023 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 2024 "Invalid sli_mode. mode=%d", hba->sli_mode); 2025 return (EMLXS_IMAGE_INCOMPATIBLE); 2026 } 2027 2028 if (hba->model_info.chip & EMLXS_BE_CHIPS) { 2029 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 2030 "Invalid adapter model. chip=%x", hba->model_info.chip); 2031 return (EMLXS_IMAGE_INCOMPATIBLE); 2032 } 2033 2034 if (buffer == NULL || len == 0) { 2035 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_bad_msg, 2036 "Empty buffer provided. buf=%p size=%d", buffer, len); 2037 return (EMLXS_IMAGE_BAD); 2038 } 2039 2040 rval = emlxs_obj_validate_image(hba, buffer, len, 0); 2041 2042 if (rval) { 2043 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_incompat_msg, 2044 "Invalid image provided."); 2045 return (EMLXS_IMAGE_INCOMPATIBLE); 2046 } 2047 2048 /* Allocate resources */ 2049 2050 if ((mbq = (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), 2051 KM_SLEEP)) == NULL) { 2052 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 2053 "Unable to allocate mailbox buffer."); 2054 2055 offline = 0; 2056 rval = EMLXS_IMAGE_FAILED; 2057 goto done; 2058 } 2059 2060 if ((mp = emlxs_mem_buf_alloc(hba, OBJ_MAX_XFER_SIZE)) == NULL) { 2061 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 2062 "Unable to allocate flash buffer."); 2063 2064 offline = 0; 2065 rval = EMLXS_IMAGE_FAILED; 2066 goto done; 2067 } 2068 2069 /* 2070 * Everything checks out, now to just do it 2071 */ 2072 if (offline) { 2073 if (emlxs_offline(hba, 0) != FC_SUCCESS) { 2074 2075 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 2076 "Unable to take adapter offline."); 2077 2078 offline = 0; 2079 rval = EMLXS_OFFLINE_FAILED; 2080 goto done; 2081 } 2082 } 2083 2084 rval = emlxs_obj_flash_image(hba, buffer, len, mbq, mp, &change_status); 2085 2086done: 2087 if (mbq) { 2088 emlxs_mem_put(hba, MEM_MBOX, (void *)mbq); 2089 } 2090 2091 if (mp) { 2092 emlxs_mem_buf_free(hba, mp); 2093 } 2094 2095 if (offline) { 2096 (void) emlxs_online(hba); 2097 } 2098 2099 if (rval == 0) { 2100 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_complete_msg, 2101 "Status good."); 2102 2103 switch (change_status) { 2104 case CS_NO_RESET: 2105 break; 2106 2107 case CS_REBOOT_RQD: 2108 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_updated_msg, 2109 "The new firmware will not be activated until " 2110 "the adapter is power cycled."); 2111 rval = EMLXS_REBOOT_REQUIRED; 2112 break; 2113 2114 case CS_FW_RESET_RQD: 2115 case CS_PROTO_RESET_RQD: 2116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_fw_updated_msg, 2117 "Resetting all ports to activate new firmware."); 2118 2119 emlxs_sli4_hba_reset_all(hba, 0); 2120 } 2121 } 2122 2123 return (rval); 2124 2125} /* emlxs_obj_fw_download() */ 2126 2127 |
|
1629extern int32_t 1630emlxs_cfl_download(emlxs_hba_t *hba, uint32_t region, caddr_t buffer, 1631 uint32_t len) 1632{ 1633 emlxs_port_t *port = &PPORT; 1634 MAILBOXQ *mbox = NULL; 1635 MAILBOX *mb; 1636 uint32_t rval = 0; --- 68 unchanged lines hidden (view full) --- 1705 goto done; 1706 } 1707 1708 mb = (MAILBOX *)mbox; 1709 1710 /* 1711 * Everything checks out, now to just do it 1712 */ | 2128extern int32_t 2129emlxs_cfl_download(emlxs_hba_t *hba, uint32_t region, caddr_t buffer, 2130 uint32_t len) 2131{ 2132 emlxs_port_t *port = &PPORT; 2133 MAILBOXQ *mbox = NULL; 2134 MAILBOX *mb; 2135 uint32_t rval = 0; --- 68 unchanged lines hidden (view full) --- 2204 goto done; 2205 } 2206 2207 mb = (MAILBOX *)mbox; 2208 2209 /* 2210 * Everything checks out, now to just do it 2211 */ |
1713 if (emlxs_offline(hba) != FC_SUCCESS) { | 2212 if (emlxs_offline(hba, 0) != FC_SUCCESS) { |
1714 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 1715 "Unable to take HBA offline."); 1716 1717 rval = EMLXS_OFFLINE_FAILED; 1718 1719 goto done; 1720 } 1721 --- 7 unchanged lines hidden (view full) --- 1729 } 1730 1731 /* Check if default region is requested */ 1732 if (region == 0xff) { 1733 /* 1734 * Sun-branded Helios and Zypher have different 1735 * default PCI region 1736 */ | 2213 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_download_failed_msg, 2214 "Unable to take HBA offline."); 2215 2216 rval = EMLXS_OFFLINE_FAILED; 2217 2218 goto done; 2219 } 2220 --- 7 unchanged lines hidden (view full) --- 2228 } 2229 2230 /* Check if default region is requested */ 2231 if (region == 0xff) { 2232 /* 2233 * Sun-branded Helios and Zypher have different 2234 * default PCI region 2235 */ |
1737 if ((hba->model_info.flags & EMLXS_SUN_BRANDED) && | 2236 if ((hba->model_info.flags & EMLXS_ORACLE_BRANDED) && |
1738 (hba->model_info.chip & 1739 (EMLXS_HELIOS_CHIP | EMLXS_ZEPHYR_CHIP))) { 1740 region = 2; 1741 } else { 1742 region = 0; 1743 } 1744 } 1745 --- 1225 unchanged lines hidden (view full) --- 2971 if (j == 0) { 2972 src += 4; 2973 } 2974 2975 SBUS_WRITE_FLASH_COPY(hba, i, bb); 2976 2977 /* check for complete */ 2978 for (;;) { | 2237 (hba->model_info.chip & 2238 (EMLXS_HELIOS_CHIP | EMLXS_ZEPHYR_CHIP))) { 2239 region = 2; 2240 } else { 2241 region = 0; 2242 } 2243 } 2244 --- 1225 unchanged lines hidden (view full) --- 3470 if (j == 0) { 3471 src += 4; 3472 } 3473 3474 SBUS_WRITE_FLASH_COPY(hba, i, bb); 3475 3476 /* check for complete */ 3477 for (;;) { |
2979 DELAYUS(20); | 3478 BUSYWAIT_US(20); |
2980 2981 cc = SBUS_READ_FLASH_COPY(hba, i); 2982 2983 /* If data matches then continue */ 2984 if (cc == bb) { 2985 break; 2986 } 2987 --- 39 unchanged lines hidden (view full) --- 3027 if (j == 0) { 3028 src += 4; 3029 } 3030 3031 SBUS_WRITE_FLASH_COPY(hba, i, bb); 3032 3033 /* check for complete */ 3034 for (;;) { | 3479 3480 cc = SBUS_READ_FLASH_COPY(hba, i); 3481 3482 /* If data matches then continue */ 3483 if (cc == bb) { 3484 break; 3485 } 3486 --- 39 unchanged lines hidden (view full) --- 3526 if (j == 0) { 3527 src += 4; 3528 } 3529 3530 SBUS_WRITE_FLASH_COPY(hba, i, bb); 3531 3532 /* check for complete */ 3533 for (;;) { |
3035 DELAYUS(20); | 3534 BUSYWAIT_US(20); |
3036 3037 cc = SBUS_READ_FLASH_COPY(hba, i); 3038 3039 /* If data matches then continue */ 3040 if (cc == bb) { 3041 break; 3042 } 3043 --- 97 unchanged lines hidden (view full) --- 3141 /* Write erase flash sequence */ 3142 for (i = 0; i < 6; i++) { 3143 SBUS_WRITE_FLASH_COPY(hba, ef[i].offset, ef[i].val); 3144 } 3145 3146 /* check for complete */ 3147 for (;;) { 3148 /* Delay 3 seconds */ | 3535 3536 cc = SBUS_READ_FLASH_COPY(hba, i); 3537 3538 /* If data matches then continue */ 3539 if (cc == bb) { 3540 break; 3541 } 3542 --- 97 unchanged lines hidden (view full) --- 3640 /* Write erase flash sequence */ 3641 for (i = 0; i < 6; i++) { 3642 SBUS_WRITE_FLASH_COPY(hba, ef[i].offset, ef[i].val); 3643 } 3644 3645 /* check for complete */ 3646 for (;;) { 3647 /* Delay 3 seconds */ |
3149 DELAYMS(3000); | 3648 BUSYWAIT_MS(3000); |
3150 3151 cc = SBUS_READ_FLASH_COPY(hba, 0); 3152 3153 3154 /* If data matches then continue; */ 3155 if (cc == 0xff) { 3156 break; 3157 } --- 231 unchanged lines hidden (view full) --- 3389 } 3390 3391#ifdef FMA_SUPPORT 3392 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 3393 if (emlxs_fm_check_dma_handle(hba, 3394 hba->sli.sli4.dump_region.dma_handle) != DDI_FM_OK) { 3395 EMLXS_MSGF(EMLXS_CONTEXT, 3396 &emlxs_invalid_dma_handle_msg, | 3649 3650 cc = SBUS_READ_FLASH_COPY(hba, 0); 3651 3652 3653 /* If data matches then continue; */ 3654 if (cc == 0xff) { 3655 break; 3656 } --- 231 unchanged lines hidden (view full) --- 3888 } 3889 3890#ifdef FMA_SUPPORT 3891 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 3892 if (emlxs_fm_check_dma_handle(hba, 3893 hba->sli.sli4.dump_region.dma_handle) != DDI_FM_OK) { 3894 EMLXS_MSGF(EMLXS_CONTEXT, 3895 &emlxs_invalid_dma_handle_msg, |
3397 "emlxs_read_wakeup_parms: hdl=%p", | 3896 "read_wakeup_parms: hdl=%p", |
3398 hba->sli.sli4.dump_region.dma_handle); 3399 rval = 1; 3400 } 3401 } 3402#endif /* FMA_SUPPORT */ 3403 3404 return (rval); 3405 --- 91 unchanged lines hidden (view full) --- 3497 } 3498 3499#ifdef FMA_SUPPORT 3500 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 3501 if (emlxs_fm_check_dma_handle(hba, 3502 hba->sli.sli4.dump_region.dma_handle) != DDI_FM_OK) { 3503 EMLXS_MSGF(EMLXS_CONTEXT, 3504 &emlxs_invalid_dma_handle_msg, | 3897 hba->sli.sli4.dump_region.dma_handle); 3898 rval = 1; 3899 } 3900 } 3901#endif /* FMA_SUPPORT */ 3902 3903 return (rval); 3904 --- 91 unchanged lines hidden (view full) --- 3996 } 3997 3998#ifdef FMA_SUPPORT 3999 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 4000 if (emlxs_fm_check_dma_handle(hba, 4001 hba->sli.sli4.dump_region.dma_handle) != DDI_FM_OK) { 4002 EMLXS_MSGF(EMLXS_CONTEXT, 4003 &emlxs_invalid_dma_handle_msg, |
3505 "emlxs_read_load_list: hdl=%p", | 4004 "read_load_list: hdl=%p", |
3506 hba->sli.sli4.dump_region.dma_handle); 3507 return (1); 3508 } 3509 } 3510#endif /* FMA_SUPPORT */ 3511 3512 return (0); 3513 3514} /* emlxs_read_load_list() */ 3515 3516 | 4005 hba->sli.sli4.dump_region.dma_handle); 4006 return (1); 4007 } 4008 } 4009#endif /* FMA_SUPPORT */ 4010 4011 return (0); 4012 4013} /* emlxs_read_load_list() */ 4014 4015 |
4016extern uint32_t 4017emlxs_get_boot_config(emlxs_hba_t *hba, uint8_t *boot_state) 4018{ 4019 emlxs_port_t *port = &PPORT; 4020 MAILBOXQ *mbq; 4021 MAILBOX4 *mb; 4022 mbox_req_hdr_t *hdr_req; 4023 IOCTL_COMMON_BOOT_CFG *boot_cfg; |
|
3517 | 4024 |
4025 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) { 4026 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 4027 "Invalid sli_mode. mode=%d", hba->sli_mode); |
|
3518 | 4028 |
4029 return (1); 4030 } 4031 4032 if ((mbq = (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), 4033 KM_NOSLEEP)) == NULL) { 4034 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 4035 "Unable to allocate mailbox buffer."); 4036 4037 return (1); 4038 } 4039 4040 mb = (MAILBOX4 *)mbq; 4041 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE); 4042 4043 mb->un.varSLIConfig.be.embedded = 1; 4044 mbq->nonembed = NULL; 4045 mbq->mbox_cmpl = NULL; 4046 4047 mb->mbxCommand = MBX_SLI_CONFIG; 4048 mb->mbxOwner = OWN_HOST; 4049 4050 hdr_req = (mbox_req_hdr_t *) 4051 &mb->un.varSLIConfig.be.un_hdr.hdr_req; 4052 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON; 4053 hdr_req->opcode = COMMON_OPCODE_GET_BOOT_CFG; 4054 4055 boot_cfg = (IOCTL_COMMON_BOOT_CFG *)(hdr_req + 1); 4056 4057 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) != MBX_SUCCESS) { 4058 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 4059 "Unable to read boot config: Mailbox cmd=%x " 4060 "status=%x", mb->mbxCommand, mb->mbxStatus); 4061 4062 kmem_free(mbq, sizeof (MAILBOXQ)); 4063 return (1); 4064 } 4065 4066 *boot_state = boot_cfg->params.response.boot_status; 4067 4068 kmem_free(mbq, sizeof (MAILBOXQ)); 4069 return (0); 4070} 4071 4072 4073extern uint32_t 4074emlxs_set_boot_config(emlxs_hba_t *hba, uint8_t boot_state) 4075{ 4076 emlxs_port_t *port = &PPORT; 4077 MAILBOXQ *mbq; 4078 MAILBOX4 *mb; 4079 mbox_req_hdr_t *hdr_req; 4080 IOCTL_COMMON_BOOT_CFG *boot_cfg; 4081 4082 if (hba->sli_mode != EMLXS_HBA_SLI4_MODE) { 4083 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 4084 "Invalid sli_mode. mode=%d", hba->sli_mode); 4085 4086 return (1); 4087 } 4088 4089 if ((mbq = (MAILBOXQ *)kmem_zalloc(sizeof (MAILBOXQ), 4090 KM_NOSLEEP)) == NULL) { 4091 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 4092 "Unable to allocate mailbox buffer."); 4093 4094 return (1); 4095 } 4096 4097 mb = (MAILBOX4 *)mbq; 4098 bzero((void *) mb, MAILBOX_CMD_SLI4_BSIZE); 4099 4100 mb->un.varSLIConfig.be.embedded = 1; 4101 mbq->nonembed = NULL; 4102 mbq->mbox_cmpl = NULL; 4103 4104 mb->mbxCommand = MBX_SLI_CONFIG; 4105 mb->mbxOwner = OWN_HOST; 4106 4107 hdr_req = (mbox_req_hdr_t *) 4108 &mb->un.varSLIConfig.be.un_hdr.hdr_req; 4109 hdr_req->subsystem = IOCTL_SUBSYSTEM_COMMON; 4110 hdr_req->opcode = COMMON_OPCODE_SET_BOOT_CFG; 4111 4112 boot_cfg = (IOCTL_COMMON_BOOT_CFG *)(hdr_req + 1); 4113 boot_cfg->params.request.boot_status = boot_state; 4114 4115 if (EMLXS_SLI_ISSUE_MBOX_CMD(hba, mbq, MBX_WAIT, 0) != MBX_SUCCESS) { 4116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 4117 "Unable to read boot config: Mailbox cmd=%x " 4118 "status=%x", mb->mbxCommand, mb->mbxStatus); 4119 4120 kmem_free(mbq, sizeof (MAILBOXQ)); 4121 return (1); 4122 } 4123 4124 kmem_free(mbq, sizeof (MAILBOXQ)); 4125 return (0); 4126} 4127 4128 4129 4130 |
|
3519static int 3520emlxs_build_parms(caddr_t Buffer, 3521 PWAKE_UP_PARMS AbsWakeUpParms, 3522 uint32_t BufferSize, PAIF_HDR AifHeader) 3523{ 3524 IMAGE_HDR ImageHdr; 3525 uint32_t NextImage; 3526 uint32_t i; --- 106 unchanged lines hidden (view full) --- 3633 3634static uint32_t 3635emlxs_validate_version(emlxs_hba_t *hba, emlxs_fw_file_t *file, uint32_t id, 3636 uint32_t type, char *file_type) 3637{ 3638 emlxs_port_t *port = &PPORT; 3639 3640 /* Create the version label */ | 4131static int 4132emlxs_build_parms(caddr_t Buffer, 4133 PWAKE_UP_PARMS AbsWakeUpParms, 4134 uint32_t BufferSize, PAIF_HDR AifHeader) 4135{ 4136 IMAGE_HDR ImageHdr; 4137 uint32_t NextImage; 4138 uint32_t i; --- 106 unchanged lines hidden (view full) --- 4245 4246static uint32_t 4247emlxs_validate_version(emlxs_hba_t *hba, emlxs_fw_file_t *file, uint32_t id, 4248 uint32_t type, char *file_type) 4249{ 4250 emlxs_port_t *port = &PPORT; 4251 4252 /* Create the version label */ |
3641 emlxs_decode_version(file->version, file->label); | 4253 emlxs_decode_version(file->version, file->label, sizeof (file->label)); |
3642 3643 /* Process the DWC type */ 3644 switch (type) { 3645 case TEST_PROGRAM: 3646 3647 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 3648 "%s: TEST: offset=%08x version=%08x, %s", file_type, 3649 file->offset, file->version, file->label); --- 814 unchanged lines hidden (view full) --- 4464 "Nothing new to update. Exiting."); 4465 return (0); 4466 } 4467 4468 /* 4469 * Everything checks out, now to just do it 4470 */ 4471 if (offline) { | 4254 4255 /* Process the DWC type */ 4256 switch (type) { 4257 case TEST_PROGRAM: 4258 4259 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_image_msg, 4260 "%s: TEST: offset=%08x version=%08x, %s", file_type, 4261 file->offset, file->version, file->label); --- 814 unchanged lines hidden (view full) --- 5076 "Nothing new to update. Exiting."); 5077 return (0); 5078 } 5079 5080 /* 5081 * Everything checks out, now to just do it 5082 */ 5083 if (offline) { |
4472 if (emlxs_offline(hba) != FC_SUCCESS) { | 5084 if (emlxs_offline(hba, 0) != FC_SUCCESS) { |
4473 return (EMLXS_OFFLINE_FAILED); 4474 } 4475 4476 if (EMLXS_SLI_HBA_RESET(hba, 1, 1, 0) != FC_SUCCESS) { 4477 return (EMLXS_OFFLINE_FAILED); 4478 } 4479 } 4480 --- 429 unchanged lines hidden (view full) --- 4910 } 4911 4912#ifdef FMA_SUPPORT 4913 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 4914 if (emlxs_fm_check_dma_handle(hba, 4915 hba->sli.sli4.dump_region.dma_handle) != DDI_FM_OK) { 4916 EMLXS_MSGF(EMLXS_CONTEXT, 4917 &emlxs_invalid_dma_handle_msg, | 5085 return (EMLXS_OFFLINE_FAILED); 5086 } 5087 5088 if (EMLXS_SLI_HBA_RESET(hba, 1, 1, 0) != FC_SUCCESS) { 5089 return (EMLXS_OFFLINE_FAILED); 5090 } 5091 } 5092 --- 429 unchanged lines hidden (view full) --- 5522 } 5523 5524#ifdef FMA_SUPPORT 5525 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 5526 if (emlxs_fm_check_dma_handle(hba, 5527 hba->sli.sli4.dump_region.dma_handle) != DDI_FM_OK) { 5528 EMLXS_MSGF(EMLXS_CONTEXT, 5529 &emlxs_invalid_dma_handle_msg, |
4918 "emlxs_get_max_sram: hdl=%p", | 5530 "get_max_sram: hdl=%p", |
4919 hba->sli.sli4.dump_region.dma_handle); 4920 rval = 1; 4921 } 4922 } 4923#endif /* FMA_SUPPORT */ 4924 4925 return (rval); 4926 --- 172 unchanged lines hidden (view full) --- 5099 5100 5101extern int32_t 5102emlxs_boot_code_disable(emlxs_hba_t *hba) 5103{ 5104 emlxs_port_t *port = &PPORT; 5105 PROG_ID Id; 5106 emlxs_vpd_t *vpd; | 5531 hba->sli.sli4.dump_region.dma_handle); 5532 rval = 1; 5533 } 5534 } 5535#endif /* FMA_SUPPORT */ 5536 5537 return (rval); 5538 --- 172 unchanged lines hidden (view full) --- 5711 5712 5713extern int32_t 5714emlxs_boot_code_disable(emlxs_hba_t *hba) 5715{ 5716 emlxs_port_t *port = &PPORT; 5717 PROG_ID Id; 5718 emlxs_vpd_t *vpd; |
5719 uint8_t boot_state = 0; |
|
5107 5108 vpd = &VPD; 5109 | 5720 5721 vpd = &VPD; 5722 |
5110 if ((hba->model_info.chip == EMLXS_BE2_CHIP) || 5111 (hba->model_info.chip == EMLXS_BE3_CHIP)) { | 5723 if (hba->model_info.chip & EMLXS_BE_CHIPS) { |
5112 return (EMLXS_OP_NOT_SUP); 5113 } 5114 | 5724 return (EMLXS_OP_NOT_SUP); 5725 } 5726 |
5115 if (emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 0)) { 5116 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5117 "emlxs_boot_code_disable: Unable to read wake up parms."); | 5727 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 5728 /* Read Boot Config */ 5729 if (emlxs_get_boot_config(hba, &boot_state)) { 5730 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5731 "boot_code_enable: Unable to get boot config."); |
5118 | 5732 |
5119 return (FC_FAILURE); 5120 } | 5733 return (FC_FAILURE); 5734 } |
5121 | 5735 |
5122 /* Check if boot code is already disabled */ 5123 if (hba->wakeup_parms.u0.boot_bios_wd[0] == 0) { 5124 return (FC_SUCCESS); 5125 } | 5736 /* Check if boot code is already disabled */ 5737 if (! boot_state) { 5738 return (FC_SUCCESS); 5739 } |
5126 | 5740 |
5127 /* Make sure EROM entry has copy of boot bios entry */ 5128 if (!(hba->model_info.chip & 5129 (EMLXS_DRAGONFLY_CHIP | EMLXS_CENTAUR_CHIP)) && 5130 (hba->wakeup_parms.u0.boot_bios_wd[0] != 5131 hba->wakeup_parms.u1.EROM_prog_wd[0]) && 5132 (hba->wakeup_parms.u0.boot_bios_wd[1] != 5133 hba->wakeup_parms.u1.EROM_prog_wd[1])) { 5134 (void) emlxs_update_boot_wakeup_parms(hba, &hba->wakeup_parms, 5135 &hba->wakeup_parms.u0.boot_bios_id, 1); 5136 } | 5741 /* Disable boot code */ 5742 boot_state = 0; 5743 if (emlxs_set_boot_config(hba, boot_state)) { 5744 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5745 "boot_code_enable: Unable to set boot config."); |
5137 | 5746 |
5138 /* Update the bios id with a zero id */ 5139 /* Don't load the EROM this time */ 5140 bzero(&Id, sizeof (PROG_ID)); 5141 (void) emlxs_update_boot_wakeup_parms(hba, &hba->wakeup_parms, &Id, 0); | 5747 return (FC_FAILURE); 5748 } |
5142 | 5749 |
5143 /* Now read the parms again to verify */ 5144 (void) emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 1); 5145 emlxs_decode_version(hba->wakeup_parms.u0.boot_bios_wd[0], 5146 vpd->boot_version); 5147 /* (void) strcpy(vpd->fcode_version, vpd->boot_version); */ | 5750 /* Now read the boot config again to verify */ 5751 if (emlxs_get_boot_config(hba, &boot_state)) { 5752 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5753 "boot_code_enable: Unable to get boot config."); |
5148 | 5754 |
5149 /* Return the result */ 5150 return ((hba->wakeup_parms.u0.boot_bios_wd[0] == 0) ? 5151 FC_SUCCESS : FC_FAILURE); | 5755 return (FC_FAILURE); 5756 } |
5152 | 5757 |
5758 /* return the result */ 5759 return ((boot_state == 0) ? FC_SUCCESS : FC_FAILURE); 5760 } else { 5761 if (emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 0)) { 5762 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5763 "boot_code_disable: Unable to read wake up parms."); 5764 5765 return (FC_FAILURE); 5766 } 5767 5768 /* Check if boot code is already disabled */ 5769 if (hba->wakeup_parms.u0.boot_bios_wd[0] == 0) { 5770 return (FC_SUCCESS); 5771 } 5772 5773 /* Make sure EROM entry has copy of boot bios entry */ 5774 if (!(hba->model_info.chip & 5775 (EMLXS_DRAGONFLY_CHIP | EMLXS_CENTAUR_CHIP)) && 5776 (hba->wakeup_parms.u0.boot_bios_wd[0] != 5777 hba->wakeup_parms.u1.EROM_prog_wd[0]) && 5778 (hba->wakeup_parms.u0.boot_bios_wd[1] != 5779 hba->wakeup_parms.u1.EROM_prog_wd[1])) { 5780 (void) emlxs_update_boot_wakeup_parms(hba, 5781 &hba->wakeup_parms, 5782 &hba->wakeup_parms.u0.boot_bios_id, 1); 5783 } 5784 5785 /* Update the bios id with a zero id */ 5786 /* Don't load the EROM this time */ 5787 bzero(&Id, sizeof (PROG_ID)); 5788 (void) emlxs_update_boot_wakeup_parms(hba, 5789 &hba->wakeup_parms, &Id, 0); 5790 5791 /* Now read the parms again to verify */ 5792 (void) emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 1); 5793 emlxs_decode_version(hba->wakeup_parms.u0.boot_bios_wd[0], 5794 vpd->boot_version, sizeof (vpd->boot_version)); 5795 /* (void) strcpy(vpd->fcode_version, vpd->boot_version); */ 5796 5797 /* Return the result */ 5798 return ((hba->wakeup_parms.u0.boot_bios_wd[0] == 0) ? 5799 FC_SUCCESS : FC_FAILURE); 5800 } 5801 |
|
5153} /* emlxs_boot_code_disable() */ 5154 5155 5156extern int32_t 5157emlxs_boot_code_enable(emlxs_hba_t *hba) 5158{ 5159 emlxs_port_t *port = &PPORT; 5160 emlxs_vpd_t *vpd; 5161 PROG_ID load_list[MAX_LOAD_ENTRY]; 5162 uint32_t i; 5163 uint32_t count; | 5802} /* emlxs_boot_code_disable() */ 5803 5804 5805extern int32_t 5806emlxs_boot_code_enable(emlxs_hba_t *hba) 5807{ 5808 emlxs_port_t *port = &PPORT; 5809 emlxs_vpd_t *vpd; 5810 PROG_ID load_list[MAX_LOAD_ENTRY]; 5811 uint32_t i; 5812 uint32_t count; |
5813 uint8_t boot_state = 0; |
|
5164 5165 vpd = &VPD; 5166 | 5814 5815 vpd = &VPD; 5816 |
5167 if ((hba->model_info.chip == EMLXS_BE2_CHIP) || 5168 (hba->model_info.chip == EMLXS_BE3_CHIP)) { | 5817 if (hba->model_info.chip & EMLXS_BE_CHIPS) { |
5169 return (FC_SUCCESS); 5170 } 5171 | 5818 return (FC_SUCCESS); 5819 } 5820 |
5172 /* Read the wakeup parms */ 5173 if (emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 0)) { 5174 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5175 "emlxs_boot_code_enable: Unable to read wake up parms."); | 5821 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 5822 /* Read Boot Config */ 5823 if (emlxs_get_boot_config(hba, &boot_state)) { 5824 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5825 "boot_code_enable: Unable to get boot config."); |
5176 | 5826 |
5177 return (FC_FAILURE); 5178 } | 5827 return (FC_FAILURE); 5828 } |
5179 | 5829 |
5180 /* Check if boot code is already enabled */ 5181 if (hba->wakeup_parms.u0.boot_bios_id.Type == BOOT_BIOS) { 5182 return (FC_SUCCESS); 5183 } | 5830 /* Check if boot code is already enabled */ 5831 if (boot_state) { 5832 return (FC_SUCCESS); 5833 } |
5184 | 5834 |
5185 if (!(hba->model_info.chip & 5186 (EMLXS_DRAGONFLY_CHIP | EMLXS_CENTAUR_CHIP))) { 5187 if (hba->wakeup_parms.u1.EROM_prog_id.Type != BOOT_BIOS) { 5188 return (EMLXS_NO_BOOT_CODE); | 5835 /* Enable boot code */ 5836 boot_state = 1; 5837 if (emlxs_set_boot_config(hba, boot_state)) { 5838 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5839 "boot_code_enable: Unable to set boot config."); 5840 5841 return (FC_FAILURE); |
5189 } 5190 | 5842 } 5843 |
5191 /* Update the parms with the boot image id */ 5192 /* Don't load the EROM this time */ 5193 (void) emlxs_update_boot_wakeup_parms(hba, &hba->wakeup_parms, 5194 &hba->wakeup_parms.u1.EROM_prog_id, 0); 5195 } else { /* (EMLXS_DRAGONFLY_CHIP | EMLXS_CENTAUR_CHIP) */ | 5844 /* Now read the boot config again to verify */ 5845 if (emlxs_get_boot_config(hba, &boot_state)) { 5846 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5847 "boot_code_enable: Unable to get boot config."); |
5196 | 5848 |
5197 count = emlxs_get_load_list(hba, load_list); | 5849 return (FC_FAILURE); 5850 } |
5198 | 5851 |
5199 if (!count) { | 5852 /* return the result */ 5853 return ((boot_state != 0) ? FC_SUCCESS : FC_FAILURE); 5854 } else { 5855 /* Read the wakeup parms */ 5856 if (emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 0)) { 5857 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5858 "boot_code_enable: Unable to read wake up parms."); 5859 |
5200 return (FC_FAILURE); 5201 } 5202 | 5860 return (FC_FAILURE); 5861 } 5862 |
5203 /* Scan load list for a boot image */ 5204 for (i = 0; i < count; i++) { 5205 if (load_list[i].Type == BOOT_BIOS) { 5206 /* Update the parms with the boot image id */ 5207 /* Don't load the EROM this time */ 5208 (void) emlxs_update_boot_wakeup_parms(hba, 5209 &hba->wakeup_parms, &load_list[i], 0); | 5863 /* Check if boot code is already enabled */ 5864 if (hba->wakeup_parms.u0.boot_bios_id.Type == BOOT_BIOS) { 5865 return (FC_SUCCESS); 5866 } |
5210 | 5867 |
5211 break; | 5868 if (!(hba->model_info.chip & 5869 (EMLXS_DRAGONFLY_CHIP | EMLXS_CENTAUR_CHIP))) { 5870 if (hba->wakeup_parms.u1.EROM_prog_id.Type 5871 != BOOT_BIOS) { 5872 return (EMLXS_NO_BOOT_CODE); |
5212 } | 5873 } |
5213 } | |
5214 | 5874 |
5215 if (i == count) { 5216 return (EMLXS_NO_BOOT_CODE); | 5875 /* Update the parms with the boot image id */ 5876 /* Don't load the EROM this time */ 5877 (void) emlxs_update_boot_wakeup_parms(hba, 5878 &hba->wakeup_parms, 5879 &hba->wakeup_parms.u1.EROM_prog_id, 0); 5880 } else { /* (EMLXS_DRAGONFLY_CHIP | EMLXS_CENTAUR_CHIP) */ 5881 5882 count = emlxs_get_load_list(hba, load_list); 5883 5884 if (!count) { 5885 return (FC_FAILURE); 5886 } 5887 5888 /* Scan load list for a boot image */ 5889 for (i = 0; i < count; i++) { 5890 if (load_list[i].Type == BOOT_BIOS) { 5891 /* 5892 * Update the parms with boot image id 5893 * Don't load the EROM this time 5894 */ 5895 (void) emlxs_update_boot_wakeup_parms( 5896 hba, &hba->wakeup_parms, 5897 &load_list[i], 0); 5898 5899 break; 5900 } 5901 } 5902 5903 if (i == count) { 5904 return (EMLXS_NO_BOOT_CODE); 5905 } |
5217 } | 5906 } |
5218 } | |
5219 | 5907 |
5220 /* Now read the parms again to verify */ 5221 (void) emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 1); 5222 emlxs_decode_version(hba->wakeup_parms.u0.boot_bios_wd[0], 5223 vpd->boot_version); 5224 /* (void) strcpy(vpd->fcode_version, vpd->boot_version); */ | 5908 /* Now read the parms again to verify */ 5909 (void) emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 1); 5910 emlxs_decode_version(hba->wakeup_parms.u0.boot_bios_wd[0], 5911 vpd->boot_version, sizeof (vpd->boot_version)); 5912 /* (void) strcpy(vpd->fcode_version, vpd->boot_version); */ |
5225 | 5913 |
5226 /* return the result */ 5227 return ((hba->wakeup_parms.u0.boot_bios_wd[0] != 0) ? 5228 FC_SUCCESS : FC_FAILURE); | 5914 /* return the result */ 5915 return ((hba->wakeup_parms.u0.boot_bios_wd[0] != 0) ? 5916 FC_SUCCESS : FC_FAILURE); 5917 } |
5229 5230} /* emlxs_boot_code_enable() */ 5231 5232 5233 5234extern int32_t 5235emlxs_boot_code_state(emlxs_hba_t *hba) 5236{ 5237 emlxs_port_t *port = &PPORT; | 5918 5919} /* emlxs_boot_code_enable() */ 5920 5921 5922 5923extern int32_t 5924emlxs_boot_code_state(emlxs_hba_t *hba) 5925{ 5926 emlxs_port_t *port = &PPORT; |
5927 uint8_t boot_state = 0; |
|
5238 | 5928 |
5239 if ((hba->model_info.chip == EMLXS_BE2_CHIP) || 5240 (hba->model_info.chip == EMLXS_BE3_CHIP)) { | 5929 if (hba->model_info.chip & EMLXS_BE_CHIPS) { |
5241 return (FC_SUCCESS); 5242 } 5243 | 5930 return (FC_SUCCESS); 5931 } 5932 |
5244 /* Read the wakeup parms */ 5245 if (emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 1)) { 5246 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5247 "emlxs_boot_code_state: Unable to read wake up parms."); | 5933 if (hba->sli_mode == EMLXS_HBA_SLI4_MODE) { 5934 /* Read Boot Config */ 5935 if (emlxs_get_boot_config(hba, &boot_state)) { 5936 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5937 "boot_code_state: Unable to read boot config."); |
5248 | 5938 |
5249 return (FC_FAILURE); 5250 } | 5939 return (FC_FAILURE); 5940 } |
5251 | 5941 |
5252 /* return the result */ 5253 return ((hba->wakeup_parms.u0.boot_bios_wd[0] != 0) ? 5254 FC_SUCCESS : FC_FAILURE); | 5942 return ((boot_state != 0) ? FC_SUCCESS : FC_FAILURE); 5943 } else { 5944 /* Read the wakeup parms */ 5945 if (emlxs_read_wakeup_parms(hba, &hba->wakeup_parms, 1)) { 5946 EMLXS_MSGF(EMLXS_CONTEXT, &emlxs_sfs_debug_msg, 5947 "boot_code_state: Unable to read wake up parms."); |
5255 | 5948 |
5949 return (FC_FAILURE); 5950 } 5951 5952 /* return the result */ 5953 return ((hba->wakeup_parms.u0.boot_bios_wd[0] != 0) ? 5954 FC_SUCCESS : FC_FAILURE); 5955 } 5956 |
|
5256} /* emlxs_boot_code_state() */ | 5957} /* emlxs_boot_code_state() */ |