diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/bfa/bfa_core.c | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_fwimg_priv.h | 25 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.c | 33 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 7 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc_cb.c | 36 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc_ct.c | 46 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_iocfc.c | 6 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 8 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_fwimg.c | 76 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_im_compat.h | 13 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_intr.c | 4 | ||||
-rw-r--r-- | drivers/scsi/bfa/include/bfi/bfi_ioc.h | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/include/defs/bfa_defs_mfg.h | 3 | ||||
-rw-r--r-- | drivers/scsi/bfa/include/defs/bfa_defs_pci.h | 11 |
14 files changed, 155 insertions, 115 deletions
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 3a7b3f88932f..bef70924d5c8 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -333,6 +333,7 @@ bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids) | |||
333 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G2P}, | 333 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G2P}, |
334 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G1P}, | 334 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G1P}, |
335 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT}, | 335 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT}, |
336 | {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT_FC}, | ||
336 | }; | 337 | }; |
337 | 338 | ||
338 | *npciids = sizeof(__pciids) / sizeof(__pciids[0]); | 339 | *npciids = sizeof(__pciids) / sizeof(__pciids[0]); |
diff --git a/drivers/scsi/bfa/bfa_fwimg_priv.h b/drivers/scsi/bfa/bfa_fwimg_priv.h index 1ec1355924d9..d33e19e54395 100644 --- a/drivers/scsi/bfa/bfa_fwimg_priv.h +++ b/drivers/scsi/bfa/bfa_fwimg_priv.h | |||
@@ -21,11 +21,24 @@ | |||
21 | #define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */ | 21 | #define BFI_FLASH_CHUNK_SZ 256 /* Flash chunk size */ |
22 | #define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32)) | 22 | #define BFI_FLASH_CHUNK_SZ_WORDS (BFI_FLASH_CHUNK_SZ/sizeof(u32)) |
23 | 23 | ||
24 | extern u32 *bfi_image_ct_get_chunk(u32 off); | 24 | /** |
25 | extern u32 bfi_image_ct_size; | 25 | * BFI FW image type |
26 | extern u32 *bfi_image_cb_get_chunk(u32 off); | 26 | */ |
27 | extern u32 bfi_image_cb_size; | 27 | enum { |
28 | extern u32 *bfi_image_cb; | 28 | BFI_IMAGE_CB_FC, |
29 | extern u32 *bfi_image_ct; | 29 | BFI_IMAGE_CT_FC, |
30 | BFI_IMAGE_CT_CNA, | ||
31 | BFI_IMAGE_MAX, | ||
32 | }; | ||
33 | |||
34 | extern u32 *bfi_image_get_chunk(int type, uint32_t off); | ||
35 | extern u32 bfi_image_get_size(int type); | ||
36 | extern u32 bfi_image_ct_fc_size; | ||
37 | extern u32 bfi_image_ct_cna_size; | ||
38 | extern u32 bfi_image_cb_fc_size; | ||
39 | extern u32 *bfi_image_ct_fc; | ||
40 | extern u32 *bfi_image_ct_cna; | ||
41 | extern u32 *bfi_image_cb_fc; | ||
42 | |||
30 | 43 | ||
31 | #endif /* __BFA_FWIMG_PRIV_H__ */ | 44 | #endif /* __BFA_FWIMG_PRIV_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index e038bc9769f6..ef3b3fefbe74 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -59,14 +59,12 @@ BFA_TRC_FILE(CNA, IOC); | |||
59 | ((__ioc)->ioc_hwif->ioc_firmware_lock(__ioc)) | 59 | ((__ioc)->ioc_hwif->ioc_firmware_lock(__ioc)) |
60 | #define bfa_ioc_firmware_unlock(__ioc) \ | 60 | #define bfa_ioc_firmware_unlock(__ioc) \ |
61 | ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc)) | 61 | ((__ioc)->ioc_hwif->ioc_firmware_unlock(__ioc)) |
62 | #define bfa_ioc_fwimg_get_chunk(__ioc, __off) \ | ||
63 | ((__ioc)->ioc_hwif->ioc_fwimg_get_chunk(__ioc, __off)) | ||
64 | #define bfa_ioc_fwimg_get_size(__ioc) \ | ||
65 | ((__ioc)->ioc_hwif->ioc_fwimg_get_size(__ioc)) | ||
66 | #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc)) | 62 | #define bfa_ioc_reg_init(__ioc) ((__ioc)->ioc_hwif->ioc_reg_init(__ioc)) |
67 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) | 63 | #define bfa_ioc_map_port(__ioc) ((__ioc)->ioc_hwif->ioc_map_port(__ioc)) |
68 | #define bfa_ioc_notify_hbfail(__ioc) \ | 64 | #define bfa_ioc_notify_hbfail(__ioc) \ |
69 | ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc)) | 65 | ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc)) |
66 | #define bfa_ioc_is_optrom(__ioc) \ | ||
67 | (bfi_image_get_size(BFA_IOC_FWIMG_TYPE(__ioc)) < BFA_IOC_FWIMG_MINSZ) | ||
70 | 68 | ||
71 | bfa_boolean_t bfa_auto_recover = BFA_TRUE; | 69 | bfa_boolean_t bfa_auto_recover = BFA_TRUE; |
72 | 70 | ||
@@ -879,8 +877,8 @@ bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc, struct bfi_ioc_image_hdr_s *fwhdr) | |||
879 | struct bfi_ioc_image_hdr_s *drv_fwhdr; | 877 | struct bfi_ioc_image_hdr_s *drv_fwhdr; |
880 | int i; | 878 | int i; |
881 | 879 | ||
882 | drv_fwhdr = | 880 | drv_fwhdr = (struct bfi_ioc_image_hdr_s *) |
883 | (struct bfi_ioc_image_hdr_s *)bfa_ioc_fwimg_get_chunk(ioc, 0); | 881 | bfi_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0); |
884 | 882 | ||
885 | for (i = 0; i < BFI_IOC_MD5SUM_SZ; i++) { | 883 | for (i = 0; i < BFI_IOC_MD5SUM_SZ; i++) { |
886 | if (fwhdr->md5sum[i] != drv_fwhdr->md5sum[i]) { | 884 | if (fwhdr->md5sum[i] != drv_fwhdr->md5sum[i]) { |
@@ -907,12 +905,13 @@ bfa_ioc_fwver_valid(struct bfa_ioc_s *ioc) | |||
907 | /** | 905 | /** |
908 | * If bios/efi boot (flash based) -- return true | 906 | * If bios/efi boot (flash based) -- return true |
909 | */ | 907 | */ |
910 | if (bfa_ioc_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | 908 | if (bfa_ioc_is_optrom(ioc)) |
911 | return BFA_TRUE; | 909 | return BFA_TRUE; |
912 | 910 | ||
913 | bfa_ioc_fwver_get(ioc, &fwhdr); | 911 | bfa_ioc_fwver_get(ioc, &fwhdr); |
914 | drv_fwhdr = | 912 | drv_fwhdr = (struct bfi_ioc_image_hdr_s *) |
915 | (struct bfi_ioc_image_hdr_s *)bfa_ioc_fwimg_get_chunk(ioc, 0); | 913 | bfi_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0); |
914 | |||
916 | 915 | ||
917 | if (fwhdr.signature != drv_fwhdr->signature) { | 916 | if (fwhdr.signature != drv_fwhdr->signature) { |
918 | bfa_trc(ioc, fwhdr.signature); | 917 | bfa_trc(ioc, fwhdr.signature); |
@@ -1125,21 +1124,22 @@ bfa_ioc_download_fw(struct bfa_ioc_s *ioc, u32 boot_type, | |||
1125 | /** | 1124 | /** |
1126 | * Flash based firmware boot | 1125 | * Flash based firmware boot |
1127 | */ | 1126 | */ |
1128 | bfa_trc(ioc, bfa_ioc_fwimg_get_size(ioc)); | 1127 | bfa_trc(ioc, bfi_image_get_size(BFA_IOC_FWIMG_TYPE(ioc))); |
1129 | if (bfa_ioc_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | 1128 | if (bfa_ioc_is_optrom(ioc)) |
1130 | boot_type = BFI_BOOT_TYPE_FLASH; | 1129 | boot_type = BFI_BOOT_TYPE_FLASH; |
1131 | fwimg = bfa_ioc_fwimg_get_chunk(ioc, chunkno); | 1130 | fwimg = bfi_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno); |
1131 | |||
1132 | 1132 | ||
1133 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); | 1133 | pgnum = bfa_ioc_smem_pgnum(ioc, loff); |
1134 | pgoff = bfa_ioc_smem_pgoff(ioc, loff); | 1134 | pgoff = bfa_ioc_smem_pgoff(ioc, loff); |
1135 | 1135 | ||
1136 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, pgnum); | 1136 | bfa_reg_write(ioc->ioc_regs.host_page_num_fn, pgnum); |
1137 | 1137 | ||
1138 | for (i = 0; i < bfa_ioc_fwimg_get_size(ioc); i++) { | 1138 | for (i = 0; i < bfi_image_get_size(BFA_IOC_FWIMG_TYPE(ioc)); i++) { |
1139 | 1139 | ||
1140 | if (BFA_IOC_FLASH_CHUNK_NO(i) != chunkno) { | 1140 | if (BFA_IOC_FLASH_CHUNK_NO(i) != chunkno) { |
1141 | chunkno = BFA_IOC_FLASH_CHUNK_NO(i); | 1141 | chunkno = BFA_IOC_FLASH_CHUNK_NO(i); |
1142 | fwimg = bfa_ioc_fwimg_get_chunk(ioc, | 1142 | fwimg = bfi_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), |
1143 | BFA_IOC_FLASH_CHUNK_ADDR(chunkno)); | 1143 | BFA_IOC_FLASH_CHUNK_ADDR(chunkno)); |
1144 | } | 1144 | } |
1145 | 1145 | ||
@@ -1188,6 +1188,7 @@ bfa_ioc_getattr_reply(struct bfa_ioc_s *ioc) | |||
1188 | struct bfi_ioc_attr_s *attr = ioc->attr; | 1188 | struct bfi_ioc_attr_s *attr = ioc->attr; |
1189 | 1189 | ||
1190 | attr->adapter_prop = bfa_os_ntohl(attr->adapter_prop); | 1190 | attr->adapter_prop = bfa_os_ntohl(attr->adapter_prop); |
1191 | attr->card_type = bfa_os_ntohl(attr->card_type); | ||
1191 | attr->maxfrsize = bfa_os_ntohs(attr->maxfrsize); | 1192 | attr->maxfrsize = bfa_os_ntohs(attr->maxfrsize); |
1192 | 1193 | ||
1193 | bfa_fsm_send_event(ioc, IOC_E_FWRSP_GETATTR); | 1194 | bfa_fsm_send_event(ioc, IOC_E_FWRSP_GETATTR); |
@@ -1416,7 +1417,7 @@ bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, | |||
1416 | { | 1417 | { |
1417 | ioc->ioc_mc = mc; | 1418 | ioc->ioc_mc = mc; |
1418 | ioc->pcidev = *pcidev; | 1419 | ioc->pcidev = *pcidev; |
1419 | ioc->ctdev = (ioc->pcidev.device_id == BFA_PCI_DEVICE_ID_CT); | 1420 | ioc->ctdev = bfa_asic_id_ct(ioc->pcidev.device_id); |
1420 | ioc->cna = ioc->ctdev && !ioc->fcmode; | 1421 | ioc->cna = ioc->ctdev && !ioc->fcmode; |
1421 | 1422 | ||
1422 | /** | 1423 | /** |
@@ -1916,7 +1917,7 @@ bfa_ioc_set_fcmode(struct bfa_ioc_s *ioc) | |||
1916 | bfa_boolean_t | 1917 | bfa_boolean_t |
1917 | bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc) | 1918 | bfa_ioc_get_fcmode(struct bfa_ioc_s *ioc) |
1918 | { | 1919 | { |
1919 | return ioc->fcmode || (ioc->pcidev.device_id != BFA_PCI_DEVICE_ID_CT); | 1920 | return ioc->fcmode || !bfa_asic_id_ct(ioc->pcidev.device_id); |
1920 | } | 1921 | } |
1921 | 1922 | ||
1922 | /** | 1923 | /** |
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index d0804406ea1a..2fbb6b2efc7d 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -186,9 +186,6 @@ struct bfa_ioc_hwif_s { | |||
186 | bfa_status_t (*ioc_pll_init) (struct bfa_ioc_s *ioc); | 186 | bfa_status_t (*ioc_pll_init) (struct bfa_ioc_s *ioc); |
187 | bfa_boolean_t (*ioc_firmware_lock) (struct bfa_ioc_s *ioc); | 187 | bfa_boolean_t (*ioc_firmware_lock) (struct bfa_ioc_s *ioc); |
188 | void (*ioc_firmware_unlock) (struct bfa_ioc_s *ioc); | 188 | void (*ioc_firmware_unlock) (struct bfa_ioc_s *ioc); |
189 | u32 * (*ioc_fwimg_get_chunk) (struct bfa_ioc_s *ioc, | ||
190 | u32 off); | ||
191 | u32 (*ioc_fwimg_get_size) (struct bfa_ioc_s *ioc); | ||
192 | void (*ioc_reg_init) (struct bfa_ioc_s *ioc); | 189 | void (*ioc_reg_init) (struct bfa_ioc_s *ioc); |
193 | void (*ioc_map_port) (struct bfa_ioc_s *ioc); | 190 | void (*ioc_map_port) (struct bfa_ioc_s *ioc); |
194 | void (*ioc_isr_mode_set) (struct bfa_ioc_s *ioc, | 191 | void (*ioc_isr_mode_set) (struct bfa_ioc_s *ioc, |
@@ -214,6 +211,10 @@ struct bfa_ioc_hwif_s { | |||
214 | 211 | ||
215 | #define bfa_ioc_stats(_ioc, _stats) ((_ioc)->stats._stats++) | 212 | #define bfa_ioc_stats(_ioc, _stats) ((_ioc)->stats._stats++) |
216 | #define BFA_IOC_FWIMG_MINSZ (16 * 1024) | 213 | #define BFA_IOC_FWIMG_MINSZ (16 * 1024) |
214 | #define BFA_IOC_FWIMG_TYPE(__ioc) \ | ||
215 | (((__ioc)->ctdev) ? \ | ||
216 | (((__ioc)->fcmode) ? BFI_IMAGE_CT_FC : BFI_IMAGE_CT_CNA) : \ | ||
217 | BFI_IMAGE_CB_FC) | ||
217 | 218 | ||
218 | #define BFA_IOC_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS) | 219 | #define BFA_IOC_FLASH_CHUNK_NO(off) (off / BFI_FLASH_CHUNK_SZ_WORDS) |
219 | #define BFA_IOC_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS) | 220 | #define BFA_IOC_FLASH_OFFSET_IN_CHUNK(off) (off % BFI_FLASH_CHUNK_SZ_WORDS) |
diff --git a/drivers/scsi/bfa/bfa_ioc_cb.c b/drivers/scsi/bfa/bfa_ioc_cb.c index 3ce85319f739..324bdde7ea2e 100644 --- a/drivers/scsi/bfa/bfa_ioc_cb.c +++ b/drivers/scsi/bfa/bfa_ioc_cb.c | |||
@@ -33,26 +33,13 @@ BFA_TRC_FILE(CNA, IOC_CB); | |||
33 | static bfa_status_t bfa_ioc_cb_pll_init(struct bfa_ioc_s *ioc); | 33 | static bfa_status_t bfa_ioc_cb_pll_init(struct bfa_ioc_s *ioc); |
34 | static bfa_boolean_t bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc); | 34 | static bfa_boolean_t bfa_ioc_cb_firmware_lock(struct bfa_ioc_s *ioc); |
35 | static void bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc); | 35 | static void bfa_ioc_cb_firmware_unlock(struct bfa_ioc_s *ioc); |
36 | static u32 *bfa_ioc_cb_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off); | ||
37 | static u32 bfa_ioc_cb_fwimg_get_size(struct bfa_ioc_s *ioc); | ||
38 | static void bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc); | 36 | static void bfa_ioc_cb_reg_init(struct bfa_ioc_s *ioc); |
39 | static void bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc); | 37 | static void bfa_ioc_cb_map_port(struct bfa_ioc_s *ioc); |
40 | static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | 38 | static void bfa_ioc_cb_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); |
41 | static void bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc); | 39 | static void bfa_ioc_cb_notify_hbfail(struct bfa_ioc_s *ioc); |
42 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); | 40 | static void bfa_ioc_cb_ownership_reset(struct bfa_ioc_s *ioc); |
43 | 41 | ||
44 | struct bfa_ioc_hwif_s hwif_cb = { | 42 | struct bfa_ioc_hwif_s hwif_cb; |
45 | bfa_ioc_cb_pll_init, | ||
46 | bfa_ioc_cb_firmware_lock, | ||
47 | bfa_ioc_cb_firmware_unlock, | ||
48 | bfa_ioc_cb_fwimg_get_chunk, | ||
49 | bfa_ioc_cb_fwimg_get_size, | ||
50 | bfa_ioc_cb_reg_init, | ||
51 | bfa_ioc_cb_map_port, | ||
52 | bfa_ioc_cb_isr_mode_set, | ||
53 | bfa_ioc_cb_notify_hbfail, | ||
54 | bfa_ioc_cb_ownership_reset, | ||
55 | }; | ||
56 | 43 | ||
57 | /** | 44 | /** |
58 | * Called from bfa_ioc_attach() to map asic specific calls. | 45 | * Called from bfa_ioc_attach() to map asic specific calls. |
@@ -60,19 +47,16 @@ struct bfa_ioc_hwif_s hwif_cb = { | |||
60 | void | 47 | void |
61 | bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc) | 48 | bfa_ioc_set_cb_hwif(struct bfa_ioc_s *ioc) |
62 | { | 49 | { |
63 | ioc->ioc_hwif = &hwif_cb; | 50 | hwif_cb.ioc_pll_init = bfa_ioc_cb_pll_init; |
64 | } | 51 | hwif_cb.ioc_firmware_lock = bfa_ioc_cb_firmware_lock; |
65 | 52 | hwif_cb.ioc_firmware_unlock = bfa_ioc_cb_firmware_unlock; | |
66 | static u32 * | 53 | hwif_cb.ioc_reg_init = bfa_ioc_cb_reg_init; |
67 | bfa_ioc_cb_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off) | 54 | hwif_cb.ioc_map_port = bfa_ioc_cb_map_port; |
68 | { | 55 | hwif_cb.ioc_isr_mode_set = bfa_ioc_cb_isr_mode_set; |
69 | return bfi_image_cb_get_chunk(off); | 56 | hwif_cb.ioc_notify_hbfail = bfa_ioc_cb_notify_hbfail; |
70 | } | 57 | hwif_cb.ioc_ownership_reset = bfa_ioc_cb_ownership_reset; |
71 | 58 | ||
72 | static u32 | 59 | ioc->ioc_hwif = &hwif_cb; |
73 | bfa_ioc_cb_fwimg_get_size(struct bfa_ioc_s *ioc) | ||
74 | { | ||
75 | return bfi_image_cb_size; | ||
76 | } | 60 | } |
77 | 61 | ||
78 | /** | 62 | /** |
diff --git a/drivers/scsi/bfa/bfa_ioc_ct.c b/drivers/scsi/bfa/bfa_ioc_ct.c index 20b58ad5f95c..17bd1513b34e 100644 --- a/drivers/scsi/bfa/bfa_ioc_ct.c +++ b/drivers/scsi/bfa/bfa_ioc_ct.c | |||
@@ -33,27 +33,13 @@ BFA_TRC_FILE(CNA, IOC_CT); | |||
33 | static bfa_status_t bfa_ioc_ct_pll_init(struct bfa_ioc_s *ioc); | 33 | static bfa_status_t bfa_ioc_ct_pll_init(struct bfa_ioc_s *ioc); |
34 | static bfa_boolean_t bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc); | 34 | static bfa_boolean_t bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc); |
35 | static void bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc); | 35 | static void bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc); |
36 | static u32* bfa_ioc_ct_fwimg_get_chunk(struct bfa_ioc_s *ioc, | ||
37 | u32 off); | ||
38 | static u32 bfa_ioc_ct_fwimg_get_size(struct bfa_ioc_s *ioc); | ||
39 | static void bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc); | 36 | static void bfa_ioc_ct_reg_init(struct bfa_ioc_s *ioc); |
40 | static void bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc); | 37 | static void bfa_ioc_ct_map_port(struct bfa_ioc_s *ioc); |
41 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); | 38 | static void bfa_ioc_ct_isr_mode_set(struct bfa_ioc_s *ioc, bfa_boolean_t msix); |
42 | static void bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc); | 39 | static void bfa_ioc_ct_notify_hbfail(struct bfa_ioc_s *ioc); |
43 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); | 40 | static void bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc); |
44 | 41 | ||
45 | struct bfa_ioc_hwif_s hwif_ct = { | 42 | struct bfa_ioc_hwif_s hwif_ct; |
46 | bfa_ioc_ct_pll_init, | ||
47 | bfa_ioc_ct_firmware_lock, | ||
48 | bfa_ioc_ct_firmware_unlock, | ||
49 | bfa_ioc_ct_fwimg_get_chunk, | ||
50 | bfa_ioc_ct_fwimg_get_size, | ||
51 | bfa_ioc_ct_reg_init, | ||
52 | bfa_ioc_ct_map_port, | ||
53 | bfa_ioc_ct_isr_mode_set, | ||
54 | bfa_ioc_ct_notify_hbfail, | ||
55 | bfa_ioc_ct_ownership_reset, | ||
56 | }; | ||
57 | 43 | ||
58 | /** | 44 | /** |
59 | * Called from bfa_ioc_attach() to map asic specific calls. | 45 | * Called from bfa_ioc_attach() to map asic specific calls. |
@@ -61,19 +47,16 @@ struct bfa_ioc_hwif_s hwif_ct = { | |||
61 | void | 47 | void |
62 | bfa_ioc_set_ct_hwif(struct bfa_ioc_s *ioc) | 48 | bfa_ioc_set_ct_hwif(struct bfa_ioc_s *ioc) |
63 | { | 49 | { |
64 | ioc->ioc_hwif = &hwif_ct; | 50 | hwif_ct.ioc_pll_init = bfa_ioc_ct_pll_init; |
65 | } | 51 | hwif_ct.ioc_firmware_lock = bfa_ioc_ct_firmware_lock; |
52 | hwif_ct.ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock; | ||
53 | hwif_ct.ioc_reg_init = bfa_ioc_ct_reg_init; | ||
54 | hwif_ct.ioc_map_port = bfa_ioc_ct_map_port; | ||
55 | hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; | ||
56 | hwif_ct.ioc_notify_hbfail = bfa_ioc_ct_notify_hbfail; | ||
57 | hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset; | ||
66 | 58 | ||
67 | static u32* | 59 | ioc->ioc_hwif = &hwif_ct; |
68 | bfa_ioc_ct_fwimg_get_chunk(struct bfa_ioc_s *ioc, u32 off) | ||
69 | { | ||
70 | return bfi_image_ct_get_chunk(off); | ||
71 | } | ||
72 | |||
73 | static u32 | ||
74 | bfa_ioc_ct_fwimg_get_size(struct bfa_ioc_s *ioc) | ||
75 | { | ||
76 | return bfi_image_ct_size; | ||
77 | } | 60 | } |
78 | 61 | ||
79 | /** | 62 | /** |
@@ -95,7 +78,7 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc) | |||
95 | /** | 78 | /** |
96 | * If bios boot (flash based) -- do not increment usage count | 79 | * If bios boot (flash based) -- do not increment usage count |
97 | */ | 80 | */ |
98 | if (bfa_ioc_ct_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | 81 | if (bfi_image_get_size(BFA_IOC_FWIMG_TYPE(ioc)) < BFA_IOC_FWIMG_MINSZ) |
99 | return BFA_TRUE; | 82 | return BFA_TRUE; |
100 | 83 | ||
101 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); | 84 | bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg); |
@@ -146,9 +129,14 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc) | |||
146 | 129 | ||
147 | /** | 130 | /** |
148 | * Firmware lock is relevant only for CNA. | 131 | * Firmware lock is relevant only for CNA. |
132 | */ | ||
133 | if (!ioc->cna) | ||
134 | return; | ||
135 | |||
136 | /** | ||
149 | * If bios boot (flash based) -- do not decrement usage count | 137 | * If bios boot (flash based) -- do not decrement usage count |
150 | */ | 138 | */ |
151 | if (!ioc->cna || bfa_ioc_ct_fwimg_get_size(ioc) < BFA_IOC_FWIMG_MINSZ) | 139 | if (bfi_image_get_size(BFA_IOC_FWIMG_TYPE(ioc)) < BFA_IOC_FWIMG_MINSZ) |
152 | return; | 140 | return; |
153 | 141 | ||
154 | /** | 142 | /** |
diff --git a/drivers/scsi/bfa/bfa_iocfc.c b/drivers/scsi/bfa/bfa_iocfc.c index a76de2669bfc..273ecece79ad 100644 --- a/drivers/scsi/bfa/bfa_iocfc.c +++ b/drivers/scsi/bfa/bfa_iocfc.c | |||
@@ -170,7 +170,7 @@ bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
170 | /** | 170 | /** |
171 | * Initialize chip specific handlers. | 171 | * Initialize chip specific handlers. |
172 | */ | 172 | */ |
173 | if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) { | 173 | if (bfa_asic_id_ct(bfa_ioc_devid(&bfa->ioc))) { |
174 | iocfc->hwif.hw_reginit = bfa_hwct_reginit; | 174 | iocfc->hwif.hw_reginit = bfa_hwct_reginit; |
175 | iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack; | 175 | iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack; |
176 | iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack; | 176 | iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack; |
@@ -625,9 +625,9 @@ bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
625 | bfa->trcmod, bfa->aen, bfa->logm); | 625 | bfa->trcmod, bfa->aen, bfa->logm); |
626 | 626 | ||
627 | /** | 627 | /** |
628 | * Choose FC (ssid: 0x1C) v/s FCoE (ssid: 0x14) mode. | 628 | * Set FC mode for BFA_PCI_DEVICE_ID_CT_FC. |
629 | */ | 629 | */ |
630 | if (0) | 630 | if (pcidev->device_id == BFA_PCI_DEVICE_ID_CT_FC) |
631 | bfa_ioc_set_fcmode(&bfa->ioc); | 631 | bfa_ioc_set_fcmode(&bfa->ioc); |
632 | 632 | ||
633 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_MC_IOCFC); | 633 | bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_MC_IOCFC); |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index d4fc4287ebd3..1b869add20b2 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -1172,6 +1172,14 @@ static struct pci_device_id bfad_id_table[] = { | |||
1172 | .class = (PCI_CLASS_SERIAL_FIBER << 8), | 1172 | .class = (PCI_CLASS_SERIAL_FIBER << 8), |
1173 | .class_mask = ~0, | 1173 | .class_mask = ~0, |
1174 | }, | 1174 | }, |
1175 | { | ||
1176 | .vendor = BFA_PCI_VENDOR_ID_BROCADE, | ||
1177 | .device = BFA_PCI_DEVICE_ID_CT_FC, | ||
1178 | .subvendor = PCI_ANY_ID, | ||
1179 | .subdevice = PCI_ANY_ID, | ||
1180 | .class = (PCI_CLASS_SERIAL_FIBER << 8), | ||
1181 | .class_mask = ~0, | ||
1182 | }, | ||
1175 | 1183 | ||
1176 | {0, 0}, | 1184 | {0, 0}, |
1177 | }; | 1185 | }; |
diff --git a/drivers/scsi/bfa/bfad_fwimg.c b/drivers/scsi/bfa/bfad_fwimg.c index 2ad65f275a92..1baca1a12085 100644 --- a/drivers/scsi/bfa/bfad_fwimg.c +++ b/drivers/scsi/bfa/bfad_fwimg.c | |||
@@ -33,16 +33,20 @@ | |||
33 | #include <bfa_fwimg_priv.h> | 33 | #include <bfa_fwimg_priv.h> |
34 | #include <bfa.h> | 34 | #include <bfa.h> |
35 | 35 | ||
36 | u32 bfi_image_ct_size; | 36 | u32 bfi_image_ct_fc_size; |
37 | u32 bfi_image_cb_size; | 37 | u32 bfi_image_ct_cna_size; |
38 | u32 *bfi_image_ct; | 38 | u32 bfi_image_cb_fc_size; |
39 | u32 *bfi_image_cb; | 39 | u32 *bfi_image_ct_fc; |
40 | u32 *bfi_image_ct_cna; | ||
41 | u32 *bfi_image_cb_fc; | ||
40 | 42 | ||
41 | 43 | ||
42 | #define BFAD_FW_FILE_CT "ctfw.bin" | 44 | #define BFAD_FW_FILE_CT_FC "ctfw_fc.bin" |
43 | #define BFAD_FW_FILE_CB "cbfw.bin" | 45 | #define BFAD_FW_FILE_CT_CNA "ctfw_cna.bin" |
44 | MODULE_FIRMWARE(BFAD_FW_FILE_CT); | 46 | #define BFAD_FW_FILE_CB_FC "cbfw_fc.bin" |
45 | MODULE_FIRMWARE(BFAD_FW_FILE_CB); | 47 | MODULE_FIRMWARE(BFAD_FW_FILE_CT_FC); |
48 | MODULE_FIRMWARE(BFAD_FW_FILE_CT_CNA); | ||
49 | MODULE_FIRMWARE(BFAD_FW_FILE_CB_FC); | ||
46 | 50 | ||
47 | u32 * | 51 | u32 * |
48 | bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, | 52 | bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image, |
@@ -74,24 +78,54 @@ error: | |||
74 | u32 * | 78 | u32 * |
75 | bfad_get_firmware_buf(struct pci_dev *pdev) | 79 | bfad_get_firmware_buf(struct pci_dev *pdev) |
76 | { | 80 | { |
77 | if (pdev->device == BFA_PCI_DEVICE_ID_CT) { | 81 | if (pdev->device == BFA_PCI_DEVICE_ID_CT_FC) { |
78 | if (bfi_image_ct_size == 0) | 82 | if (bfi_image_ct_fc_size == 0) |
79 | bfad_read_firmware(pdev, &bfi_image_ct, | 83 | bfad_read_firmware(pdev, &bfi_image_ct_fc, |
80 | &bfi_image_ct_size, BFAD_FW_FILE_CT); | 84 | &bfi_image_ct_fc_size, BFAD_FW_FILE_CT_FC); |
81 | return bfi_image_ct; | 85 | return bfi_image_ct_fc; |
86 | } else if (pdev->device == BFA_PCI_DEVICE_ID_CT) { | ||
87 | if (bfi_image_ct_cna_size == 0) | ||
88 | bfad_read_firmware(pdev, &bfi_image_ct_cna, | ||
89 | &bfi_image_ct_cna_size, BFAD_FW_FILE_CT_CNA); | ||
90 | return bfi_image_ct_cna; | ||
82 | } else { | 91 | } else { |
83 | if (bfi_image_cb_size == 0) | 92 | if (bfi_image_cb_fc_size == 0) |
84 | bfad_read_firmware(pdev, &bfi_image_cb, | 93 | bfad_read_firmware(pdev, &bfi_image_cb_fc, |
85 | &bfi_image_cb_size, BFAD_FW_FILE_CB); | 94 | &bfi_image_cb_fc_size, BFAD_FW_FILE_CB_FC); |
86 | return bfi_image_cb; | 95 | return bfi_image_cb_fc; |
87 | } | 96 | } |
88 | } | 97 | } |
89 | 98 | ||
90 | u32 * | 99 | u32 * |
91 | bfi_image_ct_get_chunk(u32 off) | 100 | bfi_image_ct_fc_get_chunk(u32 off) |
92 | { return (u32 *)(bfi_image_ct + off); } | 101 | { return (u32 *)(bfi_image_ct_fc + off); } |
93 | 102 | ||
94 | u32 * | 103 | u32 * |
95 | bfi_image_cb_get_chunk(u32 off) | 104 | bfi_image_ct_cna_get_chunk(u32 off) |
96 | { return (u32 *)(bfi_image_cb + off); } | 105 | { return (u32 *)(bfi_image_ct_cna + off); } |
97 | 106 | ||
107 | u32 * | ||
108 | bfi_image_cb_fc_get_chunk(u32 off) | ||
109 | { return (u32 *)(bfi_image_cb_fc + off); } | ||
110 | |||
111 | uint32_t * | ||
112 | bfi_image_get_chunk(int type, uint32_t off) | ||
113 | { | ||
114 | switch (type) { | ||
115 | case BFI_IMAGE_CT_FC: return bfi_image_ct_fc_get_chunk(off); break; | ||
116 | case BFI_IMAGE_CT_CNA: return bfi_image_ct_cna_get_chunk(off); break; | ||
117 | case BFI_IMAGE_CB_FC: return bfi_image_cb_fc_get_chunk(off); break; | ||
118 | default: return 0; break; | ||
119 | } | ||
120 | } | ||
121 | |||
122 | uint32_t | ||
123 | bfi_image_get_size(int type) | ||
124 | { | ||
125 | switch (type) { | ||
126 | case BFI_IMAGE_CT_FC: return bfi_image_ct_fc_size; break; | ||
127 | case BFI_IMAGE_CT_CNA: return bfi_image_ct_cna_size; break; | ||
128 | case BFI_IMAGE_CB_FC: return bfi_image_cb_fc_size; break; | ||
129 | default: return 0; break; | ||
130 | } | ||
131 | } | ||
diff --git a/drivers/scsi/bfa/bfad_im_compat.h b/drivers/scsi/bfa/bfad_im_compat.h index b36be15044a4..0a122abbbe89 100644 --- a/drivers/scsi/bfa/bfad_im_compat.h +++ b/drivers/scsi/bfa/bfad_im_compat.h | |||
@@ -18,9 +18,6 @@ | |||
18 | #ifndef __BFAD_IM_COMPAT_H__ | 18 | #ifndef __BFAD_IM_COMPAT_H__ |
19 | #define __BFAD_IM_COMPAT_H__ | 19 | #define __BFAD_IM_COMPAT_H__ |
20 | 20 | ||
21 | extern u32 *bfi_image_buf; | ||
22 | extern u32 bfi_image_size; | ||
23 | |||
24 | extern struct device_attribute *bfad_im_host_attrs[]; | 21 | extern struct device_attribute *bfad_im_host_attrs[]; |
25 | extern struct device_attribute *bfad_im_vport_attrs[]; | 22 | extern struct device_attribute *bfad_im_vport_attrs[]; |
26 | 23 | ||
@@ -37,10 +34,12 @@ bfad_load_fwimg(struct pci_dev *pdev) | |||
37 | static inline void | 34 | static inline void |
38 | bfad_free_fwimg(void) | 35 | bfad_free_fwimg(void) |
39 | { | 36 | { |
40 | if (bfi_image_ct_size && bfi_image_ct) | 37 | if (bfi_image_ct_fc_size && bfi_image_ct_fc) |
41 | vfree(bfi_image_ct); | 38 | vfree(bfi_image_ct_fc); |
42 | if (bfi_image_cb_size && bfi_image_cb) | 39 | if (bfi_image_ct_cna_size && bfi_image_ct_cna) |
43 | vfree(bfi_image_cb); | 40 | vfree(bfi_image_ct_cna); |
41 | if (bfi_image_cb_fc_size && bfi_image_cb_fc) | ||
42 | vfree(bfi_image_cb_fc); | ||
44 | } | 43 | } |
45 | 44 | ||
46 | #endif | 45 | #endif |
diff --git a/drivers/scsi/bfa/bfad_intr.c b/drivers/scsi/bfa/bfad_intr.c index 2b7dbecbebca..fed27d163655 100644 --- a/drivers/scsi/bfa/bfad_intr.c +++ b/drivers/scsi/bfa/bfad_intr.c | |||
@@ -151,8 +151,8 @@ bfad_setup_intr(struct bfad_s *bfad) | |||
151 | /* Set up the msix entry table */ | 151 | /* Set up the msix entry table */ |
152 | bfad_init_msix_entry(bfad, msix_entries, mask, max_bit); | 152 | bfad_init_msix_entry(bfad, msix_entries, mask, max_bit); |
153 | 153 | ||
154 | if ((pdev->device == BFA_PCI_DEVICE_ID_CT && !msix_disable_ct) || | 154 | if ((bfa_asic_id_ct(pdev->device) && !msix_disable_ct) || |
155 | (pdev->device != BFA_PCI_DEVICE_ID_CT && !msix_disable_cb)) { | 155 | (!bfa_asic_id_ct(pdev->device) && !msix_disable_cb)) { |
156 | 156 | ||
157 | error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); | 157 | error = pci_enable_msix(bfad->pcidev, msix_entries, bfad->nvec); |
158 | if (error) { | 158 | if (error) { |
diff --git a/drivers/scsi/bfa/include/bfi/bfi_ioc.h b/drivers/scsi/bfa/include/bfi/bfi_ioc.h index a0158aac0024..03a9c9408ca5 100644 --- a/drivers/scsi/bfa/include/bfi/bfi_ioc.h +++ b/drivers/scsi/bfa/include/bfi/bfi_ioc.h | |||
@@ -63,6 +63,7 @@ struct bfi_ioc_attr_s { | |||
63 | char fw_version[BFA_VERSION_LEN]; | 63 | char fw_version[BFA_VERSION_LEN]; |
64 | char optrom_version[BFA_VERSION_LEN]; | 64 | char optrom_version[BFA_VERSION_LEN]; |
65 | struct bfa_mfg_vpd_s vpd; | 65 | struct bfa_mfg_vpd_s vpd; |
66 | uint32_t card_type; /* card type */ | ||
66 | }; | 67 | }; |
67 | 68 | ||
68 | /** | 69 | /** |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h b/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h index c5bd9c36ad4d..bfb50eb2124d 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_mfg.h | |||
@@ -86,6 +86,9 @@ enum { | |||
86 | BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */ | 86 | BFA_MFG_TYPE_FC4P1 = 415, /* 4G 1port FC card */ |
87 | BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */ | 87 | BFA_MFG_TYPE_CNA10P2 = 1020, /* 10G 2port CNA card */ |
88 | BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */ | 88 | BFA_MFG_TYPE_CNA10P1 = 1010, /* 10G 1port CNA card */ |
89 | BFA_MFG_TYPE_JAYHAWK = 804, /* Jayhawk mezz card */ | ||
90 | BFA_MFG_TYPE_WANCHESE = 1007, /* Wanchese mezz card */ | ||
91 | BFA_MFG_TYPE_INVALID = 0, /* Invalid card type */ | ||
89 | }; | 92 | }; |
90 | 93 | ||
91 | #pragma pack(1) | 94 | #pragma pack(1) |
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_pci.h b/drivers/scsi/bfa/include/defs/bfa_defs_pci.h index c9b83321694b..ea7d89bbc0bb 100644 --- a/drivers/scsi/bfa/include/defs/bfa_defs_pci.h +++ b/drivers/scsi/bfa/include/defs/bfa_defs_pci.h | |||
@@ -26,8 +26,13 @@ enum { | |||
26 | BFA_PCI_DEVICE_ID_FC_8G2P = 0x13, | 26 | BFA_PCI_DEVICE_ID_FC_8G2P = 0x13, |
27 | BFA_PCI_DEVICE_ID_FC_8G1P = 0x17, | 27 | BFA_PCI_DEVICE_ID_FC_8G1P = 0x17, |
28 | BFA_PCI_DEVICE_ID_CT = 0x14, | 28 | BFA_PCI_DEVICE_ID_CT = 0x14, |
29 | BFA_PCI_DEVICE_ID_CT_FC = 0x21, | ||
29 | }; | 30 | }; |
30 | 31 | ||
32 | #define bfa_asic_id_ct(devid) \ | ||
33 | ((devid) == BFA_PCI_DEVICE_ID_CT || \ | ||
34 | (devid) == BFA_PCI_DEVICE_ID_CT_FC) | ||
35 | |||
31 | /** | 36 | /** |
32 | * PCI sub-system device and vendor ID information | 37 | * PCI sub-system device and vendor ID information |
33 | */ | 38 | */ |
@@ -35,7 +40,9 @@ enum { | |||
35 | BFA_PCI_FCOE_SSDEVICE_ID = 0x14, | 40 | BFA_PCI_FCOE_SSDEVICE_ID = 0x14, |
36 | }; | 41 | }; |
37 | 42 | ||
38 | #define BFA_PCI_ACCESS_RANGES 1 /* Maximum number of device address ranges | 43 | /** |
39 | * mapped through different BAR(s). */ | 44 | * Maximum number of device address ranges mapped through different BAR(s) |
45 | */ | ||
46 | #define BFA_PCI_ACCESS_RANGES 1 | ||
40 | 47 | ||
41 | #endif /* __BFA_DEFS_PCI_H__ */ | 48 | #endif /* __BFA_DEFS_PCI_H__ */ |