1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * QLogic Fibre Channel HBA Driver 4 * Copyright (c) 2003-2014 QLogic Corporation 5 */ 6 #ifndef __QLA_FW_H 7 #define __QLA_FW_H 8 9 #include <linux/nvme.h> 10 #include <linux/nvme-fc.h> 11 12 #include "qla_dsd.h" 13 14 #define MBS_CHECKSUM_ERROR 0x4010 15 #define MBS_INVALID_PRODUCT_KEY 0x4020 16 17 /* 18 * Firmware Options. 19 */ 20 #define FO1_ENABLE_PUREX BIT_10 21 #define FO1_DISABLE_LED_CTRL BIT_6 22 #define FO1_ENABLE_8016 BIT_0 23 #define FO2_ENABLE_SEL_CLASS2 BIT_5 24 #define FO3_NO_ABTS_ON_LINKDOWN BIT_14 25 #define FO3_HOLD_STS_IOCB BIT_12 26 27 /* 28 * Port Database structure definition for ISP 24xx. 29 */ 30 #define PDO_FORCE_ADISC BIT_1 31 #define PDO_FORCE_PLOGI BIT_0 32 33 struct buffer_credit_24xx { 34 u32 parameter[28]; 35 }; 36 37 #define PORT_DATABASE_24XX_SIZE 64 38 struct port_database_24xx { 39 uint16_t flags; 40 #define PDF_TASK_RETRY_ID BIT_14 41 #define PDF_FC_TAPE BIT_7 42 #define PDF_ACK0_CAPABLE BIT_6 43 #define PDF_FCP2_CONF BIT_5 44 #define PDF_CLASS_2 BIT_4 45 #define PDF_HARD_ADDR BIT_1 46 47 /* 48 * for NVMe, the login_state field has been 49 * split into nibbles. 50 * The lower nibble is for FCP. 51 * The upper nibble is for NVMe. 52 */ 53 uint8_t current_login_state; 54 uint8_t last_login_state; 55 #define PDS_PLOGI_PENDING 0x03 56 #define PDS_PLOGI_COMPLETE 0x04 57 #define PDS_PRLI_PENDING 0x05 58 #define PDS_PRLI_COMPLETE 0x06 59 #define PDS_PORT_UNAVAILABLE 0x07 60 #define PDS_PRLO_PENDING 0x09 61 #define PDS_LOGO_PENDING 0x11 62 #define PDS_PRLI2_PENDING 0x12 63 64 uint8_t hard_address[3]; 65 uint8_t reserved_1; 66 67 uint8_t port_id[3]; 68 uint8_t sequence_id; 69 70 uint16_t port_timer; 71 72 uint16_t nport_handle; /* N_PORT handle. */ 73 74 uint16_t receive_data_size; 75 uint16_t reserved_2; 76 77 uint8_t prli_svc_param_word_0[2]; /* Big endian */ 78 /* Bits 15-0 of word 0 */ 79 uint8_t prli_svc_param_word_3[2]; /* Big endian */ 80 /* Bits 15-0 of word 3 */ 81 82 uint8_t port_name[WWN_SIZE]; 83 uint8_t node_name[WWN_SIZE]; 84 85 uint8_t reserved_3[2]; 86 uint16_t nvme_first_burst_size; 87 uint16_t prli_nvme_svc_param_word_0; /* Bits 15-0 of word 0 */ 88 uint16_t prli_nvme_svc_param_word_3; /* Bits 15-0 of word 3 */ 89 uint8_t secure_login; 90 uint8_t reserved_4[14]; 91 }; 92 93 /* 94 * MB 75h returns a list of DB entries similar to port_database_24xx(64B). 95 * However, in this case it returns 1st 40 bytes. 96 */ 97 struct get_name_list_extended { 98 __le16 flags; 99 u8 current_login_state; 100 u8 last_login_state; 101 u8 hard_address[3]; 102 u8 reserved_1; 103 u8 port_id[3]; 104 u8 sequence_id; 105 __le16 port_timer; 106 __le16 nport_handle; /* N_PORT handle. */ 107 __le16 receive_data_size; 108 __le16 reserved_2; 109 110 /* PRLI SVC Param are Big endian */ 111 u8 prli_svc_param_word_0[2]; /* Bits 15-0 of word 0 */ 112 u8 prli_svc_param_word_3[2]; /* Bits 15-0 of word 3 */ 113 u8 port_name[WWN_SIZE]; 114 u8 node_name[WWN_SIZE]; 115 }; 116 117 /* MB 75h: This is the short version of the database */ 118 struct get_name_list { 119 u8 port_node_name[WWN_SIZE]; /* B7 most sig, B0 least sig */ 120 __le16 nport_handle; 121 u8 reserved; 122 }; 123 124 struct vp_database_24xx { 125 uint16_t vp_status; 126 uint8_t options; 127 uint8_t id; 128 uint8_t port_name[WWN_SIZE]; 129 uint8_t node_name[WWN_SIZE]; 130 uint16_t port_id_low; 131 uint16_t port_id_high; 132 }; 133 134 struct nvram_24xx { 135 /* NVRAM header. */ 136 uint8_t id[4]; 137 __le16 nvram_version; 138 uint16_t reserved_0; 139 140 /* Firmware Initialization Control Block. */ 141 __le16 version; 142 uint16_t reserved_1; 143 __le16 frame_payload_size; 144 __le16 execution_throttle; 145 __le16 exchange_count; 146 __le16 hard_address; 147 148 uint8_t port_name[WWN_SIZE]; 149 uint8_t node_name[WWN_SIZE]; 150 151 __le16 login_retry_count; 152 __le16 link_down_on_nos; 153 __le16 interrupt_delay_timer; 154 __le16 login_timeout; 155 156 __le32 firmware_options_1; 157 __le32 firmware_options_2; 158 __le32 firmware_options_3; 159 160 /* Offset 56. */ 161 162 /* 163 * BIT 0 = Control Enable 164 * BIT 1-15 = 165 * 166 * BIT 0-7 = Reserved 167 * BIT 8-10 = Output Swing 1G 168 * BIT 11-13 = Output Emphasis 1G 169 * BIT 14-15 = Reserved 170 * 171 * BIT 0-7 = Reserved 172 * BIT 8-10 = Output Swing 2G 173 * BIT 11-13 = Output Emphasis 2G 174 * BIT 14-15 = Reserved 175 * 176 * BIT 0-7 = Reserved 177 * BIT 8-10 = Output Swing 4G 178 * BIT 11-13 = Output Emphasis 4G 179 * BIT 14-15 = Reserved 180 */ 181 __le16 seriallink_options[4]; 182 183 uint16_t reserved_2[16]; 184 185 /* Offset 96. */ 186 uint16_t reserved_3[16]; 187 188 /* PCIe table entries. */ 189 uint16_t reserved_4[16]; 190 191 /* Offset 160. */ 192 uint16_t reserved_5[16]; 193 194 /* Offset 192. */ 195 uint16_t reserved_6[16]; 196 197 /* Offset 224. */ 198 uint16_t reserved_7[16]; 199 200 /* 201 * BIT 0 = Enable spinup delay 202 * BIT 1 = Disable BIOS 203 * BIT 2 = Enable Memory Map BIOS 204 * BIT 3 = Enable Selectable Boot 205 * BIT 4 = Disable RISC code load 206 * BIT 5 = Disable Serdes 207 * BIT 6 = 208 * BIT 7 = 209 * 210 * BIT 8 = 211 * BIT 9 = 212 * BIT 10 = Enable lip full login 213 * BIT 11 = Enable target reset 214 * BIT 12 = 215 * BIT 13 = 216 * BIT 14 = 217 * BIT 15 = Enable alternate WWN 218 * 219 * BIT 16-31 = 220 */ 221 __le32 host_p; 222 223 uint8_t alternate_port_name[WWN_SIZE]; 224 uint8_t alternate_node_name[WWN_SIZE]; 225 226 uint8_t boot_port_name[WWN_SIZE]; 227 __le16 boot_lun_number; 228 uint16_t reserved_8; 229 230 uint8_t alt1_boot_port_name[WWN_SIZE]; 231 __le16 alt1_boot_lun_number; 232 uint16_t reserved_9; 233 234 uint8_t alt2_boot_port_name[WWN_SIZE]; 235 __le16 alt2_boot_lun_number; 236 uint16_t reserved_10; 237 238 uint8_t alt3_boot_port_name[WWN_SIZE]; 239 __le16 alt3_boot_lun_number; 240 uint16_t reserved_11; 241 242 /* 243 * BIT 0 = Selective Login 244 * BIT 1 = Alt-Boot Enable 245 * BIT 2 = Reserved 246 * BIT 3 = Boot Order List 247 * BIT 4 = Reserved 248 * BIT 5 = Selective LUN 249 * BIT 6 = Reserved 250 * BIT 7-31 = 251 */ 252 __le32 efi_parameters; 253 254 uint8_t reset_delay; 255 uint8_t reserved_12; 256 uint16_t reserved_13; 257 258 __le16 boot_id_number; 259 uint16_t reserved_14; 260 261 __le16 max_luns_per_target; 262 uint16_t reserved_15; 263 264 __le16 port_down_retry_count; 265 __le16 link_down_timeout; 266 267 /* FCode parameters. */ 268 __le16 fcode_parameter; 269 270 uint16_t reserved_16[3]; 271 272 /* Offset 352. */ 273 uint8_t prev_drv_ver_major; 274 uint8_t prev_drv_ver_submajob; 275 uint8_t prev_drv_ver_minor; 276 uint8_t prev_drv_ver_subminor; 277 278 __le16 prev_bios_ver_major; 279 __le16 prev_bios_ver_minor; 280 281 __le16 prev_efi_ver_major; 282 __le16 prev_efi_ver_minor; 283 284 __le16 prev_fw_ver_major; 285 uint8_t prev_fw_ver_minor; 286 uint8_t prev_fw_ver_subminor; 287 288 uint16_t reserved_17[8]; 289 290 /* Offset 384. */ 291 uint16_t reserved_18[16]; 292 293 /* Offset 416. */ 294 uint16_t reserved_19[16]; 295 296 /* Offset 448. */ 297 uint16_t reserved_20[16]; 298 299 /* Offset 480. */ 300 uint8_t model_name[16]; 301 302 uint16_t reserved_21[2]; 303 304 /* Offset 500. */ 305 /* HW Parameter Block. */ 306 uint16_t pcie_table_sig; 307 uint16_t pcie_table_offset; 308 309 uint16_t subsystem_vendor_id; 310 uint16_t subsystem_device_id; 311 312 __le32 checksum; 313 }; 314 315 /* 316 * ISP Initialization Control Block. 317 * Little endian except where noted. 318 */ 319 #define ICB_VERSION 1 320 struct init_cb_24xx { 321 __le16 version; 322 uint16_t reserved_1; 323 324 __le16 frame_payload_size; 325 __le16 execution_throttle; 326 __le16 exchange_count; 327 328 __le16 hard_address; 329 330 uint8_t port_name[WWN_SIZE]; /* Big endian. */ 331 uint8_t node_name[WWN_SIZE]; /* Big endian. */ 332 333 __le16 response_q_inpointer; 334 __le16 request_q_outpointer; 335 336 __le16 login_retry_count; 337 338 __le16 prio_request_q_outpointer; 339 340 __le16 response_q_length; 341 __le16 request_q_length; 342 343 __le16 link_down_on_nos; /* Milliseconds. */ 344 345 __le16 prio_request_q_length; 346 347 __le64 request_q_address __packed; 348 __le64 response_q_address __packed; 349 __le64 prio_request_q_address __packed; 350 351 __le16 msix; 352 __le16 msix_atio; 353 uint8_t reserved_2[4]; 354 355 __le16 atio_q_inpointer; 356 __le16 atio_q_length; 357 __le64 atio_q_address __packed; 358 359 __le16 interrupt_delay_timer; /* 100us increments. */ 360 __le16 login_timeout; 361 362 /* 363 * BIT 0 = Enable Hard Loop Id 364 * BIT 1 = Enable Fairness 365 * BIT 2 = Enable Full-Duplex 366 * BIT 3 = Reserved 367 * BIT 4 = Enable Target Mode 368 * BIT 5 = Disable Initiator Mode 369 * BIT 6 = Acquire FA-WWN 370 * BIT 7 = Enable D-port Diagnostics 371 * 372 * BIT 8 = Reserved 373 * BIT 9 = Non Participating LIP 374 * BIT 10 = Descending Loop ID Search 375 * BIT 11 = Acquire Loop ID in LIPA 376 * BIT 12 = Reserved 377 * BIT 13 = Full Login after LIP 378 * BIT 14 = Node Name Option 379 * BIT 15-31 = Reserved 380 */ 381 __le32 firmware_options_1; 382 383 /* 384 * BIT 0 = Operation Mode bit 0 385 * BIT 1 = Operation Mode bit 1 386 * BIT 2 = Operation Mode bit 2 387 * BIT 3 = Operation Mode bit 3 388 * BIT 4 = Connection Options bit 0 389 * BIT 5 = Connection Options bit 1 390 * BIT 6 = Connection Options bit 2 391 * BIT 7 = Enable Non part on LIHA failure 392 * 393 * BIT 8 = Enable Class 2 394 * BIT 9 = Enable ACK0 395 * BIT 10 = Reserved 396 * BIT 11 = Enable FC-SP Security 397 * BIT 12 = FC Tape Enable 398 * BIT 13 = Reserved 399 * BIT 14 = Enable Target PRLI Control 400 * BIT 15-31 = Reserved 401 */ 402 __le32 firmware_options_2; 403 404 /* 405 * BIT 0 = Reserved 406 * BIT 1 = Soft ID only 407 * BIT 2 = Reserved 408 * BIT 3 = Reserved 409 * BIT 4 = FCP RSP Payload bit 0 410 * BIT 5 = FCP RSP Payload bit 1 411 * BIT 6 = Enable Receive Out-of-Order data frame handling 412 * BIT 7 = Disable Automatic PLOGI on Local Loop 413 * 414 * BIT 8 = Reserved 415 * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative offset handling 416 * BIT 10 = Reserved 417 * BIT 11 = Reserved 418 * BIT 12 = Reserved 419 * BIT 13 = Data Rate bit 0 420 * BIT 14 = Data Rate bit 1 421 * BIT 15 = Data Rate bit 2 422 * BIT 16 = Enable 75 ohm Termination Select 423 * BIT 17-28 = Reserved 424 * BIT 29 = Enable response queue 0 in index shadowing 425 * BIT 30 = Enable request queue 0 out index shadowing 426 * BIT 31 = Reserved 427 */ 428 __le32 firmware_options_3; 429 __le16 qos; 430 __le16 rid; 431 uint8_t reserved_3[20]; 432 }; 433 434 /* 435 * ISP queue - command entry structure definition. 436 */ 437 #define COMMAND_BIDIRECTIONAL 0x75 438 struct cmd_bidir { 439 uint8_t entry_type; /* Entry type. */ 440 uint8_t entry_count; /* Entry count. */ 441 uint8_t sys_define; /* System defined */ 442 uint8_t entry_status; /* Entry status. */ 443 444 uint32_t handle; /* System handle. */ 445 446 __le16 nport_handle; /* N_PORT handle. */ 447 448 __le16 timeout; /* Command timeout. */ 449 450 __le16 wr_dseg_count; /* Write Data segment count. */ 451 __le16 rd_dseg_count; /* Read Data segment count. */ 452 453 struct scsi_lun lun; /* FCP LUN (BE). */ 454 455 __le16 control_flags; /* Control flags. */ 456 #define BD_WRAP_BACK BIT_3 457 #define BD_READ_DATA BIT_1 458 #define BD_WRITE_DATA BIT_0 459 460 __le16 fcp_cmnd_dseg_len; /* Data segment length. */ 461 __le64 fcp_cmnd_dseg_address __packed;/* Data segment address. */ 462 463 uint16_t reserved[2]; /* Reserved */ 464 465 __le32 rd_byte_count; /* Total Byte count Read. */ 466 __le32 wr_byte_count; /* Total Byte count write. */ 467 468 uint8_t port_id[3]; /* PortID of destination port.*/ 469 uint8_t vp_index; 470 471 struct dsd64 fcp_dsd; 472 }; 473 474 #define COMMAND_TYPE_6 0x48 /* Command Type 6 entry */ 475 struct cmd_type_6 { 476 uint8_t entry_type; /* Entry type. */ 477 uint8_t entry_count; /* Entry count. */ 478 uint8_t sys_define; /* System defined. */ 479 uint8_t entry_status; /* Entry Status. */ 480 481 uint32_t handle; /* System handle. */ 482 483 __le16 nport_handle; /* N_PORT handle. */ 484 __le16 timeout; /* Command timeout. */ 485 486 __le16 dseg_count; /* Data segment count. */ 487 488 __le16 fcp_rsp_dsd_len; /* FCP_RSP DSD length. */ 489 490 struct scsi_lun lun; /* FCP LUN (BE). */ 491 492 __le16 control_flags; /* Control flags. */ 493 #define CF_NEW_SA BIT_12 494 #define CF_EN_EDIF BIT_9 495 #define CF_ADDITIONAL_PARAM_BLK BIT_8 496 #define CF_DIF_SEG_DESCR_ENABLE BIT_3 497 #define CF_DATA_SEG_DESCR_ENABLE BIT_2 498 #define CF_READ_DATA BIT_1 499 #define CF_WRITE_DATA BIT_0 500 501 __le16 fcp_cmnd_dseg_len; /* Data segment length. */ 502 /* Data segment address. */ 503 __le64 fcp_cmnd_dseg_address __packed; 504 /* Data segment address. */ 505 __le64 fcp_rsp_dseg_address __packed; 506 507 __le32 byte_count; /* Total byte count. */ 508 509 uint8_t port_id[3]; /* PortID of destination port. */ 510 uint8_t vp_index; 511 512 struct dsd64 fcp_dsd; 513 }; 514 515 #define COMMAND_TYPE_7 0x18 /* Command Type 7 entry */ 516 struct cmd_type_7 { 517 uint8_t entry_type; /* Entry type. */ 518 uint8_t entry_count; /* Entry count. */ 519 uint8_t sys_define; /* System defined. */ 520 uint8_t entry_status; /* Entry Status. */ 521 522 uint32_t handle; /* System handle. */ 523 524 __le16 nport_handle; /* N_PORT handle. */ 525 __le16 timeout; /* Command timeout. */ 526 #define FW_MAX_TIMEOUT 0x1999 527 528 __le16 dseg_count; /* Data segment count. */ 529 uint16_t reserved_1; 530 531 struct scsi_lun lun; /* FCP LUN (BE). */ 532 533 __le16 task_mgmt_flags; /* Task management flags. */ 534 #define TMF_CLEAR_ACA BIT_14 535 #define TMF_TARGET_RESET BIT_13 536 #define TMF_LUN_RESET BIT_12 537 #define TMF_CLEAR_TASK_SET BIT_10 538 #define TMF_ABORT_TASK_SET BIT_9 539 #define TMF_DSD_LIST_ENABLE BIT_2 540 #define TMF_READ_DATA BIT_1 541 #define TMF_WRITE_DATA BIT_0 542 543 uint8_t task; 544 #define TSK_SIMPLE 0 545 #define TSK_HEAD_OF_QUEUE 1 546 #define TSK_ORDERED 2 547 #define TSK_ACA 4 548 #define TSK_UNTAGGED 5 549 550 uint8_t crn; 551 552 uint8_t fcp_cdb[MAX_CMDSZ]; /* SCSI command words. */ 553 __le32 byte_count; /* Total byte count. */ 554 555 uint8_t port_id[3]; /* PortID of destination port. */ 556 uint8_t vp_index; 557 558 struct dsd64 dsd; 559 }; 560 561 #define COMMAND_TYPE_CRC_2 0x6A /* Command Type CRC_2 (Type 6) 562 * (T10-DIF) */ 563 struct cmd_type_crc_2 { 564 uint8_t entry_type; /* Entry type. */ 565 uint8_t entry_count; /* Entry count. */ 566 uint8_t sys_define; /* System defined. */ 567 uint8_t entry_status; /* Entry Status. */ 568 569 uint32_t handle; /* System handle. */ 570 571 __le16 nport_handle; /* N_PORT handle. */ 572 __le16 timeout; /* Command timeout. */ 573 574 __le16 dseg_count; /* Data segment count. */ 575 576 __le16 fcp_rsp_dseg_len; /* FCP_RSP DSD length. */ 577 578 struct scsi_lun lun; /* FCP LUN (BE). */ 579 580 __le16 control_flags; /* Control flags. */ 581 582 __le16 fcp_cmnd_dseg_len; /* Data segment length. */ 583 __le64 fcp_cmnd_dseg_address __packed; 584 /* Data segment address. */ 585 __le64 fcp_rsp_dseg_address __packed; 586 587 __le32 byte_count; /* Total byte count. */ 588 589 uint8_t port_id[3]; /* PortID of destination port. */ 590 uint8_t vp_index; 591 592 __le64 crc_context_address __packed; /* Data segment address. */ 593 __le16 crc_context_len; /* Data segment length. */ 594 uint16_t reserved_1; /* MUST be set to 0. */ 595 }; 596 597 598 /* 599 * ISP queue - status entry structure definition. 600 */ 601 #define STATUS_TYPE 0x03 /* Status entry. */ 602 struct sts_entry_24xx { 603 uint8_t entry_type; /* Entry type. */ 604 uint8_t entry_count; /* Entry count. */ 605 uint8_t sys_define; /* System defined. */ 606 uint8_t entry_status; /* Entry Status. */ 607 608 uint32_t handle; /* System handle. */ 609 610 __le16 comp_status; /* Completion status. */ 611 __le16 ox_id; /* OX_ID used by the firmware. */ 612 613 __le32 residual_len; /* FW calc residual transfer length. */ 614 615 union { 616 __le16 reserved_1; 617 __le16 nvme_rsp_pyld_len; 618 __le16 edif_sa_index; /* edif sa_index used for initiator read data */ 619 }; 620 621 __le16 state_flags; /* State flags. */ 622 #define SF_TRANSFERRED_DATA BIT_11 623 #define SF_NVME_ERSP BIT_6 624 #define SF_FCP_RSP_DMA BIT_0 625 626 __le16 status_qualifier; 627 __le16 scsi_status; /* SCSI status. */ 628 #define SS_CONFIRMATION_REQ BIT_12 629 630 __le32 rsp_residual_count; /* FCP RSP residual count. */ 631 632 __le32 sense_len; /* FCP SENSE length. */ 633 634 union { 635 struct { 636 __le32 rsp_data_len; /* FCP response data length */ 637 uint8_t data[28]; /* FCP rsp/sense information */ 638 }; 639 struct nvme_fc_ersp_iu nvme_ersp; 640 uint8_t nvme_ersp_data[32]; 641 }; 642 643 /* 644 * If DIF Error is set in comp_status, these additional fields are 645 * defined: 646 * 647 * !!! NOTE: Firmware sends expected/actual DIF data in big endian 648 * format; but all of the "data" field gets swab32-d in the beginning 649 * of qla2x00_status_entry(). 650 * 651 * &data[10] : uint8_t report_runt_bg[2]; - computed guard 652 * &data[12] : uint8_t actual_dif[8]; - DIF Data received 653 * &data[20] : uint8_t expected_dif[8]; - DIF Data computed 654 */ 655 }; 656 657 658 /* 659 * Status entry completion status 660 */ 661 #define CS_DATA_REASSEMBLY_ERROR 0x11 /* Data Reassembly Error.. */ 662 #define CS_ABTS_BY_TARGET 0x13 /* Target send ABTS to abort IOCB. */ 663 #define CS_FW_RESOURCE 0x2C /* Firmware Resource Unavailable. */ 664 #define CS_TASK_MGMT_OVERRUN 0x30 /* Task management overrun (8+). */ 665 #define CS_ABORT_BY_TARGET 0x47 /* Abort By Target. */ 666 667 /* 668 * ISP queue - marker entry structure definition. 669 */ 670 #define MARKER_TYPE 0x04 /* Marker entry. */ 671 struct mrk_entry_24xx { 672 uint8_t entry_type; /* Entry type. */ 673 uint8_t entry_count; /* Entry count. */ 674 uint8_t handle_count; /* Handle count. */ 675 uint8_t entry_status; /* Entry Status. */ 676 677 uint32_t handle; /* System handle. */ 678 679 __le16 nport_handle; /* N_PORT handle. */ 680 681 uint8_t modifier; /* Modifier (7-0). */ 682 #define MK_SYNC_ID_LUN 0 /* Synchronize ID/LUN */ 683 #define MK_SYNC_ID 1 /* Synchronize ID */ 684 #define MK_SYNC_ALL 2 /* Synchronize all ID/LUN */ 685 uint8_t reserved_1; 686 687 uint8_t reserved_2; 688 uint8_t vp_index; 689 690 uint16_t reserved_3; 691 692 uint8_t lun[8]; /* FCP LUN (BE). */ 693 uint8_t reserved_4[40]; 694 }; 695 696 /* 697 * ISP queue - CT Pass-Through entry structure definition. 698 */ 699 #define CT_IOCB_TYPE 0x29 /* CT Pass-Through IOCB entry */ 700 struct ct_entry_24xx { 701 uint8_t entry_type; /* Entry type. */ 702 uint8_t entry_count; /* Entry count. */ 703 uint8_t sys_define; /* System Defined. */ 704 uint8_t entry_status; /* Entry Status. */ 705 706 uint32_t handle; /* System handle. */ 707 708 __le16 comp_status; /* Completion status. */ 709 710 __le16 nport_handle; /* N_PORT handle. */ 711 712 __le16 cmd_dsd_count; 713 714 uint8_t vp_index; 715 uint8_t reserved_1; 716 717 __le16 timeout; /* Command timeout. */ 718 uint16_t reserved_2; 719 720 __le16 rsp_dsd_count; 721 722 uint8_t reserved_3[10]; 723 724 __le32 rsp_byte_count; 725 __le32 cmd_byte_count; 726 727 struct dsd64 dsd[2]; 728 }; 729 730 #define PURX_ELS_HEADER_SIZE 0x18 731 732 /* 733 * ISP queue - PUREX IOCB entry structure definition 734 */ 735 #define PUREX_IOCB_TYPE 0x51 /* CT Pass Through IOCB entry */ 736 struct purex_entry_24xx { 737 uint8_t entry_type; /* Entry type. */ 738 uint8_t entry_count; /* Entry count. */ 739 uint8_t sys_define; /* System defined. */ 740 uint8_t entry_status; /* Entry Status. */ 741 742 __le16 reserved1; 743 uint8_t vp_idx; 744 uint8_t reserved2; 745 746 __le16 status_flags; 747 __le16 nport_handle; 748 749 __le16 frame_size; 750 __le16 trunc_frame_size; 751 752 __le32 rx_xchg_addr; 753 754 uint8_t d_id[3]; 755 uint8_t r_ctl; 756 757 uint8_t s_id[3]; 758 uint8_t cs_ctl; 759 760 uint8_t f_ctl[3]; 761 uint8_t type; 762 763 __le16 seq_cnt; 764 uint8_t df_ctl; 765 uint8_t seq_id; 766 767 __le16 rx_id; 768 __le16 ox_id; 769 __le32 param; 770 771 uint8_t els_frame_payload[20]; 772 }; 773 774 /* 775 * ISP queue - ELS Pass-Through entry structure definition. 776 */ 777 #define ELS_IOCB_TYPE 0x53 /* ELS Pass-Through IOCB entry */ 778 struct els_entry_24xx { 779 uint8_t entry_type; /* Entry type. */ 780 uint8_t entry_count; /* Entry count. */ 781 uint8_t sys_define; /* System Defined. */ 782 uint8_t entry_status; /* Entry Status. */ 783 784 uint32_t handle; /* System handle. */ 785 786 __le16 comp_status; /* response only */ 787 __le16 nport_handle; 788 789 __le16 tx_dsd_count; 790 791 uint8_t vp_index; 792 uint8_t sof_type; 793 #define EST_SOFI3 (1 << 4) 794 #define EST_SOFI2 (3 << 4) 795 796 __le32 rx_xchg_address; /* Receive exchange address. */ 797 __le16 rx_dsd_count; 798 799 uint8_t opcode; 800 uint8_t reserved_2; 801 802 uint8_t d_id[3]; 803 uint8_t s_id[3]; 804 805 __le16 control_flags; /* Control flags. */ 806 #define ECF_PAYLOAD_DESCR_MASK (BIT_15|BIT_14|BIT_13) 807 #define EPD_ELS_COMMAND (0 << 13) 808 #define EPD_ELS_ACC (1 << 13) 809 #define EPD_ELS_RJT (2 << 13) 810 #define EPD_RX_XCHG (3 << 13) 811 #define ECF_CLR_PASSTHRU_PEND BIT_12 812 #define ECF_INCL_FRAME_HDR BIT_11 813 814 union { 815 struct { 816 __le32 rx_byte_count; 817 __le32 tx_byte_count; 818 819 __le64 tx_address __packed; /* DSD 0 address. */ 820 __le32 tx_len; /* DSD 0 length. */ 821 822 __le64 rx_address __packed; /* DSD 1 address. */ 823 __le32 rx_len; /* DSD 1 length. */ 824 }; 825 struct { 826 __le32 total_byte_count; 827 __le32 error_subcode_1; 828 __le32 error_subcode_2; 829 __le32 error_subcode_3; 830 }; 831 }; 832 }; 833 834 struct els_sts_entry_24xx { 835 uint8_t entry_type; /* Entry type. */ 836 uint8_t entry_count; /* Entry count. */ 837 uint8_t sys_define; /* System Defined. */ 838 uint8_t entry_status; /* Entry Status. */ 839 840 __le32 handle; /* System handle. */ 841 842 __le16 comp_status; 843 844 __le16 nport_handle; /* N_PORT handle. */ 845 846 __le16 reserved_1; 847 848 uint8_t vp_index; 849 uint8_t sof_type; 850 851 __le32 rx_xchg_address; /* Receive exchange address. */ 852 __le16 reserved_2; 853 854 uint8_t opcode; 855 uint8_t reserved_3; 856 857 uint8_t d_id[3]; 858 uint8_t s_id[3]; 859 860 __le16 control_flags; /* Control flags. */ 861 __le32 total_byte_count; 862 __le32 error_subcode_1; 863 __le32 error_subcode_2; 864 __le32 error_subcode_3; 865 866 __le32 reserved_4[4]; 867 }; 868 /* 869 * ISP queue - Mailbox Command entry structure definition. 870 */ 871 #define MBX_IOCB_TYPE 0x39 872 struct mbx_entry_24xx { 873 uint8_t entry_type; /* Entry type. */ 874 uint8_t entry_count; /* Entry count. */ 875 uint8_t handle_count; /* Handle count. */ 876 uint8_t entry_status; /* Entry Status. */ 877 878 uint32_t handle; /* System handle. */ 879 880 uint16_t mbx[28]; 881 }; 882 883 884 #define LOGINOUT_PORT_IOCB_TYPE 0x52 /* Login/Logout Port entry. */ 885 struct logio_entry_24xx { 886 uint8_t entry_type; /* Entry type. */ 887 uint8_t entry_count; /* Entry count. */ 888 uint8_t sys_define; /* System defined. */ 889 uint8_t entry_status; /* Entry Status. */ 890 891 uint32_t handle; /* System handle. */ 892 893 __le16 comp_status; /* Completion status. */ 894 #define CS_LOGIO_ERROR 0x31 /* Login/Logout IOCB error. */ 895 896 __le16 nport_handle; /* N_PORT handle. */ 897 898 __le16 control_flags; /* Control flags. */ 899 /* Modifiers. */ 900 #define LCF_INCLUDE_SNS BIT_10 /* Include SNS (FFFFFC) during LOGO. */ 901 #define LCF_FCP2_OVERRIDE BIT_9 /* Set/Reset word 3 of PRLI. */ 902 #define LCF_CLASS_2 BIT_8 /* Enable class 2 during PLOGI. */ 903 #define LCF_FREE_NPORT BIT_7 /* Release NPORT handle after LOGO. */ 904 #define LCF_COMMON_FEAT BIT_7 /* PLOGI - Set Common Features Field */ 905 #define LCF_EXPL_LOGO BIT_6 /* Perform an explicit LOGO. */ 906 #define LCF_NVME_PRLI BIT_6 /* Perform NVME FC4 PRLI */ 907 #define LCF_SKIP_PRLI BIT_5 /* Skip PRLI after PLOGI. */ 908 #define LCF_IMPL_LOGO_ALL BIT_5 /* Implicit LOGO to all ports. */ 909 #define LCF_COND_PLOGI BIT_4 /* PLOGI only if not logged-in. */ 910 #define LCF_IMPL_LOGO BIT_4 /* Perform an implicit LOGO. */ 911 #define LCF_IMPL_PRLO BIT_4 /* Perform an implicit PRLO. */ 912 /* Commands. */ 913 #define LCF_COMMAND_PLOGI 0x00 /* PLOGI. */ 914 #define LCF_COMMAND_PRLI 0x01 /* PRLI. */ 915 #define LCF_COMMAND_PDISC 0x02 /* PDISC. */ 916 #define LCF_COMMAND_ADISC 0x03 /* ADISC. */ 917 #define LCF_COMMAND_LOGO 0x08 /* LOGO. */ 918 #define LCF_COMMAND_PRLO 0x09 /* PRLO. */ 919 #define LCF_COMMAND_TPRLO 0x0A /* TPRLO. */ 920 921 uint8_t vp_index; 922 uint8_t reserved_1; 923 924 uint8_t port_id[3]; /* PortID of destination port. */ 925 926 uint8_t rsp_size; /* Response size in 32bit words. */ 927 928 __le32 io_parameter[11]; /* General I/O parameters. */ 929 #define LIO_COMM_FEAT_FCSP BIT_21 930 #define LIO_COMM_FEAT_CIO BIT_31 931 #define LSC_SCODE_NOLINK 0x01 932 #define LSC_SCODE_NOIOCB 0x02 933 #define LSC_SCODE_NOXCB 0x03 934 #define LSC_SCODE_CMD_FAILED 0x04 935 #define LSC_SCODE_NOFABRIC 0x05 936 #define LSC_SCODE_FW_NOT_READY 0x07 937 #define LSC_SCODE_NOT_LOGGED_IN 0x09 938 #define LSC_SCODE_NOPCB 0x0A 939 940 #define LSC_SCODE_ELS_REJECT 0x18 941 #define LSC_SCODE_CMD_PARAM_ERR 0x19 942 #define LSC_SCODE_PORTID_USED 0x1A 943 #define LSC_SCODE_NPORT_USED 0x1B 944 #define LSC_SCODE_NONPORT 0x1C 945 #define LSC_SCODE_LOGGED_IN 0x1D 946 #define LSC_SCODE_NOFLOGI_ACC 0x1F 947 }; 948 949 #define TSK_MGMT_IOCB_TYPE 0x14 950 struct tsk_mgmt_entry { 951 uint8_t entry_type; /* Entry type. */ 952 uint8_t entry_count; /* Entry count. */ 953 uint8_t handle_count; /* Handle count. */ 954 uint8_t entry_status; /* Entry Status. */ 955 956 uint32_t handle; /* System handle. */ 957 958 __le16 nport_handle; /* N_PORT handle. */ 959 960 uint16_t reserved_1; 961 962 __le16 delay; /* Activity delay in seconds. */ 963 964 __le16 timeout; /* Command timeout. */ 965 966 struct scsi_lun lun; /* FCP LUN (BE). */ 967 968 __le32 control_flags; /* Control Flags. */ 969 #define TCF_NOTMCMD_TO_TARGET BIT_31 970 #define TCF_LUN_RESET BIT_4 971 #define TCF_ABORT_TASK_SET BIT_3 972 #define TCF_CLEAR_TASK_SET BIT_2 973 #define TCF_TARGET_RESET BIT_1 974 #define TCF_CLEAR_ACA BIT_0 975 976 uint8_t reserved_2[20]; 977 978 uint8_t port_id[3]; /* PortID of destination port. */ 979 uint8_t vp_index; 980 981 uint8_t reserved_3[12]; 982 }; 983 984 #define ABORT_IOCB_TYPE 0x33 985 struct abort_entry_24xx { 986 uint8_t entry_type; /* Entry type. */ 987 uint8_t entry_count; /* Entry count. */ 988 uint8_t handle_count; /* Handle count. */ 989 uint8_t entry_status; /* Entry Status. */ 990 991 uint32_t handle; /* System handle. */ 992 993 union { 994 __le16 nport_handle; /* N_PORT handle. */ 995 __le16 comp_status; /* Completion status. */ 996 }; 997 998 __le16 options; /* Options. */ 999 #define AOF_NO_ABTS BIT_0 /* Do not send any ABTS. */ 1000 #define AOF_NO_RRQ BIT_1 /* Do not send RRQ. */ 1001 #define AOF_ABTS_TIMEOUT BIT_2 /* Disable logout on ABTS timeout. */ 1002 #define AOF_ABTS_RTY_CNT BIT_3 /* Use driver specified retry count. */ 1003 #define AOF_RSP_TIMEOUT BIT_4 /* Use specified response timeout. */ 1004 1005 1006 uint32_t handle_to_abort; /* System handle to abort. */ 1007 1008 __le16 req_que_no; 1009 uint8_t reserved_1[30]; 1010 1011 uint8_t port_id[3]; /* PortID of destination port. */ 1012 uint8_t vp_index; 1013 u8 reserved_2[4]; 1014 union { 1015 struct { 1016 __le16 abts_rty_cnt; 1017 __le16 rsp_timeout; 1018 } drv; 1019 struct { 1020 u8 ba_rjt_vendorUnique; 1021 u8 ba_rjt_reasonCodeExpl; 1022 u8 ba_rjt_reasonCode; 1023 u8 reserved_3; 1024 } fw; 1025 }; 1026 u8 reserved_4[4]; 1027 }; 1028 1029 #define ABTS_RCV_TYPE 0x54 1030 #define ABTS_RSP_TYPE 0x55 1031 struct abts_entry_24xx { 1032 uint8_t entry_type; 1033 uint8_t entry_count; 1034 uint8_t handle_count; 1035 uint8_t entry_status; 1036 1037 __le32 handle; /* type 0x55 only */ 1038 1039 __le16 comp_status; /* type 0x55 only */ 1040 __le16 nport_handle; /* type 0x54 only */ 1041 1042 __le16 control_flags; /* type 0x55 only */ 1043 uint8_t vp_idx; 1044 uint8_t sof_type; /* sof_type is upper nibble */ 1045 1046 __le32 rx_xch_addr; 1047 1048 uint8_t d_id[3]; 1049 uint8_t r_ctl; 1050 1051 uint8_t s_id[3]; 1052 uint8_t cs_ctl; 1053 1054 uint8_t f_ctl[3]; 1055 uint8_t type; 1056 1057 __le16 seq_cnt; 1058 uint8_t df_ctl; 1059 uint8_t seq_id; 1060 1061 __le16 rx_id; 1062 __le16 ox_id; 1063 1064 __le32 param; 1065 1066 union { 1067 struct { 1068 __le32 subcode3; 1069 __le32 rsvd; 1070 __le32 subcode1; 1071 __le32 subcode2; 1072 } error; 1073 struct { 1074 __le16 rsrvd1; 1075 uint8_t last_seq_id; 1076 uint8_t seq_id_valid; 1077 __le16 aborted_rx_id; 1078 __le16 aborted_ox_id; 1079 __le16 high_seq_cnt; 1080 __le16 low_seq_cnt; 1081 } ba_acc; 1082 struct { 1083 uint8_t vendor_unique; 1084 uint8_t explanation; 1085 uint8_t reason; 1086 } ba_rjt; 1087 } payload; 1088 1089 __le32 rx_xch_addr_to_abort; 1090 } __packed; 1091 1092 /* ABTS payload explanation values */ 1093 #define BA_RJT_EXP_NO_ADDITIONAL 0 1094 #define BA_RJT_EXP_INV_OX_RX_ID 3 1095 #define BA_RJT_EXP_SEQ_ABORTED 5 1096 1097 /* ABTS payload reason values */ 1098 #define BA_RJT_RSN_INV_CMD_CODE 1 1099 #define BA_RJT_RSN_LOGICAL_ERROR 3 1100 #define BA_RJT_RSN_LOGICAL_BUSY 5 1101 #define BA_RJT_RSN_PROTOCOL_ERROR 7 1102 #define BA_RJT_RSN_UNABLE_TO_PERFORM 9 1103 #define BA_RJT_RSN_VENDOR_SPECIFIC 0xff 1104 1105 /* FC_F values */ 1106 #define FC_TYPE_BLD 0x000 /* Basic link data */ 1107 #define FC_F_CTL_RSP_CNTXT 0x800000 /* Responder of exchange */ 1108 #define FC_F_CTL_LAST_SEQ 0x100000 /* Last sequence */ 1109 #define FC_F_CTL_END_SEQ 0x80000 /* Last sequence */ 1110 #define FC_F_CTL_SEQ_INIT 0x010000 /* Sequence initiative */ 1111 #define FC_ROUTING_BLD 0x80 /* Basic link data frame */ 1112 #define FC_R_CTL_BLD_BA_ACC 0x04 /* BA_ACC (basic accept) */ 1113 1114 /* 1115 * ISP I/O Register Set structure definitions. 1116 */ 1117 struct device_reg_24xx { 1118 __le32 flash_addr; /* Flash/NVRAM BIOS address. */ 1119 #define FARX_DATA_FLAG BIT_31 1120 #define FARX_ACCESS_FLASH_CONF 0x7FFD0000 1121 #define FARX_ACCESS_FLASH_DATA 0x7FF00000 1122 #define FARX_ACCESS_NVRAM_CONF 0x7FFF0000 1123 #define FARX_ACCESS_NVRAM_DATA 0x7FFE0000 1124 1125 #define FA_NVRAM_FUNC0_ADDR 0x80 1126 #define FA_NVRAM_FUNC1_ADDR 0x180 1127 1128 #define FA_NVRAM_VPD_SIZE 0x200 1129 #define FA_NVRAM_VPD0_ADDR 0x00 1130 #define FA_NVRAM_VPD1_ADDR 0x100 1131 1132 #define FA_BOOT_CODE_ADDR 0x00000 1133 /* 1134 * RISC code begins at offset 512KB 1135 * within flash. Consisting of two 1136 * contiguous RISC code segments. 1137 */ 1138 #define FA_RISC_CODE_ADDR 0x20000 1139 #define FA_RISC_CODE_SEGMENTS 2 1140 1141 #define FA_FLASH_DESCR_ADDR_24 0x11000 1142 #define FA_FLASH_LAYOUT_ADDR_24 0x11400 1143 #define FA_NPIV_CONF0_ADDR_24 0x16000 1144 #define FA_NPIV_CONF1_ADDR_24 0x17000 1145 1146 #define FA_FW_AREA_ADDR 0x40000 1147 #define FA_VPD_NVRAM_ADDR 0x48000 1148 #define FA_FEATURE_ADDR 0x4C000 1149 #define FA_FLASH_DESCR_ADDR 0x50000 1150 #define FA_FLASH_LAYOUT_ADDR 0x50400 1151 #define FA_HW_EVENT0_ADDR 0x54000 1152 #define FA_HW_EVENT1_ADDR 0x54400 1153 #define FA_HW_EVENT_SIZE 0x200 1154 #define FA_HW_EVENT_ENTRY_SIZE 4 1155 #define FA_NPIV_CONF0_ADDR 0x5C000 1156 #define FA_NPIV_CONF1_ADDR 0x5D000 1157 #define FA_FCP_PRIO0_ADDR 0x10000 1158 #define FA_FCP_PRIO1_ADDR 0x12000 1159 1160 /* 1161 * Flash Error Log Event Codes. 1162 */ 1163 #define HW_EVENT_RESET_ERR 0xF00B 1164 #define HW_EVENT_ISP_ERR 0xF020 1165 #define HW_EVENT_PARITY_ERR 0xF022 1166 #define HW_EVENT_NVRAM_CHKSUM_ERR 0xF023 1167 #define HW_EVENT_FLASH_FW_ERR 0xF024 1168 1169 __le32 flash_data; /* Flash/NVRAM BIOS data. */ 1170 1171 __le32 ctrl_status; /* Control/Status. */ 1172 #define CSRX_FLASH_ACCESS_ERROR BIT_18 /* Flash/NVRAM Access Error. */ 1173 #define CSRX_DMA_ACTIVE BIT_17 /* DMA Active status. */ 1174 #define CSRX_DMA_SHUTDOWN BIT_16 /* DMA Shutdown control status. */ 1175 #define CSRX_FUNCTION BIT_15 /* Function number. */ 1176 /* PCI-X Bus Mode. */ 1177 #define CSRX_PCIX_BUS_MODE_MASK (BIT_11|BIT_10|BIT_9|BIT_8) 1178 #define PBM_PCI_33MHZ (0 << 8) 1179 #define PBM_PCIX_M1_66MHZ (1 << 8) 1180 #define PBM_PCIX_M1_100MHZ (2 << 8) 1181 #define PBM_PCIX_M1_133MHZ (3 << 8) 1182 #define PBM_PCIX_M2_66MHZ (5 << 8) 1183 #define PBM_PCIX_M2_100MHZ (6 << 8) 1184 #define PBM_PCIX_M2_133MHZ (7 << 8) 1185 #define PBM_PCI_66MHZ (8 << 8) 1186 /* Max Write Burst byte count. */ 1187 #define CSRX_MAX_WRT_BURST_MASK (BIT_5|BIT_4) 1188 #define MWB_512_BYTES (0 << 4) 1189 #define MWB_1024_BYTES (1 << 4) 1190 #define MWB_2048_BYTES (2 << 4) 1191 #define MWB_4096_BYTES (3 << 4) 1192 1193 #define CSRX_64BIT_SLOT BIT_2 /* PCI 64-Bit Bus Slot. */ 1194 #define CSRX_FLASH_ENABLE BIT_1 /* Flash BIOS Read/Write enable. */ 1195 #define CSRX_ISP_SOFT_RESET BIT_0 /* ISP soft reset. */ 1196 1197 __le32 ictrl; /* Interrupt control. */ 1198 #define ICRX_EN_RISC_INT BIT_3 /* Enable RISC interrupts on PCI. */ 1199 1200 __le32 istatus; /* Interrupt status. */ 1201 #define ISRX_RISC_INT BIT_3 /* RISC interrupt. */ 1202 1203 __le32 unused_1[2]; /* Gap. */ 1204 1205 /* Request Queue. */ 1206 __le32 req_q_in; /* In-Pointer. */ 1207 __le32 req_q_out; /* Out-Pointer. */ 1208 /* Response Queue. */ 1209 __le32 rsp_q_in; /* In-Pointer. */ 1210 __le32 rsp_q_out; /* Out-Pointer. */ 1211 /* Priority Request Queue. */ 1212 __le32 preq_q_in; /* In-Pointer. */ 1213 __le32 preq_q_out; /* Out-Pointer. */ 1214 1215 __le32 unused_2[2]; /* Gap. */ 1216 1217 /* ATIO Queue. */ 1218 __le32 atio_q_in; /* In-Pointer. */ 1219 __le32 atio_q_out; /* Out-Pointer. */ 1220 1221 __le32 host_status; 1222 #define HSRX_RISC_INT BIT_15 /* RISC to Host interrupt. */ 1223 #define HSRX_RISC_PAUSED BIT_8 /* RISC Paused. */ 1224 1225 __le32 hccr; /* Host command & control register. */ 1226 /* HCCR statuses. */ 1227 #define HCCRX_HOST_INT BIT_6 /* Host to RISC interrupt bit. */ 1228 #define HCCRX_RISC_RESET BIT_5 /* RISC Reset mode bit. */ 1229 /* HCCR commands. */ 1230 /* NOOP. */ 1231 #define HCCRX_NOOP 0x00000000 1232 /* Set RISC Reset. */ 1233 #define HCCRX_SET_RISC_RESET 0x10000000 1234 /* Clear RISC Reset. */ 1235 #define HCCRX_CLR_RISC_RESET 0x20000000 1236 /* Set RISC Pause. */ 1237 #define HCCRX_SET_RISC_PAUSE 0x30000000 1238 /* Releases RISC Pause. */ 1239 #define HCCRX_REL_RISC_PAUSE 0x40000000 1240 /* Set HOST to RISC interrupt. */ 1241 #define HCCRX_SET_HOST_INT 0x50000000 1242 /* Clear HOST to RISC interrupt. */ 1243 #define HCCRX_CLR_HOST_INT 0x60000000 1244 /* Clear RISC to PCI interrupt. */ 1245 #define HCCRX_CLR_RISC_INT 0xA0000000 1246 1247 __le32 gpiod; /* GPIO Data register. */ 1248 1249 /* LED update mask. */ 1250 #define GPDX_LED_UPDATE_MASK (BIT_20|BIT_19|BIT_18) 1251 /* Data update mask. */ 1252 #define GPDX_DATA_UPDATE_MASK (BIT_17|BIT_16) 1253 /* Data update mask. */ 1254 #define GPDX_DATA_UPDATE_2_MASK (BIT_28|BIT_27|BIT_26|BIT_17|BIT_16) 1255 /* LED control mask. */ 1256 #define GPDX_LED_COLOR_MASK (BIT_4|BIT_3|BIT_2) 1257 /* LED bit values. Color names as 1258 * referenced in fw spec. 1259 */ 1260 #define GPDX_LED_YELLOW_ON BIT_2 1261 #define GPDX_LED_GREEN_ON BIT_3 1262 #define GPDX_LED_AMBER_ON BIT_4 1263 /* Data in/out. */ 1264 #define GPDX_DATA_INOUT (BIT_1|BIT_0) 1265 1266 __le32 gpioe; /* GPIO Enable register. */ 1267 /* Enable update mask. */ 1268 #define GPEX_ENABLE_UPDATE_MASK (BIT_17|BIT_16) 1269 /* Enable update mask. */ 1270 #define GPEX_ENABLE_UPDATE_2_MASK (BIT_28|BIT_27|BIT_26|BIT_17|BIT_16) 1271 /* Enable. */ 1272 #define GPEX_ENABLE (BIT_1|BIT_0) 1273 1274 __le32 iobase_addr; /* I/O Bus Base Address register. */ 1275 1276 __le32 unused_3[10]; /* Gap. */ 1277 1278 __le16 mailbox0; 1279 __le16 mailbox1; 1280 __le16 mailbox2; 1281 __le16 mailbox3; 1282 __le16 mailbox4; 1283 __le16 mailbox5; 1284 __le16 mailbox6; 1285 __le16 mailbox7; 1286 __le16 mailbox8; 1287 __le16 mailbox9; 1288 __le16 mailbox10; 1289 __le16 mailbox11; 1290 __le16 mailbox12; 1291 __le16 mailbox13; 1292 __le16 mailbox14; 1293 __le16 mailbox15; 1294 __le16 mailbox16; 1295 __le16 mailbox17; 1296 __le16 mailbox18; 1297 __le16 mailbox19; 1298 __le16 mailbox20; 1299 __le16 mailbox21; 1300 __le16 mailbox22; 1301 __le16 mailbox23; 1302 __le16 mailbox24; 1303 __le16 mailbox25; 1304 __le16 mailbox26; 1305 __le16 mailbox27; 1306 __le16 mailbox28; 1307 __le16 mailbox29; 1308 __le16 mailbox30; 1309 __le16 mailbox31; 1310 1311 __le32 iobase_window; 1312 __le32 iobase_c4; 1313 __le32 iobase_c8; 1314 __le32 unused_4_1[6]; /* Gap. */ 1315 __le32 iobase_q; 1316 __le32 unused_5[2]; /* Gap. */ 1317 __le32 iobase_select; 1318 __le32 unused_6[2]; /* Gap. */ 1319 __le32 iobase_sdata; 1320 }; 1321 /* RISC-RISC semaphore register PCI offet */ 1322 #define RISC_REGISTER_BASE_OFFSET 0x7010 1323 #define RISC_REGISTER_WINDOW_OFFSET 0x6 1324 1325 /* RISC-RISC semaphore/flag register (risc address 0x7016) */ 1326 1327 #define RISC_SEMAPHORE 0x1UL 1328 #define RISC_SEMAPHORE_WE (RISC_SEMAPHORE << 16) 1329 #define RISC_SEMAPHORE_CLR (RISC_SEMAPHORE_WE | 0x0UL) 1330 #define RISC_SEMAPHORE_SET (RISC_SEMAPHORE_WE | RISC_SEMAPHORE) 1331 1332 #define RISC_SEMAPHORE_FORCE 0x8000UL 1333 #define RISC_SEMAPHORE_FORCE_WE (RISC_SEMAPHORE_FORCE << 16) 1334 #define RISC_SEMAPHORE_FORCE_CLR (RISC_SEMAPHORE_FORCE_WE | 0x0UL) 1335 #define RISC_SEMAPHORE_FORCE_SET \ 1336 (RISC_SEMAPHORE_FORCE_WE | RISC_SEMAPHORE_FORCE) 1337 1338 /* RISC semaphore timeouts (ms) */ 1339 #define TIMEOUT_SEMAPHORE 2500 1340 #define TIMEOUT_SEMAPHORE_FORCE 2000 1341 #define TIMEOUT_TOTAL_ELAPSED 4500 1342 1343 /* Trace Control *************************************************************/ 1344 1345 #define TC_AEN_DISABLE 0 1346 1347 #define TC_EFT_ENABLE 4 1348 #define TC_EFT_DISABLE 5 1349 1350 #define TC_FCE_ENABLE 8 1351 #define TC_FCE_OPTIONS 0 1352 #define TC_FCE_DEFAULT_RX_SIZE 2112 1353 #define TC_FCE_DEFAULT_TX_SIZE 2112 1354 #define TC_FCE_DISABLE 9 1355 #define TC_FCE_DISABLE_TRACE BIT_0 1356 1357 /* MID Support ***************************************************************/ 1358 1359 #define MIN_MULTI_ID_FABRIC 64 /* Must be power-of-2. */ 1360 #define MAX_MULTI_ID_FABRIC 256 /* ... */ 1361 1362 struct mid_conf_entry_24xx { 1363 uint16_t reserved_1; 1364 1365 /* 1366 * BIT 0 = Enable Hard Loop Id 1367 * BIT 1 = Acquire Loop ID in LIPA 1368 * BIT 2 = ID not Acquired 1369 * BIT 3 = Enable VP 1370 * BIT 4 = Enable Initiator Mode 1371 * BIT 5 = Disable Target Mode 1372 * BIT 6-7 = Reserved 1373 */ 1374 uint8_t options; 1375 1376 uint8_t hard_address; 1377 1378 uint8_t port_name[WWN_SIZE]; 1379 uint8_t node_name[WWN_SIZE]; 1380 }; 1381 1382 struct mid_init_cb_24xx { 1383 struct init_cb_24xx init_cb; 1384 1385 __le16 count; 1386 __le16 options; 1387 1388 struct mid_conf_entry_24xx entries[MAX_MULTI_ID_FABRIC]; 1389 }; 1390 1391 1392 struct mid_db_entry_24xx { 1393 uint16_t status; 1394 #define MDBS_NON_PARTIC BIT_3 1395 #define MDBS_ID_ACQUIRED BIT_1 1396 #define MDBS_ENABLED BIT_0 1397 1398 uint8_t options; 1399 uint8_t hard_address; 1400 1401 uint8_t port_name[WWN_SIZE]; 1402 uint8_t node_name[WWN_SIZE]; 1403 1404 uint8_t port_id[3]; 1405 uint8_t reserved_1; 1406 }; 1407 1408 /* 1409 * Virtual Port Control IOCB 1410 */ 1411 #define VP_CTRL_IOCB_TYPE 0x30 /* Virtual Port Control entry. */ 1412 struct vp_ctrl_entry_24xx { 1413 uint8_t entry_type; /* Entry type. */ 1414 uint8_t entry_count; /* Entry count. */ 1415 uint8_t sys_define; /* System defined. */ 1416 uint8_t entry_status; /* Entry Status. */ 1417 1418 uint32_t handle; /* System handle. */ 1419 1420 __le16 vp_idx_failed; 1421 1422 __le16 comp_status; /* Completion status. */ 1423 #define CS_VCE_IOCB_ERROR 0x01 /* Error processing IOCB */ 1424 #define CS_VCE_ACQ_ID_ERROR 0x02 /* Error while acquireing ID. */ 1425 #define CS_VCE_BUSY 0x05 /* Firmware not ready to accept cmd. */ 1426 1427 __le16 command; 1428 #define VCE_COMMAND_ENABLE_VPS 0x00 /* Enable VPs. */ 1429 #define VCE_COMMAND_DISABLE_VPS 0x08 /* Disable VPs. */ 1430 #define VCE_COMMAND_DISABLE_VPS_REINIT 0x09 /* Disable VPs and reinit link. */ 1431 #define VCE_COMMAND_DISABLE_VPS_LOGO 0x0a /* Disable VPs and LOGO ports. */ 1432 #define VCE_COMMAND_DISABLE_VPS_LOGO_ALL 0x0b /* Disable VPs and LOGO ports. */ 1433 1434 __le16 vp_count; 1435 1436 uint8_t vp_idx_map[16]; 1437 __le16 flags; 1438 __le16 id; 1439 uint16_t reserved_4; 1440 __le16 hopct; 1441 uint8_t reserved_5[24]; 1442 }; 1443 1444 /* 1445 * Modify Virtual Port Configuration IOCB 1446 */ 1447 #define VP_CONFIG_IOCB_TYPE 0x31 /* Virtual Port Config entry. */ 1448 struct vp_config_entry_24xx { 1449 uint8_t entry_type; /* Entry type. */ 1450 uint8_t entry_count; /* Entry count. */ 1451 uint8_t handle_count; 1452 uint8_t entry_status; /* Entry Status. */ 1453 1454 uint32_t handle; /* System handle. */ 1455 1456 __le16 flags; 1457 #define CS_VF_BIND_VPORTS_TO_VF BIT_0 1458 #define CS_VF_SET_QOS_OF_VPORTS BIT_1 1459 #define CS_VF_SET_HOPS_OF_VPORTS BIT_2 1460 1461 __le16 comp_status; /* Completion status. */ 1462 #define CS_VCT_STS_ERROR 0x01 /* Specified VPs were not disabled. */ 1463 #define CS_VCT_CNT_ERROR 0x02 /* Invalid VP count. */ 1464 #define CS_VCT_ERROR 0x03 /* Unknown error. */ 1465 #define CS_VCT_IDX_ERROR 0x02 /* Invalid VP index. */ 1466 #define CS_VCT_BUSY 0x05 /* Firmware not ready to accept cmd. */ 1467 1468 uint8_t command; 1469 #define VCT_COMMAND_MOD_VPS 0x00 /* Modify VP configurations. */ 1470 #define VCT_COMMAND_MOD_ENABLE_VPS 0x01 /* Modify configuration & enable VPs. */ 1471 1472 uint8_t vp_count; 1473 1474 uint8_t vp_index1; 1475 uint8_t vp_index2; 1476 1477 uint8_t options_idx1; 1478 uint8_t hard_address_idx1; 1479 uint16_t reserved_vp1; 1480 uint8_t port_name_idx1[WWN_SIZE]; 1481 uint8_t node_name_idx1[WWN_SIZE]; 1482 1483 uint8_t options_idx2; 1484 uint8_t hard_address_idx2; 1485 uint16_t reserved_vp2; 1486 uint8_t port_name_idx2[WWN_SIZE]; 1487 uint8_t node_name_idx2[WWN_SIZE]; 1488 __le16 id; 1489 uint16_t reserved_4; 1490 __le16 hopct; 1491 uint8_t reserved_5[2]; 1492 }; 1493 1494 #define VP_RPT_ID_IOCB_TYPE 0x32 /* Report ID Acquisition entry. */ 1495 enum VP_STATUS { 1496 VP_STAT_COMPL, 1497 VP_STAT_FAIL, 1498 VP_STAT_ID_CHG, 1499 VP_STAT_SNS_TO, /* timeout */ 1500 VP_STAT_SNS_RJT, 1501 VP_STAT_SCR_TO, /* timeout */ 1502 VP_STAT_SCR_RJT, 1503 }; 1504 1505 enum VP_FLAGS { 1506 VP_FLAGS_CON_FLOOP = 1, 1507 VP_FLAGS_CON_P2P = 2, 1508 VP_FLAGS_CON_FABRIC = 3, 1509 VP_FLAGS_NAME_VALID = BIT_5, 1510 }; 1511 1512 struct vp_rpt_id_entry_24xx { 1513 uint8_t entry_type; /* Entry type. */ 1514 uint8_t entry_count; /* Entry count. */ 1515 uint8_t sys_define; /* System defined. */ 1516 uint8_t entry_status; /* Entry Status. */ 1517 __le32 resv1; 1518 uint8_t vp_acquired; 1519 uint8_t vp_setup; 1520 uint8_t vp_idx; /* Format 0=reserved */ 1521 uint8_t vp_status; /* Format 0=reserved */ 1522 1523 uint8_t port_id[3]; 1524 uint8_t format; 1525 union { 1526 struct _f0 { 1527 /* format 0 loop */ 1528 uint8_t vp_idx_map[16]; 1529 uint8_t reserved_4[32]; 1530 } f0; 1531 struct _f1 { 1532 /* format 1 fabric */ 1533 uint8_t vpstat1_subcode; /* vp_status=1 subcode */ 1534 uint8_t flags; 1535 #define TOPO_MASK 0xE 1536 #define TOPO_FL 0x2 1537 #define TOPO_N2N 0x4 1538 #define TOPO_F 0x6 1539 1540 uint16_t fip_flags; 1541 uint8_t rsv2[12]; 1542 1543 uint8_t ls_rjt_vendor; 1544 uint8_t ls_rjt_explanation; 1545 uint8_t ls_rjt_reason; 1546 uint8_t rsv3[5]; 1547 1548 uint8_t port_name[8]; 1549 uint8_t node_name[8]; 1550 uint16_t bbcr; 1551 uint8_t reserved_5[6]; 1552 } f1; 1553 struct _f2 { /* format 2: N2N direct connect */ 1554 uint8_t vpstat1_subcode; 1555 uint8_t flags; 1556 uint16_t fip_flags; 1557 uint8_t rsv2[12]; 1558 1559 uint8_t ls_rjt_vendor; 1560 uint8_t ls_rjt_explanation; 1561 uint8_t ls_rjt_reason; 1562 uint8_t rsv3[5]; 1563 1564 uint8_t port_name[8]; 1565 uint8_t node_name[8]; 1566 uint16_t bbcr; 1567 uint8_t reserved_5[2]; 1568 uint8_t remote_nport_id[4]; 1569 } f2; 1570 } u; 1571 }; 1572 1573 #define VF_EVFP_IOCB_TYPE 0x26 /* Exchange Virtual Fabric Parameters entry. */ 1574 struct vf_evfp_entry_24xx { 1575 uint8_t entry_type; /* Entry type. */ 1576 uint8_t entry_count; /* Entry count. */ 1577 uint8_t sys_define; /* System defined. */ 1578 uint8_t entry_status; /* Entry Status. */ 1579 1580 uint32_t handle; /* System handle. */ 1581 __le16 comp_status; /* Completion status. */ 1582 __le16 timeout; /* timeout */ 1583 __le16 adim_tagging_mode; 1584 1585 __le16 vfport_id; 1586 uint32_t exch_addr; 1587 1588 __le16 nport_handle; /* N_PORT handle. */ 1589 __le16 control_flags; 1590 uint32_t io_parameter_0; 1591 uint32_t io_parameter_1; 1592 __le64 tx_address __packed; /* Data segment 0 address. */ 1593 uint32_t tx_len; /* Data segment 0 length. */ 1594 __le64 rx_address __packed; /* Data segment 1 address. */ 1595 uint32_t rx_len; /* Data segment 1 length. */ 1596 }; 1597 1598 /* END MID Support ***********************************************************/ 1599 1600 /* Flash Description Table ***************************************************/ 1601 1602 struct qla_fdt_layout { 1603 uint8_t sig[4]; 1604 __le16 version; 1605 __le16 len; 1606 __le16 checksum; 1607 uint8_t unused1[2]; 1608 uint8_t model[16]; 1609 __le16 man_id; 1610 __le16 id; 1611 uint8_t flags; 1612 uint8_t erase_cmd; 1613 uint8_t alt_erase_cmd; 1614 uint8_t wrt_enable_cmd; 1615 uint8_t wrt_enable_bits; 1616 uint8_t wrt_sts_reg_cmd; 1617 uint8_t unprotect_sec_cmd; 1618 uint8_t read_man_id_cmd; 1619 __le32 block_size; 1620 __le32 alt_block_size; 1621 __le32 flash_size; 1622 __le32 wrt_enable_data; 1623 uint8_t read_id_addr_len; 1624 uint8_t wrt_disable_bits; 1625 uint8_t read_dev_id_len; 1626 uint8_t chip_erase_cmd; 1627 __le16 read_timeout; 1628 uint8_t protect_sec_cmd; 1629 uint8_t unused2[65]; 1630 }; 1631 1632 /* Flash Layout Table ********************************************************/ 1633 1634 struct qla_flt_location { 1635 uint8_t sig[4]; 1636 __le16 start_lo; 1637 __le16 start_hi; 1638 uint8_t version; 1639 uint8_t unused[5]; 1640 __le16 checksum; 1641 }; 1642 1643 #define FLT_REG_FW 0x01 1644 #define FLT_REG_BOOT_CODE 0x07 1645 #define FLT_REG_VPD_0 0x14 1646 #define FLT_REG_NVRAM_0 0x15 1647 #define FLT_REG_VPD_1 0x16 1648 #define FLT_REG_NVRAM_1 0x17 1649 #define FLT_REG_VPD_2 0xD4 1650 #define FLT_REG_NVRAM_2 0xD5 1651 #define FLT_REG_VPD_3 0xD6 1652 #define FLT_REG_NVRAM_3 0xD7 1653 #define FLT_REG_FDT 0x1a 1654 #define FLT_REG_FLT 0x1c 1655 #define FLT_REG_HW_EVENT_0 0x1d 1656 #define FLT_REG_HW_EVENT_1 0x1f 1657 #define FLT_REG_NPIV_CONF_0 0x29 1658 #define FLT_REG_NPIV_CONF_1 0x2a 1659 #define FLT_REG_GOLD_FW 0x2f 1660 #define FLT_REG_FCP_PRIO_0 0x87 1661 #define FLT_REG_FCP_PRIO_1 0x88 1662 #define FLT_REG_CNA_FW 0x97 1663 #define FLT_REG_BOOT_CODE_8044 0xA2 1664 #define FLT_REG_FCOE_FW 0xA4 1665 #define FLT_REG_FCOE_NVRAM_0 0xAA 1666 #define FLT_REG_FCOE_NVRAM_1 0xAC 1667 1668 /* 27xx */ 1669 #define FLT_REG_IMG_PRI_27XX 0x95 1670 #define FLT_REG_IMG_SEC_27XX 0x96 1671 #define FLT_REG_FW_SEC_27XX 0x02 1672 #define FLT_REG_BOOTLOAD_SEC_27XX 0x9 1673 #define FLT_REG_VPD_SEC_27XX_0 0x50 1674 #define FLT_REG_VPD_SEC_27XX_1 0x52 1675 #define FLT_REG_VPD_SEC_27XX_2 0xD8 1676 #define FLT_REG_VPD_SEC_27XX_3 0xDA 1677 1678 /* 28xx */ 1679 #define FLT_REG_AUX_IMG_PRI_28XX 0x125 1680 #define FLT_REG_AUX_IMG_SEC_28XX 0x126 1681 #define FLT_REG_VPD_SEC_28XX_0 0x10C 1682 #define FLT_REG_VPD_SEC_28XX_1 0x10E 1683 #define FLT_REG_VPD_SEC_28XX_2 0x110 1684 #define FLT_REG_VPD_SEC_28XX_3 0x112 1685 #define FLT_REG_NVRAM_SEC_28XX_0 0x10D 1686 #define FLT_REG_NVRAM_SEC_28XX_1 0x10F 1687 #define FLT_REG_NVRAM_SEC_28XX_2 0x111 1688 #define FLT_REG_NVRAM_SEC_28XX_3 0x113 1689 #define FLT_REG_MPI_PRI_28XX 0xD3 1690 #define FLT_REG_MPI_SEC_28XX 0xF0 1691 #define FLT_REG_PEP_PRI_28XX 0xD1 1692 #define FLT_REG_PEP_SEC_28XX 0xF1 1693 1694 struct qla_flt_region { 1695 __le16 code; 1696 uint8_t attribute; 1697 uint8_t reserved; 1698 __le32 size; 1699 __le32 start; 1700 __le32 end; 1701 }; 1702 1703 struct qla_flt_header { 1704 __le16 version; 1705 __le16 length; 1706 __le16 checksum; 1707 __le16 unused; 1708 struct qla_flt_region region[0]; 1709 }; 1710 1711 #define FLT_REGION_SIZE 16 1712 #define FLT_MAX_REGIONS 0xFF 1713 #define FLT_REGIONS_SIZE (FLT_REGION_SIZE * FLT_MAX_REGIONS) 1714 1715 /* Flash NPIV Configuration Table ********************************************/ 1716 1717 struct qla_npiv_header { 1718 uint8_t sig[2]; 1719 __le16 version; 1720 __le16 entries; 1721 __le16 unused[4]; 1722 __le16 checksum; 1723 }; 1724 1725 struct qla_npiv_entry { 1726 __le16 flags; 1727 __le16 vf_id; 1728 uint8_t q_qos; 1729 uint8_t f_qos; 1730 __le16 unused1; 1731 uint8_t port_name[WWN_SIZE]; 1732 uint8_t node_name[WWN_SIZE]; 1733 }; 1734 1735 /* 84XX Support **************************************************************/ 1736 1737 #define MBA_ISP84XX_ALERT 0x800f /* Alert Notification. */ 1738 #define A84_PANIC_RECOVERY 0x1 1739 #define A84_OP_LOGIN_COMPLETE 0x2 1740 #define A84_DIAG_LOGIN_COMPLETE 0x3 1741 #define A84_GOLD_LOGIN_COMPLETE 0x4 1742 1743 #define MBC_ISP84XX_RESET 0x3a /* Reset. */ 1744 1745 #define FSTATE_REMOTE_FC_DOWN BIT_0 1746 #define FSTATE_NSL_LINK_DOWN BIT_1 1747 #define FSTATE_IS_DIAG_FW BIT_2 1748 #define FSTATE_LOGGED_IN BIT_3 1749 #define FSTATE_WAITING_FOR_VERIFY BIT_4 1750 1751 #define VERIFY_CHIP_IOCB_TYPE 0x1B 1752 struct verify_chip_entry_84xx { 1753 uint8_t entry_type; 1754 uint8_t entry_count; 1755 uint8_t sys_defined; 1756 uint8_t entry_status; 1757 1758 uint32_t handle; 1759 1760 __le16 options; 1761 #define VCO_DONT_UPDATE_FW BIT_0 1762 #define VCO_FORCE_UPDATE BIT_1 1763 #define VCO_DONT_RESET_UPDATE BIT_2 1764 #define VCO_DIAG_FW BIT_3 1765 #define VCO_END_OF_DATA BIT_14 1766 #define VCO_ENABLE_DSD BIT_15 1767 1768 __le16 reserved_1; 1769 1770 __le16 data_seg_cnt; 1771 __le16 reserved_2[3]; 1772 1773 __le32 fw_ver; 1774 __le32 exchange_address; 1775 1776 __le32 reserved_3[3]; 1777 __le32 fw_size; 1778 __le32 fw_seq_size; 1779 __le32 relative_offset; 1780 1781 struct dsd64 dsd; 1782 }; 1783 1784 struct verify_chip_rsp_84xx { 1785 uint8_t entry_type; 1786 uint8_t entry_count; 1787 uint8_t sys_defined; 1788 uint8_t entry_status; 1789 1790 uint32_t handle; 1791 1792 __le16 comp_status; 1793 #define CS_VCS_CHIP_FAILURE 0x3 1794 #define CS_VCS_BAD_EXCHANGE 0x8 1795 #define CS_VCS_SEQ_COMPLETEi 0x40 1796 1797 __le16 failure_code; 1798 #define VFC_CHECKSUM_ERROR 0x1 1799 #define VFC_INVALID_LEN 0x2 1800 #define VFC_ALREADY_IN_PROGRESS 0x8 1801 1802 __le16 reserved_1[4]; 1803 1804 __le32 fw_ver; 1805 __le32 exchange_address; 1806 1807 __le32 reserved_2[6]; 1808 }; 1809 1810 #define ACCESS_CHIP_IOCB_TYPE 0x2B 1811 struct access_chip_84xx { 1812 uint8_t entry_type; 1813 uint8_t entry_count; 1814 uint8_t sys_defined; 1815 uint8_t entry_status; 1816 1817 uint32_t handle; 1818 1819 __le16 options; 1820 #define ACO_DUMP_MEMORY 0x0 1821 #define ACO_LOAD_MEMORY 0x1 1822 #define ACO_CHANGE_CONFIG_PARAM 0x2 1823 #define ACO_REQUEST_INFO 0x3 1824 1825 __le16 reserved1; 1826 1827 __le16 dseg_count; 1828 __le16 reserved2[3]; 1829 1830 __le32 parameter1; 1831 __le32 parameter2; 1832 __le32 parameter3; 1833 1834 __le32 reserved3[3]; 1835 __le32 total_byte_cnt; 1836 __le32 reserved4; 1837 1838 struct dsd64 dsd; 1839 }; 1840 1841 struct access_chip_rsp_84xx { 1842 uint8_t entry_type; 1843 uint8_t entry_count; 1844 uint8_t sys_defined; 1845 uint8_t entry_status; 1846 1847 uint32_t handle; 1848 1849 __le16 comp_status; 1850 __le16 failure_code; 1851 __le32 residual_count; 1852 1853 __le32 reserved[12]; 1854 }; 1855 1856 /* 81XX Support **************************************************************/ 1857 1858 #define MBA_DCBX_START 0x8016 1859 #define MBA_DCBX_COMPLETE 0x8030 1860 #define MBA_FCF_CONF_ERR 0x8031 1861 #define MBA_DCBX_PARAM_UPDATE 0x8032 1862 #define MBA_IDC_COMPLETE 0x8100 1863 #define MBA_IDC_NOTIFY 0x8101 1864 #define MBA_IDC_TIME_EXT 0x8102 1865 1866 #define MBC_IDC_ACK 0x101 1867 #define MBC_RESTART_MPI_FW 0x3d 1868 #define MBC_FLASH_ACCESS_CTRL 0x3e /* Control flash access. */ 1869 #define MBC_GET_XGMAC_STATS 0x7a 1870 #define MBC_GET_DCBX_PARAMS 0x51 1871 1872 /* 1873 * ISP83xx mailbox commands 1874 */ 1875 #define MBC_WRITE_REMOTE_REG 0x0001 /* Write remote register */ 1876 #define MBC_READ_REMOTE_REG 0x0009 /* Read remote register */ 1877 #define MBC_RESTART_NIC_FIRMWARE 0x003d /* Restart NIC firmware */ 1878 #define MBC_SET_ACCESS_CONTROL 0x003e /* Access control command */ 1879 1880 /* Flash access control option field bit definitions */ 1881 #define FAC_OPT_FORCE_SEMAPHORE BIT_15 1882 #define FAC_OPT_REQUESTOR_ID BIT_14 1883 #define FAC_OPT_CMD_SUBCODE 0xff 1884 1885 /* Flash access control command subcodes */ 1886 #define FAC_OPT_CMD_WRITE_PROTECT 0x00 1887 #define FAC_OPT_CMD_WRITE_ENABLE 0x01 1888 #define FAC_OPT_CMD_ERASE_SECTOR 0x02 1889 #define FAC_OPT_CMD_LOCK_SEMAPHORE 0x03 1890 #define FAC_OPT_CMD_UNLOCK_SEMAPHORE 0x04 1891 #define FAC_OPT_CMD_GET_SECTOR_SIZE 0x05 1892 1893 /* enhanced features bit definitions */ 1894 #define NEF_LR_DIST_ENABLE BIT_0 1895 1896 /* LR Distance bit positions */ 1897 #define LR_DIST_NV_POS 2 1898 #define LR_DIST_NV_MASK 0xf 1899 #define LR_DIST_FW_POS 12 1900 1901 /* FAC semaphore defines */ 1902 #define FAC_SEMAPHORE_UNLOCK 0 1903 #define FAC_SEMAPHORE_LOCK 1 1904 1905 struct nvram_81xx { 1906 /* NVRAM header. */ 1907 uint8_t id[4]; 1908 __le16 nvram_version; 1909 __le16 reserved_0; 1910 1911 /* Firmware Initialization Control Block. */ 1912 __le16 version; 1913 __le16 reserved_1; 1914 __le16 frame_payload_size; 1915 __le16 execution_throttle; 1916 __le16 exchange_count; 1917 __le16 reserved_2; 1918 1919 uint8_t port_name[WWN_SIZE]; 1920 uint8_t node_name[WWN_SIZE]; 1921 1922 __le16 login_retry_count; 1923 __le16 reserved_3; 1924 __le16 interrupt_delay_timer; 1925 __le16 login_timeout; 1926 1927 __le32 firmware_options_1; 1928 __le32 firmware_options_2; 1929 __le32 firmware_options_3; 1930 1931 __le16 reserved_4[4]; 1932 1933 /* Offset 64. */ 1934 uint8_t enode_mac[6]; 1935 __le16 reserved_5[5]; 1936 1937 /* Offset 80. */ 1938 __le16 reserved_6[24]; 1939 1940 /* Offset 128. */ 1941 __le16 ex_version; 1942 uint8_t prio_fcf_matching_flags; 1943 uint8_t reserved_6_1[3]; 1944 __le16 pri_fcf_vlan_id; 1945 uint8_t pri_fcf_fabric_name[8]; 1946 __le16 reserved_6_2[7]; 1947 uint8_t spma_mac_addr[6]; 1948 __le16 reserved_6_3[14]; 1949 1950 /* Offset 192. */ 1951 uint8_t min_supported_speed; 1952 uint8_t reserved_7_0; 1953 __le16 reserved_7[31]; 1954 1955 /* 1956 * BIT 0 = Enable spinup delay 1957 * BIT 1 = Disable BIOS 1958 * BIT 2 = Enable Memory Map BIOS 1959 * BIT 3 = Enable Selectable Boot 1960 * BIT 4 = Disable RISC code load 1961 * BIT 5 = Disable Serdes 1962 * BIT 6 = Opt boot mode 1963 * BIT 7 = Interrupt enable 1964 * 1965 * BIT 8 = EV Control enable 1966 * BIT 9 = Enable lip reset 1967 * BIT 10 = Enable lip full login 1968 * BIT 11 = Enable target reset 1969 * BIT 12 = Stop firmware 1970 * BIT 13 = Enable nodename option 1971 * BIT 14 = Default WWPN valid 1972 * BIT 15 = Enable alternate WWN 1973 * 1974 * BIT 16 = CLP LUN string 1975 * BIT 17 = CLP Target string 1976 * BIT 18 = CLP BIOS enable string 1977 * BIT 19 = CLP Serdes string 1978 * BIT 20 = CLP WWPN string 1979 * BIT 21 = CLP WWNN string 1980 * BIT 22 = 1981 * BIT 23 = 1982 * BIT 24 = Keep WWPN 1983 * BIT 25 = Temp WWPN 1984 * BIT 26-31 = 1985 */ 1986 __le32 host_p; 1987 1988 uint8_t alternate_port_name[WWN_SIZE]; 1989 uint8_t alternate_node_name[WWN_SIZE]; 1990 1991 uint8_t boot_port_name[WWN_SIZE]; 1992 __le16 boot_lun_number; 1993 __le16 reserved_8; 1994 1995 uint8_t alt1_boot_port_name[WWN_SIZE]; 1996 __le16 alt1_boot_lun_number; 1997 __le16 reserved_9; 1998 1999 uint8_t alt2_boot_port_name[WWN_SIZE]; 2000 __le16 alt2_boot_lun_number; 2001 __le16 reserved_10; 2002 2003 uint8_t alt3_boot_port_name[WWN_SIZE]; 2004 __le16 alt3_boot_lun_number; 2005 __le16 reserved_11; 2006 2007 /* 2008 * BIT 0 = Selective Login 2009 * BIT 1 = Alt-Boot Enable 2010 * BIT 2 = Reserved 2011 * BIT 3 = Boot Order List 2012 * BIT 4 = Reserved 2013 * BIT 5 = Selective LUN 2014 * BIT 6 = Reserved 2015 * BIT 7-31 = 2016 */ 2017 __le32 efi_parameters; 2018 2019 uint8_t reset_delay; 2020 uint8_t reserved_12; 2021 __le16 reserved_13; 2022 2023 __le16 boot_id_number; 2024 __le16 reserved_14; 2025 2026 __le16 max_luns_per_target; 2027 __le16 reserved_15; 2028 2029 __le16 port_down_retry_count; 2030 __le16 link_down_timeout; 2031 2032 /* FCode parameters. */ 2033 __le16 fcode_parameter; 2034 2035 __le16 reserved_16[3]; 2036 2037 /* Offset 352. */ 2038 uint8_t reserved_17[4]; 2039 __le16 reserved_18[5]; 2040 uint8_t reserved_19[2]; 2041 __le16 reserved_20[8]; 2042 2043 /* Offset 384. */ 2044 uint8_t reserved_21[16]; 2045 __le16 reserved_22[3]; 2046 2047 /* Offset 406 (0x196) Enhanced Features 2048 * BIT 0 = Extended BB credits for LR 2049 * BIT 1 = Virtual Fabric Enable 2050 * BIT 2-5 = Distance Support if BIT 0 is on 2051 * BIT 6 = Prefer FCP 2052 * BIT 7 = SCM Disabled if BIT is set (1) 2053 * BIT 8-15 = Unused 2054 */ 2055 uint16_t enhanced_features; 2056 2057 uint16_t reserved_24[4]; 2058 2059 /* Offset 416. */ 2060 __le16 reserved_25[32]; 2061 2062 /* Offset 480. */ 2063 uint8_t model_name[16]; 2064 2065 /* Offset 496. */ 2066 __le16 feature_mask_l; 2067 __le16 feature_mask_h; 2068 __le16 reserved_26[2]; 2069 2070 __le16 subsystem_vendor_id; 2071 __le16 subsystem_device_id; 2072 2073 __le32 checksum; 2074 }; 2075 2076 /* 2077 * ISP Initialization Control Block. 2078 * Little endian except where noted. 2079 */ 2080 #define ICB_VERSION 1 2081 struct init_cb_81xx { 2082 __le16 version; 2083 __le16 reserved_1; 2084 2085 __le16 frame_payload_size; 2086 __le16 execution_throttle; 2087 __le16 exchange_count; 2088 2089 __le16 reserved_2; 2090 2091 uint8_t port_name[WWN_SIZE]; /* Big endian. */ 2092 uint8_t node_name[WWN_SIZE]; /* Big endian. */ 2093 2094 __le16 response_q_inpointer; 2095 __le16 request_q_outpointer; 2096 2097 __le16 login_retry_count; 2098 2099 __le16 prio_request_q_outpointer; 2100 2101 __le16 response_q_length; 2102 __le16 request_q_length; 2103 2104 __le16 reserved_3; 2105 2106 __le16 prio_request_q_length; 2107 2108 __le64 request_q_address __packed; 2109 __le64 response_q_address __packed; 2110 __le64 prio_request_q_address __packed; 2111 2112 uint8_t reserved_4[8]; 2113 2114 __le16 atio_q_inpointer; 2115 __le16 atio_q_length; 2116 __le64 atio_q_address __packed; 2117 2118 __le16 interrupt_delay_timer; /* 100us increments. */ 2119 __le16 login_timeout; 2120 2121 /* 2122 * BIT 0-3 = Reserved 2123 * BIT 4 = Enable Target Mode 2124 * BIT 5 = Disable Initiator Mode 2125 * BIT 6 = Reserved 2126 * BIT 7 = Reserved 2127 * 2128 * BIT 8-13 = Reserved 2129 * BIT 14 = Node Name Option 2130 * BIT 15-31 = Reserved 2131 */ 2132 __le32 firmware_options_1; 2133 2134 /* 2135 * BIT 0 = Operation Mode bit 0 2136 * BIT 1 = Operation Mode bit 1 2137 * BIT 2 = Operation Mode bit 2 2138 * BIT 3 = Operation Mode bit 3 2139 * BIT 4-7 = Reserved 2140 * 2141 * BIT 8 = Enable Class 2 2142 * BIT 9 = Enable ACK0 2143 * BIT 10 = Reserved 2144 * BIT 11 = Enable FC-SP Security 2145 * BIT 12 = FC Tape Enable 2146 * BIT 13 = Reserved 2147 * BIT 14 = Enable Target PRLI Control 2148 * BIT 15-31 = Reserved 2149 */ 2150 __le32 firmware_options_2; 2151 2152 /* 2153 * BIT 0-3 = Reserved 2154 * BIT 4 = FCP RSP Payload bit 0 2155 * BIT 5 = FCP RSP Payload bit 1 2156 * BIT 6 = Enable Receive Out-of-Order data frame handling 2157 * BIT 7 = Reserved 2158 * 2159 * BIT 8 = Reserved 2160 * BIT 9 = Enable Out-of-Order FCP_XFER_RDY relative offset handling 2161 * BIT 10-16 = Reserved 2162 * BIT 17 = Enable multiple FCFs 2163 * BIT 18-20 = MAC addressing mode 2164 * BIT 21-25 = Ethernet data rate 2165 * BIT 26 = Enable ethernet header rx IOCB for ATIO q 2166 * BIT 27 = Enable ethernet header rx IOCB for response q 2167 * BIT 28 = SPMA selection bit 0 2168 * BIT 28 = SPMA selection bit 1 2169 * BIT 30-31 = Reserved 2170 */ 2171 __le32 firmware_options_3; 2172 2173 uint8_t reserved_5[8]; 2174 2175 uint8_t enode_mac[6]; 2176 2177 uint8_t reserved_6[10]; 2178 }; 2179 2180 struct mid_init_cb_81xx { 2181 struct init_cb_81xx init_cb; 2182 2183 uint16_t count; 2184 uint16_t options; 2185 2186 struct mid_conf_entry_24xx entries[MAX_MULTI_ID_FABRIC]; 2187 }; 2188 2189 struct ex_init_cb_81xx { 2190 uint16_t ex_version; 2191 uint8_t prio_fcf_matching_flags; 2192 uint8_t reserved_1[3]; 2193 uint16_t pri_fcf_vlan_id; 2194 uint8_t pri_fcf_fabric_name[8]; 2195 uint16_t reserved_2[7]; 2196 uint8_t spma_mac_addr[6]; 2197 uint16_t reserved_3[14]; 2198 }; 2199 2200 #define FARX_ACCESS_FLASH_CONF_81XX 0x7FFD0000 2201 #define FARX_ACCESS_FLASH_DATA_81XX 0x7F800000 2202 #define FARX_ACCESS_FLASH_CONF_28XX 0x7FFD0000 2203 #define FARX_ACCESS_FLASH_DATA_28XX 0x7F7D0000 2204 2205 /* FCP priority config defines *************************************/ 2206 /* operations */ 2207 #define QLFC_FCP_PRIO_DISABLE 0x0 2208 #define QLFC_FCP_PRIO_ENABLE 0x1 2209 #define QLFC_FCP_PRIO_GET_CONFIG 0x2 2210 #define QLFC_FCP_PRIO_SET_CONFIG 0x3 2211 2212 struct qla_fcp_prio_entry { 2213 uint16_t flags; /* Describes parameter(s) in FCP */ 2214 /* priority entry that are valid */ 2215 #define FCP_PRIO_ENTRY_VALID 0x1 2216 #define FCP_PRIO_ENTRY_TAG_VALID 0x2 2217 #define FCP_PRIO_ENTRY_SPID_VALID 0x4 2218 #define FCP_PRIO_ENTRY_DPID_VALID 0x8 2219 #define FCP_PRIO_ENTRY_LUNB_VALID 0x10 2220 #define FCP_PRIO_ENTRY_LUNE_VALID 0x20 2221 #define FCP_PRIO_ENTRY_SWWN_VALID 0x40 2222 #define FCP_PRIO_ENTRY_DWWN_VALID 0x80 2223 uint8_t tag; /* Priority value */ 2224 uint8_t reserved; /* Reserved for future use */ 2225 uint32_t src_pid; /* Src port id. high order byte */ 2226 /* unused; -1 (wild card) */ 2227 uint32_t dst_pid; /* Src port id. high order byte */ 2228 /* unused; -1 (wild card) */ 2229 uint16_t lun_beg; /* 1st lun num of lun range. */ 2230 /* -1 (wild card) */ 2231 uint16_t lun_end; /* 2nd lun num of lun range. */ 2232 /* -1 (wild card) */ 2233 uint8_t src_wwpn[8]; /* Source WWPN: -1 (wild card) */ 2234 uint8_t dst_wwpn[8]; /* Destination WWPN: -1 (wild card) */ 2235 }; 2236 2237 struct qla_fcp_prio_cfg { 2238 uint8_t signature[4]; /* "HQOS" signature of config data */ 2239 uint16_t version; /* 1: Initial version */ 2240 uint16_t length; /* config data size in num bytes */ 2241 uint16_t checksum; /* config data bytes checksum */ 2242 uint16_t num_entries; /* Number of entries */ 2243 uint16_t size_of_entry; /* Size of each entry in num bytes */ 2244 uint8_t attributes; /* enable/disable, persistence */ 2245 #define FCP_PRIO_ATTR_DISABLE 0x0 2246 #define FCP_PRIO_ATTR_ENABLE 0x1 2247 #define FCP_PRIO_ATTR_PERSIST 0x2 2248 uint8_t reserved; /* Reserved for future use */ 2249 #define FCP_PRIO_CFG_HDR_SIZE offsetof(struct qla_fcp_prio_cfg, entry) 2250 struct qla_fcp_prio_entry entry[1023]; /* fcp priority entries */ 2251 uint8_t reserved2[16]; 2252 }; 2253 2254 #define FCP_PRIO_CFG_SIZE (32*1024) /* fcp prio data per port*/ 2255 2256 /* 25XX Support ****************************************************/ 2257 #define FA_FCP_PRIO0_ADDR_25 0x3C000 2258 #define FA_FCP_PRIO1_ADDR_25 0x3E000 2259 2260 /* 81XX Flash locations -- occupies second 2MB region. */ 2261 #define FA_BOOT_CODE_ADDR_81 0x80000 2262 #define FA_RISC_CODE_ADDR_81 0xA0000 2263 #define FA_FW_AREA_ADDR_81 0xC0000 2264 #define FA_VPD_NVRAM_ADDR_81 0xD0000 2265 #define FA_VPD0_ADDR_81 0xD0000 2266 #define FA_VPD1_ADDR_81 0xD0400 2267 #define FA_NVRAM0_ADDR_81 0xD0080 2268 #define FA_NVRAM1_ADDR_81 0xD0180 2269 #define FA_FEATURE_ADDR_81 0xD4000 2270 #define FA_FLASH_DESCR_ADDR_81 0xD8000 2271 #define FA_FLASH_LAYOUT_ADDR_81 0xD8400 2272 #define FA_HW_EVENT0_ADDR_81 0xDC000 2273 #define FA_HW_EVENT1_ADDR_81 0xDC400 2274 #define FA_NPIV_CONF0_ADDR_81 0xD1000 2275 #define FA_NPIV_CONF1_ADDR_81 0xD2000 2276 2277 /* 83XX Flash locations -- occupies second 8MB region. */ 2278 #define FA_FLASH_LAYOUT_ADDR_83 (0x3F1000/4) 2279 #define FA_FLASH_LAYOUT_ADDR_28 (0x11000/4) 2280 2281 #define NVRAM_DUAL_FCP_NVME_FLAG_OFFSET 0x196 2282 2283 #endif 2284