diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_hw.h')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw.h | 249 |
1 files changed, 243 insertions, 6 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 5de5dabbbee6..4168c7b498b8 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -65,6 +65,9 @@ | |||
65 | #define SLI3_IOCB_RSP_SIZE 64 | 65 | #define SLI3_IOCB_RSP_SIZE 64 |
66 | 66 | ||
67 | 67 | ||
68 | /* vendor ID used in SCSI netlink calls */ | ||
69 | #define LPFC_NL_VENDOR_ID (SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX) | ||
70 | |||
68 | /* Common Transport structures and definitions */ | 71 | /* Common Transport structures and definitions */ |
69 | 72 | ||
70 | union CtRevisionId { | 73 | union CtRevisionId { |
@@ -866,6 +869,12 @@ typedef struct _D_ID { /* Structure is in Big Endian format */ | |||
866 | } un; | 869 | } un; |
867 | } D_ID; | 870 | } D_ID; |
868 | 871 | ||
872 | #define RSCN_ADDRESS_FORMAT_PORT 0x0 | ||
873 | #define RSCN_ADDRESS_FORMAT_AREA 0x1 | ||
874 | #define RSCN_ADDRESS_FORMAT_DOMAIN 0x2 | ||
875 | #define RSCN_ADDRESS_FORMAT_FABRIC 0x3 | ||
876 | #define RSCN_ADDRESS_FORMAT_MASK 0x3 | ||
877 | |||
869 | /* | 878 | /* |
870 | * Structure to define all ELS Payload types | 879 | * Structure to define all ELS Payload types |
871 | */ | 880 | */ |
@@ -1535,6 +1544,108 @@ typedef struct ULP_BDL { /* SLI-2 */ | |||
1535 | uint32_t ulpIoTag32; /* Can be used for 32 bit I/O Tag */ | 1544 | uint32_t ulpIoTag32; /* Can be used for 32 bit I/O Tag */ |
1536 | } ULP_BDL; | 1545 | } ULP_BDL; |
1537 | 1546 | ||
1547 | /* | ||
1548 | * BlockGuard Definitions | ||
1549 | */ | ||
1550 | |||
1551 | enum lpfc_protgrp_type { | ||
1552 | LPFC_PG_TYPE_INVALID = 0, /* used to indicate errors */ | ||
1553 | LPFC_PG_TYPE_NO_DIF, /* no DIF data pointed to by prot grp */ | ||
1554 | LPFC_PG_TYPE_EMBD_DIF, /* DIF is embedded (inline) with data */ | ||
1555 | LPFC_PG_TYPE_DIF_BUF /* DIF has its own scatter/gather list */ | ||
1556 | }; | ||
1557 | |||
1558 | /* PDE Descriptors */ | ||
1559 | #define LPFC_PDE1_DESCRIPTOR 0x81 | ||
1560 | #define LPFC_PDE2_DESCRIPTOR 0x82 | ||
1561 | #define LPFC_PDE3_DESCRIPTOR 0x83 | ||
1562 | |||
1563 | /* BlockGuard Profiles */ | ||
1564 | enum lpfc_bg_prof_codes { | ||
1565 | LPFC_PROF_INVALID, | ||
1566 | LPFC_PROF_A1 = 128, /* Full Protection */ | ||
1567 | LPFC_PROF_A2, /* Disabled Protection Checks:A2~A4 */ | ||
1568 | LPFC_PROF_A3, | ||
1569 | LPFC_PROF_A4, | ||
1570 | LPFC_PROF_B1, /* Embedded DIFs: B1~B3 */ | ||
1571 | LPFC_PROF_B2, | ||
1572 | LPFC_PROF_B3, | ||
1573 | LPFC_PROF_C1, /* Separate DIFs: C1~C3 */ | ||
1574 | LPFC_PROF_C2, | ||
1575 | LPFC_PROF_C3, | ||
1576 | LPFC_PROF_D1, /* Full Protection */ | ||
1577 | LPFC_PROF_D2, /* Partial Protection & Check Disabling */ | ||
1578 | LPFC_PROF_D3, | ||
1579 | LPFC_PROF_E1, /* E1~E4:out - check-only, in - update apptag */ | ||
1580 | LPFC_PROF_E2, | ||
1581 | LPFC_PROF_E3, | ||
1582 | LPFC_PROF_E4, | ||
1583 | LPFC_PROF_F1, /* Full Translation - F1 Prot Descriptor */ | ||
1584 | /* F1 Translation BDE */ | ||
1585 | LPFC_PROF_ANT1, /* TCP checksum, DIF inline with data buffers */ | ||
1586 | LPFC_PROF_AST1, /* TCP checksum, DIF split from data buffer */ | ||
1587 | LPFC_PROF_ANT2, | ||
1588 | LPFC_PROF_AST2 | ||
1589 | }; | ||
1590 | |||
1591 | /* BlockGuard error-control defines */ | ||
1592 | #define BG_EC_STOP_ERR 0x00 | ||
1593 | #define BG_EC_CONT_ERR 0x01 | ||
1594 | #define BG_EC_IGN_UNINIT_STOP_ERR 0x10 | ||
1595 | #define BG_EC_IGN_UNINIT_CONT_ERR 0x11 | ||
1596 | |||
1597 | /* PDE (Protection Descriptor Entry) word 0 bit masks and shifts */ | ||
1598 | #define PDE_DESC_TYPE_MASK 0xff000000 | ||
1599 | #define PDE_DESC_TYPE_SHIFT 24 | ||
1600 | #define PDE_BG_PROFILE_MASK 0x00ff0000 | ||
1601 | #define PDE_BG_PROFILE_SHIFT 16 | ||
1602 | #define PDE_BLOCK_LEN_MASK 0x0000fffc | ||
1603 | #define PDE_BLOCK_LEN_SHIFT 2 | ||
1604 | #define PDE_ERR_CTRL_MASK 0x00000003 | ||
1605 | #define PDE_ERR_CTRL_SHIFT 0 | ||
1606 | /* PDE word 1 bit masks and shifts */ | ||
1607 | #define PDE_APPTAG_MASK_MASK 0xffff0000 | ||
1608 | #define PDE_APPTAG_MASK_SHIFT 16 | ||
1609 | #define PDE_APPTAG_VAL_MASK 0x0000ffff | ||
1610 | #define PDE_APPTAG_VAL_SHIFT 0 | ||
1611 | struct lpfc_pde { | ||
1612 | uint32_t parms; /* bitfields of descriptor, prof, len, and ec */ | ||
1613 | uint32_t apptag; /* bitfields of app tag maskand app tag value */ | ||
1614 | uint32_t reftag; /* reference tag occupying all 32 bits */ | ||
1615 | }; | ||
1616 | |||
1617 | /* inline function to set fields in parms of PDE */ | ||
1618 | static inline void | ||
1619 | lpfc_pde_set_bg_parms(struct lpfc_pde *p, u8 desc, u8 prof, u16 len, u8 ec) | ||
1620 | { | ||
1621 | uint32_t *wp = &p->parms; | ||
1622 | |||
1623 | /* spec indicates that adapter appends two 0's to length field */ | ||
1624 | len = len >> 2; | ||
1625 | |||
1626 | *wp &= 0; | ||
1627 | *wp |= ((desc << PDE_DESC_TYPE_SHIFT) & PDE_DESC_TYPE_MASK); | ||
1628 | *wp |= ((prof << PDE_BG_PROFILE_SHIFT) & PDE_BG_PROFILE_MASK); | ||
1629 | *wp |= ((len << PDE_BLOCK_LEN_SHIFT) & PDE_BLOCK_LEN_MASK); | ||
1630 | *wp |= ((ec << PDE_ERR_CTRL_SHIFT) & PDE_ERR_CTRL_MASK); | ||
1631 | *wp = le32_to_cpu(*wp); | ||
1632 | } | ||
1633 | |||
1634 | /* inline function to set apptag and reftag fields of PDE */ | ||
1635 | static inline void | ||
1636 | lpfc_pde_set_dif_parms(struct lpfc_pde *p, u16 apptagmask, u16 apptagval, | ||
1637 | u32 reftag) | ||
1638 | { | ||
1639 | uint32_t *wp = &p->apptag; | ||
1640 | *wp &= 0; | ||
1641 | *wp |= ((apptagmask << PDE_APPTAG_MASK_SHIFT) & PDE_APPTAG_MASK_MASK); | ||
1642 | *wp |= ((apptagval << PDE_APPTAG_VAL_SHIFT) & PDE_APPTAG_VAL_MASK); | ||
1643 | *wp = le32_to_cpu(*wp); | ||
1644 | wp = &p->reftag; | ||
1645 | *wp = le32_to_cpu(reftag); | ||
1646 | } | ||
1647 | |||
1648 | |||
1538 | /* Structure for MB Command LOAD_SM and DOWN_LOAD */ | 1649 | /* Structure for MB Command LOAD_SM and DOWN_LOAD */ |
1539 | 1650 | ||
1540 | typedef struct { | 1651 | typedef struct { |
@@ -2359,6 +2470,30 @@ typedef struct { | |||
2359 | #define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */ | 2470 | #define DMP_RSP_OFFSET 0x14 /* word 5 contains first word of rsp */ |
2360 | #define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */ | 2471 | #define DMP_RSP_SIZE 0x6C /* maximum of 27 words of rsp data */ |
2361 | 2472 | ||
2473 | #define WAKE_UP_PARMS_REGION_ID 4 | ||
2474 | #define WAKE_UP_PARMS_WORD_SIZE 15 | ||
2475 | |||
2476 | /* Option rom version structure */ | ||
2477 | struct prog_id { | ||
2478 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2479 | uint8_t type; | ||
2480 | uint8_t id; | ||
2481 | uint32_t ver:4; /* Major Version */ | ||
2482 | uint32_t rev:4; /* Revision */ | ||
2483 | uint32_t lev:2; /* Level */ | ||
2484 | uint32_t dist:2; /* Dist Type */ | ||
2485 | uint32_t num:4; /* number after dist type */ | ||
2486 | #else /* __LITTLE_ENDIAN_BITFIELD */ | ||
2487 | uint32_t num:4; /* number after dist type */ | ||
2488 | uint32_t dist:2; /* Dist Type */ | ||
2489 | uint32_t lev:2; /* Level */ | ||
2490 | uint32_t rev:4; /* Revision */ | ||
2491 | uint32_t ver:4; /* Major Version */ | ||
2492 | uint8_t id; | ||
2493 | uint8_t type; | ||
2494 | #endif | ||
2495 | }; | ||
2496 | |||
2362 | /* Structure for MB Command UPDATE_CFG (0x1B) */ | 2497 | /* Structure for MB Command UPDATE_CFG (0x1B) */ |
2363 | 2498 | ||
2364 | struct update_cfg_var { | 2499 | struct update_cfg_var { |
@@ -2552,11 +2687,19 @@ typedef struct { | |||
2552 | 2687 | ||
2553 | uint32_t pcbLow; /* bit 31:0 of memory based port config block */ | 2688 | uint32_t pcbLow; /* bit 31:0 of memory based port config block */ |
2554 | uint32_t pcbHigh; /* bit 63:32 of memory based port config block */ | 2689 | uint32_t pcbHigh; /* bit 63:32 of memory based port config block */ |
2555 | uint32_t hbainit[6]; | 2690 | uint32_t hbainit[5]; |
2691 | #ifdef __BIG_ENDIAN_BITFIELD | ||
2692 | uint32_t hps : 1; /* bit 31 word9 Host Pointer in slim */ | ||
2693 | uint32_t rsvd : 31; /* least significant 31 bits of word 9 */ | ||
2694 | #else /* __LITTLE_ENDIAN */ | ||
2695 | uint32_t rsvd : 31; /* least significant 31 bits of word 9 */ | ||
2696 | uint32_t hps : 1; /* bit 31 word9 Host Pointer in slim */ | ||
2697 | #endif | ||
2556 | 2698 | ||
2557 | #ifdef __BIG_ENDIAN_BITFIELD | 2699 | #ifdef __BIG_ENDIAN_BITFIELD |
2558 | uint32_t rsvd : 24; /* Reserved */ | 2700 | uint32_t rsvd1 : 23; /* Reserved */ |
2559 | uint32_t cmv : 1; /* Configure Max VPIs */ | 2701 | uint32_t cbg : 1; /* Configure BlockGuard */ |
2702 | uint32_t cmv : 1; /* Configure Max VPIs */ | ||
2560 | uint32_t ccrp : 1; /* Config Command Ring Polling */ | 2703 | uint32_t ccrp : 1; /* Config Command Ring Polling */ |
2561 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ | 2704 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ |
2562 | uint32_t chbs : 1; /* Cofigure Host Backing store */ | 2705 | uint32_t chbs : 1; /* Cofigure Host Backing store */ |
@@ -2573,10 +2716,12 @@ typedef struct { | |||
2573 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ | 2716 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ |
2574 | uint32_t ccrp : 1; /* Config Command Ring Polling */ | 2717 | uint32_t ccrp : 1; /* Config Command Ring Polling */ |
2575 | uint32_t cmv : 1; /* Configure Max VPIs */ | 2718 | uint32_t cmv : 1; /* Configure Max VPIs */ |
2576 | uint32_t rsvd : 24; /* Reserved */ | 2719 | uint32_t cbg : 1; /* Configure BlockGuard */ |
2720 | uint32_t rsvd1 : 23; /* Reserved */ | ||
2577 | #endif | 2721 | #endif |
2578 | #ifdef __BIG_ENDIAN_BITFIELD | 2722 | #ifdef __BIG_ENDIAN_BITFIELD |
2579 | uint32_t rsvd2 : 24; /* Reserved */ | 2723 | uint32_t rsvd2 : 23; /* Reserved */ |
2724 | uint32_t gbg : 1; /* Grant BlockGuard */ | ||
2580 | uint32_t gmv : 1; /* Grant Max VPIs */ | 2725 | uint32_t gmv : 1; /* Grant Max VPIs */ |
2581 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ | 2726 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ |
2582 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ | 2727 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ |
@@ -2594,7 +2739,8 @@ typedef struct { | |||
2594 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ | 2739 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ |
2595 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ | 2740 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ |
2596 | uint32_t gmv : 1; /* Grant Max VPIs */ | 2741 | uint32_t gmv : 1; /* Grant Max VPIs */ |
2597 | uint32_t rsvd2 : 24; /* Reserved */ | 2742 | uint32_t gbg : 1; /* Grant BlockGuard */ |
2743 | uint32_t rsvd2 : 23; /* Reserved */ | ||
2598 | #endif | 2744 | #endif |
2599 | 2745 | ||
2600 | #ifdef __BIG_ENDIAN_BITFIELD | 2746 | #ifdef __BIG_ENDIAN_BITFIELD |
@@ -3214,6 +3360,94 @@ struct que_xri64cx_ext_fields { | |||
3214 | struct lpfc_hbq_entry buff[5]; | 3360 | struct lpfc_hbq_entry buff[5]; |
3215 | }; | 3361 | }; |
3216 | 3362 | ||
3363 | struct sli3_bg_fields { | ||
3364 | uint32_t filler[6]; /* word 8-13 in IOCB */ | ||
3365 | uint32_t bghm; /* word 14 - BlockGuard High Water Mark */ | ||
3366 | /* Bitfields for bgstat (BlockGuard Status - word 15 of IOCB) */ | ||
3367 | #define BGS_BIDIR_BG_PROF_MASK 0xff000000 | ||
3368 | #define BGS_BIDIR_BG_PROF_SHIFT 24 | ||
3369 | #define BGS_BIDIR_ERR_COND_FLAGS_MASK 0x003f0000 | ||
3370 | #define BGS_BIDIR_ERR_COND_SHIFT 16 | ||
3371 | #define BGS_BG_PROFILE_MASK 0x0000ff00 | ||
3372 | #define BGS_BG_PROFILE_SHIFT 8 | ||
3373 | #define BGS_INVALID_PROF_MASK 0x00000020 | ||
3374 | #define BGS_INVALID_PROF_SHIFT 5 | ||
3375 | #define BGS_UNINIT_DIF_BLOCK_MASK 0x00000010 | ||
3376 | #define BGS_UNINIT_DIF_BLOCK_SHIFT 4 | ||
3377 | #define BGS_HI_WATER_MARK_PRESENT_MASK 0x00000008 | ||
3378 | #define BGS_HI_WATER_MARK_PRESENT_SHIFT 3 | ||
3379 | #define BGS_REFTAG_ERR_MASK 0x00000004 | ||
3380 | #define BGS_REFTAG_ERR_SHIFT 2 | ||
3381 | #define BGS_APPTAG_ERR_MASK 0x00000002 | ||
3382 | #define BGS_APPTAG_ERR_SHIFT 1 | ||
3383 | #define BGS_GUARD_ERR_MASK 0x00000001 | ||
3384 | #define BGS_GUARD_ERR_SHIFT 0 | ||
3385 | uint32_t bgstat; /* word 15 - BlockGuard Status */ | ||
3386 | }; | ||
3387 | |||
3388 | static inline uint32_t | ||
3389 | lpfc_bgs_get_bidir_bg_prof(uint32_t bgstat) | ||
3390 | { | ||
3391 | return (le32_to_cpu(bgstat) & BGS_BIDIR_BG_PROF_MASK) >> | ||
3392 | BGS_BIDIR_BG_PROF_SHIFT; | ||
3393 | } | ||
3394 | |||
3395 | static inline uint32_t | ||
3396 | lpfc_bgs_get_bidir_err_cond(uint32_t bgstat) | ||
3397 | { | ||
3398 | return (le32_to_cpu(bgstat) & BGS_BIDIR_ERR_COND_FLAGS_MASK) >> | ||
3399 | BGS_BIDIR_ERR_COND_SHIFT; | ||
3400 | } | ||
3401 | |||
3402 | static inline uint32_t | ||
3403 | lpfc_bgs_get_bg_prof(uint32_t bgstat) | ||
3404 | { | ||
3405 | return (le32_to_cpu(bgstat) & BGS_BG_PROFILE_MASK) >> | ||
3406 | BGS_BG_PROFILE_SHIFT; | ||
3407 | } | ||
3408 | |||
3409 | static inline uint32_t | ||
3410 | lpfc_bgs_get_invalid_prof(uint32_t bgstat) | ||
3411 | { | ||
3412 | return (le32_to_cpu(bgstat) & BGS_INVALID_PROF_MASK) >> | ||
3413 | BGS_INVALID_PROF_SHIFT; | ||
3414 | } | ||
3415 | |||
3416 | static inline uint32_t | ||
3417 | lpfc_bgs_get_uninit_dif_block(uint32_t bgstat) | ||
3418 | { | ||
3419 | return (le32_to_cpu(bgstat) & BGS_UNINIT_DIF_BLOCK_MASK) >> | ||
3420 | BGS_UNINIT_DIF_BLOCK_SHIFT; | ||
3421 | } | ||
3422 | |||
3423 | static inline uint32_t | ||
3424 | lpfc_bgs_get_hi_water_mark_present(uint32_t bgstat) | ||
3425 | { | ||
3426 | return (le32_to_cpu(bgstat) & BGS_HI_WATER_MARK_PRESENT_MASK) >> | ||
3427 | BGS_HI_WATER_MARK_PRESENT_SHIFT; | ||
3428 | } | ||
3429 | |||
3430 | static inline uint32_t | ||
3431 | lpfc_bgs_get_reftag_err(uint32_t bgstat) | ||
3432 | { | ||
3433 | return (le32_to_cpu(bgstat) & BGS_REFTAG_ERR_MASK) >> | ||
3434 | BGS_REFTAG_ERR_SHIFT; | ||
3435 | } | ||
3436 | |||
3437 | static inline uint32_t | ||
3438 | lpfc_bgs_get_apptag_err(uint32_t bgstat) | ||
3439 | { | ||
3440 | return (le32_to_cpu(bgstat) & BGS_APPTAG_ERR_MASK) >> | ||
3441 | BGS_APPTAG_ERR_SHIFT; | ||
3442 | } | ||
3443 | |||
3444 | static inline uint32_t | ||
3445 | lpfc_bgs_get_guard_err(uint32_t bgstat) | ||
3446 | { | ||
3447 | return (le32_to_cpu(bgstat) & BGS_GUARD_ERR_MASK) >> | ||
3448 | BGS_GUARD_ERR_SHIFT; | ||
3449 | } | ||
3450 | |||
3217 | #define LPFC_EXT_DATA_BDE_COUNT 3 | 3451 | #define LPFC_EXT_DATA_BDE_COUNT 3 |
3218 | struct fcp_irw_ext { | 3452 | struct fcp_irw_ext { |
3219 | uint32_t io_tag64_low; | 3453 | uint32_t io_tag64_low; |
@@ -3322,6 +3556,9 @@ typedef struct _IOCB { /* IOCB structure */ | |||
3322 | struct que_xri64cx_ext_fields que_xri64cx_ext_words; | 3556 | struct que_xri64cx_ext_fields que_xri64cx_ext_words; |
3323 | struct fcp_irw_ext fcp_ext; | 3557 | struct fcp_irw_ext fcp_ext; |
3324 | uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */ | 3558 | uint32_t sli3Words[24]; /* 96 extra bytes for SLI-3 */ |
3559 | |||
3560 | /* words 8-15 for BlockGuard */ | ||
3561 | struct sli3_bg_fields sli3_bg; | ||
3325 | } unsli3; | 3562 | } unsli3; |
3326 | 3563 | ||
3327 | #define ulpCt_h ulpXS | 3564 | #define ulpCt_h ulpXS |