hermon_hw.h revision 9517:b4839b0aa7a4
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. 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 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27#ifndef _SYS_IB_ADAPTERS_HERMON_HW_H 28#define _SYS_IB_ADAPTERS_HERMON_HW_H 29 30/* 31 * hermon_hw.h 32 * Contains all the structure definitions and #defines for all Hermon 33 * hardware resources and registers (as defined by the Hermon register 34 * specification). Wherever possible, the names in the Hermon spec 35 * have been preserved in the structure and field names below. 36 */ 37 38#include <sys/types.h> 39#include <sys/conf.h> 40#include <sys/ddi.h> 41#include <sys/sunddi.h> 42 43#ifdef __cplusplus 44extern "C" { 45#endif 46 47 48/* 49 * PCI IDs for supported chipsets 50 */ 51#define PCI_VENID_MLX 0x15b3 52#define PCI_DEVID_HERMON_SDR 0x6340 /* Mellanox MT25208-SDR PCIe Gen1 */ 53#define PCI_DEVID_HERMON_DDR 0x634A /* Mellanox MT25208-DDR PCIe Gen1 */ 54#define PCI_DEVID_HERMON_DDRG2 0x6732 /* Mellanox MT25208-DDR PCIe Gen2 */ 55#define PCI_DEVID_HERMON_QDRG2 0x673C /* Mellanox MT25208-QDR PCIe Gen2 */ 56#define PCI_DEVID_HERMON_MAINT 0x0191 /* Maintenance/Mem Controller Mode */ 57 58/* 59 * Native page size of the adapter 60 */ 61#define HERMON_PAGESIZE 0x1000 /* 4Kb */ 62#define HERMON_PAGEMASK (HERMON_PAGESIZE - 1) 63#define HERMON_PAGESHIFT 0xC /* 12 */ 64 65/* 66 * MACROS to make some page stuff easier 67 */ 68 69/* given a value, return a value that's the next higher power of 2 */ 70#define HERMON_POW2(x) (1 << highbit(x)) 71/* 72 * given a size in bytes, return the minimum number of 73 * *HCA PAGES* needed to hold it 74 */ 75#define HERMON_HCA_PAGES(x) \ 76 (((x + HERMON_PAGESIZE) & HERMON_PAGEMASK) >> HERMON_PAGESHIFT) 77 78/* 79 * given a size in bytes, return the power of two number of 80 * *HCA PAGES* needed to hold it 81 */ 82#define HERMON_HCA_POW2_PAGES(x) (HERMON_POW2(HERMON_HCA_PAGES(x))) 83/* 84 * Offsets into the CMD BAR (BAR 0) for many of the more interesting hardware 85 * registers. These registers include the HCR (more below), and the software 86 * reset register (SW_RESET). 87 */ 88#define HERMON_CMD_HCR_OFFSET 0x80680 /* PRM */ 89#define HERMON_CMD_SW_RESET_OFFSET 0xF0010 /* PRM */ 90#define HERMON_CMD_SW_SEMAPHORE_OFFSET 0xF03FC /* PRM */ 91#define HERMON_CMD_OFFSET_MASK 0xFFFFF /* per MLX instruction */ 92 93 94/* 95 * Ownership flags used to define hardware or software ownership for 96 * various Hermon resources 97 */ 98#define HERMON_HW_OWNER 0x1 99#define HERMON_SW_OWNER 0x0 100 101/* 102 * Determines whether or not virtual-to-physical address translation is 103 * required. Several of the Hermon hardware structures can be optionally 104 * accessed by Hermon without going through the TPT address translation 105 * tables. 106 */ 107#define HERMON_VA2PA_XLAT_ENABLED 0x1 108#define HERMON_VA2PA_XLAT_DISABLED 0x0 109 110/* 111 * HCA Command Register (HCR) 112 * The HCR command interface provides privileged access to the HCA in 113 * order to query, configure and modify HCA execution. It is the 114 * primary mechanism through which mailboxes may be posted to Hermon 115 * firmware. To use this interface software fills the HCR with pointers 116 * to input and output mailboxes. Some commands support immediate 117 * parameters, however, and for these commands the HCR will contain the 118 * input or output parameters. Command execution completion can be 119 * detected either by the software polling the HCR or by waiting for a 120 * command completion event. 121 */ 122struct hermon_hw_hcr_s { 123 uint32_t in_param0; 124 uint32_t in_param1; 125 uint32_t input_modifier; 126 uint32_t out_param0; 127 uint32_t out_param1; 128 uint32_t token; 129 uint32_t cmd; 130}; 131#define HERMON_HCR_TOKEN_MASK 0xFFFF0000 132#define HERMON_HCR_TOKEN_SHIFT 16 133 134#define HERMON_HCR_CMD_STATUS_MASK 0xFF000000 135#define HERMON_HCR_CMD_GO_MASK 0x00800000 136#define HERMON_HCR_CMD_E_MASK 0x00400000 137#define HERMON_HCR_CMD_T_MASK 0x00200000 138#define HERMON_HCR_CMD_OPMOD_MASK 0x0000F000 139#define HERMON_HCR_CMD_OPCODE_MASK 0x00000FFF 140#define HERMON_HCR_CMD_STATUS_SHFT 24 141#define HERMON_HCR_CMD_GO_SHFT 23 142#define HERMON_HCR_CMD_E_SHFT 22 143#define HERMON_HCR_CMD_T_SHFT 21 144#define HERMON_HCR_CMD_OPMOD_SHFT 12 145 146/* 147 * Arbel "QUERY_DEV_LIM" command - Hermon, "QUERY_DEV_CAP" - Same hex code 148 * same function as tavor/arbel QUERY_DEV_LIM, just renamed (whatever). 149 * The QUERY_DEV_LIM command returns the device limits and capabilities 150 * supported by the Hermon device. This command must be run before 151 * running the INIT_HCA command (below) in order to determine the maximum 152 * capabilities of the device and which optional features are supported. 153 */ 154#ifdef _LITTLE_ENDIAN 155struct hermon_hw_querydevlim_s { 156 uint32_t rsrv0[4]; 157 158 uint32_t log_max_scqs :4; 159 uint32_t :4; 160 uint32_t num_rsvd_scqs :6; 161 uint32_t :2; 162 uint32_t log_max_srq :5; 163 uint32_t :7; 164 uint32_t log_rsvd_srq :4; 165 166 uint32_t log_max_qp :5; 167 uint32_t :3; 168 uint32_t log_rsvd_qp :4; 169 uint32_t :4; 170 uint32_t log_max_qp_sz :8; 171 uint32_t log_max_srq_sz :8; 172 173 uint32_t log_max_eq :4; 174 uint32_t :4; 175 uint32_t num_rsvd_eq :4; 176 uint32_t :4; 177 uint32_t log_max_dmpt :6; 178 uint32_t :2; 179 uint32_t log_max_eq_sz :8; 180 181 uint32_t log_max_cq :5; 182 uint32_t :3; 183 uint32_t log_rsvd_cq :4; 184 uint32_t :4; 185 uint32_t log_max_cq_sz :8; 186 uint32_t :8; 187 188 189 uint32_t :32; 190 191 uint32_t log_max_mtt :6; 192 uint32_t :2; 193 uint32_t log_rsvd_dmpt :4; 194 uint32_t :4; 195 uint32_t log_max_mrw_sz :8; 196 uint32_t :4; 197 uint32_t log_rsvd_mtt :4; 198 199 uint32_t log_max_ra_glob :6; 200 uint32_t :2; 201 uint32_t log_max_rss_tbl_sz :4; 202 uint32_t rss_toep :1; /* rss toeplitz hashing */ 203 uint32_t rss_xor :1; /* rss xor hashing */ 204 uint32_t :2; 205 uint32_t log_max_gso_sz :5; /* Lge Send Offload */ 206 uint32_t :11; /* new w/ 0.35, RSS info */ 207 208 uint32_t log_max_ra_res_qp :6; 209 uint32_t :10; 210 uint32_t log_max_ra_req_qp :6; 211 uint32_t :10; 212 213 uint32_t num_ports :4; 214 uint32_t :12; 215 uint32_t ca_ack_delay :5; 216 uint32_t :11; 217 218 uint32_t mod_wr_srq :1; 219 uint32_t :31; 220 221 uint32_t :4; 222 uint32_t :12; 223 uint32_t stat_rate_sup :16; 224 225 uint32_t :4; 226 uint32_t :12; 227 uint32_t :8; 228 uint32_t log_max_msg :5; 229 uint32_t :3; 230 231 uint32_t rc :1; 232 uint32_t uc :1; 233 uint32_t ud :1; 234 uint32_t xrc :1; 235 uint32_t rcm :1; 236 uint32_t fcoib :1; 237 uint32_t srq :1; 238 uint32_t ipoib_cksm :1; 239 uint32_t pkey_v :1; 240 uint32_t qkey_v :1; 241 uint32_t vmm :1; 242 uint32_t :5; 243 uint32_t mem_win :1; 244 uint32_t apm :1; 245 uint32_t atomic :1; 246 uint32_t raw_multi :1; 247 uint32_t avp :1; 248 uint32_t ud_multi :1; 249 uint32_t :2; 250 uint32_t pg_on_demand :1; 251 uint32_t router :1; 252 uint32_t :6; 253 254 uint32_t :32; 255 256 uint32_t log_max_bf_page :6; 257 uint32_t :2; 258 uint32_t log_max_bf_req_ppg :6; 259 uint32_t :2; 260 uint32_t log_bf_reg_sz :5; 261 uint32_t :10; 262 uint32_t blu_flm :1; 263 264 uint32_t log_pg_sz :8; 265 uint32_t :8; 266 uint32_t log_max_uar_sz :6; 267 uint32_t :6; 268 uint32_t num_rsvd_uar :4; 269 270 uint32_t max_desc_sz_rq :16; 271 uint32_t max_sg_rq :8; 272 uint32_t :8; 273 274 uint32_t max_desc_sz_sq :16; 275 uint32_t max_sg_sq :8; 276 uint32_t :8; 277 278 uint32_t rsvd_fcoib[2]; 279 280 uint32_t log_max_srcd :4; 281 uint32_t :8; 282 uint32_t num_rsvd_srcds :4; 283 uint32_t log_max_pd :5; 284 uint32_t :7; 285 uint32_t num_rsvd_pd :4; 286 287 uint32_t log_max_mcg :8; 288 uint32_t num_rsvd_mcg :4; 289 uint32_t :4; 290 uint32_t log_max_qp_mcg :8; 291 uint32_t :8; 292 293 uint32_t rsrv2[6]; 294 295 uint32_t altc_entry_sz :16; 296 uint32_t aux_entry_sz :16; 297 298 uint32_t qpc_entry_sz :16; 299 uint32_t rdmardc_entry_sz :16; 300 301 uint32_t cmpt_entry_sz :16; 302 uint32_t srq_entry_sz :16; 303 304 uint32_t cqc_entry_sz :16; 305 uint32_t eqc_entry_sz :16; 306 307 uint32_t bmme :1; 308 uint32_t win_type :1; 309 uint32_t mps :1; 310 uint32_t bl :1; 311 uint32_t zb :1; 312 uint32_t lif :1; 313 uint32_t local_inv :1; 314 uint32_t remote_inv :1; 315 uint32_t :1; 316 uint32_t win_type2 :1; 317 uint32_t reserved_lkey :1; 318 uint32_t fast_reg_wr :1; 319 uint32_t :20; 320 321 uint32_t dmpt_entry_sz :16; 322 uint32_t mtt_entry_sz :16; 323 324 uint32_t :32; 325 326 uint32_t rsv_lkey; 327 328 uint64_t max_icm_size; 329 330 uint32_t rsrv3[22]; 331}; 332 333#else /* BIG ENDIAN */ 334 335struct hermon_hw_querydevlim_s { 336 uint32_t rsrv0[4]; 337 338 uint32_t log_max_srq_sz :8; 339 uint32_t log_max_qp_sz :8; 340 uint32_t :4; 341 uint32_t log_rsvd_qp :4; 342 uint32_t :3; 343 uint32_t log_max_qp :5; 344 345 uint32_t log_rsvd_srq :4; 346 uint32_t :7; 347 uint32_t log_max_srq :5; 348 uint32_t :2; 349 uint32_t num_rsvd_scqs :6; 350 uint32_t :4; 351 uint32_t log_max_scqs :4; 352 353 uint32_t :8; 354 uint32_t log_max_cq_sz :8; 355 uint32_t :4; 356 uint32_t log_rsvd_cq :4; 357 uint32_t :3; 358 uint32_t log_max_cq :5; 359 360 uint32_t log_max_eq_sz :8; 361 uint32_t :2; 362 uint32_t log_max_dmpt :6; 363 uint32_t :4; 364 uint32_t num_rsvd_eq :4; 365 uint32_t :4; 366 uint32_t log_max_eq :4; 367 368 uint32_t log_rsvd_mtt :4; 369 uint32_t :4; 370 uint32_t log_max_mrw_sz :8; 371 uint32_t :4; 372 uint32_t log_rsvd_dmpt :4; 373 uint32_t :2; 374 uint32_t log_max_mtt :6; 375 376 uint32_t :32; 377 378 uint32_t :10; 379 uint32_t log_max_ra_req_qp :6; 380 uint32_t :10; 381 uint32_t log_max_ra_res_qp :6; 382 383 uint32_t :11; /* new w/ 0.35, RSS info */ 384 uint32_t log_max_gso_sz :5; /* Lge Send Offload */ 385 uint32_t :2; 386 uint32_t rss_xor :1; /* rss xor hashing */ 387 uint32_t rss_toep :1; /* rss toeplitz hashing */ 388 uint32_t log_max_rss_tbl_sz :4; 389 uint32_t :2; 390 uint32_t log_max_ra_glob :6; 391 392 uint32_t :31; 393 uint32_t mod_wr_srq :1; 394 395 uint32_t :11; 396 uint32_t ca_ack_delay :5; 397 /* PRM 0.35, stuff moved to per port info */ 398 uint32_t :12; 399 uint32_t num_ports :4; 400 401 uint32_t :3; 402 uint32_t log_max_msg :5; 403 uint32_t :8; 404 uint32_t :12; 405 uint32_t :4; 406 407 uint32_t stat_rate_sup :16; 408 uint32_t :12; 409 uint32_t :4; 410 411 uint32_t :32; 412 413 uint32_t :6; 414 uint32_t router :1; 415 uint32_t pg_on_demand :1; 416 uint32_t :2; 417 uint32_t ud_multi :1; 418 uint32_t avp :1; 419 uint32_t raw_multi :1; 420 uint32_t atomic :1; 421 uint32_t apm :1; 422 uint32_t mem_win :1; 423 uint32_t :5; 424 uint32_t vmm :1; 425 uint32_t qkey_v :1; 426 uint32_t pkey_v :1; 427 uint32_t ipoib_cksm :1; 428 uint32_t srq :1; 429 uint32_t fcoib :1; 430 uint32_t rcm :1; 431 uint32_t xrc :1; 432 uint32_t ud :1; 433 uint32_t uc :1; 434 uint32_t rc :1; 435 436 uint32_t num_rsvd_uar :4; 437 uint32_t :6; 438 uint32_t log_max_uar_sz :6; 439 uint32_t :8; 440 uint32_t log_pg_sz :8; 441 442 uint32_t blu_flm :1; 443 uint32_t :10; 444 uint32_t log_bf_reg_sz :5; 445 uint32_t :2; 446 uint32_t log_max_bf_req_ppg :6; 447 uint32_t :2; 448 uint32_t log_max_bf_page :6; 449 450 uint32_t :8; 451 uint32_t max_sg_sq :8; 452 uint32_t max_desc_sz_sq :16; 453 454 uint32_t :8; 455 uint32_t max_sg_rq :8; 456 uint32_t max_desc_sz_rq :16; 457 458 uint32_t rsvd_fcoib[2]; 459 460 uint32_t :8; 461 uint32_t log_max_qp_mcg :8; 462 uint32_t :4; 463 uint32_t num_rsvd_mcg :4; 464 uint32_t log_max_mcg :8; 465 466 uint32_t num_rsvd_pd :4; 467 uint32_t :7; 468 uint32_t log_max_pd :5; 469 uint32_t num_rsvd_srcds :4; 470 uint32_t :8; 471 uint32_t log_max_srcd :4; 472 473 uint32_t rsrv2[6]; 474 475 uint32_t rdmardc_entry_sz :16; 476 uint32_t qpc_entry_sz :16; 477 478 uint32_t aux_entry_sz :16; 479 uint32_t altc_entry_sz :16; 480 481 uint32_t eqc_entry_sz :16; 482 uint32_t cqc_entry_sz :16; 483 484 uint32_t srq_entry_sz :16; 485 uint32_t cmpt_entry_sz :16; 486 487 uint32_t mtt_entry_sz :16; 488 uint32_t dmpt_entry_sz :16; 489 490 uint32_t :20; 491 uint32_t fast_reg_wr :1; 492 uint32_t reserved_lkey :1; 493 uint32_t win_type2 :1; 494 uint32_t :1; 495 uint32_t remote_inv :1; 496 uint32_t local_inv :1; 497 uint32_t lif :1; 498 uint32_t zb :1; 499 uint32_t bl :1; 500 uint32_t mps :1; 501 uint32_t win_type :1; 502 uint32_t bmme :1; 503 504 uint32_t rsv_lkey; 505 506 uint32_t :32; 507 508 uint64_t max_icm_size; 509 510 uint32_t rsrv3[22]; 511}; 512#endif 513 514 515 516/* 517 * Hermon "QUERY_FW" command 518 * The QUERY_FW command retrieves the firmware revision and the Command 519 * Interface revision. The command also returns the HCA attached local 520 * memory area (DDR) which is used by the firmware. Below we also 521 * include some defines which are used to enforce a minimum firmware 522 * version check (see hermon_fw_version_check() for more details). 523 */ 524 525#ifdef _LITTLE_ENDIAN 526struct hermon_hw_queryfw_s { 527 uint32_t fw_rev_minor :16; 528 uint32_t fw_rev_subminor :16; 529 530 uint32_t fw_rev_major :16; 531 uint32_t fw_pages :16; 532 533 uint32_t log_max_cmd :8; 534 uint32_t :23; 535 uint32_t dbg_trace :1; 536 537 uint32_t cmd_intf_rev :16; 538 uint32_t :16; 539 540 uint32_t fw_day :8; 541 uint32_t fw_month :8; 542 uint32_t fw_year :16; 543 544 uint32_t :1; 545 uint32_t ccq :1; 546 uint32_t :6; 547 uint32_t fw_sec :8; 548 uint32_t fw_min :8; 549 uint32_t fw_hour :8; 550 551 uint32_t rsrv0[2]; 552 553 uint64_t clr_intr_offs; 554 555 uint32_t :32; 556 557 uint32_t :30; 558 uint32_t clr_int_bar :2; 559 560 uint64_t error_buf_addr; 561 562 uint32_t :30; 563 uint32_t err_buf_bar :2; 564 565 uint32_t error_buf_sz; 566 567 uint32_t rsrv2[48]; 568}; 569#else 570struct hermon_hw_queryfw_s { 571 uint32_t fw_pages :16; 572 uint32_t fw_rev_major :16; 573 574 uint32_t fw_rev_subminor :16; 575 uint32_t fw_rev_minor :16; 576 577 uint32_t :16; 578 uint32_t cmd_intf_rev :16; 579 580 uint32_t dbg_trace :1; 581 uint32_t :23; 582 uint32_t log_max_cmd :8; 583 584 uint32_t fw_hour :8; 585 uint32_t fw_min :8; 586 uint32_t fw_sec :8; 587 uint32_t :6; 588 uint32_t ccq :1; 589 uint32_t :1; 590 591 uint32_t fw_year :16; 592 uint32_t fw_month :8; 593 uint32_t fw_day :8; 594 595 uint32_t rsrv1[2]; 596 597 uint64_t clr_intr_offs; 598 599 uint32_t clr_int_bar :2; 600 uint32_t :30; 601 602 uint32_t :32; 603 604 uint64_t error_buf_addr; 605 606 uint32_t error_buf_sz; 607 608 uint32_t err_buf_bar :2; 609 uint32_t :30; 610 611 uint32_t rsrv2[48]; 612}; 613#endif 614 615/* 616 * need to have min 2.3.0 to include config_spec_qp and SMA in FW 617 */ 618 619#define HERMON_FW_VER_MAJOR 0x0002 /* TBD for Hermon */ 620#define HERMON_FW_VER_MINOR 0x0005 621#define HERMON_FW_VER_SUBMINOR 0x0000 622 623/* 624 * Hermon "QUERY_ADAPTER" command 625 * The QUERY_ADAPTER command retrieves adapter specific parameters. The 626 * command also retrieves the PCI(X) interrupt pin routing for each of 627 * the INTx# pins supported by the device. This information is used by 628 * the driver during interrupt processing in order to clear the appropriate 629 * interrupt bit. 630 */ 631#ifdef _LITTLE_ENDIAN 632struct hermon_hw_queryadapter_s { 633 uint32_t rsrv0[4]; 634 635 uint32_t :32; 636 637 uint32_t :24; 638 uint32_t inta_pin :8; 639 640 uint32_t vsd_vend_id :16; /* added v35 hermon */ 641 uint32_t :16; 642 643 uint32_t :32; 644 645 uint32_t vsd[52]; 646 uint32_t psid[4]; 647}; 648#else 649struct hermon_hw_queryadapter_s { 650 uint32_t rsrv0[4]; 651 652 uint32_t inta_pin :8; 653 uint32_t :24; 654 655 uint32_t :32; 656 657 uint32_t :32; 658 659 uint32_t :16; 660 uint32_t vsd_vend_id :16; /* added v35 hermon */ 661 662 uint32_t vsd[52]; 663 uint32_t psid[4]; 664}; 665#endif 666#define HERMON_REV_A0 0xA0 667#define HERMON_REV_A1 0xA1 668 669/* 670 * Virtual physical mapping structure for: MAP_FA, MAP_ICM_AUX, and 671 * MAP_ICM commands. 672 */ 673 674#ifdef _LITTLE_ENDIAN 675struct hermon_hw_vpm_s { 676 uint32_t :12; 677 uint32_t vaddr_l :20; 678 uint32_t vaddr_h; 679 680 uint32_t log2sz :5; 681 uint32_t :7; 682 uint32_t paddr_l :20; 683 uint32_t paddr_h; 684}; 685#else 686struct hermon_hw_vpm_s { 687 uint32_t vaddr_h; 688 uint32_t vaddr_l :20; 689 uint32_t :12; 690 691 uint32_t paddr_h; 692 uint32_t paddr_l :20; 693 uint32_t :7; 694 uint32_t log2sz :5; 695}; 696#endif 697 698 699 700 701/* 702 * Hermon "INIT_HCA" and "QUERY_HCA" commands 703 * The INIT_HCA command configures all HCA resources in HCA attached local 704 * memory and some system relevant information. The same mailbox output 705 * format is used by the QUERY_HCA command. All parameters, which are 706 * specifically the output of the QUERY_HCA command are marked as 707 * "QUERY_HCA only". These parameters are not configurable through the 708 * INIT_HCA command, but can be retrieved as read-only through the 709 * QUERY_HCA command. 710 * 711 * Below we first define several structures which help make up the whole 712 * of the INIT_HCA/QUERY_HCA command. These are: 713 * hermon_hw_qp_ee_cq_eq_rdb_t for "QPC/EEC/CQC/EQC/RDB Parameters", 714 * hermon_udav_mem_param_t for "Memory Access Parameters for UDAV Table", 715 * hermon_multicast_param_t for "Multicast Support Parameters", 716 * hermon_tpt_param_t for "Translation and Protection Table Parameters", 717 * and hermon_uar_param_t for Hermon "UAR Parameters". 718 */ 719 720/* 721 * need to consider removing any ref to "ee", hermon doesn't support 722 * ee/rd stuff, and they've taken away the pretense 723 */ 724 725 726#ifdef _LITTLE_ENDIAN 727typedef struct hermon_hw_qp_ee_cq_eq_rdb_s { 728 uint32_t rsrv0[4]; 729 730 uint32_t log_num_qp :5; 731 uint32_t qpc_baseaddr_l :27; 732 uint32_t qpc_baseaddr_h; 733 734 uint32_t rsrv1[4]; 735 736 uint32_t log_num_srq :5; 737 uint32_t srqc_baseaddr_l :27; 738 uint32_t srqc_baseaddr_h; 739 740 uint32_t log_num_cq :5; 741 uint32_t cqc_baseaddr_l :27; 742 uint32_t cqc_baseaddr_h; 743 744 uint32_t rsrv2[2]; 745 746 uint64_t altc_baseaddr; 747 748 uint32_t rsrv3[2]; 749 750 uint64_t auxc_baseaddr; 751 752 uint32_t rsrv4[2]; 753 754 uint32_t log_num_eq :5; 755 uint32_t eqc_baseaddr_l :27; 756 uint32_t eqc_baseaddr_h; 757 758 uint32_t rsv5[2]; 759 760 uint32_t log_num_rdmardc :3; 761 uint32_t :2; 762 uint32_t rdmardc_baseaddr_l :27; 763 uint32_t rdmardc_baseaddr_h; 764 765 uint32_t rsrv6[2]; 766} hermon_hw_qp_ee_cq_eq_rdb_t; 767#else 768typedef struct hermon_hw_qp_ee_cq_eq_rdb_s { 769 uint32_t rsrv0[4]; 770 771 uint32_t qpc_baseaddr_h; 772 uint32_t qpc_baseaddr_l :27; 773 uint32_t log_num_qp :5; 774 775 uint32_t rsrv1[4]; 776 777 uint32_t srqc_baseaddr_h; 778 uint32_t srqc_baseaddr_l :27; 779 uint32_t log_num_srq :5; 780 781 uint32_t cqc_baseaddr_h; 782 uint32_t cqc_baseaddr_l :27; 783 uint32_t log_num_cq :5; 784 785 uint32_t rsrv2[2]; 786 787 uint64_t altc_baseaddr; 788 789 uint32_t rsrv3[2]; 790 791 uint64_t auxc_baseaddr; 792 793 uint32_t rsrv4[2]; 794 795 uint32_t eqc_baseaddr_h; 796 uint32_t eqc_baseaddr_l :27; 797 uint32_t log_num_eq :5; 798 799 uint32_t rsv5[2]; 800 801 uint32_t rdmardc_baseaddr_h; 802 uint32_t rdmardc_baseaddr_l :27; 803 uint32_t :2; 804 uint32_t log_num_rdmardc :3; 805 806 uint32_t rsrv6[2]; 807} hermon_hw_qp_ee_cq_eq_rdb_t; 808#endif 809 810 811 812 813#ifdef _LITTLE_ENDIAN 814typedef struct hermon_multicast_param_s { 815 uint64_t mc_baseaddr; 816 817 uint32_t rsrv0[2]; 818 819 uint32_t log_mc_tbl_hash_sz :5; 820 uint32_t :27; 821 822 uint32_t log_mc_tbl_ent :5; 823 uint32_t :27; 824 825 uint32_t :32; 826 827 uint32_t log_mc_tbl_sz :5; 828 uint32_t :19; 829 uint32_t mc_hash_fn :3; 830 uint32_t :5; 831} hermon_multicast_param_t; 832#else 833typedef struct hermon_multicast_param_s { 834 uint64_t mc_baseaddr; 835 836 uint32_t rsrv0[2]; 837 838 uint32_t :27; 839 uint32_t log_mc_tbl_ent :5; 840 841 uint32_t :27; 842 uint32_t log_mc_tbl_hash_sz :5; 843 844 uint32_t :5; 845 uint32_t mc_hash_fn :3; 846 uint32_t :19; 847 uint32_t log_mc_tbl_sz :5; 848 849 uint32_t :32; 850} hermon_multicast_param_t; 851#endif 852 853#define HERMON_MCG_DEFAULT_HASH_FN 0x0 854 855#ifdef _LITTLE_ENDIAN 856typedef struct hermon_tpt_param_s { 857 uint64_t dmpt_baseaddr; 858 859 uint32_t :32; 860 uint32_t log_dmpt_sz :6; 861 uint32_t :2; 862 uint32_t pgfault_rnr_to :5; 863 uint32_t :19; 864 865 uint64_t mtt_baseaddr; 866 867 uint64_t cmpt_baseaddr; 868} hermon_tpt_param_t; 869#else 870typedef struct hermon_tpt_param_s { 871 uint64_t dmpt_baseaddr; 872 873 uint32_t :19; 874 uint32_t pgfault_rnr_to :5; 875 uint32_t :2; 876 uint32_t log_dmpt_sz :6; 877 uint32_t :32; 878 879 uint64_t mtt_baseaddr; 880 881 uint64_t cmpt_baseaddr; 882} hermon_tpt_param_t; 883#endif 884 885 886#ifdef _LITTLE_ENDIAN 887typedef struct hermon_uar_param_s { 888 uint32_t rsvd0[2]; 889 890 uint32_t :32; 891 892 uint32_t uar_pg_sz :8; 893 uint32_t log_max_uars :4; 894 uint32_t :20; 895 896 uint32_t resvd1[4]; 897} hermon_uar_param_t; 898#else 899typedef struct hermon_uar_param_s { 900 uint32_t rsvd0[2]; 901 902 uint32_t :20; 903 uint32_t log_max_uars :4; 904 uint32_t uar_pg_sz :8; 905 906 uint32_t :32; 907 908 uint32_t resvd1[4]; 909} hermon_uar_param_t; 910#endif 911 912/* 913 * NEW for Hermon 914 * QP Allocation Params 915 * 916 */ 917 918#ifdef _LITTLE_ENDIAN 919typedef struct hermon_qp_alloc_param_s { 920 uint32_t :32; 921 922 uint32_t ccq_base :24; 923 uint32_t log2ccqs :5; 924 uint32_t :2; 925 uint32_t ccq_en :1; 926 927 uint32_t rsvd[6]; /* but 0x14 def'd for fibre channel */ 928} hermon_qp_alloc_param_t; 929#else /* BIG ENDIAN */ 930typedef struct hermon_qp_alloc_param_s { 931 uint32_t ccq_en :1; 932 uint32_t :2; 933 uint32_t log2ccqs :5; 934 uint32_t ccq_base :24; 935 936 uint32_t :32; 937 938 uint32_t rsvd[6]; /* but 0x14 def'd for fibre channel */ 939} hermon_qp_alloc_param_t; 940#endif 941 942#ifdef _LITTLE_ENDIAN 943struct hermon_hw_initqueryhca_s { 944 uint32_t :32; 945 946 uint32_t :24; 947 uint32_t version :8; 948 949 uint32_t :13; 950 uint32_t log2_cacheline :3; 951 uint32_t hca_core_clock :16; /* QUERY_HCA only */ 952 953 uint32_t :32; 954 955 uint32_t udav_port_chk :1; 956 uint32_t big_endian :1; 957 uint32_t :1; 958 uint32_t chsum_en :1; 959 uint32_t :28; 960 961 uint32_t router_qp :24; 962 uint32_t :5; 963 uint32_t ipr2 :1; 964 uint32_t ipr1 :1; 965 uint32_t router_en :1; 966 967 uint32_t rsrv1[2]; 968 969 hermon_hw_qp_ee_cq_eq_rdb_t context; 970 971 uint32_t rsrv2[8]; 972 973 hermon_multicast_param_t multi; 974 975 uint32_t rsrv3[4]; 976 977 hermon_tpt_param_t tpt; 978 979 uint32_t rsrv4[4]; 980 981 hermon_uar_param_t uar; 982 983 uint32_t rsrv5[4]; 984 985 hermon_qp_alloc_param_t qp_alloc; 986 987 uint32_t rsrv6[100]; /* from 0x16c to 0x2fc offsets */ 988}; 989#else /* BIG ENDIAN */ 990struct hermon_hw_initqueryhca_s { 991 uint32_t version :8; 992 uint32_t :24; 993 994 uint32_t :32; 995 996 uint32_t :32; 997 998 uint32_t hca_core_clock :16; /* QUERY_HCA only */ 999 uint32_t log2_cacheline :3; 1000 uint32_t :13; 1001 1002 uint32_t router_en :1; 1003 uint32_t ipr1 :1; 1004 uint32_t ipr2 :1; 1005 uint32_t :5; 1006 uint32_t router_qp :24; 1007 1008 uint32_t :28; 1009 uint32_t chsum_en :1; 1010 uint32_t :1; 1011 uint32_t big_endian :1; 1012 uint32_t udav_port_chk :1; 1013 1014 uint32_t rsrv1[2]; 1015 1016 hermon_hw_qp_ee_cq_eq_rdb_t context; 1017 1018 uint32_t rsrv2[8]; 1019 1020 hermon_multicast_param_t multi; 1021 1022 uint32_t rsrv3[4]; 1023 1024 hermon_tpt_param_t tpt; 1025 1026 uint32_t rsrv4[4]; 1027 1028 hermon_uar_param_t uar; 1029 1030 uint32_t rsrv5[4]; 1031 1032 hermon_qp_alloc_param_t qp_alloc; 1033 1034 uint32_t rsrv6[100]; /* from 0x16c to 0x2fc offsets */ 1035}; 1036#endif 1037#define HERMON_UDAV_PROTECT_DISABLED 0x0 1038#define HERMON_UDAV_PROTECT_ENABLED 0x1 1039#define HERMON_UDAV_PORTCHK_DISABLED 0x0 1040#define HERMON_UDAV_PORTCHK_ENABLED 0x1 1041 1042 1043/* 1044 * Hermon "INIT_IB"/"INIT_PORT" command 1045 * The INIT_IB/INIT_PORT command enables the physical layer of an IB port. 1046 * It provides control over the IB port attributes. The capabilities 1047 * requested here should not exceed the device limits, as retrieved by 1048 * the QUERY_DEV_LIM/CAP command (above). To query information about the IB 1049 * port or node, the driver may submit GetPortInfo or GetNodeInfo MADs 1050 * through the Hermon MAD_IFC command. 1051 * 1052 * Changed name to initport, but operates similar to initib - but as of 1053 * PRM v0.35c the initport just does that, and the params set previously 1054 * by initib are now set in SET_PORT 1055 */ 1056 1057 1058 1059 1060/* 1061 * HERMON query_port and set_port commands. QUERY_PORT is new for hermon, 1062 * doing some of what used to be done in the QUERY_DEV_CAP command. It is 1063 * introduced in PRM v0.35 and will need to be added to the list of 1064 * supported HCA commands 1065 * 1066 * SET_PORT is similar to the SET_IB command from tavor and arbel. Here, 1067 * tho, it's more extensive and will be easier to deal with I suspect by 1068 * making it a structure and filling it in and then doing the copy to the 1069 * mailbox (instead of just writing the minimal information to the mailbox 1070 * directly as was done for the previous HCAs). 1071 */ 1072 1073#ifdef _LITTLE_ENDIAN 1074struct hermon_hw_query_port_s { 1075 uint32_t log_max_pkey :4; /* pkey table size */ 1076 uint32_t log_max_gid :4; /* max gids / port */ 1077 /* was max_port_width arbel: long list of values */ 1078 uint32_t ib_port_wid :4; 1079 uint32_t :4; 1080 uint32_t :4; /* other types possibly */ 1081 uint32_t :4; 1082 /* 1083 * 0x1=2.5G, 0x3=2.5 or 5.0G, 0x5=2.5 or 10G 1084 * 0x7=2.5, 5.0, or 10G, others rsvd 1085 */ 1086 uint32_t ib_link_spd :4; 1087 1088 uint32_t :4; 1089 1090 uint32_t :16; /* used for other types (?) */ 1091 uint32_t ib_mtu :4; 1092 /* 1093 * 0x0 rsvd, 0x1=256, 0x2=512, 0x3=1024, 0x5=2048 1094 * 0x5=4096, others rsvd 1095 */ 1096 uint32_t :4; 1097 uint32_t port_type :8; /* 0x00, 0x01 IB, others TBD */ 1098 1099 uint32_t :32; 1100 /* max vl's supported (not incl vl_15) */ 1101 uint32_t max_vl :4; 1102 uint32_t :4; 1103 uint32_t :8; /* but others possibly */ 1104 uint32_t :16; 1105 1106 uint32_t rsvd0[2]; /* but for other types */ 1107 uint32_t rsvd1[504]; 1108}; 1109#else /* BIG ENDIAN */ 1110struct hermon_hw_query_port_s { 1111 uint32_t port_type :8; /* 0x00, 0x01 IB, others TBD */ 1112 uint32_t :4; 1113 /* 1114 * 0x0 rsvd, 0x1=256, 0x2=512, 0x3=1024, 0x5=2048 1115 * 0x1=256, 0x2=512, 0x3=1024, 0x5=2048 1116 */ 1117 uint32_t ib_mtu :4; 1118 /* 0x5=4096, others rsvd */ 1119 uint32_t :16; /* used for other types (?) */ 1120 1121 uint32_t :4; 1122 uint32_t ib_link_spd :4; 1123 /* 1124 * 0x1=2.5G, 0x3=2.5 or 5.0G, 0x5=2.5 or 10G 1125 * 0x7=2.5, 5.0, or 10G, others rsvd 1126 */ 1127 uint32_t :4; 1128 uint32_t :4; /* other types possibly */ 1129 uint32_t :4; 1130 /* was max_port_width arbel: long list of values */ 1131 uint32_t ib_port_wid :4; 1132 uint32_t log_max_gid :4; /* max gids / port */ 1133 uint32_t log_max_pkey :4; /* pkey table size */ 1134 1135 uint32_t :16; 1136 uint32_t :8; /* but others possibly */ 1137 uint32_t :4; 1138 /* max vl's supported (not incl vl_15) */ 1139 uint32_t max_vl :4; 1140 1141 uint32_t :32; 1142 1143 uint32_t rsvd0[2]; /* but for other types */ 1144 uint32_t rsvd1[504]; 1145 1146}; 1147#endif 1148 1149#ifdef _LITTLE_ENDIAN 1150struct hermon_hw_set_port_s { 1151 uint32_t cap_mask; 1152 1153 uint32_t rqk :1; /* reset qkey violation cntr */ 1154 uint32_t :15; 1155 uint32_t g0 :1; /* set port GUID0 */ 1156 uint32_t ng :1; /* set node GUID (all ports) */ 1157 uint32_t sig :1; /* set sys image */ 1158 uint32_t mg :1; /* change GID table */ 1159 uint32_t mp :1; /* change pkey table size */ 1160 uint32_t :11; 1161 1162 uint64_t sys_img_guid; 1163 1164 uint64_t guid0; 1165 1166 uint64_t node_guid; 1167 1168 uint32_t sniff_qpn_base :24; 1169 uint32_t ge :1; /* glob egress sniff enabled */ 1170 uint32_t gi :1; /* glob ingress sniff enabled */ 1171 uint32_t qe :1; /* qp-egress sniff enable */ 1172 uint32_t qi :1; /* qp-ingress sniff enabled */ 1173 uint32_t :4; 1174 1175 uint32_t router_qpn_base :24; 1176 uint32_t routermode :1; 1177 uint32_t :7; 1178 1179 uint32_t :32; 1180 1181 uint32_t max_guid :16; /* valid if noted above */ 1182 uint32_t max_pkey :16; /* valid if noted above */ 1183 1184 uint32_t rsrd0[500]; 1185}; 1186#else /* BIG ENDIAN */ 1187struct hermon_hw_set_port_s { 1188 uint32_t :11; 1189 uint32_t mp :1; /* change pkey table size */ 1190 uint32_t mg :1; /* change GID table size */ 1191 uint32_t sig :1; /* set sys image GUID */ 1192 uint32_t ng :1; /* set node GUID (all ports) */ 1193 uint32_t g0 :1; /* set port GUID0 */ 1194 uint32_t :15; 1195 uint32_t rqk :1; /* reset qkey violation cntr */ 1196 1197 uint32_t cap_mask; 1198 1199 uint64_t sys_img_guid; 1200 1201 uint64_t guid0; 1202 1203 uint64_t node_guid; 1204 1205 uint32_t :7; 1206 uint32_t routermode :1; 1207 uint32_t router_qpn_base :24; 1208 1209 uint32_t :4; 1210 uint32_t qi :1; /* qp-ingress sniff enabled */ 1211 uint32_t qe :1; /* qp-egress sniff enable */ 1212 uint32_t gi :1; /* glob ingress sniff enabled */ 1213 uint32_t ge :1; /* glob egress sniff enabled */ 1214 uint32_t sniff_qpn_base :24; 1215 1216 uint32_t max_pkey :16; /* valid if noted above */ 1217 uint32_t max_guid :16; /* valid if noted above */ 1218 1219 uint32_t :32; 1220 1221 uint32_t rsrd0[500]; 1222}; 1223#endif 1224 1225 1226 1227 1228/* 1229 * Hermon Memory Protection Table (MPT) entries 1230 * 1231 * The Memory Protection Table (MPT) contains the information associated 1232 * with all the regions and windows. The MPT table resides in a virtually- 1233 * contiguous area in ICM, and the memory key (R_Key or L_Key) is used to 1234 * calculate the physical address for accessing the entries in the table. 1235 * 1236 * 1237 * The SW2HW_MPT command transfers ownership of an MPT entry from software 1238 * to hardware. The command takes the MPT entry from the input mailbox and 1239 * stores it in the MPT in the hardware. The command will fail if the 1240 * requested MPT entry is already owned by the hardware or if the MPT index 1241 * given in the command is inconsistent with the MPT entry memory key. 1242 * The QUERY_MPT command retrieves a snapshot of an MPT entry. The command 1243 * takes the current state of an MPT entry from the hardware and stores it 1244 * in the output mailbox. The command will fail if the requested MPT entry 1245 * is already owned by software. 1246 * Finally, the HW2SW_MPT command transfers ownership of an MPT entry from 1247 * the hardware to the software. The command takes the MPT entry from the 1248 * hardware, invalidates it, and stores it in the output mailbox. The 1249 * command will fail if the requested entry is already owned by software. 1250 * The command will also fail if the MPT entry in question is a Memory 1251 * Region which has Memory Windows currently bound to it. 1252 * 1253 * The following structure is used in the SW2HW_MPT, QUERY_MPT, and 1254 * HW2SW_MPT commands, and ONLY for the dMPT - for data. 1255 */ 1256 1257#ifdef _LITTLE_ENDIAN 1258struct hermon_hw_dmpt_s { 1259 uint32_t :7; 1260 uint32_t bnd_qp :1; 1261 uint32_t qpn :24; /* dw 1, byte 4-7 */ 1262 1263 uint32_t :8; 1264 uint32_t reg_win :1; 1265 uint32_t phys_addr :1; 1266 uint32_t lr :1; 1267 uint32_t lw :1; 1268 uint32_t rr :1; 1269 uint32_t rw :1; 1270 uint32_t atomic :1; 1271 uint32_t en_bind :1; 1272 uint32_t atc_req :1; 1273 uint32_t atc_xlat :1; 1274 uint32_t :1; 1275 uint32_t no_snoop :1; 1276 uint32_t :8; 1277 uint32_t status :4; /* dw 0, byte 0-3 */ 1278 1279 uint32_t pd :24; 1280 uint32_t ren_inval :1; 1281 uint32_t en_inval :1; 1282 uint32_t net_cache :1; 1283 uint32_t fast_reg_en :1; 1284 uint32_t rem_acc_en :1; 1285 uint32_t w_dif :1; 1286 uint32_t m_dif :1; 1287 uint32_t :1; /* dw 2, byte 0xc-f */ 1288 1289 uint32_t mem_key; 1290 uint64_t start_addr; /* dw 4-5, byte 0x10-17 */ 1291 1292 uint64_t reg_win_len; /* dw 6-7, byte 0x18-1f */ 1293 1294 uint32_t win_cnt :24; 1295 uint32_t :8; /* dw 9, byte 0x24-27 */ 1296 1297 uint32_t lkey; /* dw 8, byte 0x20-23 */ 1298 1299 uint32_t mtt_addr_h :8; 1300 uint32_t :24; /* dw 11, byte 0x2c-2f */ 1301 1302 uint32_t mtt_rep :4; 1303 uint32_t :17; 1304 uint32_t blk_mode :1; 1305 uint32_t len_b64 :1; /* bit 64 of length */ 1306 uint32_t fbo_en :1; 1307 uint32_t :8; /* dw 10, byte 0x28-2b */ 1308 1309 uint32_t mtt_size; /* dw 13, byte 0x34-37 */ 1310 1311 uint32_t :3; 1312 uint32_t mtt_addr_l :29; /* dw 12, byte 0x30-33 */ 1313 1314 uint32_t mtt_fbo :21; 1315 uint32_t :11; /* dw 15, byte 0x3c-3f */ 1316 1317 uint32_t entity_sz :21; 1318 uint32_t :11; /* dw 14, byte 0x38-3b */ 1319#ifdef HERMON_NOTIMPL 1320 uint32_t dif_m_atag :16; 1321 uint32_t :16; /* dw 17, 0x44-47 */ 1322 1323 uint32_t dif_a_msk :16; 1324 uint32_t dif_v_msk :2; 1325 uint32_t dif_rep :2; 1326 uint32_t :9; 1327 uint32_t dif_err :3; /* dw 16, 0x40-43 */ 1328 1329 uint32_t dif_w_atag :16; 1330 uint32_t :16; /* dw 19, 0x4c-4f */ 1331 1332 uint32_t dif_m_rtagb; /* dw 18, 0x48-4b */ 1333 1334 uint32_t :32; 1335 1336 uint32_t dif_w_rtagb; /* dw 20, 0x50-53 */ 1337#endif /* HERMON_NOTIMPL */ 1338}; 1339 1340#else /* BIG ENDIAN */ 1341struct hermon_hw_dmpt_s { 1342 uint32_t status :4; 1343 uint32_t :8; 1344 uint32_t no_snoop :1; 1345 uint32_t :1; 1346 uint32_t atc_xlat :1; 1347 uint32_t atc_req :1; 1348 uint32_t en_bind :1; 1349 uint32_t atomic :1; 1350 uint32_t rw :1; 1351 uint32_t rr :1; 1352 uint32_t lw :1; 1353 uint32_t lr :1; 1354 uint32_t phys_addr :1; 1355 uint32_t reg_win :1; 1356 uint32_t :8; /* dw 0, byte 0x0-3 */ 1357 1358 uint32_t qpn :24; 1359 uint32_t bnd_qp :1; 1360 uint32_t :7; /* dw 1, byte 0x4-7 */ 1361 1362 uint32_t mem_key; /* dw 2, byte 0x8-b */ 1363 1364 uint32_t :1; 1365 uint32_t m_dif :1; 1366 uint32_t w_dif :1; 1367 uint32_t rem_acc_en :1; 1368 uint32_t fast_reg_en :1; 1369 uint32_t net_cache :1; 1370 uint32_t en_inval :1; 1371 uint32_t ren_inavl :1; 1372 uint32_t pd :24; /* dw 3, byte 0xc-f */ 1373 1374 uint64_t start_addr; /* dw 4-5, byte 0x10-17 */ 1375 1376 uint64_t reg_win_len; /* dw 6-7, byte 0x18-1f */ 1377 1378 uint32_t lkey; /* dw 8, bytd 0x20-23 */ 1379 1380 uint32_t :8; 1381 uint32_t win_cnt :24; /* dw 9, byte 0x24-27 */ 1382 1383 uint32_t :8; 1384 uint32_t fbo_en :1; 1385 uint32_t len_b64 :1; /* bit 64 of length */ 1386 uint32_t blk_mode :1; 1387 uint32_t :17; 1388 uint32_t mtt_rep :4; /* dw 10, byte 0x28-2b */ 1389 1390 uint32_t :24; 1391 uint32_t mtt_addr_h :8; /* dw 11, byte 0x2c-2f */ 1392 1393 uint32_t mtt_addr_l :29; 1394 uint32_t :3; /* dw 12, byte 0x30-33 */ 1395 1396 uint32_t mtt_size; /* dw 13, byte 0x34-37 */ 1397 1398 uint32_t :11; 1399 uint32_t entity_sz :21; /* dw 14, byte 0x38-3b */ 1400 1401 uint32_t :11; 1402 uint32_t mtt_fbo :21; /* dw 15, byte 0x3c-3f */ 1403#ifdef HERMON_NOTIMPL 1404 1405 uint32_t dif_err :3; 1406 uint32_t :9; 1407 uint32_t dif_rep :2; 1408 uint32_t dif_v_msk :2; 1409 uint32_t dif_a_msk :16; /* dw 16, 0x40-43 */ 1410 1411 uint32_t :16; 1412 uint32_t dif_m_atag :16; /* dw 17, 0x44-47 */ 1413 1414 uint32_t dif_m_rtagb; /* dw 18, 0x48-4b */ 1415 1416 uint32_t :16; 1417 uint32_t dif_w_atag :16; /* dw 19, 0x4c-4f */ 1418 1419 uint32_t dif_w_rtagb; /* dw 20, 0x50-53 */ 1420 1421 uint32_t :32; 1422#endif /* HERMON_NOTIMPL */ 1423}; 1424#endif 1425 1426/* 1427 * The following structure is for the CMPTs. This is NEVER actually built and 1428 * passed to the hardware - we use it to track information needed for the 1429 * context entries, and to facilitate the alloc tracking. It differs from 1430 * the dMPT sturcture above in that it does not have/need the "dif" stuff. 1431 * 1432 */ 1433 1434 1435 1436#ifdef _LITTLE_ENDIAN 1437struct hermon_hw_cmpt_s { 1438 uint32_t :7; 1439 uint32_t bnd_qp :1; 1440 uint32_t qpn :24; /* dw 1, byte 4-7 */ 1441 1442 uint32_t :8; 1443 uint32_t reg_win :1; 1444 uint32_t phys_addr :1; 1445 uint32_t lr :1; 1446 uint32_t lw :1; 1447 uint32_t rr :1; 1448 uint32_t rw :1; 1449 uint32_t atomic :1; 1450 uint32_t en_bind :1; 1451 uint32_t atc_req :1; 1452 uint32_t atc_xlat :1; 1453 uint32_t :1; 1454 uint32_t no_snoop :1; 1455 uint32_t :8; 1456 uint32_t status :4; /* dw 0, byte 0-3 */ 1457 1458 uint32_t pd :24; 1459 uint32_t ren_inval :1; 1460 uint32_t en_inval :1; 1461 uint32_t net_cache :1; 1462 uint32_t fast_reg_en :1; 1463 uint32_t rem_acc_en :1; 1464 uint32_t w_dif :1; 1465 uint32_t m_dif :1; 1466 uint32_t :1; /* dw 2, byte 0xc-f */ 1467 1468 uint32_t mem_key; 1469 uint64_t start_addr; /* dw 4-5, byte 0x10-17 */ 1470 1471 uint64_t reg_win_len; /* dw 6-7, byte 0x18-1f */ 1472 1473 uint32_t win_cnt :24; 1474 uint32_t :8; /* dw 9, byte 0x24-27 */ 1475 1476 uint32_t lkey; /* dw 8, byte 0x20-23 */ 1477 1478 uint32_t mtt_addr_h :8; 1479 uint32_t :24; /* dw 11, byte 0x2c-2f */ 1480 1481 uint32_t mtt_rep :4; 1482 uint32_t :17; 1483 uint32_t blk_mode :1; 1484 uint32_t len_b64 :1; /* bit 64 of length */ 1485 uint32_t fbo_en :1; 1486 uint32_t :8; /* dw 10, byte 0x28-2b */ 1487 1488 uint32_t mtt_size; /* dw 13, byte 0x34-37 */ 1489 1490 uint32_t :3; 1491 uint32_t mtt_addr_l :29; /* dw 12, byte 0x30-33 */ 1492 1493 uint32_t mtt_fbo :21; 1494 uint32_t :11; /* dw 15, byte 0x3c-3f */ 1495 1496 uint32_t entity_sz :21; 1497 uint32_t :11; /* dw 14, byte 0x38-3b */ 1498 1499}; 1500 1501 1502#else /* BIG ENDIAN */ 1503struct hermon_hw_cmpt_s { 1504 uint32_t status :4; 1505 uint32_t :8; 1506 uint32_t no_snoop :1; 1507 uint32_t :1; 1508 uint32_t atc_xlat :1; 1509 uint32_t atc_req :1; 1510 uint32_t en_bind :1; 1511 uint32_t atomic :1; 1512 uint32_t rw :1; 1513 uint32_t rr :1; 1514 uint32_t lw :1; 1515 uint32_t lr :1; 1516 uint32_t phys_addr :1; 1517 uint32_t reg_win :1; 1518 uint32_t :8; /* dw 0, byte 0x0-3 */ 1519 1520 uint32_t qpn :24; 1521 uint32_t bnd_qp :1; 1522 uint32_t :7; /* dw 1, byte 0x4-7 */ 1523 1524 uint32_t mem_key; /* dw 2, byte 0x8-b */ 1525 1526 uint32_t :1; 1527 uint32_t m_dif :1; 1528 uint32_t w_dif :1; 1529 uint32_t rem_acc_en :1; 1530 uint32_t fast_reg_en :1; 1531 uint32_t net_cache :1; 1532 uint32_t en_inval :1; 1533 uint32_t ren_inavl :1; 1534 uint32_t pd :24; /* dw 3, byte 0xc-f */ 1535 1536 uint64_t start_addr; /* dw 4-5, byte 0x10-17 */ 1537 1538 uint64_t reg_win_len; /* dw 6-7, byte 0x18-1f */ 1539 1540 uint32_t lkey; /* dw 8, bytd 0x20-23 */ 1541 1542 uint32_t :8; 1543 uint32_t win_cnt :24; /* dw 9, byte 0x24-27 */ 1544 1545 uint32_t :8; 1546 uint32_t fbo_en :1; 1547 uint32_t len_b64 :1; /* bit 64 of length */ 1548 uint32_t blk_mode :1; 1549 uint32_t :17; 1550 uint32_t mtt_rep :4; /* dw 10, byte 0x28-2b */ 1551 1552 uint32_t :24; 1553 uint32_t mtt_addr_h :8; /* dw 11, byte 0x2c-2f */ 1554 1555 uint32_t mtt_addr_l :29; 1556 uint32_t :3; /* dw 12, byte 0x30-33 */ 1557 1558 uint32_t mtt_size; /* dw 13, byte 0x34-37 */ 1559 1560 uint32_t :11; 1561 uint32_t entity_sz :21; /* dw 14, byte 0x38-3b */ 1562}; 1563#endif 1564 1565 1566#define HERMON_MEM_CYCLE_GENERATE 0x1 1567#define HERMON_IO_CYCLE_GENERATE 0x0 1568 1569#define HERMON_MPT_IS_WINDOW 0x0 1570#define HERMON_MPT_IS_REGION 0x1 1571 1572#define HERMON_MPT_DEFAULT_VERSION 0x0 1573 1574#define HERMON_UNLIMITED_WIN_BIND 0x0 1575 1576#define HERMON_PHYSADDR_ENABLED 0x1 1577#define HERMON_PHYSADDR_DISABLED 0x0 1578 1579 1580/* 1581 * Hermon Memory Translation Table (MTT) entries 1582 * After accessing the MPT table (above) and validating the access rights 1583 * to the region/window, Hermon address translation moves to the next step 1584 * where it translates the virtual address to a physical address. This 1585 * translation is performed using the Memory Translation Table entries 1586 * (MTT). Note: The MTT in hardware is organized into segments and each 1587 * segment contains multiple address translation pages (MTT entries). 1588 * Each memory region (MPT above) points to the first segment in the MTT 1589 * that corresponds to that region. 1590 */ 1591 1592#ifdef _LITTLE_ENDIAN 1593struct hermon_hw_mtt_s { 1594 uint32_t present :1; 1595 uint32_t :2; 1596 uint32_t ptag_l :29; 1597 1598 uint32_t ptag_h; 1599}; 1600#else /* BIG_ENDIAN */ 1601struct hermon_hw_mtt_s { 1602 uint32_t ptag_h; 1603 1604 uint32_t ptag_l :29; 1605 uint32_t :2; 1606 uint32_t present :1; 1607}; 1608 1609#endif 1610#define HERMON_MTT_ENTRY_NOTPRESENT 0x0 1611#define HERMON_MTT_ENTRY_PRESENT 0x1 1612 1613 1614/* 1615 * Hermon Event Queue Context Table (EQC) entries 1616 * Hermon supports 512 Event Queues, and the status of Event Queues is stored 1617 * in the Event Queue Context (EQC) table. The EQC table is a virtually- 1618 * contiguous memory structure in the ICM. Each EQC 1619 * table entry contains Event Queue status and information required by 1620 * the hardware in order to access the event queue. 1621 * NOTE that in Hermon (as opposed to earlier HCAs), 1622 * you have to allocate ICM for 2**32 (or about 16 M), even though 1623 * it doesn't support that many. See PRM v35. Also, some set of them 1624 * will be available for each domain in a virtual environment, needing to 1625 * rething the allocation and usage model for EQs - in the future. 1626 * 1627 * The following structure is used in the SW2HW_EQ, QUERY_EQ, and HW2SW_EQ 1628 * commands. 1629 * The SW2HW_EQ command transfers ownership of an EQ context from software 1630 * to hardware. The command takes the EQC entry from the input mailbox and 1631 * stores it in the EQC in the hardware. The command will fail if the 1632 * requested EQC entry is already owned by the hardware. NOTE: the 1633 * initialization of the cMPT for the EQC occurs implicitly as a result 1634 * of executing this command, and MR has/had to be adjusted for it. 1635 * The QUERY_EQ command retrieves a snapshot of an EQC entry. The command 1636 * stores the snapshot in the output mailbox. The EQC state and its values 1637 * are not affected by the QUERY_EQ command. 1638 * Finally, the HW2SW_EQ command transfers ownership of an EQC entry from 1639 * the hardware to the software. The command takes the EQC entry from the 1640 * hardware and stores it in the output mailbox. The EQC entry will be 1641 * invalidated as a result of the command. It is the responsibility of the 1642 * software to unmap all the events, which might have been previously 1643 * mapped to the EQ, prior to issuing the HW2SW_EQ command. 1644 */ 1645 1646 1647#ifdef _LITTLE_ENDIAN 1648struct hermon_hw_eqc_s { 1649 uint32_t :32; 1650 1651 uint32_t :8; 1652 uint32_t state :4; 1653 uint32_t :5; 1654 uint32_t overrun_ignore :1; 1655 uint32_t ev_coalesc :1; 1656 uint32_t :9; 1657 uint32_t status :4; 1658 1659 uint32_t :24; 1660 uint32_t log_eq_sz :5; 1661 uint32_t :3; 1662 1663 uint32_t :5; 1664 uint32_t pg_offs :7; 1665 uint32_t :20; 1666 1667 uint32_t intr :10; 1668 uint32_t :22; 1669 1670 uint32_t eq_max_cnt :16; 1671 uint32_t eq_period :16; 1672 1673 uint32_t :3; 1674 uint32_t mtt_base_addrl :29; 1675 1676 uint32_t mtt_base_addrh :8; 1677 uint32_t :16; 1678 uint32_t log2_pgsz :6; /* in 4K pages */ 1679 uint32_t :2; 1680 1681 uint32_t rsrv0[2]; 1682 1683 uint32_t prod_indx :24; 1684 uint32_t :8; 1685 1686 uint32_t cons_indx :24; 1687 uint32_t :8; 1688 1689 uint64_t rsrv1[2]; /* force it to 8b alignment */ 1690}; 1691#else /* BIG ENDIAN */ 1692struct hermon_hw_eqc_s { 1693 uint32_t status :4; 1694 uint32_t :9; 1695 uint32_t ev_coalesc :1; 1696 uint32_t overrun_ignore :1; 1697 uint32_t :5; 1698 uint32_t state :4; 1699 uint32_t :8; 1700 1701 uint32_t :32; 1702 1703 uint32_t :20; 1704 uint32_t pg_offs :7; 1705 uint32_t :5; 1706 1707 uint32_t :3; 1708 uint32_t log_eq_sz :5; 1709 uint32_t :24; 1710 1711 uint32_t eq_period :16; 1712 uint32_t eq_max_cnt :16; 1713 1714 uint32_t :22; 1715 uint32_t intr :10; 1716 1717 uint32_t :2; 1718 uint32_t log2_pgsz :6; /* in 4K pages */ 1719 uint32_t :16; 1720 uint32_t mtt_base_addrh :8; 1721 1722 uint32_t mtt_base_addrl :29; 1723 uint32_t :3; 1724 1725 uint32_t rsrv0[2]; 1726 1727 uint32_t :8; 1728 uint32_t cons_indx :24; 1729 1730 uint32_t :8; 1731 uint32_t prod_indx :24; 1732 1733 uint64_t rsrv1[2]; /* force it to 8b alignment */ 1734}; 1735#endif 1736#define HERMON_EQ_STATUS_OK 0x0 1737#define HERMON_EQ_STATUS_OVERFLOW 0x9 1738#define HERMON_EQ_STATUS_WRITE_FAILURE 0xA 1739 1740#define HERMON_EQ_ARMED 0x9 1741#define HERMON_EQ_FIRED 0xA 1742#define HERMON_EQ_ALWAYS_ARMED 0xB 1743 1744 1745/* 1746 * Hermon Event Queue Entries (EQE) 1747 * Each EQE contains enough information for the software to identify the 1748 * source of the event. The following structures are used to define each 1749 * of the various kinds of events that the Hermon hardware will generate. 1750 * Note: The hermon_hw_eqe_t below is the generic "Event Queue Entry". All 1751 * other EQEs differ only in the contents of their "event_data" field. 1752 * 1753 * Below we first define several structures which define the contents of 1754 * the "event_data" fields: 1755 * hermon_hw_eqe_cq_t for "Completion Queue Events" 1756 * hermon_hw_eqe_qp_evt_t for "Queue Pair Events" such as Path Migration 1757 * Succeeded, Path Migration Failed, Communication Established, Send 1758 * Queue Drained, Local WQ Catastrophic Error, Invalid Request Local 1759 * WQ Error, and Local Access Violation WQ Error. 1760 * hermon_hw_eqe_cqerr_t for "Completion Queue Error Events" 1761 * hermon_hw_eqe_portstate_t for "Port State Change Events" 1762 * hermon_hw_eqe_gpio_t for "GPIO State Change Events" 1763 * hermon_hw_eqe_cmdcmpl_t for "Command Interface Completion Events" 1764 * hermon_hw_eqe_operr_t for "Operational and Catastrophic Error Events" 1765 * such as EQ Overflow, Misbehaved UAR page, Internal Parity Error, 1766 * Uplink bus error, and DDR data error. 1767 * hermon_hw_eqe_pgflt_t for "Not-present Page Fault on WQE or Data 1768 * Buffer Access". (Note: Currently, this event is unsupported). 1769 * 1770 * Note also: The following structures are not #define'd with both 1771 * little-endian and big-endian definitions. This is because their 1772 * individual fields are not directly accessed except through the macros 1773 * defined below. 1774 */ 1775 1776 1777typedef struct hermon_hw_eqe_cq_s { 1778 uint32_t :8; 1779 uint32_t cqn :24; 1780 uint32_t rsrv0[5]; 1781} hermon_hw_eqe_cq_t; 1782 1783 1784 1785typedef struct hermon_hw_eqe_qp_evt_s { 1786 uint32_t :8; 1787 uint32_t qpn :24; 1788 1789 uint32_t rsrv0[5]; 1790} hermon_hw_eqe_qpevt_t; 1791 1792 1793typedef struct hermon_hw_eqe_cqerr_s { 1794 uint32_t :8; 1795 uint32_t cqn :24; 1796 1797 uint32_t :32; 1798 1799 uint32_t :24; 1800 uint32_t syndrome :8; 1801 1802 uint32_t rsrv0[3]; 1803} hermon_hw_eqe_cqerr_t; 1804#define HERMON_CQERR_OVERFLOW 0x1 1805#define HERMON_CQERR_ACCESS_VIOLATION 0x2 1806 1807 1808typedef struct hermon_hw_eqe_portstate_s { 1809 uint32_t rsrv0[2]; 1810 1811 uint32_t :2; 1812 uint32_t port :2; 1813 uint32_t :28; 1814 1815 uint32_t rsrv1[3]; 1816} hermon_hw_eqe_portstate_t; 1817#define HERMON_PORT_LINK_ACTIVE 0x4 1818#define HERMON_PORT_LINK_DOWN 0x1 1819 1820 1821typedef struct hermon_hw_eqe_gpio_s { 1822 uint32_t rsrv0[3]; 1823 1824 uint32_t gpio_ev0; 1825 1826 uint32_t gpio_ev1; 1827 1828 uint32_t :32; 1829} hermon_hw_eqe_gpio_t; 1830 1831 1832typedef struct hermon_hw_eqe_cmdcmpl_s { 1833 uint32_t :16; 1834 uint32_t token :16; 1835 1836 uint32_t :32; 1837 1838 uint32_t :24; 1839 uint32_t status :8; 1840 1841 uint32_t out_param0; 1842 1843 uint32_t out_param1; 1844 1845 uint32_t :32; 1846} hermon_hw_eqe_cmdcmpl_t; 1847 1848 1849typedef struct hermon_hw_eqe_operr_s { 1850 uint32_t rsrv0[2]; 1851 1852 uint32_t :24; 1853 uint32_t error_type :8; 1854 1855 uint32_t data; 1856 1857 uint32_t rsrv1[2]; 1858} hermon_hw_eqe_operr_t; 1859#define HERMON_ERREVT_EQ_OVERFLOW 0x1 1860#define HERMON_ERREVT_BAD_UARPG 0x2 1861#define HERMON_ERREVT_UPLINK_BUSERR 0x3 1862#define HERMON_ERREVT_DDR_DATAERR 0x4 1863#define HERMON_ERREVT_INTERNAL_PARITY 0x5 1864 1865 1866typedef struct hermon_hw_eqe_pgflt_s { 1867 uint32_t rsrv0[2]; 1868 uint32_t :24; 1869 uint32_t fault_type :4; 1870 uint32_t wqv :1; 1871 uint32_t wqe_data :1; 1872 uint32_t rem_loc :1; 1873 uint32_t snd_rcv :1; 1874 uint32_t vaddr_h; 1875 uint32_t vaddr_l; 1876 uint32_t mem_key; 1877} hermon_hw_eqe_pgflt_t; 1878#define HERMON_PGFLT_PG_NOTPRESENT 0x8 1879#define HERMON_PGFLT_PG_WRACC_VIOL 0xA 1880#define HERMON_PGFLT_UNSUP_NOTPRESENT 0xE 1881#define HERMON_PGFLT_UNSUP_WRACC_VIOL 0xF 1882#define HERMON_PGFLT_WQE_CAUSED 0x1 1883#define HERMON_PGFLT_DATA_CAUSED 0x0 1884#define HERMON_PGFLT_REMOTE_CAUSED 0x1 1885#define HERMON_PGFLT_LOCAL_CAUSED 0x0 1886#define HERMON_PGFLT_SEND_CAUSED 0x1 1887#define HERMON_PGFLT_RECV_CAUSED 0x0 1888#define HERMON_PGFLT_DESC_CONSUMED 0x1 1889#define HERMON_PGFLT_DESC_NOTCONSUMED 0x0 1890 1891struct hermon_hw_eqe_s { 1892 uint32_t :8; 1893 uint32_t event_type :8; 1894 uint32_t :8; 1895 uint32_t event_subtype :8; 1896 union { 1897 hermon_hw_eqe_cq_t eqe_cq; 1898 hermon_hw_eqe_qpevt_t eqe_qpevt; 1899 hermon_hw_eqe_cqerr_t eqe_cqerr; 1900 hermon_hw_eqe_portstate_t eqe_portstate; 1901 hermon_hw_eqe_gpio_t eqe_gpio; 1902 hermon_hw_eqe_cmdcmpl_t eqe_cmdcmpl; 1903 hermon_hw_eqe_operr_t eqe_operr; 1904 hermon_hw_eqe_pgflt_t eqe_pgflt; 1905 } event_data; 1906 uint32_t :24; 1907 uint32_t owner :1; 1908 uint32_t :7; 1909}; 1910#define eqe_cq event_data.eqe_cq 1911#define eqe_qpevt event_data.eqe_qpevt 1912#define eqe_cqerr event_data.eqe_cqerr 1913#define eqe_portstate event_data.eqe_portstate 1914#define eqe_gpio event_data.eqe_gpio 1915#define eqe_cmdcmpl event_data.eqe_cmdcmpl 1916#define eqe_operr event_data.eqe_operr 1917#define eqe_pgflt event_data.eqe_pgflt 1918 1919/* 1920 * The following macros are used for extracting (and in some cases filling in) 1921 * information from EQEs 1922 */ 1923#define HERMON_EQE_CQNUM_MASK 0x00FFFFFF 1924#define HERMON_EQE_CQNUM_SHIFT 0 1925#define HERMON_EQE_QPNUM_MASK 0x00FFFFFF 1926#define HERMON_EQE_QPNUM_SHIFT 0 1927#define HERMON_EQE_PORTNUM_MASK 0x30 1928#define HERMON_EQE_PORTNUM_SHIFT 4 1929#define HERMON_EQE_OWNER_MASK 0x00000080 1930#define HERMON_EQE_OWNER_SHIFT 7 1931 1932#define HERMON_EQE_EVTTYPE_GET(eq, eqe) \ 1933 (((uint8_t *)(eqe))[1]) 1934#define HERMON_EQE_EVTSUBTYPE_GET(eq, eqe) \ 1935 (((uint8_t *)(eqe))[3]) 1936#define HERMON_EQE_CQNUM_GET(eq, eqe) \ 1937 ((htonl(((uint32_t *)(eqe))[1]) & HERMON_EQE_CQNUM_MASK) >> \ 1938 HERMON_EQE_CQNUM_SHIFT) 1939#define HERMON_EQE_QPNUM_GET(eq, eqe) \ 1940 ((htonl(((uint32_t *)(eqe))[1]) & HERMON_EQE_QPNUM_MASK) >> \ 1941 HERMON_EQE_QPNUM_SHIFT) 1942#define HERMON_EQE_PORTNUM_GET(eq, eqe) \ 1943 (((((uint8_t *)(eqe))[12]) & HERMON_EQE_PORTNUM_MASK) >> \ 1944 HERMON_EQE_PORTNUM_SHIFT) 1945#define HERMON_EQE_CMDTOKEN_GET(eq, eqe) \ 1946 htons(((uint16_t *)(eqe))[3]) 1947#define HERMON_EQE_CMDSTATUS_GET(eq, eqe) \ 1948 (((uint8_t *)(eqe))[0xf]) 1949#define HERMON_EQE_CMDOUTP0_GET(eq, eqe) \ 1950 htonl(((uint32_t *)(eqe))[4]) 1951#define HERMON_EQE_CMDOUTP1_GET(eq, eqe) \ 1952 htonl(((uint32_t *)(eqe))[5]) 1953#define HERMON_EQE_OPERRTYPE_GET(eq, eqe) \ 1954 (((uint8_t *)(eqe))[0xf]) 1955#define HERMON_EQE_OPERRDATA_GET(eq, eqe) \ 1956 htonl(((uint32_t *)(eqe))[4]) 1957/* 1958 * Hermon does ownership of CQ and EQ differently from Arbel & Tavor. 1959 * Now, you keep track of the TOTAL number of CQE's or EQE's that have been 1960 * processed, and the sense of the ownership bit changes each time through. 1961 * That is, if the size of the queue is 16, so 4 bits [3:0] are the index 1962 * number, then bit [4] is the ownership bit in the count. So you mask that 1963 * bit and compare it to the owner bit in the entry - if the same, then the 1964 * entry is in SW onwership. Otherwise, it's in hardware and the driver 1965 * does not consume it. 1966 */ 1967 1968#define HERMON_EQE_OWNER_IS_SW(eq, eqe) \ 1969 ((((uint8_t *)(eqe))[0x1f] & HERMON_EQE_OWNER_MASK) == \ 1970 (((eq->eq_nexteqe) & eq->eq_bufsz) >> \ 1971 (eq->eq_log_eqsz - HERMON_EQE_OWNER_SHIFT))) 1972 1973/* 1974 * Hermon Completion Queue Context Table (CQC) entries 1975 * The CQC table is a virtually-contiguous memory area residing in HCA's 1976 * ICM. Each CQC table entry contains information 1977 * required by the hardware to access the completion queue to post 1978 * completions (CQE). 1979 * 1980 * The following structure is used in the SW2HW_CQ, QUERY_CQ, RESIZE_CQ, 1981 * and HW2SW_CQ commands. 1982 * The SW2HW_CQ command transfers ownership of an CQ context from software 1983 * to hardware. The command takes the CQC entry from the input mailbox and 1984 * stores it in the CQC in the hardware. The command will fail if the 1985 * requested CQC entry is already owned by the hardware. 1986 * The QUERY_CQ command retrieves a snapshot of a CQC entry. The command 1987 * stores the snapshot in the output mailbox. The CQC state and its values 1988 * are not affected by the QUERY_CQ command. 1989 * Finally, the HW2SW_CQ command transfers ownership of a CQC entry from 1990 * the hardware to the software. The command takes the CQC entry from the 1991 * hardware and stores it in the output mailbox. The CQC entry will be 1992 * invalidated as a result of the command. 1993 */ 1994 1995 1996#ifdef _LITTLE_ENDIAN 1997struct hermon_hw_cqc_s { 1998 uint32_t :32; 1999 2000 uint32_t :8; 2001 uint32_t state :4; 2002 uint32_t :5; 2003 uint32_t overrun_ignore :1; 2004 uint32_t cqe_coalesc :1; 2005 uint32_t :9; 2006 uint32_t status :4; 2007 2008 uint32_t usr_page :24; 2009 uint32_t log_cq_sz :5; 2010 uint32_t :3; 2011 2012 uint32_t :5; 2013 uint32_t pg_offs :7; 2014 uint32_t :20; 2015 2016 uint32_t c_eqn :9; 2017 uint32_t :23; 2018 2019 uint32_t cq_max_cnt :16; 2020 uint32_t cq_period :16; 2021 2022 uint32_t :3; 2023 uint32_t mtt_base_addl :29; 2024 2025 uint32_t mtt_base_addh :8; 2026 uint32_t :16; 2027 uint32_t log2_pgsz :6; 2028 uint32_t :2; 2029 2030 uint32_t solicit_prod_indx :24; 2031 uint32_t :8; 2032 2033 uint32_t last_notified_indx :24; 2034 uint32_t :8; 2035 2036 uint32_t prod_cntr :24; /* producer counter */ 2037 uint32_t :8; 2038 2039 uint32_t cons_cntr :24; /* consumer counter */ 2040 uint32_t :8; 2041 2042 uint32_t rsrv0[2]; 2043 2044 uint32_t :3; 2045 uint32_t dbr_addrl :29; 2046 2047 uint32_t dbr_addrh; 2048 2049 uint64_t rsrv1[8]; /* hermon, match DEV_CAP size */ 2050}; 2051#else 2052struct hermon_hw_cqc_s { 2053 uint32_t status :4; 2054 uint32_t :9; 2055 uint32_t cqe_coalesc :1; 2056 uint32_t overrun_ignore :1; 2057 uint32_t :5; 2058 uint32_t state :4; 2059 uint32_t :8; 2060 2061 uint32_t :32; 2062 2063 uint32_t :20; 2064 uint32_t pg_offs :7; 2065 uint32_t :5; 2066 2067 uint32_t :3; 2068 uint32_t log_cq_sz :5; 2069 uint32_t usr_page :24; 2070 2071 uint32_t cq_period :16; 2072 uint32_t cq_max_cnt :16; 2073 2074 uint32_t :23; 2075 uint32_t c_eqn :9; 2076 2077 uint32_t :2; 2078 uint32_t log2_pgsz :6; 2079 uint32_t :16; 2080 uint32_t mtt_base_addh :8; 2081 2082 uint32_t mtt_base_addl :29; 2083 uint32_t :3; 2084 2085 uint32_t :8; 2086 uint32_t last_notified_indx :24; 2087 2088 uint32_t :8; 2089 uint32_t solicit_prod_indx :24; 2090 2091 uint32_t :8; 2092 uint32_t cons_cntr :24; /* consumer counter */ 2093 2094 uint32_t :8; 2095 uint32_t prod_cntr :24; /* priducer counter */ 2096 2097 uint32_t rsrv0[2]; 2098 2099 uint32_t dbr_addrh; 2100 2101 uint32_t dbr_addrl :29; 2102 uint32_t :3; 2103 2104 uint64_t rsrv1[8]; /* hermon, match DEV_CAP size */ 2105}; 2106#endif 2107#define HERMON_CQ_STATUS_OK 0x0 2108#define HERMON_CQ_STATUS_OVERFLOW 0x9 2109#define HERMON_CQ_STATUS_WRITE_FAILURE 0xA 2110 2111#define HERMON_CQ_DISARMED 0x0 2112#define HERMON_CQ_ARMED 0x1 2113#define HERMON_CQ_ARMED_SOLICITED 0x4 2114#define HERMON_CQ_FIRED 0xA 2115 2116/* 2117 * Hermon Completion Queue Entries (CQE) 2118 * Each CQE contains enough information for the software to associate the 2119 * completion with the Work Queue Element (WQE) to which it corresponds. 2120 * 2121 * Note: The following structure is not #define'd with both little-endian 2122 * and big-endian definitions. This is because each CQE's individual 2123 * fields are not directly accessed except through the macros defined below. 2124 */ 2125 2126 2127struct hermon_hw_cqe_s { 2128 uint32_t dife :1; 2129 uint32_t :2; 2130 uint32_t fl :1; 2131 uint32_t fccrc_sd :1; 2132 uint32_t d2s :1; 2133 uint32_t :2; 2134 uint32_t my_qpn :24; 2135 2136 uint32_t immed_rss_val_key; 2137 2138 uint32_t grh :1; 2139 uint32_t ml_path :7; 2140 uint32_t srq_rqpn :24; 2141 2142 uint32_t sl :4; 2143 uint32_t :12; 2144 uint32_t slid :16; 2145 2146 uint32_t ipoib_status; 2147 2148 uint32_t byte_cnt; 2149 2150 uint32_t wqe_cntr :16; 2151 uint32_t checksum :16; 2152 2153 uint32_t :8; 2154 uint32_t :16; 2155 uint32_t owner :1; 2156 uint32_t send_or_recv :1; 2157 uint32_t inline_scatter :1; 2158 uint32_t opcode :5; 2159}; 2160#define HERMON_COMPLETION_RECV 0x0 2161#define HERMON_COMPLETION_SEND 0x1 2162 2163#define HERMON_CQE_DEFAULT_VERSION 0x0 2164 2165/* 2166 * The following macros are used for extracting (and in some cases filling in) 2167 * information from CQEs 2168 */ 2169#define HERMON_CQE_QPNUM_MASK 0x00FFFFFF 2170#define HERMON_CQE_QPNUM_SHIFT 0 2171 2172 2173#define HERMON_CQE_DQPN_MASK 0x00FFFFFF 2174#define HERMON_CQE_DQPN_SHIFT 0 2175 2176 2177#define HERMON_CQE_SL_SHIFT 4 2178#define HERMON_CQE_GRH_MASK 0x80 2179#define HERMON_CQE_PATHBITS_MASK 0x7F 2180#define HERMON_CQE_SLID_15_8 0xe 2181#define HERMON_CQE_SLID_7_0 0xf 2182#define HERMON_CQE_OPCODE_MASK 0x1F 2183#define HERMON_CQE_SENDRECV_MASK 0x40 2184#define HERMON_CQE_SENDRECV_SHIFT 6 2185#define HERMON_CQE_OWNER_MASK 0x80 2186#define HERMON_CQE_OWNER_SHIFT 7 2187#define HERMON_CQE_WQECNTR_15_8 0x18 2188#define HERMON_CQE_WQECNTR_7_0 0x19 2189/* Byte offsets for IPoIB Checksum Offload fields */ 2190#define HERMON_CQE_CKSUM_15_8 0x1a 2191#define HERMON_CQE_CKSUM_7_0 0x1b 2192#define HERMON_CQE_IPOK 0x10 /* byte 0x10 in cqe */ 2193#define HERMON_CQE_IPOK_BIT 0x10 /* bitmask for OK bit */ 2194 2195#define HERMON_CQE_IS_IPOK(cq, cqe) \ 2196 (((uint8_t *)(cqe))[HERMON_CQE_IPOK] & HERMON_CQE_IPOK_BIT) 2197 2198#define HERMON_CQE_CKSUM(cq, cqe) \ 2199 ((((uint8_t *)(cqe))[HERMON_CQE_CKSUM_15_8] << 8) | \ 2200 (((uint8_t *)(cqe))[HERMON_CQE_CKSUM_7_0])) 2201 2202#define HERMON_CQE_IPOIB_STATUS(cq, cqe) \ 2203 htonl((((uint32_t *)(cqe)))[4]) 2204 2205#define HERMON_CQE_QPNUM_GET(cq, cqe) \ 2206 ((htonl((((uint32_t *)(cqe)))[0]) & HERMON_CQE_QPNUM_MASK) >> \ 2207 HERMON_CQE_QPNUM_SHIFT) 2208 2209#define HERMON_CQE_IMM_ETH_PKEY_CRED_GET(cq, cqe) \ 2210 htonl(((uint32_t *)(cqe))[1]) 2211 2212#define HERMON_CQE_DQPN_GET(cq, cqe) \ 2213 ((htonl(((uint32_t *)(cqe))[2]) & HERMON_CQE_DQPN_MASK) >> \ 2214 HERMON_CQE_DQPN_SHIFT) 2215 2216#define HERMON_CQE_GRH_GET(cq, cqe) \ 2217 (((uint8_t *)(cqe))[8] & HERMON_CQE_GRH_MASK) 2218 2219#define HERMON_CQE_PATHBITS_GET(cq, cqe) \ 2220 (((uint8_t *)(cqe))[8] & HERMON_CQE_PATHBITS_MASK) 2221 2222#define HERMON_CQE_DLID_GET(cq, cqe) \ 2223 ((((uint8_t *)(cqe))[HERMON_CQE_SLID_15_8] << 8) | \ 2224 (((uint8_t *)(cqe))[HERMON_CQE_SLID_7_0])) 2225 2226#define HERMON_CQE_SL_GET(cq, cqe) \ 2227 ((((uint8_t *)(cqe))[12]) >> HERMON_CQE_SL_SHIFT) 2228 2229#define HERMON_CQE_BYTECNT_GET(cq, cqe) \ 2230 htonl(((uint32_t *)(cqe))[5]) 2231 2232#define HERMON_CQE_WQECNTR_GET(cq, cqe) \ 2233 ((((uint8_t *)(cqe))[HERMON_CQE_WQECNTR_15_8] << 8) | \ 2234 (((uint8_t *)(cqe))[HERMON_CQE_WQECNTR_7_0])) 2235 2236#define HERMON_CQE_ERROR_SYNDROME_GET(cq, cqe) \ 2237 (((uint8_t *)(cqe))[27]) 2238 2239#define HERMON_CQE_OPCODE_GET(cq, cqe) \ 2240 ((((uint8_t *)(cqe))[31]) & HERMON_CQE_OPCODE_MASK) 2241 2242#define HERMON_CQE_SENDRECV_GET(cq, cqe) \ 2243 (((((uint8_t *)(cqe))[31]) & HERMON_CQE_SENDRECV_MASK) >> \ 2244 HERMON_CQE_SENDRECV_SHIFT) 2245 2246/* See Comment above for EQE - ownership of CQE is handled the same */ 2247 2248#define HERMON_CQE_OWNER_IS_SW(cq, cqe, considx) \ 2249 (((((uint8_t *)(cqe))[31] & HERMON_CQE_OWNER_MASK) >> \ 2250 HERMON_CQE_OWNER_SHIFT) == \ 2251 (((considx) & cq->cq_bufsz) >> cq->cq_log_cqsz)) 2252 2253/* 2254 * Hermon Shared Receive Queue (SRQ) Context Entry Format 2255 */ 2256 2257#ifdef _LITTLE_ENDIAN 2258struct hermon_hw_srqc_s { 2259 uint32_t xrc_domain :16; 2260 uint32_t :8; 2261 uint32_t log_rq_stride :3; 2262 uint32_t :5; 2263 2264 uint32_t srqn :24; 2265 uint32_t log_srq_size :4; 2266 uint32_t state :4; 2267 2268 uint32_t :32; 2269 2270 uint32_t cqn_xrc :24; 2271 uint32_t :2; 2272 uint32_t page_offs :6; 2273 2274 uint32_t :3; 2275 uint32_t mtt_base_addrl :29; 2276 2277 uint32_t mtt_base_addrh :8; 2278 uint32_t :16; 2279 uint32_t log2_pgsz :6; 2280 uint32_t :2; 2281 2282 uint32_t wqe_cnt :16; 2283 uint32_t lwm :16; 2284 2285 uint32_t pd :24; 2286 uint32_t :8; 2287 2288 uint32_t :32; 2289 2290 uint32_t srq_wqe_cntr :16; 2291 uint32_t :16; 2292 2293 uint32_t :2; 2294 uint32_t dbr_addrl :30; 2295 2296 uint32_t dbr_addrh; 2297 2298 uint32_t rsrc0[80]; /* to match DEV_CAP size of 0x80 */ 2299 2300}; 2301#else 2302struct hermon_hw_srqc_s { 2303 uint32_t state :4; 2304 uint32_t log_srq_size :4; 2305 uint32_t srqn :24; 2306 2307 uint32_t :5; 2308 uint32_t log_rq_stride :3; 2309 uint32_t :8; 2310 uint32_t xrc_domain :16; 2311 2312 uint32_t page_offs :6; 2313 uint32_t :2; 2314 uint32_t cqn_xrc :24; 2315 2316 uint32_t :32; 2317 2318 uint32_t :2; 2319 uint32_t log2_pgsz :6; 2320 uint32_t :16; 2321 uint32_t mtt_base_addrh :8; 2322 2323 uint32_t mtt_base_addrl :29; 2324 uint32_t :3; 2325 2326 uint32_t :8; 2327 uint32_t pd :24; 2328 2329 uint32_t lwm :16; 2330 uint32_t wqe_cnt :16; 2331 2332 uint32_t :16; 2333 uint32_t srq_wqe_cntr :16; 2334 2335 uint32_t :32; 2336 2337 uint32_t dbr_addrh; 2338 2339 uint32_t dbr_addrl :30; 2340 uint32_t :2; 2341 2342 uint32_t rsrc0[80]; /* to match DEV_CAP size of 0x80 */ 2343}; 2344#endif 2345 2346/* 2347 * Hermon MOD_STAT_CFG input mailbox structure 2348 */ 2349 2350 2351#ifdef _LITTLE_ENDIAN 2352struct hermon_hw_mod_stat_cfg_s { 2353 uint32_t rsvd0; 2354 2355 uint32_t :14; 2356 uint32_t dife :1; 2357 uint32_t dife_m :1; 2358 uint32_t rx_options :4; 2359 uint32_t :3; 2360 uint32_t rx_options_m :1; 2361 uint32_t tx_options :4; 2362 uint32_t :3; 2363 uint32_t tx_options_m :1; 2364 2365 uint32_t lid :16; 2366 uint32_t lid_m :1; 2367 uint32_t :3; 2368 uint32_t port_en :1; 2369 uint32_t port_en_m :1; 2370 uint32_t :10; 2371 2372 uint32_t rsvd1; 2373 2374 uint32_t guid_hi; 2375 2376 uint32_t :31; 2377 uint32_t guid_hi_m :1; 2378 2379 uint32_t guid_lo; 2380 uint32_t :31; 2381 2382 uint32_t guid_lo_m :1; 2383 2384 uint32_t rsvd[4]; 2385 2386 uint32_t inbuf_ind_en :3; 2387 uint32_t :1; 2388 uint32_t sd_main :4; 2389 uint32_t :4; 2390 uint32_t sd_equal :4; 2391 uint32_t :4; 2392 uint32_t sd_mux_main :2; 2393 uint32_t :2; 2394 uint32_t mux_eq :2; 2395 uint32_t :2; 2396 uint32_t sigdet_th :3; 2397 uint32_t :1; 2398 2399 uint32_t ob_preemp_pre :5; 2400 uint32_t :3; 2401 uint32_t op_preemp_post :5; 2402 uint32_t :3; 2403 uint32_t ob_preemp_main :5; 2404 uint32_t :3; 2405 uint32_t ob_preemp :5; 2406 uint32_t :2; 2407 uint32_t serdes_m :1; 2408 2409 uint32_t reserved[50]; 2410}; 2411#else /* BIG ENDIAN */ 2412struct hermon_hw_mod_stat_cfg_s { 2413 uint32_t tx_options_m :1; 2414 uint32_t :3; 2415 uint32_t tx_options :4; 2416 uint32_t rx_options_m :1; 2417 uint32_t :3; 2418 uint32_t rx_options :4; 2419 uint32_t dife_m :1; 2420 uint32_t dife :1; 2421 uint32_t :14; 2422 2423 uint32_t rsvd0; 2424 2425 uint32_t rsvd1; 2426 2427 uint32_t :10; 2428 uint32_t port_en_m :1; 2429 uint32_t port_en :1; 2430 uint32_t :3; 2431 uint32_t lid_m :1; 2432 uint32_t lid :16; 2433 2434 uint32_t guid_hi_m :1; 2435 uint32_t :31; 2436 2437 uint32_t guid_hi; 2438 2439 uint32_t guid_lo_m :1; 2440 uint32_t :31; 2441 2442 uint32_t guid_lo; 2443 2444 uint32_t rsvd[4]; 2445 2446 uint32_t serdes_m :1; 2447 uint32_t :2; 2448 uint32_t ob_preemp :5; 2449 uint32_t :3; 2450 uint32_t ob_preemp_main :5; 2451 uint32_t :3; 2452 uint32_t op_preemp_post :5; 2453 uint32_t :3; 2454 uint32_t ob_preemp_pre :5; 2455 2456 uint32_t :1; 2457 uint32_t sigdet_th :3; 2458 uint32_t :2; 2459 uint32_t mux_eq :2; 2460 uint32_t :2; 2461 uint32_t sd_mux_main :2; 2462 uint32_t :4; 2463 uint32_t sd_equal :4; 2464 uint32_t :4; 2465 uint32_t sd_main :4; 2466 uint32_t :1; 2467 uint32_t inbuf_ind_en :3; 2468 2469 uint32_t reserved[50]; 2470}; 2471#endif 2472 2473 2474/* 2475 * Hermon MOD_STAT_CFG input modifier structure 2476 */ 2477struct hermon_hw_msg_in_mod_s { 2478#ifdef _LITTLE_ENDIAN 2479 uint32_t offset :8; 2480 uint32_t port_num :8; 2481 uint32_t lane_num :4; 2482 uint32_t link_speed :3; 2483 uint32_t auto_neg :1; 2484 uint32_t :8; 2485#else 2486 uint32_t :8; 2487 uint32_t auto_neg :1; 2488 uint32_t link_speed :3; 2489 uint32_t lane_num :4; 2490 uint32_t port_num :8; 2491 uint32_t offset :8; 2492#endif 2493}; 2494 2495 2496/* 2497 * Hermon UD Address Vector (UDAV) 2498 * Hermon UDAV are used in conjunction with Unreliable Datagram (UD) send 2499 * WQEs. Each UD send message contains an address vector in in the datagram 2500 * segment. The verbs consumer must use special verbs to create and modify 2501 * address handles, each of which contains a UDAV structure. When posting 2502 * send WQEs to UD QP, the verbs consumer must supply a valid address 2503 * handle/UDAV. 2504 */ 2505 2506 2507#ifdef _LITTLE_ENDIAN 2508struct hermon_hw_udav_s { 2509 uint32_t rlid :16; 2510 uint32_t ml_path :7; 2511 uint32_t grh :1; 2512 uint32_t :8; 2513 2514 uint32_t pd :24; 2515 uint32_t portnum :2; 2516 uint32_t :5; 2517 uint32_t force_lp :1; 2518 2519 uint32_t flow_label :20; 2520 uint32_t tclass :8; 2521 uint32_t sl :4; 2522 2523 uint32_t hop_limit :8; 2524 uint32_t max_stat_rate :4; 2525 uint32_t :4; 2526 uint32_t mgid_index :7; 2527 uint32_t :9; 2528 2529 uint64_t rgid_h; 2530 uint64_t rgid_l; 2531}; 2532#else 2533struct hermon_hw_udav_s { 2534 uint32_t force_lb :1; 2535 uint32_t :5; 2536 uint32_t portnum :2; 2537 uint32_t pd :24; 2538 2539 uint32_t :8; 2540 uint32_t grh :1; 2541 uint32_t ml_path :7; 2542 uint32_t rlid :16; 2543 2544 uint32_t :9; 2545 uint32_t mgid_index :7; 2546 uint32_t :4; 2547 uint32_t max_stat_rate :4; 2548 uint32_t hop_limit :8; 2549 2550 uint32_t sl :4; 2551 uint32_t tclass :8; 2552 uint32_t flow_label :20; 2553 2554 uint64_t rgid_h; 2555 uint64_t rgid_l; 2556}; 2557#endif 2558#define HERMON_UDAV_MODIFY_MASK0 0xFCFFFFFFFF000000ULL 2559#define HERMON_UDAV_MODIFY_MASK1 0xFF80F00000000000ULL 2560 2561 2562/* 2563 * Hermon Queue Pair Context Table (QPC) entries 2564 * The QPC table is a virtually-contiguous memory area residing in HCA 2565 * ICM. Each QPC entry is accessed for reads and writes 2566 * by the HCA while executing work requests on the associated QP. 2567 * 2568 * The following structure is used in the RST2INIT_QP, INIT2INIT_QP, 2569 * INIT2RTR_QP, RTR2RTS_QP, RTS2RTS_QP, SQERR2RTS_QP, TOERR_QP, RTS2SQD_QP, 2570 * SQD2RTS_QP, TORST_QP, and QUERY_QP commands. 2571 * With the exception of the QUERY_QP command, each of these commands reads 2572 * from some portion of the QPC in the input mailbox and modified the QPC 2573 * stored in the hardware. The QUERY_QP command retrieves a snapshot of a 2574 * QPC entry. The command stores the snapshot in the output mailbox. The 2575 * QPC state and its values are not affected by the QUERY_QP command. 2576 * 2577 * Below we first define the hermon_hw_addr_path_t or "Hermon Address Path" 2578 * structure. This structure is used to provide address path information 2579 * (both primary and secondary) for each QP context. Note: Since this 2580 * structure is _very_ similar to the hermon_hw_udav_t structure above, 2581 * we are able to leverage the similarity with filling in and reading from 2582 * the two types of structures. See hermon_get_addr_path() and 2583 * hermon_set_addr_path() in hermon_misc.c for more details. 2584 */ 2585#if (DATAMODEL_NATIVE == DATAMODEL_LP64) 2586#pragma pack(4) 2587#endif 2588 2589#ifdef _LITTLE_ENDIAN 2590struct hermon_hw_addr_path_s { 2591 uint32_t rlid :16; 2592 uint32_t mlid :7; 2593 uint32_t grh :1; 2594 uint32_t cntr_idx :8; 2595 2596 uint32_t pkey_indx :7; 2597 uint32_t :22; 2598 uint32_t :2; /* but may be used for enet */ 2599 uint32_t force_lb :1; 2600 2601 uint32_t flow_label :20; 2602 uint32_t tclass :8; 2603 uint32_t :4; 2604 2605 uint32_t hop_limit :8; 2606 uint32_t max_stat_rate :4; 2607 uint32_t :4; 2608 uint32_t mgid_index :7; 2609 uint32_t :4; 2610 uint32_t ack_timeout :5; 2611 2612 uint64_t rgid_h; 2613 uint64_t rgid_l; 2614 2615 uint32_t :32; /* but may be used for enet */ 2616 2617 uint32_t :12; /* but may be used for enet */ 2618 uint32_t fsip :1; 2619 uint32_t :3; 2620 uint32_t :7; 2621 uint32_t :1; 2622 uint32_t sched_q :8; 2623 2624 2625 uint32_t :32; 2626}; 2627#else 2628struct hermon_hw_addr_path_s { 2629 uint32_t force_lb :1; 2630 uint32_t :2; /* but may be used for enet */ 2631 uint32_t :22; 2632 uint32_t pkey_indx :7; 2633 2634 uint32_t cntr_idx :8; 2635 uint32_t grh :1; 2636 uint32_t mlid :7; 2637 uint32_t rlid :16; 2638 2639 uint32_t ack_timeout :5; 2640 uint32_t :4; 2641 uint32_t mgid_index :7; 2642 uint32_t :4; 2643 uint32_t max_stat_rate :4; 2644 uint32_t hop_limit :8; 2645 2646 uint32_t :4; 2647 uint32_t tclass :8; 2648 uint32_t flow_label :20; 2649 2650 uint64_t rgid_h; 2651 uint64_t rgid_l; 2652 2653 uint32_t sched_q :8; 2654 uint32_t :1; 2655 uint32_t :7; 2656 uint32_t :3; 2657 uint32_t fsip :1; 2658 uint32_t :12; /* but may be used for enet */ 2659 2660 uint32_t :32; /* but may be used for enet */ 2661 2662 uint32_t :32; 2663}; 2664#endif /* LITTLE ENDIAN */ 2665 2666#if (DATAMODEL_NATIVE == DATAMODEL_LP64) 2667#pragma pack() 2668#endif 2669 2670#if (DATAMODEL_NATIVE == DATAMODEL_LP64) 2671#pragma pack(4) 2672#endif 2673#ifdef _LITTLE_ENDIAN 2674struct hermon_hw_qpc_s { 2675 uint32_t pd :24; 2676 uint32_t :8; 2677 2678 uint32_t :11; 2679 uint32_t pm_state :2; 2680 uint32_t rss :1; 2681 uint32_t :2; 2682 uint32_t serv_type :8; 2683 uint32_t :4; 2684 uint32_t state :4; 2685 2686 uint32_t usr_page :24; 2687 uint32_t :8; 2688 2689 uint32_t :4; 2690 uint32_t rlky :1; 2691 uint32_t :3; 2692 uint32_t log_sq_stride :3; 2693 uint32_t log_sq_size :4; 2694 uint32_t sq_no_prefetch :1; 2695 uint32_t log_rq_stride :3; 2696 uint32_t log_rq_size :4; 2697 uint32_t :1; 2698 uint32_t msg_max :5; 2699 uint32_t mtu :3; 2700 2701 uint32_t rem_qpn :24; 2702 uint32_t :8; 2703 2704 uint32_t loc_qpn :24; 2705 uint32_t :8; 2706 2707 hermon_hw_addr_path_t pri_addr_path; 2708 2709 hermon_hw_addr_path_t alt_addr_path; 2710 2711 uint32_t :32; 2712 2713 uint32_t :5; 2714 uint32_t cur_retry_cnt :3; 2715 uint32_t cur_rnr_retry :3; 2716 uint32_t fre :1; 2717 uint32_t :1; 2718 uint32_t rnr_retry :3; 2719 uint32_t retry_cnt :3; 2720 uint32_t :2; 2721 uint32_t sra_max :3; 2722 uint32_t :4; 2723 uint32_t ack_req_freq :4; 2724 2725 uint32_t cqn_snd :24; 2726 uint32_t :8; 2727 2728 uint32_t next_snd_psn :24; 2729 uint32_t :8; 2730 2731 uint32_t :32; 2732 2733 uint32_t :32; 2734 2735 uint32_t ssn :24; 2736 uint32_t :8; 2737 2738 uint32_t last_acked_psn :24; 2739 uint32_t :8; 2740 2741 uint32_t next_rcv_psn :24; 2742 uint32_t min_rnr_nak :5; 2743 uint32_t :3; 2744 2745 uint32_t :4; 2746 uint32_t ric :1; 2747 uint32_t :1; 2748 uint32_t page_offs :6; 2749 uint32_t :1; 2750 uint32_t rae :1; 2751 uint32_t rwe :1; 2752 uint32_t rre :1; 2753 uint32_t :5; 2754 uint32_t rra_max :3; 2755 uint32_t :8; 2756 2757 uint32_t cqn_rcv :24; 2758 uint32_t :8; 2759 2760 uint32_t srcd :16; 2761 uint32_t :16; 2762 2763 uint32_t :2; 2764 uint32_t dbr_addrl :30; 2765 2766 uint32_t dbr_addrh :32; 2767 2768 uint32_t srq_number :24; 2769 uint32_t srq_en :1; 2770 uint32_t :7; 2771 2772 uint32_t qkey; 2773 2774 uint32_t sq_wqe_counter :16; 2775 uint32_t rq_wqe_counter :16; 2776 2777 uint32_t rmsn :24; 2778 uint32_t :8; 2779 2780 uint32_t rsrv0[2]; 2781 2782 /* new w/ hermon */ 2783 2784 uint32_t base_mkey :24; /* bits 32-8, low 7 m/b 0 */ 2785 uint32_t num_rmc_peers :8; 2786 2787 uint32_t rmc_parent_qpn :24; 2788 uint32_t header_sep :1; 2789 uint32_t inline_scatter :1; /* m/b 0 for srq */ 2790 uint32_t :1; 2791 uint32_t rmc_enable :2; 2792 uint32_t :2; /* may use one bit for enet */ 2793 uint32_t mkey_remap :1; 2794 2795 uint32_t :3; 2796 uint32_t mtt_base_addrl :29; 2797 2798 uint32_t mtt_base_addrh :8; 2799 uint32_t :16; 2800 uint32_t log2_pgsz :6; 2801 uint32_t :2; 2802 2803 uint32_t rsvd[12]; /* may/will be used for FCoIB */ 2804}; 2805#else /* BIG ENDIAN */ 2806struct hermon_hw_qpc_s { 2807 uint32_t state :4; 2808 uint32_t :4; 2809 uint32_t serv_type :8; 2810 uint32_t :2; 2811 uint32_t rss :1; 2812 uint32_t pm_state :2; 2813 uint32_t :11; 2814 2815 uint32_t :8; 2816 uint32_t pd :24; 2817 2818 uint32_t mtu :3; 2819 uint32_t msg_max :5; 2820 uint32_t :1; 2821 uint32_t log_rq_size :4; 2822 uint32_t log_rq_stride :3; 2823 uint32_t sq_no_prefetch :1; 2824 uint32_t log_sq_size :4; 2825 uint32_t log_sq_stride :3; 2826 uint32_t :3; 2827 uint32_t rlky :1; 2828 uint32_t :4; 2829 2830 uint32_t :8; 2831 uint32_t usr_page :24; 2832 2833 uint32_t :8; 2834 uint32_t loc_qpn :24; 2835 2836 uint32_t :8; 2837 uint32_t rem_qpn :24; 2838 2839 hermon_hw_addr_path_t pri_addr_path; 2840 2841 hermon_hw_addr_path_t alt_addr_path; 2842 2843 uint32_t ack_req_freq :4; 2844 uint32_t :4; 2845 uint32_t sra_max :3; 2846 uint32_t :2; 2847 uint32_t retry_cnt :3; 2848 uint32_t rnr_retry :3; 2849 uint32_t :1; 2850 uint32_t fre :1; 2851 uint32_t cur_rnr_retry :3; 2852 uint32_t cur_retry_cnt :3; 2853 uint32_t :5; 2854 2855 uint32_t :32; 2856 2857 uint32_t :8; 2858 uint32_t next_snd_psn :24; 2859 2860 uint32_t :8; 2861 uint32_t cqn_snd :24; 2862 2863 uint32_t :32; 2864 2865 uint32_t :32; 2866 2867 uint32_t :8; 2868 uint32_t last_acked_psn :24; 2869 2870 uint32_t :8; 2871 uint32_t ssn :24; 2872 2873 uint32_t :8; 2874 uint32_t rra_max :3; 2875 uint32_t :5; 2876 uint32_t rre :1; 2877 uint32_t rwe :1; 2878 uint32_t rae :1; 2879 uint32_t :1; 2880 uint32_t page_offs :6; 2881 uint32_t :1; 2882 uint32_t ric :1; 2883 uint32_t :4; 2884 2885 uint32_t :3; 2886 uint32_t min_rnr_nak :5; 2887 uint32_t next_rcv_psn :24; 2888 2889 uint32_t :16; 2890 uint32_t srcd :16; 2891 2892 uint32_t :8; 2893 uint32_t cqn_rcv :24; 2894 2895 uint32_t dbr_addrh :32; 2896 2897 uint32_t dbr_addrl :30; 2898 uint32_t :2; 2899 2900 uint32_t qkey; 2901 2902 uint32_t :7; 2903 uint32_t srq_en :1; 2904 uint32_t srq_number :24; 2905 2906 uint32_t :8; 2907 uint32_t rmsn :24; 2908 2909 uint32_t rq_wqe_counter :16; 2910 uint32_t sq_wqe_counter :16; 2911 2912 uint32_t rsrv0[2]; 2913 2914 /* new w/ hermon */ 2915 2916 uint32_t mkey_remap :1; 2917 uint32_t :2; /* may use one bit for enet */ 2918 uint32_t rmc_enable :2; 2919 uint32_t :1; 2920 uint32_t inline_scatter :1; /* m/b 0 for srq */ 2921 uint32_t header_sep :1; 2922 uint32_t rmc_parent_qpn :24; 2923 2924 uint32_t num_rmc_peers :8; 2925 uint32_t base_mkey :24; /* bits 32-8, low 7 m/b 0 */ 2926 2927 uint32_t :2; 2928 uint32_t log2_pgsz :6; 2929 uint32_t :16; 2930 uint32_t mtt_base_addrh :8; 2931 2932 uint32_t mtt_base_addrl :29; 2933 uint32_t :3; 2934 2935 uint32_t rsvd[12]; /* may/will be used for FCoIB */ 2936}; 2937#endif /* LITTLE ENDIAN */ 2938 2939#if (DATAMODEL_NATIVE == DATAMODEL_LP64) 2940#pragma pack() 2941#endif 2942 2943#define HERMON_QP_RESET 0x0 2944#define HERMON_QP_INIT 0x1 2945#define HERMON_QP_RTR 0x2 2946#define HERMON_QP_RTS 0x3 2947#define HERMON_QP_SQERR 0x4 2948#define HERMON_QP_SQD 0x5 2949#define HERMON_QP_ERR 0x6 2950#define HERMON_QP_SQDRAINING 0x7 2951 2952#define HERMON_QP_RC 0x0 2953#define HERMON_QP_UC 0x1 2954#define HERMON_QP_UD 0x3 2955#define HERMON_QP_MLX 0x7 2956 2957#define HERMON_QP_PMSTATE_MIGRATED 0x3 2958#define HERMON_QP_PMSTATE_ARMED 0x0 2959#define HERMON_QP_PMSTATE_REARM 0x1 2960 2961#define HERMON_QP_DESC_EVT_DISABLED 0x0 2962#define HERMON_QP_DESC_EVT_ENABLED 0x1 2963 2964#define HERMON_QP_FLIGHT_LIM_UNLIMITED 0xF 2965 2966#define HERMON_QP_SQ_ALL_SIGNALED 0x1 2967#define HERMON_QP_SQ_WR_SIGNALED 0x0 2968#define HERMON_QP_RQ_ALL_SIGNALED 0x1 2969#define HERMON_QP_RQ_WR_SIGNALED 0x0 2970 2971#define HERMON_QP_SRQ_ENABLED 0x1 2972#define HERMON_QP_SRQ_DISABLED 0x0 2973 2974#define HERMON_QP_WQE_BASE_SHIFT 0x6 2975 2976/* 2977 * Hermon Multicast Group Member (MCG) 2978 * Hermon MCG are organized in a virtually-contiguous memory table (the 2979 * Multicast Group Table) in the ICM. This table is 2980 * actually comprised of two consecutive tables: the Multicast Group Hash 2981 * Table (MGHT) and the Additional Multicast Group Members Table (AMGM). 2982 * Each such entry contains an MGID and a list of QPs that are attached to 2983 * the multicast group. Each such entry may also include an index to an 2984 * Additional Multicast Group Member Table (AMGM) entry. The AMGMs are 2985 * used to form a linked list of MCG entries that all map to the same hash 2986 * value. The MCG entry size is configured through the INIT_HCA command. 2987 * Note: An MCG actually consists of a single hermon_hw_mcg_t and some 2988 * number of hermon_hw_mcg_qp_list_t (such that the combined structure is a 2989 * power-of-2). 2990 * 2991 * The following structures are used in the READ_MGM and WRITE_MGM commands. 2992 * The READ_MGM command reads an MCG entry from the multicast table and 2993 * returns it in the output mailbox. Note: This operation does not affect 2994 * the MCG entry state or values. 2995 * The WRITE_MGM command retrieves an MCG entry from the input mailbox and 2996 * stores it in the multicast group table at the index specified in the 2997 * command. Once the command has finished execution, the multicast group 2998 * table is updated. The old entry contents are lost. 2999 */ 3000#ifdef _LITTLE_ENDIAN 3001struct hermon_hw_mcg_s { 3002 uint32_t member_cnt :24; 3003 uint32_t :8; 3004 3005 uint32_t :6; 3006 uint32_t next_gid_indx :26; 3007 3008 uint32_t :32; 3009 uint32_t :32; 3010 3011 uint64_t mgid_h; 3012 uint64_t mgid_l; 3013}; 3014#else 3015struct hermon_hw_mcg_s { 3016 uint32_t next_gid_indx :26; 3017 uint32_t :6; 3018 3019 uint32_t :8; 3020 uint32_t member_cnt :24; 3021 3022 uint32_t :32; 3023 uint32_t :32; 3024 3025 uint64_t mgid_h; 3026 uint64_t mgid_l; 3027}; 3028#endif 3029 3030 3031/* Multicast Group Member - QP List entries */ 3032#ifdef _LITTLE_ENDIAN 3033struct hermon_hw_mcg_qp_list_s { 3034 uint32_t qpn :24; 3035 uint32_t :6; 3036 uint32_t blk_lb :1; 3037 uint32_t :1; 3038}; 3039#else 3040struct hermon_hw_mcg_qp_list_s { 3041 uint32_t :1; 3042 uint32_t blk_lb :1; 3043 uint32_t :6; 3044 uint32_t qpn :24; 3045}; 3046#endif 3047 3048#define HERMON_MCG_QPN_BLOCK_LB 0x40000000 3049 3050/* 3051 * Structure for getting the peformance counters from the HCA 3052 */ 3053 3054#ifdef _LITTLE_ENDIAN 3055struct hermon_hw_sm_perfcntr_s { 3056 uint32_t linkdown :8; 3057 uint32_t linkerrrec :8; 3058 uint32_t symerr :16; 3059 3060 uint32_t cntrsel :16; 3061 uint32_t portsel :8; 3062 uint32_t :8; 3063 3064 uint32_t portxmdiscard :16; 3065 uint32_t portrcvswrelay :16; 3066 3067 uint32_t portrcvrem :16; 3068 uint32_t portrcv :16; 3069 3070 uint32_t vl15drop :16; 3071 uint32_t :16; 3072 3073 uint32_t xsbuffovrun :4; 3074 uint32_t locallinkint :4; 3075 uint32_t :8; 3076 uint32_t portrcconstr :8; 3077 uint32_t portxmconstr :8; 3078 3079 uint32_t portrcdata; 3080 3081 uint32_t portxmdata; 3082 3083 uint32_t portrcpkts; 3084 3085 uint32_t portxmpkts; 3086 3087 uint32_t reserved; 3088 3089 uint32_t portxmwait; 3090}; 3091#else /* BIG ENDIAN */ 3092struct hermon_hw_sm_perfcntr_s { 3093 uint32_t :8; 3094 uint32_t portsel :8; 3095 uint32_t cntrsel :16; 3096 3097 uint32_t symerr :16; 3098 uint32_t linkerrrec :8; 3099 uint32_t linkdown :8; 3100 3101 uint32_t portrcv :16; 3102 uint32_t portrcvrem :16; 3103 3104 uint32_t portrcvswrelay :16; 3105 uint32_t portxmdiscard :16; 3106 3107 uint32_t portxmconstr :8; 3108 uint32_t portrcconstr :8; 3109 uint32_t :8; 3110 uint32_t locallinkint :4; 3111 uint32_t xsbuffovrun :4; 3112 3113 uint32_t :16; 3114 uint32_t vl15drop :16; 3115 3116 uint32_t portxmdata; 3117 3118 uint32_t portrcdata; 3119 3120 uint32_t portxmpkts; 3121 3122 uint32_t portrcpkts; 3123 3124 uint32_t portxmwait; 3125 3126 uint32_t reserved; 3127}; 3128#endif 3129 3130 3131/* 3132 * Hermon User Access Region (UAR) 3133 * 3134 * JBDB : writeup on the UAR for memfree 3135 * 3136 * JBDB : writeup on the structures 3137 * UAR page 3138 * DB register 3139 * DB record 3140 * UCE 3141 * 3142 * [es] and change it even further for hermon 3143 * the whole UAR and doorbell record (dbr) approach is changed again 3144 * from arbel, and needs commenting 3145 * 3146 * -- Tavor comment 3147 * 3148 * 3149 * Tavor doorbells are each rung by writing to the doorbell registers that 3150 * form a User Access Region (UAR). A doorbell is a write-only hardware 3151 * register which enables passing information from software to hardware 3152 * with minimum software latency. A write operation from the host software 3153 * to these doorbell registers passes information about the HCA resources 3154 * and initiates processing of the doorbell data. There are 6 types of 3155 * doorbells in Tavor. 3156 * 3157 * "Send Doorbell" for synchronizing the attachment of a WQE (or a chain 3158 * of WQEs) to the send queue. 3159 * "RD Send Doorbell" (Same as above, except for RD QPs) is not supported. 3160 * "Receive Doorbell" for synchronizing the attachment of a WQE (or a chain 3161 * of WQEs) to the receive queue. 3162 * "CQ Doorbell" for updating the CQ consumer index and requesting 3163 * completion notifications. 3164 * "EQ Doorbell" for updating the EQ consumer index, arming interrupt 3165 * triggering, and disarming CQ notification requests. 3166 * "InfiniBlast" (which would have enabled access to the "InfiniBlast 3167 * buffer") is not supported. 3168 * 3169 * Note: The tavor_hw_uar_t below is the container for all of the various 3170 * doorbell types. Below we first define several structures which make up 3171 * the contents of those doorbell types. 3172 * 3173 * Note also: The following structures are not #define'd with both little- 3174 * endian and big-endian definitions. This is because each doorbell type 3175 * is not directly accessed except through a single ddi_put64() operation 3176 * (see tavor_qp_send_doorbell, tavor_qp_recv_doorbell, tavor_cq_doorbell, 3177 * or tavor_eq_doorbell) 3178 */ 3179 3180/* 3181 * Send doorbell register structure 3182 */ 3183typedef struct hermon_hw_send_db_reg_s { 3184 uint32_t :32; 3185 3186 uint32_t snd_q_num :24; 3187 uint32_t :8; 3188} hermon_hw_send_db_reg_t; 3189 3190#define HERMON_QPSNDDB_QPN_SHIFT 0x8 3191 3192/* Max descriptors per Hermon doorbell */ 3193#define HERMON_QP_MAXDESC_PER_DB 256 3194 3195/* 3196 * CQ doorbell register structure 3197 */ 3198typedef struct hermon_hw_cq_db_reg_s { 3199 uint32_t :2; 3200 uint32_t cmd_sn :2; 3201 uint32_t :2; 3202 uint32_t cmd :2; 3203 uint32_t cqn :24; 3204 3205 uint32_t :8; 3206 /* consumer cntr of last polled completion */ 3207 uint32_t cq_ci :24; 3208} hermon_hw_cq_db_reg_t; 3209 3210#define HERMON_CQDB_CMD_SHIFT 0x18 /* dec 24 */ 3211#define HERMON_CQDB_CMDSN_SHIFT 0x1C /* dec 28 */ 3212 3213 3214#define HERMON_CQDB_NOTIFY_CQ 0x02 3215#define HERMON_CQDB_NOTIFY_CQ_SOLICIT 0x01 3216 3217/* Default value for use in NOTIFY_CQ doorbell */ 3218#define HERMON_CQDB_DEFAULT_PARAM 0xFFFFFFFF 3219 3220typedef struct hermon_hw_guest_eq_ci_s { /* guest op eq consumer index */ 3221 uint32_t armed :1; 3222 uint32_t :7; 3223 uint32_t guestos_ci :24; 3224 3225 uint32_t :32; 3226} hermon_hw_guest_eq_ci_t; 3227 3228 3229 3230/* 3231 * UAR page structure, containing all doorbell registers 3232 */ 3233struct hermon_hw_uar_s { 3234 uint32_t rsrv0[4]; 3235 3236 hermon_hw_send_db_reg_t send; 3237 3238 uint32_t rsrv1[2]; 3239 3240 hermon_hw_cq_db_reg_t cq; 3241 3242 uint32_t rsrv2[502]; /* next is at offset 0x800 */ 3243 3244 hermon_hw_guest_eq_ci_t g_eq0; 3245 hermon_hw_guest_eq_ci_t g_eq1; 3246 hermon_hw_guest_eq_ci_t g_eq2; 3247 hermon_hw_guest_eq_ci_t g_eq3; 3248 3249 uint32_t rsrv3[504]; /* end of page */ 3250}; 3251 3252/* 3253 * QP (RQ, SRQ) doorbell record-specific data 3254 * Note that this structure is NOT in ICM, but just kept in host memory 3255 * and managed independently of PRM or other constraints. Also, though 3256 * the qp/srq doorbell need to be only 4 bytes, it is 8 bytes in memory for 3257 * ease of management. Hermon defines its usage in the QP chapter. 3258 */ 3259typedef struct hermon_hw_qp_db_s { 3260 uint32_t :16; 3261 uint32_t rcv_wqe_cntr :16; /* wqe_counter */ 3262 3263 uint32_t :32; 3264} hermon_hw_qp_db_t; 3265 3266/* 3267 * CQ (ARM and SET_CI) doorbell record-specific data 3268 * See comment above re: QP doorbell. This dbr is 8 bytes long, and its 3269 * usage is defined in PRM chapter on Completion Queues 3270 */ 3271typedef struct hermon_hw_cq_arm_db_s { 3272 uint32_t :8; 3273 uint32_t update_ci :24; 3274 3275 uint32_t :2; 3276 /* sequence number of the doorbell ring % 4 */ 3277 uint32_t cmd_sn :2; 3278 uint32_t :1; 3279 uint32_t cmd :3; /* command */ 3280 uint32_t cq_ci :24; 3281} hermon_hw_cq_db_t; 3282 3283#define HERMON_CQ_DB_CMD_SOLICTED 0x01 3284#define HERMON_CQ_DB_CMD_NEXT 0x02 3285 3286 3287/* 3288 * Hermon Blue Flame (BF) 3289 * Hermon has the ability to do a low-latency write of successive WQEs 3290 * for the HCA. This utilizes part of the memory area behind the 3291 * same BAR as the UAR page (see above) - half the area is devoted to 3292 * UAR pages, the other half to BlueFlame (though in fairness, the return 3293 * information from QUERY_DEV_CAP should be consulted _in case_ they ever 3294 * decide to change it. 3295 * 3296 * We define the structures to access them below. 3297 */ 3298 3299 3300/* 3301 * Hermon Send Work Queue Element (WQE) 3302 * A Hermon Send WQE is built of the following segments, each of which is a 3303 * multiple of 16 bytes. Note: Each individual WQE may contain only a 3304 * subset of these segments described below (according to the operation type 3305 * and transport type of the QP). 3306 * 3307 * The first 16 bytes of ever WQE are formed from the "Ctrl" segment. 3308 * This segment contains the address of the next WQE to be executed and the 3309 * information required in order to allocate the resources to execute the 3310 * next WQE. The "Ctrl" part of this segment contains the control 3311 * information required to execute the WQE, including the opcode and other 3312 * control information. 3313 * The "Datagram" segment contains address information required in order to 3314 * form a UD message. 3315 * The "Bind" segment contains the parameters required for a Bind Memory 3316 * Window operation. 3317 * The "Remote Address" segment is present only in RDMA or Atomic WQEs and 3318 * specifies remote virtual addresses and RKey, respectively. Length of 3319 * the remote access is calculated from the scatter/gather list (for 3320 * RDMA-write/RDMA-read) or set to eight (for Atomic). 3321 * The "Atomic" segment is present only in Atomic WQEs and specifies 3322 * Swap/Add and Compare data. 3323 * 3324 * Note: The following structures are not #define'd with both little-endian 3325 * and big-endian definitions. This is because their individual fields are 3326 * not directly accessed except through macros defined below. 3327 */ 3328 3329 3330struct hermon_hw_snd_wqe_ctrl_s { 3331 uint32_t owner :1; 3332 /* NOTE: some/many may be used by enet */ 3333 uint32_t :26; 3334 uint32_t opcode :5; 3335 /* NOTE: some will be used by enet */ 3336 uint32_t :25; 3337 uint32_t fence :1; 3338 /* WQE size in octowords */ 3339 uint32_t ds :6; 3340 /* SRC remote buffer if impl */ 3341 uint32_t src_rem_buf :24; 3342 uint32_t so :1; 3343 uint32_t :1; /* FCoIB only */ 3344 uint32_t tcp_udp :1; /* Checksumming */ 3345 uint32_t ip :1; /* Checksumming */ 3346 uint32_t cq_gen :2; /* 00=no cqe, 11= gen cqe */ 3347 /* set means solicit bit in last packet */ 3348 uint32_t s :1; 3349 uint32_t force_lb :1; 3350 3351 uint32_t immediate :32; 3352}; 3353 3354struct hermon_hw_srq_wqe_next_s { 3355 uint32_t :16; 3356 uint32_t next_wqe_idx :16; 3357 3358 uint32_t rsvd[3]; 3359}; 3360 3361 3362#define HERMON_WQE_SEND_FENCE_MASK 0x40 3363 3364#define HERMON_WQE_SEND_NOPCODE_NOP 0x00 3365#define HERMON_WQE_SEND_NOPCODE_SND_INV 0x01 3366#define HERMON_WQE_SEND_NOPCODE_RDMAW 0x8 3367#define HERMON_WQE_SEND_NOPCODE_RDMAWI 0x9 3368#define HERMON_WQE_SEND_NOPCODE_SEND 0xA 3369#define HERMON_WQE_SEND_NOPCODE_SENDI 0xB 3370#define HERMON_WQE_SEND_NOPCODE_LSO 0xE 3371#define HERMON_WQE_SEND_NOPCODE_RDMAR 0x10 3372#define HERMON_WQE_SEND_NOPCODE_ATMCS 0x11 3373#define HERMON_WQE_SEND_NOPCODE_ATMFA 0x12 3374#define HERMON_WQE_SEND_NOPCODE_ATMCSE 0x14 3375#define HERMON_WQE_SEND_NOPCODE_ATMFAE 0x15 3376#define HERMON_WQE_SEND_NOPCODE_BIND 0x18 3377#define HERMON_WQE_SEND_NOPCODE_FRWR 0x19 3378#define HERMON_WQE_SEND_NOPCODE_LCL_INV 0x1B 3379#define HERMON_WQE_SEND_NOPCODE_CONFIG 0x1F /* for ccq only */ 3380 3381#define HERMON_WQE_SEND_SIGNALED_MASK 0x0000000C00000000ull 3382#define HERMON_WQE_SEND_SOLICIT_MASK 0x0000000200000000ull 3383#define HERMON_WQE_SEND_IMMEDIATE_MASK 0x0000000100000000ull 3384 3385struct hermon_hw_snd_wqe_ud_s { 3386 struct hermon_hw_udav_s ud_addr_v; 3387 3388 uint32_t :8; 3389 uint32_t dest_qp :24; 3390 uint32_t qkey :32; 3391 uint32_t :32; 3392 uint32_t :32; 3393}; 3394#define HERMON_WQE_SENDHDR_UD_AV_MASK 0xFFFFFFFFFFFFFFE0ull 3395#define HERMON_WQE_SENDHDR_UD_DQPN_MASK 0xFFFFFF 3396 3397struct hermon_hw_snd_wqe_bind_s { 3398 uint32_t ae :1; 3399 uint32_t rw :1; 3400 uint32_t rr :1; 3401 uint32_t :3; 3402 uint32_t l_64 :1; 3403 uint32_t :25; 3404 3405 uint32_t win_t :1; 3406 uint32_t z_base :1; 3407 uint32_t :30; 3408 3409 uint32_t new_rkey; 3410 uint32_t reg_lkey; 3411 uint64_t addr; 3412 uint64_t len; 3413}; 3414#define HERMON_WQE_SENDHDR_BIND_ATOM 0x8000000000000000ull 3415#define HERMON_WQE_SENDHDR_BIND_WR 0x4000000000000000ull 3416#define HERMON_WQE_SENDHDR_BIND_RD 0x2000000000000000ull 3417 3418struct hermon_hw_snd_wqe_remaddr_s { 3419 uint64_t vaddr; 3420 uint32_t rkey; 3421 uint32_t :32; 3422}; 3423 3424struct hermon_hw_snd_wqe_atomic_s { 3425 uint64_t swap_add; 3426 uint64_t compare; 3427}; 3428 3429struct hermon_hw_snd_wqe_atomic_ext_s { 3430 uint64_t swap_add; 3431 uint64_t compare; 3432 uint64_t swapmask; 3433 uint64_t cmpmask; 3434}; 3435 3436 3437 3438struct hermon_hw_snd_wqe_local_inv_s { 3439 uint32_t :6; 3440 uint32_t atc_shoot :1; 3441 uint32_t :25; 3442 3443 uint32_t :32; 3444 3445 uint32_t mkey; 3446 3447 uint32_t :25; 3448 uint32_t guest_id :7; /* for atc shootdown */ 3449 3450 uint32_t rsrv0[6]; 3451 3452 uint32_t p_addrh; 3453 uint32_t p_addrl :23; 3454 uint32_t :9; 3455}; 3456 3457struct hermon_hw_snd_wqe_frwr_s { 3458 uint32_t rem_atomic :1; 3459 uint32_t rem_write :1; 3460 uint32_t rem_read :1; 3461 uint32_t loc_write :1; 3462 uint32_t loc_read :1; 3463 uint32_t fbo_en :1; 3464 uint32_t len_64 :1; 3465 uint32_t :3; /* but some for FCoIB */ 3466 uint32_t bind_en :1; 3467 uint32_t blk_pg_mode :1; 3468 uint32_t mtt_rep :4; 3469 uint32_t :16; 3470 3471 uint32_t mkey; /* swapped w/ addrh relative to arbel */ 3472 3473 uint32_t pbl_addrh; 3474 3475 uint32_t pbl_addrl :26; 3476 uint32_t :6; 3477 3478 uint64_t start_addr; 3479 3480 uint64_t reg_len; /* w/ len_64 allows 65 bits of length */ 3481 3482 uint32_t :11; 3483 uint32_t fbo :21; 3484 3485 uint32_t :11; 3486 uint32_t pge_blk_sz :21; 3487 3488 uint32_t rsrv0[2]; 3489}; 3490 3491/* 3492 * NOTE: Some hermon-PRM defined Send WQE segments are not defined here 3493 * because they will not be used initially: they should be added and 3494 * used later on: 3495 * FCP-3 init 3496 * FCP-3 Control 3497 * Large Send Offload 3498 * 3499 */ 3500 3501/* 3502 * Hermon "MLX transport" Work Queue Element (WQE) 3503 * The format of the MLX WQE is similar to that of the Send WQE (above) 3504 * with the following exceptions. MLX WQEs are used for sending MADs on 3505 * special QPs 0 and 1. Everything following the "Next/Ctrl" header 3506 * (defined below) consists of scatter-gather list entries. The contents 3507 * of these SGLs (also defined below) will be put on the wire exactly as 3508 * they appear in the buffers. In addition, the VCRC and the ICRC of each 3509 * sent packet can be modified by changing values in the following header 3510 * or in the payload of the packet itself. 3511 */ 3512 3513 3514struct hermon_hw_mlx_wqe_nextctrl_s { 3515 uint32_t owner :1; 3516 uint32_t :23; 3517 uint32_t :3; 3518 uint32_t opcode :5; /* is 0x0A (send) for MLX */ 3519 3520 uint32_t :26; 3521 uint32_t ds :6; /* WQE size in octowords */ 3522 3523 uint32_t :14; 3524 uint32_t vl15 :1; 3525 uint32_t slr :1; 3526 uint32_t max_srate :4; 3527 uint32_t sl :4; 3528 uint32_t :3; /* FCoIB usage */ 3529 uint32_t icrc :1; /* 1==don't replace icrc fld */ 3530 uint32_t cq_gen :2; /* 00= no cqe, 11==cqe */ 3531 uint32_t :1; 3532 uint32_t force_lb :1; 3533 3534 uint32_t rlid :16; 3535 uint32_t :16; 3536}; 3537 3538 3539#define HERMON_WQE_MLXHDR_VL15_MASK 0x0002000000000000ull 3540#define HERMON_WQE_MLXHDR_SLR_MASK 0x0001000000000000ull 3541#define HERMON_WQE_MLXHDR_SRATE_SHIFT 44 3542#define HERMON_WQE_MLXHDR_SL_SHIFT 40 3543#define HERMON_WQE_MLXHDR_SIGNALED_MASK 0x0000000800000000ull 3544#define HERMON_WQE_MLXHDR_RLID_SHIFT 16 3545 3546 3547/* 3548 * Hermon Receive Work Queue Element (WQE) 3549 * Unlike the Send WQE, the Receive WQE is built ONLY of 16-byte segments. A 3550 * "Next/Ctrl" segment is no longer needed, because of the fixed 3551 * receive queue stride (RQ.STRIDE). It contains just 3552 * some number of scatter list entries for the incoming message. 3553 * 3554 * The format of the scatter-gather list entries is shown below. For 3555 * Receive WQEs the "inline_data" field must be cleared (i.e. data segments 3556 * cannot contain inline data). 3557 */ 3558 3559 3560struct hermon_hw_wqe_sgl_s { 3561 uint32_t inline_data :1; 3562 uint32_t byte_cnt :31; 3563 3564 uint32_t lkey; 3565 3566 uint64_t addr; 3567}; 3568#define HERMON_WQE_SGL_BYTE_CNT_MASK 0x7FFFFFFF 3569#define HERMON_WQE_SGL_INLINE_MASK 0x80000000 3570 3571/* 3572 * The following defines are used when building descriptors for special QP 3573 * work requests (i.e. MLX transport WQEs). Note: Because Hermon MLX transport 3574 * requires the driver to build actual IB packet headers, we use these defines 3575 * for the most common fields in those headers. 3576 */ 3577 3578 3579#define HERMON_MLX_VL15_LVER 0xF0000000 3580#define HERMON_MLX_VL0_LVER 0x00000000 3581#define HERMON_MLX_IPVER_TC_FLOW 0x60000000 3582#define HERMON_MLX_TC_SHIFT 20 3583#define HERMON_MLX_DEF_PKEY 0xFFFF 3584#define HERMON_MLX_GSI_QKEY 0x80010000 3585#define HERMON_MLX_UDSEND_OPCODE 0x64000000 3586#define HERMON_MLX_DQPN_MASK 0xFFFFFF 3587 3588/* 3589 * The following macros are used for building each of the individual 3590 * segments that can make up a Hermon WQE. Note: We try not to use the 3591 * structures (with their associated bitfields) here, instead opting to 3592 * build and put 64-bit or 32-bit chunks to the WQEs as appropriate, 3593 * primarily because using the bitfields appears to force more read-modify- 3594 * write operations. 3595 * 3596 * HERMON_WQE_BUILD_UD - Builds Unreliable Datagram Segment 3597 * 3598 * HERMON_WQE_BUILD_REMADDR - Builds Remote Address Segment using 3599 * RDMA info from the work request 3600 * HERMON_WQE_BUILD_RC_ATOMIC_REMADDR - Builds Remote Address Segment 3601 * for RC Atomic work requests 3602 * HERMON_WQE_BUILD_ATOMIC - Builds Atomic Segment using atomic 3603 * info from the work request 3604 * HERMON_WQE_BUILD_BIND - Builds the Bind Memory Window 3605 * Segment using bind info from the 3606 * work request 3607 * HERMON_WQE_BUILD_DATA_SEG - Builds the individual Data Segments 3608 * for Send, Receive, and MLX WQEs 3609 * HERMON_WQE_BUILD_INLINE - Builds an "inline" Data Segment 3610 * (primarily for MLX transport) 3611 * HERMON_WQE_BUILD_INLINE_ICRC - Also builds an "inline" Data Segment 3612 * (but used primarily in the ICRC 3613 * portion of MLX transport WQEs) 3614 * HERMON_WQE_LINKNEXT - Links the current WQE to the 3615 * previous one 3616 * HERMON_WQE_LINKFIRST - Links the first WQE on the current 3617 * chain to the previous WQE 3618 * HERMON_WQE_BUILD_MLX_LRH - Builds the inline LRH header for 3619 * MLX transport MADs 3620 * HERMON_WQE_BUILD_MLX_GRH - Builds the inline GRH header for 3621 * MLX transport MADs 3622 * HERMON_WQE_BUILD_MLX_BTH - Builds the inline BTH header for 3623 * MLX transport MADs 3624 * HERMON_WQE_BUILD_MLX_DETH - Builds the inline DETH header for 3625 * MLX transport MADs 3626 */ 3627#define HERMON_WQE_BUILD_UD(qp, ud, ah, dest) \ 3628{ \ 3629 uint64_t *tmp; \ 3630 uint64_t *udav; \ 3631 \ 3632 tmp = (uint64_t *)(ud); \ 3633 udav = (uint64_t *)(ah)->ah_udav; \ 3634 tmp[0] = ntohll(udav[0]); \ 3635 tmp[1] = ntohll(udav[1]); \ 3636 tmp[2] = ntohll(udav[2]); \ 3637 tmp[3] = ntohll(udav[3]); \ 3638 tmp[4] = ntohll((((uint64_t)((dest)->ud_dst_qpn & \ 3639 HERMON_WQE_SENDHDR_UD_DQPN_MASK) << 32) | \ 3640 (dest)->ud_qkey)); \ 3641 tmp[5] = 0; \ 3642} 3643 3644#define HERMON_WQE_BUILD_LSO(qp, ds, mss, hdr_sz) \ 3645 *(uint32_t *)(ds) = htonl(((mss) << 16) | hdr_sz); 3646 3647#define HERMON_WQE_BUILD_REMADDR(qp, ra, wr_rdma) \ 3648{ \ 3649 uint64_t *tmp; \ 3650 \ 3651 tmp = (uint64_t *)(ra); \ 3652 tmp[0] = htonll((wr_rdma)->rdma_raddr); \ 3653 tmp[1] = htonll((uint64_t)(wr_rdma)->rdma_rkey << 32); \ 3654} 3655 3656#define HERMON_WQE_BUILD_RC_ATOMIC_REMADDR(qp, rc, wr) \ 3657{ \ 3658 uint64_t *tmp; \ 3659 \ 3660 tmp = (uint64_t *)(rc); \ 3661 tmp[0] = htonll((wr)->wr.rc.rcwr.atomic->atom_raddr); \ 3662 tmp[1] = htonll((uint64_t)(wr)->wr.rc.rcwr.atomic->atom_rkey << 32); \ 3663} 3664 3665#define HERMON_WQE_BUILD_ATOMIC(qp, at, wr_atom) \ 3666{ \ 3667 uint64_t *tmp; \ 3668 \ 3669 tmp = (uint64_t *)(at); \ 3670 tmp[0] = htonll((wr_atom)->atom_arg2); \ 3671 tmp[1] = htonll((wr_atom)->atom_arg1); \ 3672} 3673 3674#define HERMON_WQE_BUILD_BIND(qp, bn, wr_bind) \ 3675{ \ 3676 uint64_t *tmp; \ 3677 uint64_t bn0_tmp; \ 3678 ibt_bind_flags_t bind_flags; \ 3679 \ 3680 tmp = (uint64_t *)(bn); \ 3681 bind_flags = (wr_bind)->bind_flags; \ 3682 bn0_tmp = (bind_flags & IBT_WR_BIND_ATOMIC) ? \ 3683 HERMON_WQE_SENDHDR_BIND_ATOM : 0; \ 3684 bn0_tmp |= (bind_flags & IBT_WR_BIND_WRITE) ? \ 3685 HERMON_WQE_SENDHDR_BIND_WR : 0; \ 3686 bn0_tmp |= (bind_flags & IBT_WR_BIND_READ) ? \ 3687 HERMON_WQE_SENDHDR_BIND_RD : 0; \ 3688 tmp[0] = htonll(bn0_tmp); \ 3689 tmp[1] = htonll(((uint64_t)(wr_bind)->bind_rkey_out << 32) | \ 3690 (wr_bind)->bind_lkey); \ 3691 tmp[2] = htonll((wr_bind)->bind_va); \ 3692 tmp[3] = htonll((wr_bind)->bind_len); \ 3693} 3694 3695#define HERMON_WQE_BUILD_DATA_SEG_RECV(ds, sgl) \ 3696{ \ 3697 uint64_t *tmp; \ 3698 \ 3699 tmp = (uint64_t *)(ds); \ 3700 tmp[0] = htonll((((uint64_t)((sgl)->ds_len & \ 3701 HERMON_WQE_SGL_BYTE_CNT_MASK) << 32) | (sgl)->ds_key)); \ 3702 tmp[1] = htonll((sgl)->ds_va); \ 3703} 3704#define HERMON_WQE_BUILD_DATA_SEG_SEND(ds, sgl) \ 3705{ \ 3706 ((uint64_t *)(ds))[1] = htonll((sgl)->ds_va); \ 3707 ((uint32_t *)(ds))[1] = htonl((sgl)->ds_key); \ 3708 membar_producer(); \ 3709 ((uint32_t *)(ds))[0] = \ 3710 htonl((sgl)->ds_len & HERMON_WQE_SGL_BYTE_CNT_MASK); \ 3711} 3712 3713#define HERMON_WQE_BUILD_INLINE(qp, ds, sz) \ 3714 *(uint32_t *)(ds) = htonl(HERMON_WQE_SGL_INLINE_MASK | (sz)) 3715 3716#define HERMON_WQE_BUILD_INLINE_ICRC(qp, ds, sz, icrc) \ 3717{ \ 3718 uint32_t *tmp; \ 3719 \ 3720 tmp = (uint32_t *)(ds); \ 3721 tmp[0] = htonl(HERMON_WQE_SGL_INLINE_MASK | (sz)); \ 3722 tmp[1] = htonl(icrc); \ 3723} 3724 3725#define HERMON_WQE_SET_CTRL_SEGMENT(desc, desc_sz, fence, \ 3726 imm, sol, sig, ip_cksum, qp) \ 3727{ \ 3728 uint32_t *tmp; \ 3729 uint32_t cntr_tmp; \ 3730 \ 3731 /* do not set the first dword (owner/opcode) here */ \ 3732 tmp = (uint32_t *)desc; \ 3733 cntr_tmp = (fence << 6) | desc_sz; \ 3734 tmp[1] = ntohl(cntr_tmp); \ 3735 cntr_tmp = 0; \ 3736 if ((sol) != 0) cntr_tmp |= 0x02; \ 3737 if ((sig) != 0) cntr_tmp |= 0x0C; \ 3738 /*LINTED*/ \ 3739 if (ip_cksum) cntr_tmp |= 0x30; \ 3740 tmp[2] = ntohl(cntr_tmp); \ 3741 tmp[3] = ntohl(imm); \ 3742} 3743 3744#define HERMON_WQE_SET_MLX_CTRL_SEGMENT(desc, desc_sz, sig, maxstat, \ 3745 lid, qp, sl) \ 3746{ \ 3747 uint32_t *tmp; \ 3748 uint32_t cntr_tmp; \ 3749 \ 3750 tmp = (uint32_t *)desc; \ 3751 cntr_tmp = htonl(tmp[0]); \ 3752 cntr_tmp &= 0x80000000; \ 3753 cntr_tmp |= HERMON_WQE_SEND_NOPCODE_SEND; \ 3754 tmp[0] = ntohl(cntr_tmp); \ 3755 tmp[1] = ntohl(desc_sz); \ 3756 cntr_tmp = ((maxstat << 4) | (sl & 0xff)) << 8; \ 3757 if (qp->qp_is_special == HERMON_QP_SMI) \ 3758 cntr_tmp |= (0x02 << 16); \ 3759 if (lid == IB_LID_PERMISSIVE) \ 3760 cntr_tmp |= (0x01 << 16); \ 3761 if ((sig) != 0) \ 3762 cntr_tmp |= 0xC; \ 3763 tmp[2] = ntohl(cntr_tmp); \ 3764 tmp[3] = ntohl((lid) << 16); \ 3765} 3766 3767#define HERMON_WQE_BUILD_MLX_LRH(lrh, qp, udav, pktlen) \ 3768{ \ 3769 uint32_t *tmp; \ 3770 uint32_t lrh_tmp; \ 3771 \ 3772 tmp = (uint32_t *)(void *)(lrh); \ 3773 \ 3774 if ((qp)->qp_is_special == HERMON_QP_SMI) { \ 3775 lrh_tmp = HERMON_MLX_VL15_LVER; \ 3776 } else { \ 3777 lrh_tmp = HERMON_MLX_VL0_LVER | ((udav)->sl << 20); \ 3778 } \ 3779 if ((udav)->grh) { \ 3780 lrh_tmp |= (IB_LRH_NEXT_HDR_GRH << 16); \ 3781 } else { \ 3782 lrh_tmp |= (IB_LRH_NEXT_HDR_BTH << 16); \ 3783 } \ 3784 lrh_tmp |= (udav)->rlid; \ 3785 tmp[0] = htonl(lrh_tmp); \ 3786 \ 3787 lrh_tmp = (pktlen) << 16; \ 3788 if ((udav)->rlid == IB_LID_PERMISSIVE) { \ 3789 lrh_tmp |= IB_LID_PERMISSIVE; \ 3790 } else { \ 3791 lrh_tmp |= (udav)->ml_path; \ 3792 } \ 3793 tmp[1] = htonl(lrh_tmp); \ 3794} 3795 3796/* 3797 * Note: The GRH payload length, calculated below, is the overall packet 3798 * length (in bytes) minus LRH header and GRH headers. 3799 * 3800 * Also note: Filling in the GIDs in the way we do below is helpful because 3801 * it avoids potential alignment restrictions and/or conflicts. 3802 */ 3803#define HERMON_WQE_BUILD_MLX_GRH(state, grh, qp, udav, pktlen) \ 3804{ \ 3805 uint32_t *tmp; \ 3806 uint32_t grh_tmp; \ 3807 ib_gid_t sgid; \ 3808 \ 3809 tmp = (uint32_t *)(grh); \ 3810 \ 3811 grh_tmp = HERMON_MLX_IPVER_TC_FLOW; \ 3812 grh_tmp |= (udav)->tclass << HERMON_MLX_TC_SHIFT; \ 3813 grh_tmp |= (udav)->flow_label; \ 3814 tmp[0] = htonl(grh_tmp); \ 3815 \ 3816 grh_tmp = (((pktlen) << 2) - (sizeof (ib_lrh_hdr_t) + \ 3817 sizeof (ib_grh_t))) << 16; \ 3818 grh_tmp |= (IB_GRH_NEXT_HDR_BTH << 8); \ 3819 grh_tmp |= (udav)->hop_limit; \ 3820 tmp[1] = htonl(grh_tmp); \ 3821 \ 3822 sgid.gid_prefix = (state)->hs_sn_prefix[(qp)->qp_portnum]; \ 3823 sgid.gid_guid = (state)->hs_guid[(qp)->qp_portnum] \ 3824 [(udav)->mgid_index]; \ 3825 bcopy(&sgid, &tmp[2], sizeof (ib_gid_t)); \ 3826 bcopy(&(udav)->rgid_h, &tmp[6], sizeof (ib_gid_t)); \ 3827} 3828 3829#define HERMON_WQE_BUILD_MLX_BTH(state, bth, qp, wr) \ 3830{ \ 3831 uint32_t *tmp; \ 3832 uint32_t bth_tmp; \ 3833 \ 3834 tmp = (uint32_t *)(bth); \ 3835 \ 3836 bth_tmp = HERMON_MLX_UDSEND_OPCODE; \ 3837 if ((wr)->wr_flags & IBT_WR_SEND_SOLICIT) { \ 3838 bth_tmp |= (IB_BTH_SOLICITED_EVENT_MASK << 16); \ 3839 } \ 3840 if (qp->qp_is_special == HERMON_QP_SMI) { \ 3841 bth_tmp |= HERMON_MLX_DEF_PKEY; \ 3842 } else { \ 3843 bth_tmp |= (state)->hs_pkey[(qp)->qp_portnum] \ 3844 [(qp)->qp_pkeyindx]; \ 3845 } \ 3846 tmp[0] = htonl(bth_tmp); \ 3847 tmp[1] = htonl((wr)->wr.ud.udwr_dest->ud_dst_qpn & \ 3848 HERMON_MLX_DQPN_MASK); \ 3849 tmp[2] = 0x0; \ 3850} 3851 3852#define HERMON_WQE_BUILD_MLX_DETH(deth, qp) \ 3853{ \ 3854 uint32_t *tmp; \ 3855 \ 3856 tmp = (uint32_t *)(deth); \ 3857 \ 3858 if ((qp)->qp_is_special == HERMON_QP_SMI) { \ 3859 tmp[0] = 0x0; \ 3860 tmp[1] = 0x0; \ 3861 } else { \ 3862 tmp[0] = htonl(HERMON_MLX_GSI_QKEY); \ 3863 tmp[1] = htonl(0x1); \ 3864 } \ 3865} 3866 3867 3868 3869 3870 3871 3872/* 3873 * Flash interface: 3874 * Below we have PCI config space space offsets for flash interface 3875 * access, offsets within Hermon CR space for accessing flash-specific 3876 * information or settings, masks used for flash settings, and 3877 * timeout values for flash operations. 3878 */ 3879#define HERMON_HW_FLASH_CFG_HWREV 8 3880#define HERMON_HW_FLASH_CFG_ADDR 88 3881#define HERMON_HW_FLASH_CFG_DATA 92 3882 3883#define HERMON_HW_FLASH_RESET_AMD 0xF0 3884#define HERMON_HW_FLASH_RESET_INTEL 0xFF 3885#define HERMON_HW_FLASH_CPUMODE 0xF0150 3886#define HERMON_HW_FLASH_ADDR 0xF01A4 3887#define HERMON_HW_FLASH_DATA 0xF01A8 3888#define HERMON_HW_FLASH_GPIO_SEMA 0xF03FC 3889#define HERMON_HW_FLASH_WRCONF_SEMA 0xF0380 3890#define HERMON_HW_FLASH_GPIO_DATA 0xF0040 3891#define HERMON_HW_FLASH_GPIO_MOD1 0xF004C 3892#define HERMON_HW_FLASH_GPIO_MOD0 0xF0050 3893#define HERMON_HW_FLASH_GPIO_DATACLEAR 0xF00D4 3894#define HERMON_HW_FLASH_GPIO_DATASET 0xF00DC 3895#define HERMON_HW_FLASH_GPIO_LOCK 0xF0048 3896#define HERMON_HW_FLASH_GPIO_UNLOCK_VAL 0xD42F 3897#define HERMON_HW_FLASH_GPIO_PIN_ENABLE 0x1E000000 3898 3899#define HERMON_HW_FLASH_CPU_MASK 0xC0000000 3900#define HERMON_HW_FLASH_CPU_SHIFT 30 3901#define HERMON_HW_FLASH_ADDR_MASK 0x0007FFFC 3902#define HERMON_HW_FLASH_CMD_MASK 0xE0000000 3903#define HERMON_HW_FLASH_BANK_MASK 0xFFF80000 3904 3905#define HERMON_HW_FLASH_SPI_BUSY 0x40000000 3906#define HERMON_HW_FLASH_SPI_WIP 0x01000000 3907#define HERMON_HW_FLASH_SPI_READ_OP 0x00000001 3908#define HERMON_HW_FLASH_SPI_USE_INSTR 0x00000040 3909#define HERMON_HW_FLASH_SPI_NO_ADDR 0x00000020 3910#define HERMON_HW_FLASH_SPI_NO_DATA 0x00000010 3911#define HERMON_HW_FLASH_SPI_TRANS_SZ_4B 0x00000200 3912 3913#define HERMON_HW_FLASH_SPI_SECTOR_ERASE 0xD8 3914#define HERMON_HW_FLASH_SPI_READ 0x03 3915#define HERMON_HW_FLASH_SPI_PAGE_PROGRAM 0x02 3916#define HERMON_HW_FLASH_SPI_READ_STATUS_REG 0x05 3917#define HERMON_HW_FLASH_SPI_WRITE_ENABLE 0x06 3918#define HERMON_HW_FLASH_SPI_READ_ESIGNATURE 0xAB 3919 3920#define HERMON_HW_FLASH_SPI_GW 0xF0400 3921#define HERMON_HW_FLASH_SPI_ADDR 0xF0404 3922#define HERMON_HW_FLASH_SPI_DATA 0xF0410 3923#define HERMON_HW_FLASH_SPI_DATA4 0xF0414 3924#define HERMON_HW_FLASH_SPI_DATA8 0xF0418 3925#define HERMON_HW_FLASH_SPI_DATA12 0xF041C 3926#define HERMON_HW_FLASH_SPI_ADDR_MASK 0x00FFFFFF 3927#define HERMON_HW_FLASH_SPI_INSTR_PHASE_OFF 0x04 3928#define HERMON_HW_FLASH_SPI_ADDR_PHASE_OFF 0x08 3929#define HERMON_HW_FLASH_SPI_DATA_PHASE_OFF 0x10 3930#define HERMON_HW_FLASH_SPI_ENABLE_OFF 0x2000 3931#define HERMON_HW_FLASH_SPI_CS_OFF 0x800 3932#define HERMON_HW_FLASH_SPI_INSTR_OFF 0x10000 3933#define HERMON_HW_FLASH_SPI_INSTR_SHIFT 0x10 3934#define HERMON_HW_FLASH_SPI_BOOT_ADDR_REG 0xF0000 3935 3936#define HERMON_HW_FLASH_TIMEOUT_WRITE 300 3937#define HERMON_HW_FLASH_TIMEOUT_ERASE 1000000 3938#define HERMON_HW_FLASH_TIMEOUT_GPIO_SEMA 1000 3939#define HERMON_HW_FLASH_TIMEOUT_CONFIG 50 3940 3941#define HERMON_HW_FLASH_ICS_ERASE 0x20 3942#define HERMON_HW_FLASH_ICS_ERROR 0x3E 3943#define HERMON_HW_FLASH_ICS_WRITE 0x40 3944#define HERMON_HW_FLASH_ICS_STATUS 0x70 3945#define HERMON_HW_FLASH_ICS_READY 0x80 3946#define HERMON_HW_FLASH_ICS_CONFIRM 0xD0 3947#define HERMON_HW_FLASH_ICS_READ 0xFF 3948 3949#ifdef __cplusplus 3950} 3951#endif 3952 3953#endif /* _SYS_IB_ADAPTERS_HERMON_HW_H */ 3954