diff options
author | James Smart <James.Smart@Emulex.Com> | 2008-12-04 22:39:46 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:27 -0500 |
commit | 81301a9b05c3690bf32bf4ef37d941f0f870a7ba (patch) | |
tree | cd4f13d46241e0652a697f057e5accd8df06b9a9 /drivers/scsi/lpfc/lpfc_hw.h | |
parent | 9f1e1b50ab43a281dbc75c25f11e1926a9ea367a (diff) |
[SCSI] lpfc 8.3.0 : Add BlockGuard support (T10-DIF) structs and defs
Update struct definitions, #defines, sysfs entries, and initialization
to support BlockGuard.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_hw.h')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw.h | 207 |
1 files changed, 202 insertions, 5 deletions
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 74a4b306d021..4168c7b498b8 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -1544,6 +1544,108 @@ typedef struct ULP_BDL { /* SLI-2 */ | |||
1544 | 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 */ |
1545 | } ULP_BDL; | 1545 | } ULP_BDL; |
1546 | 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 | |||
1547 | /* Structure for MB Command LOAD_SM and DOWN_LOAD */ | 1649 | /* Structure for MB Command LOAD_SM and DOWN_LOAD */ |
1548 | 1650 | ||
1549 | typedef struct { | 1651 | typedef struct { |
@@ -2595,8 +2697,9 @@ typedef struct { | |||
2595 | #endif | 2697 | #endif |
2596 | 2698 | ||
2597 | #ifdef __BIG_ENDIAN_BITFIELD | 2699 | #ifdef __BIG_ENDIAN_BITFIELD |
2598 | uint32_t rsvd1 : 24; /* Reserved */ | 2700 | uint32_t rsvd1 : 23; /* Reserved */ |
2599 | uint32_t cmv : 1; /* Configure Max VPIs */ | 2701 | uint32_t cbg : 1; /* Configure BlockGuard */ |
2702 | uint32_t cmv : 1; /* Configure Max VPIs */ | ||
2600 | uint32_t ccrp : 1; /* Config Command Ring Polling */ | 2703 | uint32_t ccrp : 1; /* Config Command Ring Polling */ |
2601 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ | 2704 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ |
2602 | uint32_t chbs : 1; /* Cofigure Host Backing store */ | 2705 | uint32_t chbs : 1; /* Cofigure Host Backing store */ |
@@ -2613,10 +2716,12 @@ typedef struct { | |||
2613 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ | 2716 | uint32_t csah : 1; /* Configure Synchronous Abort Handling */ |
2614 | uint32_t ccrp : 1; /* Config Command Ring Polling */ | 2717 | uint32_t ccrp : 1; /* Config Command Ring Polling */ |
2615 | uint32_t cmv : 1; /* Configure Max VPIs */ | 2718 | uint32_t cmv : 1; /* Configure Max VPIs */ |
2616 | uint32_t rsvd1 : 24; /* Reserved */ | 2719 | uint32_t cbg : 1; /* Configure BlockGuard */ |
2720 | uint32_t rsvd1 : 23; /* Reserved */ | ||
2617 | #endif | 2721 | #endif |
2618 | #ifdef __BIG_ENDIAN_BITFIELD | 2722 | #ifdef __BIG_ENDIAN_BITFIELD |
2619 | uint32_t rsvd2 : 24; /* Reserved */ | 2723 | uint32_t rsvd2 : 23; /* Reserved */ |
2724 | uint32_t gbg : 1; /* Grant BlockGuard */ | ||
2620 | uint32_t gmv : 1; /* Grant Max VPIs */ | 2725 | uint32_t gmv : 1; /* Grant Max VPIs */ |
2621 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ | 2726 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ |
2622 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ | 2727 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ |
@@ -2634,7 +2739,8 @@ typedef struct { | |||
2634 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ | 2739 | uint32_t gsah : 1; /* Grant Synchronous Abort Handling */ |
2635 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ | 2740 | uint32_t gcrp : 1; /* Grant Command Ring Polling */ |
2636 | uint32_t gmv : 1; /* Grant Max VPIs */ | 2741 | uint32_t gmv : 1; /* Grant Max VPIs */ |
2637 | uint32_t rsvd2 : 24; /* Reserved */ | 2742 | uint32_t gbg : 1; /* Grant BlockGuard */ |
2743 | uint32_t rsvd2 : 23; /* Reserved */ | ||
2638 | #endif | 2744 | #endif |
2639 | 2745 | ||
2640 | #ifdef __BIG_ENDIAN_BITFIELD | 2746 | #ifdef __BIG_ENDIAN_BITFIELD |
@@ -3254,6 +3360,94 @@ struct que_xri64cx_ext_fields { | |||
3254 | struct lpfc_hbq_entry buff[5]; | 3360 | struct lpfc_hbq_entry buff[5]; |
3255 | }; | 3361 | }; |
3256 | 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 | |||
3257 | #define LPFC_EXT_DATA_BDE_COUNT 3 | 3451 | #define LPFC_EXT_DATA_BDE_COUNT 3 |
3258 | struct fcp_irw_ext { | 3452 | struct fcp_irw_ext { |
3259 | uint32_t io_tag64_low; | 3453 | uint32_t io_tag64_low; |
@@ -3362,6 +3556,9 @@ typedef struct _IOCB { /* IOCB structure */ | |||
3362 | struct que_xri64cx_ext_fields que_xri64cx_ext_words; | 3556 | struct que_xri64cx_ext_fields que_xri64cx_ext_words; |
3363 | struct fcp_irw_ext fcp_ext; | 3557 | struct fcp_irw_ext fcp_ext; |
3364 | 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; | ||
3365 | } unsli3; | 3562 | } unsli3; |
3366 | 3563 | ||
3367 | #define ulpCt_h ulpXS | 3564 | #define ulpCt_h ulpXS |