Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Vijaya Mohan Guvva <vmohan@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Vijaya Mohan Guvva and committed by
James Bottomley
079bcbc3 bccd2683

+43 -18
+7 -2
drivers/scsi/bfa/bfa_defs.h
··· 45 45 BFA_MFG_TYPE_PROWLER_C = 1710, /* Prowler CNA only cards */ 46 46 BFA_MFG_TYPE_PROWLER_D = 1860, /* Prowler Dual cards */ 47 47 BFA_MFG_TYPE_CHINOOK = 1867, /* Chinook cards */ 48 + BFA_MFG_TYPE_CHINOOK2 = 1869, /*!< Chinook2 cards */ 48 49 BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */ 49 50 }; 50 51 ··· 60 59 (type) == BFA_MFG_TYPE_ASTRA || \ 61 60 (type) == BFA_MFG_TYPE_LIGHTNING_P0 || \ 62 61 (type) == BFA_MFG_TYPE_LIGHTNING || \ 63 - (type) == BFA_MFG_TYPE_CHINOOK)) 62 + (type) == BFA_MFG_TYPE_CHINOOK || \ 63 + (type) == BFA_MFG_TYPE_CHINOOK2)) 64 64 65 65 /* 66 66 * Check if the card having old wwn/mac handling ··· 265 263 BFA_ADAPTER_MFG_NAME_LEN = 8, /* manufacturer name length */ 266 264 BFA_ADAPTER_SYM_NAME_LEN = 64, /* adapter symbolic name length */ 267 265 BFA_ADAPTER_OS_TYPE_LEN = 64, /* adapter os type length */ 266 + BFA_ADAPTER_UUID_LEN = 16, /* adapter uuid length */ 268 267 }; 269 268 270 269 struct bfa_adapter_attr_s { ··· 299 296 u8 mfg_month; /* manufacturing month */ 300 297 u16 mfg_year; /* manufacturing year */ 301 298 u16 rsvd; 299 + u8 uuid[BFA_ADAPTER_UUID_LEN]; 302 300 }; 303 301 304 302 /* ··· 413 409 u8 port_mode; /* bfa_mode_s */ 414 410 u8 cap_bm; /* capability */ 415 411 u8 port_mode_cfg; /* bfa_mode_s */ 416 - u8 rsvd[4]; /* 64bit align */ 412 + u8 def_fn; /* 1 if default fn */ 413 + u8 rsvd[3]; /* 64bit align */ 417 414 }; 418 415 419 416 /*
+4 -4
drivers/scsi/bfa/bfa_fcs.h
··· 243 243 * Symbolic Name. 244 244 * 245 245 * Physical Port's symbolic name Format : (Total 128 bytes) 246 - * Adapter Model number/name : 12 bytes 246 + * Adapter Model number/name : 16 bytes 247 247 * Driver Version : 10 bytes 248 248 * Host Machine Name : 30 bytes 249 - * Host OS Info : 48 bytes 249 + * Host OS Info : 44 bytes 250 250 * Host OS PATCH Info : 16 bytes 251 251 * ( remaining 12 bytes reserved to be used for separator) 252 252 */ 253 253 #define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | " 254 254 255 - #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 12 255 + #define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 16 256 256 #define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10 257 257 #define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30 258 - #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48 258 + #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 44 259 259 #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 260 260 261 261 /*
+21 -8
drivers/scsi/bfa/bfa_ioc.c
··· 2508 2508 ad_attr->mfg_day = ioc_attr->mfg_day; 2509 2509 ad_attr->mfg_month = ioc_attr->mfg_month; 2510 2510 ad_attr->mfg_year = ioc_attr->mfg_year; 2511 + memcpy(ad_attr->uuid, ioc_attr->uuid, BFA_ADAPTER_UUID_LEN); 2511 2512 } 2512 2513 2513 2514 enum bfa_ioc_type_e ··· 2573 2572 bfa_ioc_get_adapter_model(struct bfa_ioc_s *ioc, char *model) 2574 2573 { 2575 2574 struct bfi_ioc_attr_s *ioc_attr; 2575 + u8 nports = bfa_ioc_get_nports(ioc); 2576 2576 2577 2577 WARN_ON(!model); 2578 2578 memset((void *)model, 0, BFA_ADAPTER_MODEL_NAME_LEN); 2579 2579 2580 2580 ioc_attr = ioc->attr; 2581 2581 2582 - snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", 2582 + if (bfa_asic_id_ct2(ioc->pcidev.device_id) && 2583 + (!bfa_mfg_is_mezz(ioc_attr->card_type))) 2584 + snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u-%u%s", 2585 + BFA_MFG_NAME, ioc_attr->card_type, nports, "p"); 2586 + else 2587 + snprintf(model, BFA_ADAPTER_MODEL_NAME_LEN, "%s-%u", 2583 2588 BFA_MFG_NAME, ioc_attr->card_type); 2584 2589 } 2585 2590 ··· 2635 2628 memset((void *)ioc_attr, 0, sizeof(struct bfa_ioc_attr_s)); 2636 2629 2637 2630 ioc_attr->state = bfa_ioc_get_state(ioc); 2638 - ioc_attr->port_id = ioc->port_id; 2631 + ioc_attr->port_id = bfa_ioc_portid(ioc); 2639 2632 ioc_attr->port_mode = ioc->port_mode; 2640 2633 ioc_attr->port_mode_cfg = ioc->port_mode_cfg; 2641 2634 ioc_attr->cap_bm = ioc->ad_cap_bm; ··· 2644 2637 2645 2638 bfa_ioc_get_adapter_attr(ioc, &ioc_attr->adapter_attr); 2646 2639 2647 - ioc_attr->pci_attr.device_id = ioc->pcidev.device_id; 2648 - ioc_attr->pci_attr.pcifn = ioc->pcidev.pci_func; 2640 + ioc_attr->pci_attr.device_id = bfa_ioc_devid(ioc); 2641 + ioc_attr->pci_attr.pcifn = bfa_ioc_pcifn(ioc); 2642 + ioc_attr->def_fn = (bfa_ioc_pcifn(ioc) == bfa_ioc_portid(ioc)); 2649 2643 bfa_ioc_get_pci_chip_rev(ioc, ioc_attr->pci_attr.chip_rev); 2650 2644 } 2651 2645 ··· 6026 6018 */ 6027 6019 msg->last = (len == fru->residue) ? 1 : 0; 6028 6020 6021 + msg->trfr_cmpl = (len == fru->residue) ? fru->trfr_cmpl : 0; 6029 6022 bfi_h2i_set(msg->mh, BFI_MC_FRU, msg_type, bfa_ioc_portid(fru->ioc)); 6030 6023 bfa_alen_set(&msg->alen, len, fru->dbuf_pa); 6031 6024 ··· 6141 6132 */ 6142 6133 bfa_status_t 6143 6134 bfa_fruvpd_update(struct bfa_fru_s *fru, void *buf, u32 len, u32 offset, 6144 - bfa_cb_fru_t cbfn, void *cbarg) 6135 + bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl) 6145 6136 { 6146 6137 bfa_trc(fru, BFI_FRUVPD_H2I_WRITE_REQ); 6147 6138 bfa_trc(fru, len); 6148 6139 bfa_trc(fru, offset); 6149 6140 6150 - if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) 6141 + if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2 && 6142 + fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2) 6151 6143 return BFA_STATUS_FRU_NOT_PRESENT; 6152 6144 6153 6145 if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) ··· 6170 6160 fru->offset = 0; 6171 6161 fru->addr_off = offset; 6172 6162 fru->ubuf = buf; 6163 + fru->trfr_cmpl = trfr_cmpl; 6173 6164 6174 6165 bfa_fru_write_send(fru, BFI_FRUVPD_H2I_WRITE_REQ); 6175 6166 ··· 6200 6189 if (fru->ioc->asic_gen != BFI_ASIC_GEN_CT2) 6201 6190 return BFA_STATUS_FRU_NOT_PRESENT; 6202 6191 6203 - if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK) 6192 + if (fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK && 6193 + fru->ioc->attr->card_type != BFA_MFG_TYPE_CHINOOK2) 6204 6194 return BFA_STATUS_CMD_NOTSUPP; 6205 6195 6206 6196 if (!bfa_ioc_is_operational(fru->ioc)) ··· 6242 6230 if (!bfa_ioc_is_operational(fru->ioc)) 6243 6231 return BFA_STATUS_IOC_NON_OP; 6244 6232 6245 - if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK) 6233 + if (fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK || 6234 + fru->ioc->attr->card_type == BFA_MFG_TYPE_CHINOOK2) 6246 6235 *max_size = BFA_FRU_CHINOOK_MAX_SIZE; 6247 6236 else 6248 6237 return BFA_STATUS_CMD_NOTSUPP;
+2 -1
drivers/scsi/bfa/bfa_ioc.h
··· 731 731 struct bfa_mbox_cmd_s mb; /* mailbox */ 732 732 struct bfa_ioc_notify_s ioc_notify; /* ioc event notify */ 733 733 struct bfa_mem_dma_s fru_dma; 734 + u8 trfr_cmpl; 734 735 }; 735 736 736 737 #define BFA_FRU(__bfa) (&(__bfa)->modules.fru) ··· 739 738 740 739 bfa_status_t bfa_fruvpd_update(struct bfa_fru_s *fru, 741 740 void *buf, u32 len, u32 offset, 742 - bfa_cb_fru_t cbfn, void *cbarg); 741 + bfa_cb_fru_t cbfn, void *cbarg, u8 trfr_cmpl); 743 742 bfa_status_t bfa_fruvpd_read(struct bfa_fru_s *fru, 744 743 void *buf, u32 len, u32 offset, 745 744 bfa_cb_fru_t cbfn, void *cbarg);
+1 -1
drivers/scsi/bfa/bfad_bsg.c
··· 2716 2716 spin_lock_irqsave(&bfad->bfad_lock, flags); 2717 2717 iocmd->status = bfa_fruvpd_update(BFA_FRU(&bfad->bfa), 2718 2718 &iocmd->data, iocmd->len, iocmd->offset, 2719 - bfad_hcb_comp, &fcomp); 2719 + bfad_hcb_comp, &fcomp, iocmd->trfr_cmpl); 2720 2720 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 2721 2721 if (iocmd->status == BFA_STATUS_OK) { 2722 2722 wait_for_completion(&fcomp.comp);
+3 -1
drivers/scsi/bfa/bfad_bsg.h
··· 794 794 struct bfa_bsg_fruvpd_s { 795 795 bfa_status_t status; 796 796 u16 bfad_num; 797 - u16 rsvd; 797 + u16 rsvd1; 798 798 u32 offset; 799 799 u32 len; 800 800 u8 data[BFA_MAX_FRUVPD_TRANSFER_SIZE]; 801 + u8 trfr_cmpl; 802 + u8 rsvd2[3]; 801 803 }; 802 804 803 805 struct bfa_bsg_fruvpd_max_size_s {
+5 -1
drivers/scsi/bfa/bfi.h
··· 264 264 union bfi_addr_u attr_addr; 265 265 }; 266 266 267 + #define BFI_IOC_ATTR_UUID_SZ 16 267 268 struct bfi_ioc_attr_s { 268 269 wwn_t mfg_pwwn; /* Mfg port wwn */ 269 270 wwn_t mfg_nwwn; /* Mfg node wwn */ ··· 293 292 u8 mfg_day; /* manufacturing day */ 294 293 u8 mfg_month; /* manufacturing month */ 295 294 u16 mfg_year; /* manufacturing year */ 295 + u8 uuid[BFI_IOC_ATTR_UUID_SZ]; /*!< chinook uuid */ 296 296 }; 297 297 298 298 /* ··· 1255 1253 struct bfi_fru_write_req_s { 1256 1254 struct bfi_mhdr_s mh; /* Common msg header */ 1257 1255 u8 last; 1258 - u8 rsv[3]; 1256 + u8 rsv_1[3]; 1257 + u8 trfr_cmpl; 1258 + u8 rsv_2[3]; 1259 1259 u32 offset; 1260 1260 u32 length; 1261 1261 struct bfi_alen_s alen;