diff options
author | Krishna Gudipati <kgudipat@brocade.com> | 2011-06-24 23:22:28 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-06-29 17:56:05 -0400 |
commit | 1a4d8e1bd81c018f7b8c7622066d5cfead59b38a (patch) | |
tree | 52ec78c60131cf3d861929e1f90d84e8acd0a429 | |
parent | ea9582d721a0d711fb046a25f5e94dcbbc5be410 (diff) |
[SCSI] bfa: Enable ASIC block configuration and query.
- Added ASIC block configuration APIs:
- to create/delete/update the physical functions
- to do adapter/port mode configuration
- to query the current ASIC block configuration.
Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/bfa/bfa_core.c | 25 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_defs.h | 71 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_defs_svc.h | 10 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.c | 402 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_ioc.h | 49 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfa_modules.h | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 1 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 186 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.h | 45 | ||||
-rw-r--r-- | drivers/scsi/bfa/bfi.h | 82 |
10 files changed, 863 insertions, 9 deletions
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c index 6da615f48822..2b497243baf4 100644 --- a/drivers/scsi/bfa/bfa_core.c +++ b/drivers/scsi/bfa/bfa_core.c | |||
@@ -109,6 +109,29 @@ bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi) | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /* | 111 | /* |
112 | * ablk module attach | ||
113 | */ | ||
114 | static void | ||
115 | bfa_com_ablk_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi) | ||
116 | { | ||
117 | struct bfa_ablk_s *ablk = &bfa->modules.ablk; | ||
118 | u32 dm_len; | ||
119 | u8 *dm_kva; | ||
120 | u64 dm_pa; | ||
121 | |||
122 | dm_len = bfa_ablk_meminfo(); | ||
123 | dm_kva = bfa_meminfo_dma_virt(mi); | ||
124 | dm_pa = bfa_meminfo_dma_phys(mi); | ||
125 | |||
126 | memset(ablk, 0, sizeof(struct bfa_ablk_s)); | ||
127 | bfa_ablk_attach(ablk, &bfa->ioc); | ||
128 | bfa_ablk_memclaim(ablk, dm_kva, dm_pa); | ||
129 | |||
130 | bfa_meminfo_dma_virt(mi) = dm_kva + dm_len; | ||
131 | bfa_meminfo_dma_phys(mi) = dm_pa + dm_len; | ||
132 | } | ||
133 | |||
134 | /* | ||
112 | * BFA IOC FC related definitions | 135 | * BFA IOC FC related definitions |
113 | */ | 136 | */ |
114 | 137 | ||
@@ -1117,6 +1140,7 @@ bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo) | |||
1117 | hal_mods[i]->meminfo(cfg, &km_len, &dm_len); | 1140 | hal_mods[i]->meminfo(cfg, &km_len, &dm_len); |
1118 | 1141 | ||
1119 | dm_len += bfa_port_meminfo(); | 1142 | dm_len += bfa_port_meminfo(); |
1143 | dm_len += bfa_ablk_meminfo(); | ||
1120 | 1144 | ||
1121 | meminfo->meminfo[BFA_MEM_TYPE_KVA - 1].mem_len = km_len; | 1145 | meminfo->meminfo[BFA_MEM_TYPE_KVA - 1].mem_len = km_len; |
1122 | meminfo->meminfo[BFA_MEM_TYPE_DMA - 1].mem_len = dm_len; | 1146 | meminfo->meminfo[BFA_MEM_TYPE_DMA - 1].mem_len = dm_len; |
@@ -1174,6 +1198,7 @@ bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, | |||
1174 | hal_mods[i]->attach(bfa, bfad, cfg, meminfo, pcidev); | 1198 | hal_mods[i]->attach(bfa, bfad, cfg, meminfo, pcidev); |
1175 | 1199 | ||
1176 | bfa_com_port_attach(bfa, meminfo); | 1200 | bfa_com_port_attach(bfa, meminfo); |
1201 | bfa_com_ablk_attach(bfa, meminfo); | ||
1177 | } | 1202 | } |
1178 | 1203 | ||
1179 | /* | 1204 | /* |
diff --git a/drivers/scsi/bfa/bfa_defs.h b/drivers/scsi/bfa/bfa_defs.h index 08ab60c4760f..cced5874cb55 100644 --- a/drivers/scsi/bfa/bfa_defs.h +++ b/drivers/scsi/bfa/bfa_defs.h | |||
@@ -329,7 +329,10 @@ struct bfa_ioc_attr_s { | |||
329 | struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */ | 329 | struct bfa_ioc_driver_attr_s driver_attr; /* driver attr */ |
330 | struct bfa_ioc_pci_attr_s pci_attr; | 330 | struct bfa_ioc_pci_attr_s pci_attr; |
331 | u8 port_id; /* port number */ | 331 | u8 port_id; /* port number */ |
332 | u8 rsvd[7]; /* 64bit align */ | 332 | u8 port_mode; /* bfa_mode_s */ |
333 | u8 cap_bm; /* capability */ | ||
334 | u8 port_mode_cfg; /* bfa_mode_s */ | ||
335 | u8 rsvd[4]; /* 64bit align */ | ||
333 | }; | 336 | }; |
334 | 337 | ||
335 | /* | 338 | /* |
@@ -352,6 +355,16 @@ struct bfa_ioc_attr_s { | |||
352 | #define BFA_MFG_IC_FC 0x01 | 355 | #define BFA_MFG_IC_FC 0x01 |
353 | #define BFA_MFG_IC_ETH 0x02 | 356 | #define BFA_MFG_IC_ETH 0x02 |
354 | 357 | ||
358 | /* | ||
359 | * Adapter capability mask definition | ||
360 | */ | ||
361 | #define BFA_CM_HBA 0x01 | ||
362 | #define BFA_CM_CNA 0x02 | ||
363 | #define BFA_CM_NIC 0x04 | ||
364 | #define BFA_CM_FC16G 0x08 | ||
365 | #define BFA_CM_SRIOV 0x10 | ||
366 | #define BFA_CM_MEZZ 0x20 | ||
367 | |||
355 | #pragma pack(1) | 368 | #pragma pack(1) |
356 | 369 | ||
357 | /* | 370 | /* |
@@ -418,6 +431,9 @@ enum { | |||
418 | */ | 431 | */ |
419 | enum { | 432 | enum { |
420 | BFA_PCI_FCOE_SSDEVICE_ID = 0x14, | 433 | BFA_PCI_FCOE_SSDEVICE_ID = 0x14, |
434 | BFA_PCI_CT2_SSID_FCoE = 0x22, | ||
435 | BFA_PCI_CT2_SSID_ETH = 0x23, | ||
436 | BFA_PCI_CT2_SSID_FC = 0x24, | ||
421 | }; | 437 | }; |
422 | 438 | ||
423 | /* | 439 | /* |
@@ -485,4 +501,57 @@ struct bfa_boot_pbc_s { | |||
485 | struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX]; | 501 | struct bfa_boot_bootlun_s pblun[BFA_PREBOOT_BOOTLUN_MAX]; |
486 | }; | 502 | }; |
487 | 503 | ||
504 | /* | ||
505 | * ASIC block configuration related structures | ||
506 | */ | ||
507 | #define BFA_ABLK_MAX_PORTS 2 | ||
508 | #define BFA_ABLK_MAX_PFS 16 | ||
509 | #define BFA_ABLK_MAX 2 | ||
510 | |||
511 | #pragma pack(1) | ||
512 | enum bfa_mode_s { | ||
513 | BFA_MODE_HBA = 1, | ||
514 | BFA_MODE_CNA = 2, | ||
515 | BFA_MODE_NIC = 3 | ||
516 | }; | ||
517 | |||
518 | struct bfa_adapter_cfg_mode_s { | ||
519 | u16 max_pf; | ||
520 | u16 max_vf; | ||
521 | enum bfa_mode_s mode; | ||
522 | }; | ||
523 | |||
524 | struct bfa_ablk_cfg_pf_s { | ||
525 | u16 pers; | ||
526 | u8 port_id; | ||
527 | u8 optrom; | ||
528 | u8 valid; | ||
529 | u8 sriov; | ||
530 | u8 max_vfs; | ||
531 | u8 rsvd[1]; | ||
532 | u16 num_qpairs; | ||
533 | u16 num_vectors; | ||
534 | u32 bw; | ||
535 | }; | ||
536 | |||
537 | struct bfa_ablk_cfg_port_s { | ||
538 | u8 mode; | ||
539 | u8 type; | ||
540 | u8 max_pfs; | ||
541 | u8 rsvd[5]; | ||
542 | }; | ||
543 | |||
544 | struct bfa_ablk_cfg_inst_s { | ||
545 | u8 nports; | ||
546 | u8 max_pfs; | ||
547 | u8 rsvd[6]; | ||
548 | struct bfa_ablk_cfg_pf_s pf_cfg[BFA_ABLK_MAX_PFS]; | ||
549 | struct bfa_ablk_cfg_port_s port_cfg[BFA_ABLK_MAX_PORTS]; | ||
550 | }; | ||
551 | |||
552 | struct bfa_ablk_cfg_s { | ||
553 | struct bfa_ablk_cfg_inst_s inst[BFA_ABLK_MAX]; | ||
554 | }; | ||
555 | #pragma pack() | ||
556 | |||
488 | #endif /* __BFA_DEFS_H__ */ | 557 | #endif /* __BFA_DEFS_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h index e1aae51bb974..0ee3f954dc85 100644 --- a/drivers/scsi/bfa/bfa_defs_svc.h +++ b/drivers/scsi/bfa/bfa_defs_svc.h | |||
@@ -265,8 +265,8 @@ struct bfa_fw_fcoe_stats_s { | |||
265 | * IOC firmware FCoE port stats | 265 | * IOC firmware FCoE port stats |
266 | */ | 266 | */ |
267 | struct bfa_fw_fcoe_port_stats_s { | 267 | struct bfa_fw_fcoe_port_stats_s { |
268 | struct bfa_fw_fcoe_stats_s fcoe_stats; | 268 | struct bfa_fw_fcoe_stats_s fcoe_stats; |
269 | struct bfa_fw_fip_stats_s fip_stats; | 269 | struct bfa_fw_fip_stats_s fip_stats; |
270 | }; | 270 | }; |
271 | 271 | ||
272 | /* | 272 | /* |
@@ -1083,4 +1083,10 @@ union bfa_port_stats_u { | |||
1083 | struct bfa_port_eth_stats_s eth; | 1083 | struct bfa_port_eth_stats_s eth; |
1084 | }; | 1084 | }; |
1085 | 1085 | ||
1086 | struct bfa_port_cfg_mode_s { | ||
1087 | u16 max_pf; | ||
1088 | u16 max_vf; | ||
1089 | enum bfa_mode_s mode; | ||
1090 | }; | ||
1091 | |||
1086 | #endif /* __BFA_DEFS_SVC_H__ */ | 1092 | #endif /* __BFA_DEFS_SVC_H__ */ |
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c index b9413c2e67ff..2c575f5dea04 100644 --- a/drivers/scsi/bfa/bfa_ioc.c +++ b/drivers/scsi/bfa/bfa_ioc.c | |||
@@ -1945,6 +1945,9 @@ bfa_ioc_isr(struct bfa_ioc_s *ioc, struct bfi_mbmsg_s *m) | |||
1945 | break; | 1945 | break; |
1946 | 1946 | ||
1947 | case BFI_IOC_I2H_ENABLE_REPLY: | 1947 | case BFI_IOC_I2H_ENABLE_REPLY: |
1948 | ioc->port_mode = ioc->port_mode_cfg = | ||
1949 | (enum bfa_mode_s)msg->fw_event.port_mode; | ||
1950 | ioc->ad_cap_bm = msg->fw_event.cap_bm; | ||
1948 | bfa_fsm_send_event(iocpf, IOCPF_E_FWRSP_ENABLE); | 1951 | bfa_fsm_send_event(iocpf, IOCPF_E_FWRSP_ENABLE); |
1949 | break; | 1952 | break; |
1950 | 1953 | ||
@@ -2018,25 +2021,46 @@ bfa_ioc_pci_init(struct bfa_ioc_s *ioc, struct bfa_pcidev_s *pcidev, | |||
2018 | case BFA_PCI_DEVICE_ID_FC_8G1P: | 2021 | case BFA_PCI_DEVICE_ID_FC_8G1P: |
2019 | case BFA_PCI_DEVICE_ID_FC_8G2P: | 2022 | case BFA_PCI_DEVICE_ID_FC_8G2P: |
2020 | ioc->asic_gen = BFI_ASIC_GEN_CB; | 2023 | ioc->asic_gen = BFI_ASIC_GEN_CB; |
2024 | ioc->fcmode = BFA_TRUE; | ||
2025 | ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; | ||
2026 | ioc->ad_cap_bm = BFA_CM_HBA; | ||
2021 | break; | 2027 | break; |
2022 | 2028 | ||
2023 | case BFA_PCI_DEVICE_ID_CT: | 2029 | case BFA_PCI_DEVICE_ID_CT: |
2024 | ioc->asic_gen = BFI_ASIC_GEN_CT; | 2030 | ioc->asic_gen = BFI_ASIC_GEN_CT; |
2025 | ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; | 2031 | ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; |
2026 | ioc->asic_mode = BFI_ASIC_MODE_ETH; | 2032 | ioc->asic_mode = BFI_ASIC_MODE_ETH; |
2033 | ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_CNA; | ||
2034 | ioc->ad_cap_bm = BFA_CM_CNA; | ||
2027 | break; | 2035 | break; |
2028 | 2036 | ||
2029 | case BFA_PCI_DEVICE_ID_CT_FC: | 2037 | case BFA_PCI_DEVICE_ID_CT_FC: |
2030 | ioc->asic_gen = BFI_ASIC_GEN_CT; | 2038 | ioc->asic_gen = BFI_ASIC_GEN_CT; |
2039 | ioc->fcmode = BFA_TRUE; | ||
2040 | ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; | ||
2041 | ioc->ad_cap_bm = BFA_CM_HBA; | ||
2031 | break; | 2042 | break; |
2032 | 2043 | ||
2033 | case BFA_PCI_DEVICE_ID_CT2: | 2044 | case BFA_PCI_DEVICE_ID_CT2: |
2034 | ioc->asic_gen = BFI_ASIC_GEN_CT2; | 2045 | ioc->asic_gen = BFI_ASIC_GEN_CT2; |
2035 | if (clscode == BFI_PCIFN_CLASS_FC) | 2046 | if (clscode == BFI_PCIFN_CLASS_FC && |
2047 | pcidev->ssid == BFA_PCI_CT2_SSID_FC) { | ||
2036 | ioc->asic_mode = BFI_ASIC_MODE_FC16; | 2048 | ioc->asic_mode = BFI_ASIC_MODE_FC16; |
2037 | else { | 2049 | ioc->fcmode = BFA_TRUE; |
2050 | ioc->port_mode = ioc->port_mode_cfg = BFA_MODE_HBA; | ||
2051 | ioc->ad_cap_bm = BFA_CM_HBA; | ||
2052 | } else { | ||
2038 | ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; | 2053 | ioc->port0_mode = ioc->port1_mode = BFI_PORT_MODE_ETH; |
2039 | ioc->asic_mode = BFI_ASIC_MODE_ETH; | 2054 | ioc->asic_mode = BFI_ASIC_MODE_ETH; |
2055 | if (pcidev->ssid == BFA_PCI_CT2_SSID_FCoE) { | ||
2056 | ioc->port_mode = | ||
2057 | ioc->port_mode_cfg = BFA_MODE_CNA; | ||
2058 | ioc->ad_cap_bm = BFA_CM_CNA; | ||
2059 | } else { | ||
2060 | ioc->port_mode = | ||
2061 | ioc->port_mode_cfg = BFA_MODE_NIC; | ||
2062 | ioc->ad_cap_bm = BFA_CM_NIC; | ||
2063 | } | ||
2040 | } | 2064 | } |
2041 | break; | 2065 | break; |
2042 | 2066 | ||
@@ -2477,6 +2501,9 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr) | |||
2477 | 2501 | ||
2478 | ioc_attr->state = bfa_ioc_get_state(ioc); | 2502 | ioc_attr->state = bfa_ioc_get_state(ioc); |
2479 | ioc_attr->port_id = ioc->port_id; | 2503 | ioc_attr->port_id = ioc->port_id; |
2504 | ioc_attr->port_mode = ioc->port_mode; | ||
2505 | ioc_attr->port_mode_cfg = ioc->port_mode_cfg; | ||
2506 | ioc_attr->cap_bm = ioc->ad_cap_bm; | ||
2480 | 2507 | ||
2481 | ioc_attr->ioc_type = bfa_ioc_get_type(ioc); | 2508 | ioc_attr->ioc_type = bfa_ioc_get_type(ioc); |
2482 | 2509 | ||
@@ -2837,3 +2864,372 @@ bfa_timer_stop(struct bfa_timer_s *timer) | |||
2837 | 2864 | ||
2838 | list_del(&timer->qe); | 2865 | list_del(&timer->qe); |
2839 | } | 2866 | } |
2867 | |||
2868 | /* | ||
2869 | * ASIC block related | ||
2870 | */ | ||
2871 | static void | ||
2872 | bfa_ablk_config_swap(struct bfa_ablk_cfg_s *cfg) | ||
2873 | { | ||
2874 | struct bfa_ablk_cfg_inst_s *cfg_inst; | ||
2875 | int i, j; | ||
2876 | u16 be16; | ||
2877 | u32 be32; | ||
2878 | |||
2879 | for (i = 0; i < BFA_ABLK_MAX; i++) { | ||
2880 | cfg_inst = &cfg->inst[i]; | ||
2881 | for (j = 0; j < BFA_ABLK_MAX_PFS; j++) { | ||
2882 | be16 = cfg_inst->pf_cfg[j].pers; | ||
2883 | cfg_inst->pf_cfg[j].pers = be16_to_cpu(be16); | ||
2884 | be16 = cfg_inst->pf_cfg[j].num_qpairs; | ||
2885 | cfg_inst->pf_cfg[j].num_qpairs = be16_to_cpu(be16); | ||
2886 | be16 = cfg_inst->pf_cfg[j].num_vectors; | ||
2887 | cfg_inst->pf_cfg[j].num_vectors = be16_to_cpu(be16); | ||
2888 | be32 = cfg_inst->pf_cfg[j].bw; | ||
2889 | cfg_inst->pf_cfg[j].bw = be16_to_cpu(be32); | ||
2890 | } | ||
2891 | } | ||
2892 | } | ||
2893 | |||
2894 | static void | ||
2895 | bfa_ablk_isr(void *cbarg, struct bfi_mbmsg_s *msg) | ||
2896 | { | ||
2897 | struct bfa_ablk_s *ablk = (struct bfa_ablk_s *)cbarg; | ||
2898 | struct bfi_ablk_i2h_rsp_s *rsp = (struct bfi_ablk_i2h_rsp_s *)msg; | ||
2899 | bfa_ablk_cbfn_t cbfn; | ||
2900 | |||
2901 | WARN_ON(msg->mh.msg_class != BFI_MC_ABLK); | ||
2902 | bfa_trc(ablk->ioc, msg->mh.msg_id); | ||
2903 | |||
2904 | switch (msg->mh.msg_id) { | ||
2905 | case BFI_ABLK_I2H_QUERY: | ||
2906 | if (rsp->status == BFA_STATUS_OK) { | ||
2907 | memcpy(ablk->cfg, ablk->dma_addr.kva, | ||
2908 | sizeof(struct bfa_ablk_cfg_s)); | ||
2909 | bfa_ablk_config_swap(ablk->cfg); | ||
2910 | ablk->cfg = NULL; | ||
2911 | } | ||
2912 | break; | ||
2913 | |||
2914 | case BFI_ABLK_I2H_ADPT_CONFIG: | ||
2915 | case BFI_ABLK_I2H_PORT_CONFIG: | ||
2916 | /* update config port mode */ | ||
2917 | ablk->ioc->port_mode_cfg = rsp->port_mode; | ||
2918 | |||
2919 | case BFI_ABLK_I2H_PF_DELETE: | ||
2920 | case BFI_ABLK_I2H_PF_UPDATE: | ||
2921 | case BFI_ABLK_I2H_OPTROM_ENABLE: | ||
2922 | case BFI_ABLK_I2H_OPTROM_DISABLE: | ||
2923 | /* No-op */ | ||
2924 | break; | ||
2925 | |||
2926 | case BFI_ABLK_I2H_PF_CREATE: | ||
2927 | *(ablk->pcifn) = rsp->pcifn; | ||
2928 | ablk->pcifn = NULL; | ||
2929 | break; | ||
2930 | |||
2931 | default: | ||
2932 | WARN_ON(1); | ||
2933 | } | ||
2934 | |||
2935 | ablk->busy = BFA_FALSE; | ||
2936 | if (ablk->cbfn) { | ||
2937 | cbfn = ablk->cbfn; | ||
2938 | ablk->cbfn = NULL; | ||
2939 | cbfn(ablk->cbarg, rsp->status); | ||
2940 | } | ||
2941 | } | ||
2942 | |||
2943 | static void | ||
2944 | bfa_ablk_notify(void *cbarg, enum bfa_ioc_event_e event) | ||
2945 | { | ||
2946 | struct bfa_ablk_s *ablk = (struct bfa_ablk_s *)cbarg; | ||
2947 | |||
2948 | bfa_trc(ablk->ioc, event); | ||
2949 | |||
2950 | switch (event) { | ||
2951 | case BFA_IOC_E_ENABLED: | ||
2952 | WARN_ON(ablk->busy != BFA_FALSE); | ||
2953 | break; | ||
2954 | |||
2955 | case BFA_IOC_E_DISABLED: | ||
2956 | case BFA_IOC_E_FAILED: | ||
2957 | /* Fail any pending requests */ | ||
2958 | ablk->pcifn = NULL; | ||
2959 | if (ablk->busy) { | ||
2960 | if (ablk->cbfn) | ||
2961 | ablk->cbfn(ablk->cbarg, BFA_STATUS_FAILED); | ||
2962 | ablk->cbfn = NULL; | ||
2963 | ablk->busy = BFA_FALSE; | ||
2964 | } | ||
2965 | break; | ||
2966 | |||
2967 | default: | ||
2968 | WARN_ON(1); | ||
2969 | break; | ||
2970 | } | ||
2971 | } | ||
2972 | |||
2973 | u32 | ||
2974 | bfa_ablk_meminfo(void) | ||
2975 | { | ||
2976 | return BFA_ROUNDUP(sizeof(struct bfa_ablk_cfg_s), BFA_DMA_ALIGN_SZ); | ||
2977 | } | ||
2978 | |||
2979 | void | ||
2980 | bfa_ablk_memclaim(struct bfa_ablk_s *ablk, u8 *dma_kva, u64 dma_pa) | ||
2981 | { | ||
2982 | ablk->dma_addr.kva = dma_kva; | ||
2983 | ablk->dma_addr.pa = dma_pa; | ||
2984 | } | ||
2985 | |||
2986 | void | ||
2987 | bfa_ablk_attach(struct bfa_ablk_s *ablk, struct bfa_ioc_s *ioc) | ||
2988 | { | ||
2989 | ablk->ioc = ioc; | ||
2990 | |||
2991 | bfa_ioc_mbox_regisr(ablk->ioc, BFI_MC_ABLK, bfa_ablk_isr, ablk); | ||
2992 | bfa_ioc_notify_init(&ablk->ioc_notify, bfa_ablk_notify, ablk); | ||
2993 | list_add_tail(&ablk->ioc_notify.qe, &ablk->ioc->notify_q); | ||
2994 | } | ||
2995 | |||
2996 | bfa_status_t | ||
2997 | bfa_ablk_query(struct bfa_ablk_s *ablk, struct bfa_ablk_cfg_s *ablk_cfg, | ||
2998 | bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
2999 | { | ||
3000 | struct bfi_ablk_h2i_query_s *m; | ||
3001 | |||
3002 | WARN_ON(!ablk_cfg); | ||
3003 | |||
3004 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3005 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3006 | return BFA_STATUS_IOC_FAILURE; | ||
3007 | } | ||
3008 | |||
3009 | if (ablk->busy) { | ||
3010 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3011 | return BFA_STATUS_DEVBUSY; | ||
3012 | } | ||
3013 | |||
3014 | ablk->cfg = ablk_cfg; | ||
3015 | ablk->cbfn = cbfn; | ||
3016 | ablk->cbarg = cbarg; | ||
3017 | ablk->busy = BFA_TRUE; | ||
3018 | |||
3019 | m = (struct bfi_ablk_h2i_query_s *)ablk->mb.msg; | ||
3020 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_QUERY, | ||
3021 | bfa_ioc_portid(ablk->ioc)); | ||
3022 | bfa_dma_be_addr_set(m->addr, ablk->dma_addr.pa); | ||
3023 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3024 | |||
3025 | return BFA_STATUS_OK; | ||
3026 | } | ||
3027 | |||
3028 | bfa_status_t | ||
3029 | bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, | ||
3030 | u8 port, enum bfi_pcifn_class personality, int bw, | ||
3031 | bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3032 | { | ||
3033 | struct bfi_ablk_h2i_pf_req_s *m; | ||
3034 | |||
3035 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3036 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3037 | return BFA_STATUS_IOC_FAILURE; | ||
3038 | } | ||
3039 | |||
3040 | if (ablk->busy) { | ||
3041 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3042 | return BFA_STATUS_DEVBUSY; | ||
3043 | } | ||
3044 | |||
3045 | ablk->pcifn = pcifn; | ||
3046 | ablk->cbfn = cbfn; | ||
3047 | ablk->cbarg = cbarg; | ||
3048 | ablk->busy = BFA_TRUE; | ||
3049 | |||
3050 | m = (struct bfi_ablk_h2i_pf_req_s *)ablk->mb.msg; | ||
3051 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_CREATE, | ||
3052 | bfa_ioc_portid(ablk->ioc)); | ||
3053 | m->pers = cpu_to_be16((u16)personality); | ||
3054 | m->bw = cpu_to_be32(bw); | ||
3055 | m->port = port; | ||
3056 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3057 | |||
3058 | return BFA_STATUS_OK; | ||
3059 | } | ||
3060 | |||
3061 | bfa_status_t | ||
3062 | bfa_ablk_pf_delete(struct bfa_ablk_s *ablk, int pcifn, | ||
3063 | bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3064 | { | ||
3065 | struct bfi_ablk_h2i_pf_req_s *m; | ||
3066 | |||
3067 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3068 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3069 | return BFA_STATUS_IOC_FAILURE; | ||
3070 | } | ||
3071 | |||
3072 | if (ablk->busy) { | ||
3073 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3074 | return BFA_STATUS_DEVBUSY; | ||
3075 | } | ||
3076 | |||
3077 | ablk->cbfn = cbfn; | ||
3078 | ablk->cbarg = cbarg; | ||
3079 | ablk->busy = BFA_TRUE; | ||
3080 | |||
3081 | m = (struct bfi_ablk_h2i_pf_req_s *)ablk->mb.msg; | ||
3082 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_DELETE, | ||
3083 | bfa_ioc_portid(ablk->ioc)); | ||
3084 | m->pcifn = (u8)pcifn; | ||
3085 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3086 | |||
3087 | return BFA_STATUS_OK; | ||
3088 | } | ||
3089 | |||
3090 | bfa_status_t | ||
3091 | bfa_ablk_adapter_config(struct bfa_ablk_s *ablk, enum bfa_mode_s mode, | ||
3092 | int max_pf, int max_vf, bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3093 | { | ||
3094 | struct bfi_ablk_h2i_cfg_req_s *m; | ||
3095 | |||
3096 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3097 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3098 | return BFA_STATUS_IOC_FAILURE; | ||
3099 | } | ||
3100 | |||
3101 | if (ablk->busy) { | ||
3102 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3103 | return BFA_STATUS_DEVBUSY; | ||
3104 | } | ||
3105 | |||
3106 | ablk->cbfn = cbfn; | ||
3107 | ablk->cbarg = cbarg; | ||
3108 | ablk->busy = BFA_TRUE; | ||
3109 | |||
3110 | m = (struct bfi_ablk_h2i_cfg_req_s *)ablk->mb.msg; | ||
3111 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_ADPT_CONFIG, | ||
3112 | bfa_ioc_portid(ablk->ioc)); | ||
3113 | m->mode = (u8)mode; | ||
3114 | m->max_pf = (u8)max_pf; | ||
3115 | m->max_vf = (u8)max_vf; | ||
3116 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3117 | |||
3118 | return BFA_STATUS_OK; | ||
3119 | } | ||
3120 | |||
3121 | bfa_status_t | ||
3122 | bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port, enum bfa_mode_s mode, | ||
3123 | int max_pf, int max_vf, bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3124 | { | ||
3125 | struct bfi_ablk_h2i_cfg_req_s *m; | ||
3126 | |||
3127 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3128 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3129 | return BFA_STATUS_IOC_FAILURE; | ||
3130 | } | ||
3131 | |||
3132 | if (ablk->busy) { | ||
3133 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3134 | return BFA_STATUS_DEVBUSY; | ||
3135 | } | ||
3136 | |||
3137 | ablk->cbfn = cbfn; | ||
3138 | ablk->cbarg = cbarg; | ||
3139 | ablk->busy = BFA_TRUE; | ||
3140 | |||
3141 | m = (struct bfi_ablk_h2i_cfg_req_s *)ablk->mb.msg; | ||
3142 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PORT_CONFIG, | ||
3143 | bfa_ioc_portid(ablk->ioc)); | ||
3144 | m->port = (u8)port; | ||
3145 | m->mode = (u8)mode; | ||
3146 | m->max_pf = (u8)max_pf; | ||
3147 | m->max_vf = (u8)max_vf; | ||
3148 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3149 | |||
3150 | return BFA_STATUS_OK; | ||
3151 | } | ||
3152 | |||
3153 | bfa_status_t | ||
3154 | bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, | ||
3155 | bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3156 | { | ||
3157 | struct bfi_ablk_h2i_pf_req_s *m; | ||
3158 | |||
3159 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3160 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3161 | return BFA_STATUS_IOC_FAILURE; | ||
3162 | } | ||
3163 | |||
3164 | if (ablk->busy) { | ||
3165 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3166 | return BFA_STATUS_DEVBUSY; | ||
3167 | } | ||
3168 | |||
3169 | ablk->cbfn = cbfn; | ||
3170 | ablk->cbarg = cbarg; | ||
3171 | ablk->busy = BFA_TRUE; | ||
3172 | |||
3173 | m = (struct bfi_ablk_h2i_pf_req_s *)ablk->mb.msg; | ||
3174 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_PF_UPDATE, | ||
3175 | bfa_ioc_portid(ablk->ioc)); | ||
3176 | m->pcifn = (u8)pcifn; | ||
3177 | m->bw = cpu_to_be32(bw); | ||
3178 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3179 | |||
3180 | return BFA_STATUS_OK; | ||
3181 | } | ||
3182 | |||
3183 | bfa_status_t | ||
3184 | bfa_ablk_optrom_en(struct bfa_ablk_s *ablk, bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3185 | { | ||
3186 | struct bfi_ablk_h2i_optrom_s *m; | ||
3187 | |||
3188 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3189 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3190 | return BFA_STATUS_IOC_FAILURE; | ||
3191 | } | ||
3192 | |||
3193 | if (ablk->busy) { | ||
3194 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3195 | return BFA_STATUS_DEVBUSY; | ||
3196 | } | ||
3197 | |||
3198 | ablk->cbfn = cbfn; | ||
3199 | ablk->cbarg = cbarg; | ||
3200 | ablk->busy = BFA_TRUE; | ||
3201 | |||
3202 | m = (struct bfi_ablk_h2i_optrom_s *)ablk->mb.msg; | ||
3203 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_OPTROM_ENABLE, | ||
3204 | bfa_ioc_portid(ablk->ioc)); | ||
3205 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3206 | |||
3207 | return BFA_STATUS_OK; | ||
3208 | } | ||
3209 | |||
3210 | bfa_status_t | ||
3211 | bfa_ablk_optrom_dis(struct bfa_ablk_s *ablk, bfa_ablk_cbfn_t cbfn, void *cbarg) | ||
3212 | { | ||
3213 | struct bfi_ablk_h2i_optrom_s *m; | ||
3214 | |||
3215 | if (!bfa_ioc_is_operational(ablk->ioc)) { | ||
3216 | bfa_trc(ablk->ioc, BFA_STATUS_IOC_FAILURE); | ||
3217 | return BFA_STATUS_IOC_FAILURE; | ||
3218 | } | ||
3219 | |||
3220 | if (ablk->busy) { | ||
3221 | bfa_trc(ablk->ioc, BFA_STATUS_DEVBUSY); | ||
3222 | return BFA_STATUS_DEVBUSY; | ||
3223 | } | ||
3224 | |||
3225 | ablk->cbfn = cbfn; | ||
3226 | ablk->cbarg = cbarg; | ||
3227 | ablk->busy = BFA_TRUE; | ||
3228 | |||
3229 | m = (struct bfi_ablk_h2i_optrom_s *)ablk->mb.msg; | ||
3230 | bfi_h2i_set(m->mh, BFI_MC_ABLK, BFI_ABLK_H2I_OPTROM_DISABLE, | ||
3231 | bfa_ioc_portid(ablk->ioc)); | ||
3232 | bfa_ioc_mbox_queue(ablk->ioc, &ablk->mb); | ||
3233 | |||
3234 | return BFA_STATUS_OK; | ||
3235 | } | ||
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h index c717b2035573..337d0366845f 100644 --- a/drivers/scsi/bfa/bfa_ioc.h +++ b/drivers/scsi/bfa/bfa_ioc.h | |||
@@ -91,6 +91,7 @@ struct bfa_pcidev_s { | |||
91 | int pci_slot; | 91 | int pci_slot; |
92 | u8 pci_func; | 92 | u8 pci_func; |
93 | u16 device_id; | 93 | u16 device_id; |
94 | u16 ssid; | ||
94 | void __iomem *pci_bar_kva; | 95 | void __iomem *pci_bar_kva; |
95 | }; | 96 | }; |
96 | 97 | ||
@@ -261,6 +262,9 @@ struct bfa_ioc_s { | |||
261 | enum bfi_asic_mode asic_mode; | 262 | enum bfi_asic_mode asic_mode; |
262 | enum bfi_port_mode port0_mode; | 263 | enum bfi_port_mode port0_mode; |
263 | enum bfi_port_mode port1_mode; | 264 | enum bfi_port_mode port1_mode; |
265 | enum bfa_mode_s port_mode; | ||
266 | u8 ad_cap_bm; /* adapter cap bit mask */ | ||
267 | u8 port_mode_cfg; /* config port mode */ | ||
264 | }; | 268 | }; |
265 | 269 | ||
266 | struct bfa_ioc_hwif_s { | 270 | struct bfa_ioc_hwif_s { |
@@ -281,6 +285,24 @@ struct bfa_ioc_hwif_s { | |||
281 | bfa_boolean_t (*ioc_lpu_read_stat) (struct bfa_ioc_s *ioc); | 285 | bfa_boolean_t (*ioc_lpu_read_stat) (struct bfa_ioc_s *ioc); |
282 | }; | 286 | }; |
283 | 287 | ||
288 | /* | ||
289 | * ASIC block configurtion related | ||
290 | */ | ||
291 | |||
292 | typedef void (*bfa_ablk_cbfn_t)(void *, enum bfa_status); | ||
293 | |||
294 | struct bfa_ablk_s { | ||
295 | struct bfa_ioc_s *ioc; | ||
296 | struct bfa_ablk_cfg_s *cfg; | ||
297 | u16 *pcifn; | ||
298 | struct bfa_dma_s dma_addr; | ||
299 | bfa_boolean_t busy; | ||
300 | struct bfa_mbox_cmd_s mb; | ||
301 | bfa_ablk_cbfn_t cbfn; | ||
302 | void *cbarg; | ||
303 | struct bfa_ioc_notify_s ioc_notify; | ||
304 | }; | ||
305 | |||
284 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) | 306 | #define bfa_ioc_pcifn(__ioc) ((__ioc)->pcidev.pci_func) |
285 | #define bfa_ioc_devid(__ioc) ((__ioc)->pcidev.device_id) | 307 | #define bfa_ioc_devid(__ioc) ((__ioc)->pcidev.device_id) |
286 | #define bfa_ioc_bar0(__ioc) ((__ioc)->pcidev.pci_bar_kva) | 308 | #define bfa_ioc_bar0(__ioc) ((__ioc)->pcidev.pci_bar_kva) |
@@ -402,6 +424,33 @@ bfa_status_t bfa_ioc_fw_stats_get(struct bfa_ioc_s *ioc, void *stats); | |||
402 | bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc); | 424 | bfa_status_t bfa_ioc_fw_stats_clear(struct bfa_ioc_s *ioc); |
403 | 425 | ||
404 | /* | 426 | /* |
427 | * asic block configuration related APIs | ||
428 | */ | ||
429 | u32 bfa_ablk_meminfo(void); | ||
430 | void bfa_ablk_memclaim(struct bfa_ablk_s *ablk, u8 *dma_kva, u64 dma_pa); | ||
431 | void bfa_ablk_attach(struct bfa_ablk_s *ablk, struct bfa_ioc_s *ioc); | ||
432 | bfa_status_t bfa_ablk_query(struct bfa_ablk_s *ablk, | ||
433 | struct bfa_ablk_cfg_s *ablk_cfg, | ||
434 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
435 | bfa_status_t bfa_ablk_adapter_config(struct bfa_ablk_s *ablk, | ||
436 | enum bfa_mode_s mode, int max_pf, int max_vf, | ||
437 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
438 | bfa_status_t bfa_ablk_port_config(struct bfa_ablk_s *ablk, int port, | ||
439 | enum bfa_mode_s mode, int max_pf, int max_vf, | ||
440 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
441 | bfa_status_t bfa_ablk_pf_create(struct bfa_ablk_s *ablk, u16 *pcifn, | ||
442 | u8 port, enum bfi_pcifn_class personality, int bw, | ||
443 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
444 | bfa_status_t bfa_ablk_pf_delete(struct bfa_ablk_s *ablk, int pcifn, | ||
445 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
446 | bfa_status_t bfa_ablk_pf_update(struct bfa_ablk_s *ablk, int pcifn, int bw, | ||
447 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
448 | bfa_status_t bfa_ablk_optrom_en(struct bfa_ablk_s *ablk, | ||
449 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
450 | bfa_status_t bfa_ablk_optrom_dis(struct bfa_ablk_s *ablk, | ||
451 | bfa_ablk_cbfn_t cbfn, void *cbarg); | ||
452 | |||
453 | /* | ||
405 | * bfa mfg wwn API functions | 454 | * bfa mfg wwn API functions |
406 | */ | 455 | */ |
407 | mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc); | 456 | mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc); |
diff --git a/drivers/scsi/bfa/bfa_modules.h b/drivers/scsi/bfa/bfa_modules.h index 0fc23f645057..7311169089a9 100644 --- a/drivers/scsi/bfa/bfa_modules.h +++ b/drivers/scsi/bfa/bfa_modules.h | |||
@@ -37,6 +37,7 @@ struct bfa_modules_s { | |||
37 | struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */ | 37 | struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */ |
38 | struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */ | 38 | struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */ |
39 | struct bfa_port_s port; /* Physical port module */ | 39 | struct bfa_port_s port; /* Physical port module */ |
40 | struct bfa_ablk_s ablk; /* ASIC block config module */ | ||
40 | }; | 41 | }; |
41 | 42 | ||
42 | /* | 43 | /* |
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 0db583c50ba2..4fa3988ccb32 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -802,6 +802,7 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) | |||
802 | bfad->hal_pcidev.pci_func = PCI_FUNC(pdev->devfn); | 802 | bfad->hal_pcidev.pci_func = PCI_FUNC(pdev->devfn); |
803 | bfad->hal_pcidev.pci_bar_kva = bfad->pci_bar0_kva; | 803 | bfad->hal_pcidev.pci_bar_kva = bfad->pci_bar0_kva; |
804 | bfad->hal_pcidev.device_id = pdev->device; | 804 | bfad->hal_pcidev.device_id = pdev->device; |
805 | bfad->hal_pcidev.ssid = pdev->subsystem_device; | ||
805 | bfad->pci_name = pci_name(pdev); | 806 | bfad->pci_name = pci_name(pdev); |
806 | 807 | ||
807 | bfad->pci_attr.vendor_id = pdev->vendor; | 808 | bfad->pci_attr.vendor_id = pdev->vendor; |
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index d479f1444204..35c415c81dad 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c | |||
@@ -273,6 +273,170 @@ bfad_iocmd_itnim_get_attr(struct bfad_s *bfad, void *cmd) | |||
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | 275 | ||
276 | int | ||
277 | bfad_iocmd_ioc_get_pcifn_cfg(struct bfad_s *bfad, void *cmd) | ||
278 | { | ||
279 | struct bfa_bsg_pcifn_cfg_s *iocmd = (struct bfa_bsg_pcifn_cfg_s *)cmd; | ||
280 | struct bfad_hal_comp fcomp; | ||
281 | unsigned long flags; | ||
282 | |||
283 | init_completion(&fcomp.comp); | ||
284 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
285 | iocmd->status = bfa_ablk_query(&bfad->bfa.modules.ablk, | ||
286 | &iocmd->pcifn_cfg, | ||
287 | bfad_hcb_comp, &fcomp); | ||
288 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
289 | if (iocmd->status != BFA_STATUS_OK) | ||
290 | goto out; | ||
291 | |||
292 | wait_for_completion(&fcomp.comp); | ||
293 | iocmd->status = fcomp.status; | ||
294 | out: | ||
295 | return 0; | ||
296 | } | ||
297 | |||
298 | int | ||
299 | bfad_iocmd_pcifn_create(struct bfad_s *bfad, void *cmd) | ||
300 | { | ||
301 | struct bfa_bsg_pcifn_s *iocmd = (struct bfa_bsg_pcifn_s *)cmd; | ||
302 | struct bfad_hal_comp fcomp; | ||
303 | unsigned long flags; | ||
304 | |||
305 | init_completion(&fcomp.comp); | ||
306 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
307 | iocmd->status = bfa_ablk_pf_create(&bfad->bfa.modules.ablk, | ||
308 | &iocmd->pcifn_id, iocmd->port, | ||
309 | iocmd->pcifn_class, iocmd->bandwidth, | ||
310 | bfad_hcb_comp, &fcomp); | ||
311 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
312 | if (iocmd->status != BFA_STATUS_OK) | ||
313 | goto out; | ||
314 | |||
315 | wait_for_completion(&fcomp.comp); | ||
316 | iocmd->status = fcomp.status; | ||
317 | out: | ||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | int | ||
322 | bfad_iocmd_pcifn_delete(struct bfad_s *bfad, void *cmd) | ||
323 | { | ||
324 | struct bfa_bsg_pcifn_s *iocmd = (struct bfa_bsg_pcifn_s *)cmd; | ||
325 | struct bfad_hal_comp fcomp; | ||
326 | unsigned long flags; | ||
327 | |||
328 | init_completion(&fcomp.comp); | ||
329 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
330 | iocmd->status = bfa_ablk_pf_delete(&bfad->bfa.modules.ablk, | ||
331 | iocmd->pcifn_id, | ||
332 | bfad_hcb_comp, &fcomp); | ||
333 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
334 | if (iocmd->status != BFA_STATUS_OK) | ||
335 | goto out; | ||
336 | |||
337 | wait_for_completion(&fcomp.comp); | ||
338 | iocmd->status = fcomp.status; | ||
339 | out: | ||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | int | ||
344 | bfad_iocmd_pcifn_bw(struct bfad_s *bfad, void *cmd) | ||
345 | { | ||
346 | struct bfa_bsg_pcifn_s *iocmd = (struct bfa_bsg_pcifn_s *)cmd; | ||
347 | struct bfad_hal_comp fcomp; | ||
348 | unsigned long flags; | ||
349 | |||
350 | init_completion(&fcomp.comp); | ||
351 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
352 | iocmd->status = bfa_ablk_pf_update(&bfad->bfa.modules.ablk, | ||
353 | iocmd->pcifn_id, iocmd->bandwidth, | ||
354 | bfad_hcb_comp, &fcomp); | ||
355 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
356 | bfa_trc(bfad, iocmd->status); | ||
357 | if (iocmd->status != BFA_STATUS_OK) | ||
358 | goto out; | ||
359 | |||
360 | wait_for_completion(&fcomp.comp); | ||
361 | iocmd->status = fcomp.status; | ||
362 | bfa_trc(bfad, iocmd->status); | ||
363 | out: | ||
364 | return 0; | ||
365 | } | ||
366 | |||
367 | int | ||
368 | bfad_iocmd_adapter_cfg_mode(struct bfad_s *bfad, void *cmd) | ||
369 | { | ||
370 | struct bfa_bsg_adapter_cfg_mode_s *iocmd = | ||
371 | (struct bfa_bsg_adapter_cfg_mode_s *)cmd; | ||
372 | struct bfad_hal_comp fcomp; | ||
373 | unsigned long flags = 0; | ||
374 | |||
375 | init_completion(&fcomp.comp); | ||
376 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
377 | iocmd->status = bfa_ablk_adapter_config(&bfad->bfa.modules.ablk, | ||
378 | iocmd->cfg.mode, iocmd->cfg.max_pf, | ||
379 | iocmd->cfg.max_vf, bfad_hcb_comp, &fcomp); | ||
380 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
381 | if (iocmd->status != BFA_STATUS_OK) | ||
382 | goto out; | ||
383 | |||
384 | wait_for_completion(&fcomp.comp); | ||
385 | iocmd->status = fcomp.status; | ||
386 | out: | ||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | int | ||
391 | bfad_iocmd_port_cfg_mode(struct bfad_s *bfad, void *cmd) | ||
392 | { | ||
393 | struct bfa_bsg_port_cfg_mode_s *iocmd = | ||
394 | (struct bfa_bsg_port_cfg_mode_s *)cmd; | ||
395 | struct bfad_hal_comp fcomp; | ||
396 | unsigned long flags = 0; | ||
397 | |||
398 | init_completion(&fcomp.comp); | ||
399 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
400 | iocmd->status = bfa_ablk_port_config(&bfad->bfa.modules.ablk, | ||
401 | iocmd->instance, iocmd->cfg.mode, | ||
402 | iocmd->cfg.max_pf, iocmd->cfg.max_vf, | ||
403 | bfad_hcb_comp, &fcomp); | ||
404 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
405 | if (iocmd->status != BFA_STATUS_OK) | ||
406 | goto out; | ||
407 | |||
408 | wait_for_completion(&fcomp.comp); | ||
409 | iocmd->status = fcomp.status; | ||
410 | out: | ||
411 | return 0; | ||
412 | } | ||
413 | |||
414 | int | ||
415 | bfad_iocmd_ablk_optrom(struct bfad_s *bfad, unsigned int cmd, void *pcmd) | ||
416 | { | ||
417 | struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)pcmd; | ||
418 | struct bfad_hal_comp fcomp; | ||
419 | unsigned long flags; | ||
420 | |||
421 | init_completion(&fcomp.comp); | ||
422 | spin_lock_irqsave(&bfad->bfad_lock, flags); | ||
423 | if (cmd == IOCMD_FLASH_ENABLE_OPTROM) | ||
424 | iocmd->status = bfa_ablk_optrom_en(&bfad->bfa.modules.ablk, | ||
425 | bfad_hcb_comp, &fcomp); | ||
426 | else | ||
427 | iocmd->status = bfa_ablk_optrom_dis(&bfad->bfa.modules.ablk, | ||
428 | bfad_hcb_comp, &fcomp); | ||
429 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); | ||
430 | |||
431 | if (iocmd->status != BFA_STATUS_OK) | ||
432 | goto out; | ||
433 | |||
434 | wait_for_completion(&fcomp.comp); | ||
435 | iocmd->status = fcomp.status; | ||
436 | out: | ||
437 | return 0; | ||
438 | } | ||
439 | |||
276 | static int | 440 | static int |
277 | bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | 441 | bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, |
278 | unsigned int payload_len) | 442 | unsigned int payload_len) |
@@ -301,6 +465,28 @@ bfad_iocmd_handler(struct bfad_s *bfad, unsigned int cmd, void *iocmd, | |||
301 | case IOCMD_ITNIM_GET_ATTR: | 465 | case IOCMD_ITNIM_GET_ATTR: |
302 | rc = bfad_iocmd_itnim_get_attr(bfad, iocmd); | 466 | rc = bfad_iocmd_itnim_get_attr(bfad, iocmd); |
303 | break; | 467 | break; |
468 | case IOCMD_IOC_PCIFN_CFG: | ||
469 | rc = bfad_iocmd_ioc_get_pcifn_cfg(bfad, iocmd); | ||
470 | break; | ||
471 | case IOCMD_PCIFN_CREATE: | ||
472 | rc = bfad_iocmd_pcifn_create(bfad, iocmd); | ||
473 | break; | ||
474 | case IOCMD_PCIFN_DELETE: | ||
475 | rc = bfad_iocmd_pcifn_delete(bfad, iocmd); | ||
476 | break; | ||
477 | case IOCMD_PCIFN_BW: | ||
478 | rc = bfad_iocmd_pcifn_bw(bfad, iocmd); | ||
479 | break; | ||
480 | case IOCMD_ADAPTER_CFG_MODE: | ||
481 | rc = bfad_iocmd_adapter_cfg_mode(bfad, iocmd); | ||
482 | break; | ||
483 | case IOCMD_PORT_CFG_MODE: | ||
484 | rc = bfad_iocmd_port_cfg_mode(bfad, iocmd); | ||
485 | break; | ||
486 | case IOCMD_FLASH_ENABLE_OPTROM: | ||
487 | case IOCMD_FLASH_DISABLE_OPTROM: | ||
488 | rc = bfad_iocmd_ablk_optrom(bfad, cmd, iocmd); | ||
489 | break; | ||
304 | default: | 490 | default: |
305 | rc = EINVAL; | 491 | rc = EINVAL; |
306 | break; | 492 | break; |
diff --git a/drivers/scsi/bfa/bfad_bsg.h b/drivers/scsi/bfa/bfad_bsg.h index e0e90f031ff7..a4dcb39883e7 100644 --- a/drivers/scsi/bfa/bfad_bsg.h +++ b/drivers/scsi/bfa/bfad_bsg.h | |||
@@ -31,6 +31,20 @@ enum { | |||
31 | IOCMD_RPORT_GET_ADDR, | 31 | IOCMD_RPORT_GET_ADDR, |
32 | IOCMD_FABRIC_GET_LPORTS, | 32 | IOCMD_FABRIC_GET_LPORTS, |
33 | IOCMD_ITNIM_GET_ATTR, | 33 | IOCMD_ITNIM_GET_ATTR, |
34 | IOCMD_IOC_PCIFN_CFG, | ||
35 | IOCMD_PCIFN_CREATE, | ||
36 | IOCMD_PCIFN_DELETE, | ||
37 | IOCMD_PCIFN_BW, | ||
38 | IOCMD_ADAPTER_CFG_MODE, | ||
39 | IOCMD_PORT_CFG_MODE, | ||
40 | IOCMD_FLASH_ENABLE_OPTROM, | ||
41 | IOCMD_FLASH_DISABLE_OPTROM, | ||
42 | }; | ||
43 | |||
44 | struct bfa_bsg_gen_s { | ||
45 | bfa_status_t status; | ||
46 | u16 bfad_num; | ||
47 | u16 rsvd; | ||
34 | }; | 48 | }; |
35 | 49 | ||
36 | struct bfa_bsg_ioc_info_s { | 50 | struct bfa_bsg_ioc_info_s { |
@@ -111,6 +125,37 @@ struct bfa_bsg_itnim_attr_s { | |||
111 | struct bfa_itnim_attr_s attr; | 125 | struct bfa_itnim_attr_s attr; |
112 | }; | 126 | }; |
113 | 127 | ||
128 | struct bfa_bsg_pcifn_cfg_s { | ||
129 | bfa_status_t status; | ||
130 | u16 bfad_num; | ||
131 | u16 rsvd; | ||
132 | struct bfa_ablk_cfg_s pcifn_cfg; | ||
133 | }; | ||
134 | |||
135 | struct bfa_bsg_pcifn_s { | ||
136 | bfa_status_t status; | ||
137 | u16 bfad_num; | ||
138 | u16 pcifn_id; | ||
139 | u32 bandwidth; | ||
140 | u8 port; | ||
141 | enum bfi_pcifn_class pcifn_class; | ||
142 | u8 rsvd[1]; | ||
143 | }; | ||
144 | |||
145 | struct bfa_bsg_adapter_cfg_mode_s { | ||
146 | bfa_status_t status; | ||
147 | u16 bfad_num; | ||
148 | u16 rsvd; | ||
149 | struct bfa_adapter_cfg_mode_s cfg; | ||
150 | }; | ||
151 | |||
152 | struct bfa_bsg_port_cfg_mode_s { | ||
153 | bfa_status_t status; | ||
154 | u16 bfad_num; | ||
155 | u16 instance; | ||
156 | struct bfa_port_cfg_mode_s cfg; | ||
157 | }; | ||
158 | |||
114 | struct bfa_bsg_fcpt_s { | 159 | struct bfa_bsg_fcpt_s { |
115 | bfa_status_t status; | 160 | bfa_status_t status; |
116 | u16 vf_id; | 161 | u16 vf_id; |
diff --git a/drivers/scsi/bfa/bfi.h b/drivers/scsi/bfa/bfi.h index 35af1d11ab2f..d28c7c55a60c 100644 --- a/drivers/scsi/bfa/bfi.h +++ b/drivers/scsi/bfa/bfi.h | |||
@@ -167,7 +167,7 @@ enum bfi_mclass { | |||
167 | BFI_MC_IOC = 1, /* IO Controller (IOC) */ | 167 | BFI_MC_IOC = 1, /* IO Controller (IOC) */ |
168 | BFI_MC_FCPORT = 5, /* FC port */ | 168 | BFI_MC_FCPORT = 5, /* FC port */ |
169 | BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */ | 169 | BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */ |
170 | BFI_MC_LL = 7, /* Link Layer */ | 170 | BFI_MC_ABLK = 7, /* ASIC block configuration */ |
171 | BFI_MC_UF = 8, /* Unsolicited frame receive */ | 171 | BFI_MC_UF = 8, /* Unsolicited frame receive */ |
172 | BFI_MC_FCXP = 9, /* FC Transport */ | 172 | BFI_MC_FCXP = 9, /* FC Transport */ |
173 | BFI_MC_LPS = 10, /* lport fc login services */ | 173 | BFI_MC_LPS = 10, /* lport fc login services */ |
@@ -386,7 +386,9 @@ struct bfi_ioc_ctrl_req_s { | |||
386 | struct bfi_ioc_ctrl_reply_s { | 386 | struct bfi_ioc_ctrl_reply_s { |
387 | struct bfi_mhdr_s mh; /* Common msg header */ | 387 | struct bfi_mhdr_s mh; /* Common msg header */ |
388 | u8 status; /* enable/disable status */ | 388 | u8 status; /* enable/disable status */ |
389 | u8 rsvd[3]; | 389 | u8 port_mode; /* bfa_mode_s */ |
390 | u8 cap_bm; /* capability bit mask */ | ||
391 | u8 rsvd; | ||
390 | }; | 392 | }; |
391 | #define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s; | 393 | #define bfi_ioc_enable_reply_t struct bfi_ioc_ctrl_reply_s; |
392 | #define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s; | 394 | #define bfi_ioc_disable_reply_t struct bfi_ioc_ctrl_reply_s; |
@@ -408,7 +410,7 @@ union bfi_ioc_h2i_msg_u { | |||
408 | */ | 410 | */ |
409 | union bfi_ioc_i2h_msg_u { | 411 | union bfi_ioc_i2h_msg_u { |
410 | struct bfi_mhdr_s mh; | 412 | struct bfi_mhdr_s mh; |
411 | struct bfi_ioc_ctrl_reply_s rdy_event; | 413 | struct bfi_ioc_ctrl_reply_s fw_event; |
412 | u32 mboxmsg[BFI_IOC_MSGSZ]; | 414 | u32 mboxmsg[BFI_IOC_MSGSZ]; |
413 | }; | 415 | }; |
414 | 416 | ||
@@ -603,6 +605,80 @@ union bfi_port_i2h_msg_u { | |||
603 | struct bfi_port_generic_rsp_s clearstats_rsp; | 605 | struct bfi_port_generic_rsp_s clearstats_rsp; |
604 | }; | 606 | }; |
605 | 607 | ||
608 | /* | ||
609 | *---------------------------------------------------------------------- | ||
610 | * ABLK | ||
611 | *---------------------------------------------------------------------- | ||
612 | */ | ||
613 | enum bfi_ablk_h2i_msgs_e { | ||
614 | BFI_ABLK_H2I_QUERY = 1, | ||
615 | BFI_ABLK_H2I_ADPT_CONFIG = 2, | ||
616 | BFI_ABLK_H2I_PORT_CONFIG = 3, | ||
617 | BFI_ABLK_H2I_PF_CREATE = 4, | ||
618 | BFI_ABLK_H2I_PF_DELETE = 5, | ||
619 | BFI_ABLK_H2I_PF_UPDATE = 6, | ||
620 | BFI_ABLK_H2I_OPTROM_ENABLE = 7, | ||
621 | BFI_ABLK_H2I_OPTROM_DISABLE = 8, | ||
622 | }; | ||
623 | |||
624 | enum bfi_ablk_i2h_msgs_e { | ||
625 | BFI_ABLK_I2H_QUERY = BFA_I2HM(BFI_ABLK_H2I_QUERY), | ||
626 | BFI_ABLK_I2H_ADPT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_ADPT_CONFIG), | ||
627 | BFI_ABLK_I2H_PORT_CONFIG = BFA_I2HM(BFI_ABLK_H2I_PORT_CONFIG), | ||
628 | BFI_ABLK_I2H_PF_CREATE = BFA_I2HM(BFI_ABLK_H2I_PF_CREATE), | ||
629 | BFI_ABLK_I2H_PF_DELETE = BFA_I2HM(BFI_ABLK_H2I_PF_DELETE), | ||
630 | BFI_ABLK_I2H_PF_UPDATE = BFA_I2HM(BFI_ABLK_H2I_PF_UPDATE), | ||
631 | BFI_ABLK_I2H_OPTROM_ENABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_ENABLE), | ||
632 | BFI_ABLK_I2H_OPTROM_DISABLE = BFA_I2HM(BFI_ABLK_H2I_OPTROM_DISABLE), | ||
633 | }; | ||
634 | |||
635 | /* BFI_ABLK_H2I_QUERY */ | ||
636 | struct bfi_ablk_h2i_query_s { | ||
637 | struct bfi_mhdr_s mh; | ||
638 | union bfi_addr_u addr; | ||
639 | }; | ||
640 | |||
641 | /* BFI_ABL_H2I_ADPT_CONFIG, BFI_ABLK_H2I_PORT_CONFIG */ | ||
642 | struct bfi_ablk_h2i_cfg_req_s { | ||
643 | struct bfi_mhdr_s mh; | ||
644 | u8 mode; | ||
645 | u8 port; | ||
646 | u8 max_pf; | ||
647 | u8 max_vf; | ||
648 | }; | ||
649 | |||
650 | /* | ||
651 | * BFI_ABLK_H2I_PF_CREATE, BFI_ABLK_H2I_PF_DELETE, | ||
652 | */ | ||
653 | struct bfi_ablk_h2i_pf_req_s { | ||
654 | struct bfi_mhdr_s mh; | ||
655 | u8 pcifn; | ||
656 | u8 port; | ||
657 | u16 pers; | ||
658 | u32 bw; | ||
659 | }; | ||
660 | |||
661 | /* BFI_ABLK_H2I_OPTROM_ENABLE, BFI_ABLK_H2I_OPTROM_DISABLE */ | ||
662 | struct bfi_ablk_h2i_optrom_s { | ||
663 | struct bfi_mhdr_s mh; | ||
664 | }; | ||
665 | |||
666 | /* | ||
667 | * BFI_ABLK_I2H_QUERY | ||
668 | * BFI_ABLK_I2H_PORT_CONFIG | ||
669 | * BFI_ABLK_I2H_PF_CREATE | ||
670 | * BFI_ABLK_I2H_PF_DELETE | ||
671 | * BFI_ABLK_I2H_PF_UPDATE | ||
672 | * BFI_ABLK_I2H_OPTROM_ENABLE | ||
673 | * BFI_ABLK_I2H_OPTROM_DISABLE | ||
674 | */ | ||
675 | struct bfi_ablk_i2h_rsp_s { | ||
676 | struct bfi_mhdr_s mh; | ||
677 | u8 status; | ||
678 | u8 pcifn; | ||
679 | u8 port_mode; | ||
680 | }; | ||
681 | |||
606 | #pragma pack() | 682 | #pragma pack() |
607 | 683 | ||
608 | #endif /* __BFI_H__ */ | 684 | #endif /* __BFI_H__ */ |