Commit 079bcbc3 authored by Vijaya Mohan Guvva's avatar Vijaya Mohan Guvva Committed by James Bottomley

[SCSI] bfa: fru vpd date update changes

1. While FRU VPD data update, inform firmware to send a completion event
   on I2C bus. Without this change, firmware used to send completion
   message on I2C bus for every chunk of FRU VPD update.
2. Support for FRU VPN update on CHINOOK2 cards.
3. Append port count to the model name to differentiate between single
   port and dual port model of 1860.
4. Update the size of the model name to 16bytes
Signed-off-by: default avatarVijaya Mohan Guvva <vmohan@brocade.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent bccd2683
...@@ -45,6 +45,7 @@ enum { ...@@ -45,6 +45,7 @@ enum {
BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */ BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */
BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */ BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */
BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */ BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */
BFA_MFG_TYPE_CHINOOK2 = 1869, /*!< Chinook2 cards */
BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */ BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */
}; };
...@@ -59,7 +60,8 @@ enum { ...@@ -59,7 +60,8 @@ enum {
(type) == BFA_MFG_TYPE_ASTRA || \ (type) == BFA_MFG_TYPE_ASTRA || \
(type) == BFA_MFG_TYPE_LIGHTNING_P0 || \ (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \
(type) == BFA_MFG_TYPE_LIGHTNING || \ (type) == BFA_MFG_TYPE_LIGHTNING || \
(type) == BFA_MFG_TYPE_CHINOOK)) (type) == BFA_MFG_TYPE_CHINOOK || \
(type) == BFA_MFG_TYPE_CHINOOK2))
/* /*
* Check if the card having old wwn/mac handling * Check if the card having old wwn/mac handling
...@@ -263,6 +265,7 @@ enum { ...@@ -263,6 +265,7 @@ enum {
BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */ BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */
BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */ BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */
BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */ BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */
BFA_ADAPTER_UUID_LEN = 16, /* adapter uuid length */
}; };
struct bfa_adapter_attr_s { struct bfa_adapter_attr_s {
...@@ -296,6 +299,7 @@ struct bfa_adapter_attr_s { ...@@ -296,6 +299,7 @@ struct bfa_adapter_attr_s {
u8 mfg_month; /* manufacturing month */ u8 mfg_month; /* manufacturing month */
u16 mfg_year; /* manufacturing year */ u16 mfg_year; /* manufacturing year */
u16 rsvd; u16 rsvd;
u8 uuid[BFA_ADAPTER_UUID_LEN];
}; };
/* /*
...@@ -409,7 +413,8 @@ struct bfa_ioc_attr_s { ...@@ -409,7 +413,8 @@ struct bfa_ioc_attr_s {
u8 port_mode; /* bfa_mode_s */ u8 port_mode; /* bfa_mode_s */
u8 cap_bm; /* capability */ u8 cap_bm; /* capability */
u8 port_mode_cfg; /* bfa_mode_s */ u8 port_mode_cfg; /* bfa_mode_s */
u8 rsvd[4]; /* 64bit align */ u8 def_fn; /* 1 if default fn */
u8 rsvd[3]; /* 64bit align */
}; };
/* /*
......
...@@ -243,19 +243,19 @@ struct bfa_fcs_fabric_s; ...@@ -243,19 +243,19 @@ struct bfa_fcs_fabric_s;
* Symbolic Name. * Symbolic Name.
* *
* Physical Port's symbolic name Format : (Total 128 bytes) * Physical Port's symbolic name Format : (Total 128 bytes)
* Adapter Model number/name : 12 bytes * Adapter Model number/name : 16 bytes
* Driver Version : 10 bytes * Driver Version : 10 bytes
* Host Machine Name : 30 bytes * Host Machine Name : 30 bytes
* Host OS Info : 48 bytes * Host OS Info : 44 bytes
* Host OS PATCH Info : 16 bytes * Host OS PATCH Info : 16 bytes
* ( remaining 12 bytes reserved to be used for separator) * ( remaining 12 bytes reserved to be used for separator)
*/ */
#define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | " #define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | "
#define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 12 #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16
#define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10 #define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10
#define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30 #define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30
#define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48 #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44
#define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16
/* /*
......
...@@ -2508,6 +2508,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc, ...@@ -2508,6 +2508,7 @@ bfa_ioc_get_adapter_attr(struct bfa_ioc_s *ioc,
ad_attr->mfg_day = ioc_attr->mfg_day; ad_attr->mfg_day = ioc_attr->mfg_day;
ad_attr->mfg_month = ioc_attr->mfg_month; ad_attr->mfg_month = ioc_attr->mfg_month;
ad_attr->mfg_year = ioc_attr->mfg_year; ad_attr->mfg_year = ioc_attr->mfg_year;
memcpy(ad_attr->uuid, ioc_attr->uuid, BFA_ADAPTER_UUID_LEN);
} }
enum bfa_ioc_type_e enum bfa_ioc_type_e
...@@ -2572,12 +2573,18 @@ void ...@@ -2572,12 +2573,18 @@ void
bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model)
{ {
struct bfi_ioc_attr_s *ioc_attr; struct bfi_ioc_attr_s *ioc_attr;
u8 nports = bfa_ioc_get_nports(ioc);
WARN_ON(!model); WARN_ON(!model);
memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN);
ioc_attr = ioc->attr; ioc_attr = ioc->attr;
if (bfa_asic_id_ct2(ioc->pcidev.device_id) &&
(!bfa_mfg_is_mezz(ioc_attr->card_type)))
snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u-%u%s",
BFA_MFG_NAME, ioc_attr->card_type, nports, "p");
else
snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u",
BFA_MFG_NAME, ioc_attr->card_type); BFA_MFG_NAME, ioc_attr->card_type);
} }
...@@ -2628,7 +2635,7 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) ...@@ -2628,7 +2635,7 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr)
memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s)); memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s));
ioc_attr->state = bfa_ioc_get_state(ioc); ioc_attr->state = bfa_ioc_get_state(ioc);
ioc_attr->port_id = ioc->port_id; ioc_attr->port_id = bfa_ioc_portid(ioc);
ioc_attr->port_mode = ioc->port_mode; ioc_attr->port_mode = ioc->port_mode;
ioc_attr->port_mode_cfg = ioc->port_mode_cfg; ioc_attr->port_mode_cfg = ioc->port_mode_cfg;
ioc_attr->cap_bm = ioc->ad_cap_bm; ioc_attr->cap_bm = ioc->ad_cap_bm;
...@@ -2637,8 +2644,9 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) ...@@ -2637,8 +2644,9 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr)
bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr);
ioc_attr->pci_attr.device_id = ioc->pcidev.device_id; ioc_attr->pci_attr.device_id = bfa_ioc_devid(ioc);
ioc_attr->pci_attr.pcifn = ioc->pcidev.pci_func; ioc_attr->pci_attr.pcifn = bfa_ioc_pcifn(ioc);
ioc_attr->def_fn = (bfa_ioc_pcifn(ioc) == bfa_ioc_portid(ioc));
bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev);
} }
...@@ -6018,6 +6026,7 @@ bfa_fru_write_send(void *cbarg, enum bfi_fru_h2i_msgs msg_type) ...@@ -6018,6 +6026,7 @@ bfa_fru_write_send(void *cbarg, enum bfi_fru_h2i_msgs msg_type)
*/ */
msg->last = (len == fru->residue) ? 1 : 0; msg->last = (len == fru->residue) ? 1 : 0;
msg->trfr_cmpl = (len == fru->residue) ? fru->trfr_cmpl : 0;
bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc));
bfa_alen_set(&msg->alen, len, fru->dbuf_pa); bfa_alen_set(&msg->alen, len, fru->dbuf_pa);
...@@ -6132,13 +6141,14 @@ bfa_fru_memclaim(struct bfa_fru_s *fru, u8 *dm_kva, u64 dm_pa, ...@@ -6132,13 +6141,14 @@ bfa_fru_memclaim(struct bfa_fru_s *fru, u8 *dm_kva, u64 dm_pa,
*/ */
bfa_status_t bfa_status_t
bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset,
bfa_cb_fru_t cbfn, void *cbarg) bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl)
{ {
bfa_trc(fru, BFI_FRUVPD_H2I_WRITE_REQ); bfa_trc(fru, BFI_FRUVPD_H2I_WRITE_REQ);
bfa_trc(fru, len); bfa_trc(fru, len);
bfa_trc(fru, offset); bfa_trc(fru, offset);
if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2 &&
fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2)
return BFA_STATUS_FRU_NOT_PRESENT; return BFA_STATUS_FRU_NOT_PRESENT;
if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK)
...@@ -6160,6 +6170,7 @@ bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, ...@@ -6160,6 +6170,7 @@ bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset,
fru->offset = 0; fru->offset = 0;
fru->addr_off = offset; fru->addr_off = offset;
fru->ubuf = buf; fru->ubuf = buf;
fru->trfr_cmpl = trfr_cmpl;
bfa_fru_write_send(fru, BFI_FRUVPD_H2I_WRITE_REQ); bfa_fru_write_send(fru, BFI_FRUVPD_H2I_WRITE_REQ);
...@@ -6189,7 +6200,8 @@ bfa_fruvpd_read(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, ...@@ -6189,7 +6200,8 @@ bfa_fruvpd_read(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset,
if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2)
return BFA_STATUS_FRU_NOT_PRESENT; return BFA_STATUS_FRU_NOT_PRESENT;
if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK &&
fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2)
return BFA_STATUS_CMD_NOTSUPP; return BFA_STATUS_CMD_NOTSUPP;
if (!bfa_ioc_is_operational(fru->ioc)) if (!bfa_ioc_is_operational(fru->ioc))
...@@ -6230,7 +6242,8 @@ bfa_fruvpd_get_max_size(struct bfa_fru_s *fru, u32 *max_size) ...@@ -6230,7 +6242,8 @@ bfa_fruvpd_get_max_size(struct bfa_fru_s *fru, u32 *max_size)
if (!bfa_ioc_is_operational(fru->ioc)) if (!bfa_ioc_is_operational(fru->ioc))
return BFA_STATUS_IOC_NON_OP; return BFA_STATUS_IOC_NON_OP;
if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK) if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK ||
fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK2)
*max_size = BFA_FRU_CHINOOK_MAX_SIZE; *max_size = BFA_FRU_CHINOOK_MAX_SIZE;
else else
return BFA_STATUS_CMD_NOTSUPP; return BFA_STATUS_CMD_NOTSUPP;
......
...@@ -731,6 +731,7 @@ struct bfa_fru_s { ...@@ -731,6 +731,7 @@ struct bfa_fru_s {
struct bfa_mbox_cmd_s mb; /* mailbox */ struct bfa_mbox_cmd_s mb; /* mailbox */
struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */ struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */
struct bfa_mem_dma_s fru_dma; struct bfa_mem_dma_s fru_dma;
u8 trfr_cmpl;
}; };
#define BFA_FRU(__bfa) (&(__bfa)->modules.fru) #define BFA_FRU(__bfa) (&(__bfa)->modules.fru)
...@@ -738,7 +739,7 @@ struct bfa_fru_s { ...@@ -738,7 +739,7 @@ struct bfa_fru_s {
bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru, bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru,
void *buf, u32 len, u32 offset, void *buf, u32 len, u32 offset,
bfa_cb_fru_t cbfn, void *cbarg); bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl);
bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru, bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru,
void *buf, u32 len, u32 offset, void *buf, u32 len, u32 offset,
bfa_cb_fru_t cbfn, void *cbarg); bfa_cb_fru_t cbfn, void *cbarg);
......
...@@ -2716,7 +2716,7 @@ bfad_iocmd_fruvpd_update(struct bfad_s *bfad, void *cmd) ...@@ -2716,7 +2716,7 @@ bfad_iocmd_fruvpd_update(struct bfad_s *bfad, void *cmd)
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
iocmd->status = bfa_fruvpd_update(BFA_FRU(&bfad->bfa), iocmd->status = bfa_fruvpd_update(BFA_FRU(&bfad->bfa),
&iocmd->data, iocmd->len, iocmd->offset, &iocmd->data, iocmd->len, iocmd->offset,
bfad_hcb_comp, &fcomp); bfad_hcb_comp, &fcomp, iocmd->trfr_cmpl);
spin_unlock_irqrestore(&bfad->bfad_lock, flags); spin_unlock_irqrestore(&bfad->bfad_lock, flags);
if (iocmd->status == BFA_STATUS_OK) { if (iocmd->status == BFA_STATUS_OK) {
wait_for_completion(&fcomp.comp); wait_for_completion(&fcomp.comp);
......
...@@ -794,10 +794,12 @@ struct bfa_bsg_tfru_s { ...@@ -794,10 +794,12 @@ struct bfa_bsg_tfru_s {
struct bfa_bsg_fruvpd_s { struct bfa_bsg_fruvpd_s {
bfa_status_t status; bfa_status_t status;
u16 bfad_num; u16 bfad_num;
u16 rsvd; u16 rsvd1;
u32 offset; u32 offset;
u32 len; u32 len;
u8 data[BFA_MAX_FRUVPD_TRANSFER_SIZE]; u8 data[BFA_MAX_FRUVPD_TRANSFER_SIZE];
u8 trfr_cmpl;
u8 rsvd2[3];
}; };
struct bfa_bsg_fruvpd_max_size_s { struct bfa_bsg_fruvpd_max_size_s {
......
...@@ -264,6 +264,7 @@ struct bfi_ioc_getattr_req_s { ...@@ -264,6 +264,7 @@ struct bfi_ioc_getattr_req_s {
union bfi_addr_u attr_addr; union bfi_addr_u attr_addr;
}; };
#define BFI_IOC_ATTR_UUID_SZ 16
struct bfi_ioc_attr_s { struct bfi_ioc_attr_s {
wwn_t mfg_pwwn; /* Mfg port wwn */ wwn_t mfg_pwwn; /* Mfg port wwn */
wwn_t mfg_nwwn; /* Mfg node wwn */ wwn_t mfg_nwwn; /* Mfg node wwn */
...@@ -292,6 +293,7 @@ struct bfi_ioc_attr_s { ...@@ -292,6 +293,7 @@ struct bfi_ioc_attr_s {
u8 mfg_day; /* manufacturing day */ u8 mfg_day; /* manufacturing day */
u8 mfg_month; /* manufacturing month */ u8 mfg_month; /* manufacturing month */
u16 mfg_year; /* manufacturing year */ u16 mfg_year; /* manufacturing year */
u8 uuid[BFI_IOC_ATTR_UUID_SZ]; /*!< chinook uuid */
}; };
/* /*
...@@ -1253,7 +1255,9 @@ enum bfi_fru_i2h_msgs { ...@@ -1253,7 +1255,9 @@ enum bfi_fru_i2h_msgs {
struct bfi_fru_write_req_s { struct bfi_fru_write_req_s {
struct bfi_mhdr_s mh; /* Common msg header */ struct bfi_mhdr_s mh; /* Common msg header */
u8 last; u8 last;
u8 rsv[3]; u8 rsv_1[3];
u8 trfr_cmpl;
u8 rsv_2[3];
u32 offset; u32 offset;
u32 length; u32 length;
struct bfi_alen_s alen; struct bfi_alen_s alen;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment