bfa_core.c 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #include "bfad_drv.h"
  18. #include "bfa_modules.h"
  19. #include "bfi_reg.h"
  20. BFA_TRC_FILE(HAL, CORE);
  21. /*
  22. * BFA module list terminated by NULL
  23. */
  24. static struct bfa_module_s *hal_mods[] = {
  25. &hal_mod_sgpg,
  26. &hal_mod_fcport,
  27. &hal_mod_fcxp,
  28. &hal_mod_lps,
  29. &hal_mod_uf,
  30. &hal_mod_rport,
  31. &hal_mod_fcp,
  32. NULL
  33. };
  34. /*
  35. * Message handlers for various modules.
  36. */
  37. static bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = {
  38. bfa_isr_unhandled, /* NONE */
  39. bfa_isr_unhandled, /* BFI_MC_IOC */
  40. bfa_isr_unhandled, /* BFI_MC_DIAG */
  41. bfa_isr_unhandled, /* BFI_MC_FLASH */
  42. bfa_isr_unhandled, /* BFI_MC_CEE */
  43. bfa_fcport_isr, /* BFI_MC_FCPORT */
  44. bfa_isr_unhandled, /* BFI_MC_IOCFC */
  45. bfa_isr_unhandled, /* BFI_MC_LL */
  46. bfa_uf_isr, /* BFI_MC_UF */
  47. bfa_fcxp_isr, /* BFI_MC_FCXP */
  48. bfa_lps_isr, /* BFI_MC_LPS */
  49. bfa_rport_isr, /* BFI_MC_RPORT */
  50. bfa_itn_isr, /* BFI_MC_ITN */
  51. bfa_isr_unhandled, /* BFI_MC_IOIM_READ */
  52. bfa_isr_unhandled, /* BFI_MC_IOIM_WRITE */
  53. bfa_isr_unhandled, /* BFI_MC_IOIM_IO */
  54. bfa_ioim_isr, /* BFI_MC_IOIM */
  55. bfa_ioim_good_comp_isr, /* BFI_MC_IOIM_IOCOM */
  56. bfa_tskim_isr, /* BFI_MC_TSKIM */
  57. bfa_isr_unhandled, /* BFI_MC_SBOOT */
  58. bfa_isr_unhandled, /* BFI_MC_IPFC */
  59. bfa_isr_unhandled, /* BFI_MC_PORT */
  60. bfa_isr_unhandled, /* --------- */
  61. bfa_isr_unhandled, /* --------- */
  62. bfa_isr_unhandled, /* --------- */
  63. bfa_isr_unhandled, /* --------- */
  64. bfa_isr_unhandled, /* --------- */
  65. bfa_isr_unhandled, /* --------- */
  66. bfa_isr_unhandled, /* --------- */
  67. bfa_isr_unhandled, /* --------- */
  68. bfa_isr_unhandled, /* --------- */
  69. bfa_isr_unhandled, /* --------- */
  70. };
  71. /*
  72. * Message handlers for mailbox command classes
  73. */
  74. static bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = {
  75. NULL,
  76. NULL, /* BFI_MC_IOC */
  77. NULL, /* BFI_MC_DIAG */
  78. NULL, /* BFI_MC_FLASH */
  79. NULL, /* BFI_MC_CEE */
  80. NULL, /* BFI_MC_PORT */
  81. bfa_iocfc_isr, /* BFI_MC_IOCFC */
  82. NULL,
  83. };
  84. static void
  85. bfa_com_port_attach(struct bfa_s *bfa)
  86. {
  87. struct bfa_port_s *port = &bfa->modules.port;
  88. struct bfa_mem_dma_s *port_dma = BFA_MEM_PORT_DMA(bfa);
  89. bfa_port_attach(port, &bfa->ioc, bfa, bfa->trcmod);
  90. bfa_port_mem_claim(port, port_dma->kva_curp, port_dma->dma_curp);
  91. }
  92. /*
  93. * ablk module attach
  94. */
  95. static void
  96. bfa_com_ablk_attach(struct bfa_s *bfa)
  97. {
  98. struct bfa_ablk_s *ablk = &bfa->modules.ablk;
  99. struct bfa_mem_dma_s *ablk_dma = BFA_MEM_ABLK_DMA(bfa);
  100. bfa_ablk_attach(ablk, &bfa->ioc);
  101. bfa_ablk_memclaim(ablk, ablk_dma->kva_curp, ablk_dma->dma_curp);
  102. }
  103. /*
  104. * BFA IOC FC related definitions
  105. */
  106. /*
  107. * IOC local definitions
  108. */
  109. #define BFA_IOCFC_TOV 5000 /* msecs */
  110. enum {
  111. BFA_IOCFC_ACT_NONE = 0,
  112. BFA_IOCFC_ACT_INIT = 1,
  113. BFA_IOCFC_ACT_STOP = 2,
  114. BFA_IOCFC_ACT_DISABLE = 3,
  115. BFA_IOCFC_ACT_ENABLE = 4,
  116. };
  117. #define DEF_CFG_NUM_FABRICS 1
  118. #define DEF_CFG_NUM_LPORTS 256
  119. #define DEF_CFG_NUM_CQS 4
  120. #define DEF_CFG_NUM_IOIM_REQS (BFA_IOIM_MAX)
  121. #define DEF_CFG_NUM_TSKIM_REQS 128
  122. #define DEF_CFG_NUM_FCXP_REQS 64
  123. #define DEF_CFG_NUM_UF_BUFS 64
  124. #define DEF_CFG_NUM_RPORTS 1024
  125. #define DEF_CFG_NUM_ITNIMS (DEF_CFG_NUM_RPORTS)
  126. #define DEF_CFG_NUM_TINS 256
  127. #define DEF_CFG_NUM_SGPGS 2048
  128. #define DEF_CFG_NUM_REQQ_ELEMS 256
  129. #define DEF_CFG_NUM_RSPQ_ELEMS 64
  130. #define DEF_CFG_NUM_SBOOT_TGTS 16
  131. #define DEF_CFG_NUM_SBOOT_LUNS 16
  132. /*
  133. * forward declaration for IOC FC functions
  134. */
  135. static void bfa_iocfc_enable_cbfn(void *bfa_arg, enum bfa_status status);
  136. static void bfa_iocfc_disable_cbfn(void *bfa_arg);
  137. static void bfa_iocfc_hbfail_cbfn(void *bfa_arg);
  138. static void bfa_iocfc_reset_cbfn(void *bfa_arg);
  139. static struct bfa_ioc_cbfn_s bfa_iocfc_cbfn;
  140. /*
  141. * BFA Interrupt handling functions
  142. */
  143. static void
  144. bfa_reqq_resume(struct bfa_s *bfa, int qid)
  145. {
  146. struct list_head *waitq, *qe, *qen;
  147. struct bfa_reqq_wait_s *wqe;
  148. waitq = bfa_reqq(bfa, qid);
  149. list_for_each_safe(qe, qen, waitq) {
  150. /*
  151. * Callback only as long as there is room in request queue
  152. */
  153. if (bfa_reqq_full(bfa, qid))
  154. break;
  155. list_del(qe);
  156. wqe = (struct bfa_reqq_wait_s *) qe;
  157. wqe->qresume(wqe->cbarg);
  158. }
  159. }
  160. static inline void
  161. bfa_isr_rspq(struct bfa_s *bfa, int qid)
  162. {
  163. struct bfi_msg_s *m;
  164. u32 pi, ci;
  165. struct list_head *waitq;
  166. bfa_isr_rspq_ack(bfa, qid);
  167. ci = bfa_rspq_ci(bfa, qid);
  168. pi = bfa_rspq_pi(bfa, qid);
  169. while (ci != pi) {
  170. m = bfa_rspq_elem(bfa, qid, ci);
  171. WARN_ON(m->mhdr.msg_class >= BFI_MC_MAX);
  172. bfa_isrs[m->mhdr.msg_class] (bfa, m);
  173. CQ_INCR(ci, bfa->iocfc.cfg.drvcfg.num_rspq_elems);
  174. }
  175. /*
  176. * update CI
  177. */
  178. bfa_rspq_ci(bfa, qid) = pi;
  179. writel(pi, bfa->iocfc.bfa_regs.rme_q_ci[qid]);
  180. mmiowb();
  181. /*
  182. * Resume any pending requests in the corresponding reqq.
  183. */
  184. waitq = bfa_reqq(bfa, qid);
  185. if (!list_empty(waitq))
  186. bfa_reqq_resume(bfa, qid);
  187. }
  188. static inline void
  189. bfa_isr_reqq(struct bfa_s *bfa, int qid)
  190. {
  191. struct list_head *waitq;
  192. bfa_isr_reqq_ack(bfa, qid);
  193. /*
  194. * Resume any pending requests in the corresponding reqq.
  195. */
  196. waitq = bfa_reqq(bfa, qid);
  197. if (!list_empty(waitq))
  198. bfa_reqq_resume(bfa, qid);
  199. }
  200. void
  201. bfa_msix_all(struct bfa_s *bfa, int vec)
  202. {
  203. u32 intr, qintr;
  204. int queue;
  205. intr = readl(bfa->iocfc.bfa_regs.intr_status);
  206. if (!intr)
  207. return;
  208. /*
  209. * RME completion queue interrupt
  210. */
  211. qintr = intr & __HFN_INT_RME_MASK;
  212. if (qintr && bfa->queue_process) {
  213. for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
  214. bfa_isr_rspq(bfa, queue);
  215. }
  216. intr &= ~qintr;
  217. if (!intr)
  218. return;
  219. /*
  220. * CPE completion queue interrupt
  221. */
  222. qintr = intr & __HFN_INT_CPE_MASK;
  223. if (qintr && bfa->queue_process) {
  224. for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
  225. bfa_isr_reqq(bfa, queue);
  226. }
  227. intr &= ~qintr;
  228. if (!intr)
  229. return;
  230. bfa_msix_lpu_err(bfa, intr);
  231. }
  232. bfa_boolean_t
  233. bfa_intx(struct bfa_s *bfa)
  234. {
  235. u32 intr, qintr;
  236. int queue;
  237. intr = readl(bfa->iocfc.bfa_regs.intr_status);
  238. if (!intr)
  239. return BFA_FALSE;
  240. qintr = intr & (__HFN_INT_RME_MASK | __HFN_INT_CPE_MASK);
  241. if (qintr)
  242. writel(qintr, bfa->iocfc.bfa_regs.intr_status);
  243. /*
  244. * RME completion queue interrupt
  245. */
  246. qintr = intr & __HFN_INT_RME_MASK;
  247. if (qintr && bfa->queue_process) {
  248. for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
  249. bfa_isr_rspq(bfa, queue);
  250. }
  251. intr &= ~qintr;
  252. if (!intr)
  253. return BFA_TRUE;
  254. /*
  255. * CPE completion queue interrupt
  256. */
  257. qintr = intr & __HFN_INT_CPE_MASK;
  258. if (qintr && bfa->queue_process) {
  259. for (queue = 0; queue < BFI_IOC_MAX_CQS; queue++)
  260. bfa_isr_reqq(bfa, queue);
  261. }
  262. intr &= ~qintr;
  263. if (!intr)
  264. return BFA_TRUE;
  265. bfa_msix_lpu_err(bfa, intr);
  266. return BFA_TRUE;
  267. }
  268. void
  269. bfa_isr_enable(struct bfa_s *bfa)
  270. {
  271. u32 umsk;
  272. int pci_func = bfa_ioc_pcifn(&bfa->ioc);
  273. bfa_trc(bfa, pci_func);
  274. bfa_msix_ctrl_install(bfa);
  275. if (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id)) {
  276. umsk = __HFN_INT_ERR_MASK_CT2;
  277. umsk |= pci_func == 0 ?
  278. __HFN_INT_FN0_MASK_CT2 : __HFN_INT_FN1_MASK_CT2;
  279. } else {
  280. umsk = __HFN_INT_ERR_MASK;
  281. umsk |= pci_func == 0 ? __HFN_INT_FN0_MASK : __HFN_INT_FN1_MASK;
  282. }
  283. writel(umsk, bfa->iocfc.bfa_regs.intr_status);
  284. writel(~umsk, bfa->iocfc.bfa_regs.intr_mask);
  285. bfa->iocfc.intr_mask = ~umsk;
  286. bfa_isr_mode_set(bfa, bfa->msix.nvecs != 0);
  287. }
  288. void
  289. bfa_isr_disable(struct bfa_s *bfa)
  290. {
  291. bfa_isr_mode_set(bfa, BFA_FALSE);
  292. writel(-1L, bfa->iocfc.bfa_regs.intr_mask);
  293. bfa_msix_uninstall(bfa);
  294. }
  295. void
  296. bfa_msix_reqq(struct bfa_s *bfa, int vec)
  297. {
  298. bfa_isr_reqq(bfa, vec - bfa->iocfc.hwif.cpe_vec_q0);
  299. }
  300. void
  301. bfa_isr_unhandled(struct bfa_s *bfa, struct bfi_msg_s *m)
  302. {
  303. bfa_trc(bfa, m->mhdr.msg_class);
  304. bfa_trc(bfa, m->mhdr.msg_id);
  305. bfa_trc(bfa, m->mhdr.mtag.i2htok);
  306. WARN_ON(1);
  307. bfa_trc_stop(bfa->trcmod);
  308. }
  309. void
  310. bfa_msix_rspq(struct bfa_s *bfa, int vec)
  311. {
  312. bfa_isr_rspq(bfa, vec - bfa->iocfc.hwif.rme_vec_q0);
  313. }
  314. void
  315. bfa_msix_lpu_err(struct bfa_s *bfa, int vec)
  316. {
  317. u32 intr, curr_value;
  318. bfa_boolean_t lpu_isr, halt_isr, pss_isr;
  319. intr = readl(bfa->iocfc.bfa_regs.intr_status);
  320. if (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id)) {
  321. halt_isr = intr & __HFN_INT_CPQ_HALT_CT2;
  322. pss_isr = intr & __HFN_INT_ERR_PSS_CT2;
  323. lpu_isr = intr & (__HFN_INT_MBOX_LPU0_CT2 |
  324. __HFN_INT_MBOX_LPU1_CT2);
  325. intr &= __HFN_INT_ERR_MASK_CT2;
  326. } else {
  327. halt_isr = intr & __HFN_INT_LL_HALT;
  328. pss_isr = intr & __HFN_INT_ERR_PSS;
  329. lpu_isr = intr & (__HFN_INT_MBOX_LPU0 | __HFN_INT_MBOX_LPU1);
  330. intr &= __HFN_INT_ERR_MASK;
  331. }
  332. if (lpu_isr)
  333. bfa_ioc_mbox_isr(&bfa->ioc);
  334. if (intr) {
  335. if (halt_isr) {
  336. /*
  337. * If LL_HALT bit is set then FW Init Halt LL Port
  338. * Register needs to be cleared as well so Interrupt
  339. * Status Register will be cleared.
  340. */
  341. curr_value = readl(bfa->ioc.ioc_regs.ll_halt);
  342. curr_value &= ~__FW_INIT_HALT_P;
  343. writel(curr_value, bfa->ioc.ioc_regs.ll_halt);
  344. }
  345. if (pss_isr) {
  346. /*
  347. * ERR_PSS bit needs to be cleared as well in case
  348. * interrups are shared so driver's interrupt handler is
  349. * still called even though it is already masked out.
  350. */
  351. curr_value = readl(
  352. bfa->ioc.ioc_regs.pss_err_status_reg);
  353. writel(curr_value,
  354. bfa->ioc.ioc_regs.pss_err_status_reg);
  355. }
  356. writel(intr, bfa->iocfc.bfa_regs.intr_status);
  357. bfa_ioc_error_isr(&bfa->ioc);
  358. }
  359. }
  360. /*
  361. * BFA IOC FC related functions
  362. */
  363. /*
  364. * BFA IOC private functions
  365. */
  366. /*
  367. * Use the Mailbox interface to send BFI_IOCFC_H2I_CFG_REQ
  368. */
  369. static void
  370. bfa_iocfc_send_cfg(void *bfa_arg)
  371. {
  372. struct bfa_s *bfa = bfa_arg;
  373. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  374. struct bfi_iocfc_cfg_req_s cfg_req;
  375. struct bfi_iocfc_cfg_s *cfg_info = iocfc->cfginfo;
  376. struct bfa_iocfc_cfg_s *cfg = &iocfc->cfg;
  377. int i;
  378. WARN_ON(cfg->fwcfg.num_cqs > BFI_IOC_MAX_CQS);
  379. bfa_trc(bfa, cfg->fwcfg.num_cqs);
  380. bfa_iocfc_reset_queues(bfa);
  381. /*
  382. * initialize IOC configuration info
  383. */
  384. cfg_info->single_msix_vec = 0;
  385. if (bfa->msix.nvecs == 1)
  386. cfg_info->single_msix_vec = 1;
  387. cfg_info->endian_sig = BFI_IOC_ENDIAN_SIG;
  388. cfg_info->num_cqs = cfg->fwcfg.num_cqs;
  389. cfg_info->num_ioim_reqs = cpu_to_be16(cfg->fwcfg.num_ioim_reqs);
  390. cfg_info->num_fwtio_reqs = cpu_to_be16(cfg->fwcfg.num_fwtio_reqs);
  391. bfa_dma_be_addr_set(cfg_info->cfgrsp_addr, iocfc->cfgrsp_dma.pa);
  392. /*
  393. * dma map REQ and RSP circular queues and shadow pointers
  394. */
  395. for (i = 0; i < cfg->fwcfg.num_cqs; i++) {
  396. bfa_dma_be_addr_set(cfg_info->req_cq_ba[i],
  397. iocfc->req_cq_ba[i].pa);
  398. bfa_dma_be_addr_set(cfg_info->req_shadow_ci[i],
  399. iocfc->req_cq_shadow_ci[i].pa);
  400. cfg_info->req_cq_elems[i] =
  401. cpu_to_be16(cfg->drvcfg.num_reqq_elems);
  402. bfa_dma_be_addr_set(cfg_info->rsp_cq_ba[i],
  403. iocfc->rsp_cq_ba[i].pa);
  404. bfa_dma_be_addr_set(cfg_info->rsp_shadow_pi[i],
  405. iocfc->rsp_cq_shadow_pi[i].pa);
  406. cfg_info->rsp_cq_elems[i] =
  407. cpu_to_be16(cfg->drvcfg.num_rspq_elems);
  408. }
  409. /*
  410. * Enable interrupt coalescing if it is driver init path
  411. * and not ioc disable/enable path.
  412. */
  413. if (!iocfc->cfgdone)
  414. cfg_info->intr_attr.coalesce = BFA_TRUE;
  415. iocfc->cfgdone = BFA_FALSE;
  416. /*
  417. * dma map IOC configuration itself
  418. */
  419. bfi_h2i_set(cfg_req.mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_CFG_REQ,
  420. bfa_fn_lpu(bfa));
  421. bfa_dma_be_addr_set(cfg_req.ioc_cfg_dma_addr, iocfc->cfg_info.pa);
  422. bfa_ioc_mbox_send(&bfa->ioc, &cfg_req,
  423. sizeof(struct bfi_iocfc_cfg_req_s));
  424. }
  425. static void
  426. bfa_iocfc_init_mem(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
  427. struct bfa_pcidev_s *pcidev)
  428. {
  429. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  430. bfa->bfad = bfad;
  431. iocfc->bfa = bfa;
  432. iocfc->action = BFA_IOCFC_ACT_NONE;
  433. iocfc->cfg = *cfg;
  434. /*
  435. * Initialize chip specific handlers.
  436. */
  437. if (bfa_asic_id_ctc(bfa_ioc_devid(&bfa->ioc))) {
  438. iocfc->hwif.hw_reginit = bfa_hwct_reginit;
  439. iocfc->hwif.hw_reqq_ack = bfa_hwct_reqq_ack;
  440. iocfc->hwif.hw_rspq_ack = bfa_hwct_rspq_ack;
  441. iocfc->hwif.hw_msix_init = bfa_hwct_msix_init;
  442. iocfc->hwif.hw_msix_ctrl_install = bfa_hwct_msix_ctrl_install;
  443. iocfc->hwif.hw_msix_queue_install = bfa_hwct_msix_queue_install;
  444. iocfc->hwif.hw_msix_uninstall = bfa_hwct_msix_uninstall;
  445. iocfc->hwif.hw_isr_mode_set = bfa_hwct_isr_mode_set;
  446. iocfc->hwif.hw_msix_getvecs = bfa_hwct_msix_getvecs;
  447. iocfc->hwif.hw_msix_get_rme_range = bfa_hwct_msix_get_rme_range;
  448. iocfc->hwif.rme_vec_q0 = BFI_MSIX_RME_QMIN_CT;
  449. iocfc->hwif.cpe_vec_q0 = BFI_MSIX_CPE_QMIN_CT;
  450. } else {
  451. iocfc->hwif.hw_reginit = bfa_hwcb_reginit;
  452. iocfc->hwif.hw_reqq_ack = NULL;
  453. iocfc->hwif.hw_rspq_ack = NULL;
  454. iocfc->hwif.hw_msix_init = bfa_hwcb_msix_init;
  455. iocfc->hwif.hw_msix_ctrl_install = bfa_hwcb_msix_ctrl_install;
  456. iocfc->hwif.hw_msix_queue_install = bfa_hwcb_msix_queue_install;
  457. iocfc->hwif.hw_msix_uninstall = bfa_hwcb_msix_uninstall;
  458. iocfc->hwif.hw_isr_mode_set = bfa_hwcb_isr_mode_set;
  459. iocfc->hwif.hw_msix_getvecs = bfa_hwcb_msix_getvecs;
  460. iocfc->hwif.hw_msix_get_rme_range = bfa_hwcb_msix_get_rme_range;
  461. iocfc->hwif.rme_vec_q0 = BFI_MSIX_RME_QMIN_CB +
  462. bfa_ioc_pcifn(&bfa->ioc) * BFI_IOC_MAX_CQS;
  463. iocfc->hwif.cpe_vec_q0 = BFI_MSIX_CPE_QMIN_CB +
  464. bfa_ioc_pcifn(&bfa->ioc) * BFI_IOC_MAX_CQS;
  465. }
  466. if (bfa_asic_id_ct2(bfa_ioc_devid(&bfa->ioc))) {
  467. iocfc->hwif.hw_reginit = bfa_hwct2_reginit;
  468. iocfc->hwif.hw_isr_mode_set = NULL;
  469. iocfc->hwif.hw_rspq_ack = NULL;
  470. }
  471. iocfc->hwif.hw_reginit(bfa);
  472. bfa->msix.nvecs = 0;
  473. }
  474. static void
  475. bfa_iocfc_mem_claim(struct bfa_s *bfa, struct bfa_iocfc_cfg_s *cfg)
  476. {
  477. u8 *dm_kva = NULL;
  478. u64 dm_pa = 0;
  479. int i, per_reqq_sz, per_rspq_sz, dbgsz;
  480. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  481. struct bfa_mem_dma_s *ioc_dma = BFA_MEM_IOC_DMA(bfa);
  482. struct bfa_mem_dma_s *iocfc_dma = BFA_MEM_IOCFC_DMA(bfa);
  483. struct bfa_mem_dma_s *reqq_dma, *rspq_dma;
  484. /* First allocate dma memory for IOC */
  485. bfa_ioc_mem_claim(&bfa->ioc, bfa_mem_dma_virt(ioc_dma),
  486. bfa_mem_dma_phys(ioc_dma));
  487. /* Claim DMA-able memory for the request/response queues */
  488. per_reqq_sz = BFA_ROUNDUP((cfg->drvcfg.num_reqq_elems * BFI_LMSG_SZ),
  489. BFA_DMA_ALIGN_SZ);
  490. per_rspq_sz = BFA_ROUNDUP((cfg->drvcfg.num_rspq_elems * BFI_LMSG_SZ),
  491. BFA_DMA_ALIGN_SZ);
  492. for (i = 0; i < cfg->fwcfg.num_cqs; i++) {
  493. reqq_dma = BFA_MEM_REQQ_DMA(bfa, i);
  494. iocfc->req_cq_ba[i].kva = bfa_mem_dma_virt(reqq_dma);
  495. iocfc->req_cq_ba[i].pa = bfa_mem_dma_phys(reqq_dma);
  496. memset(iocfc->req_cq_ba[i].kva, 0, per_reqq_sz);
  497. rspq_dma = BFA_MEM_RSPQ_DMA(bfa, i);
  498. iocfc->rsp_cq_ba[i].kva = bfa_mem_dma_virt(rspq_dma);
  499. iocfc->rsp_cq_ba[i].pa = bfa_mem_dma_phys(rspq_dma);
  500. memset(iocfc->rsp_cq_ba[i].kva, 0, per_rspq_sz);
  501. }
  502. /* Claim IOCFC dma memory - for shadow CI/PI */
  503. dm_kva = bfa_mem_dma_virt(iocfc_dma);
  504. dm_pa = bfa_mem_dma_phys(iocfc_dma);
  505. for (i = 0; i < cfg->fwcfg.num_cqs; i++) {
  506. iocfc->req_cq_shadow_ci[i].kva = dm_kva;
  507. iocfc->req_cq_shadow_ci[i].pa = dm_pa;
  508. dm_kva += BFA_CACHELINE_SZ;
  509. dm_pa += BFA_CACHELINE_SZ;
  510. iocfc->rsp_cq_shadow_pi[i].kva = dm_kva;
  511. iocfc->rsp_cq_shadow_pi[i].pa = dm_pa;
  512. dm_kva += BFA_CACHELINE_SZ;
  513. dm_pa += BFA_CACHELINE_SZ;
  514. }
  515. /* Claim IOCFC dma memory - for the config info page */
  516. bfa->iocfc.cfg_info.kva = dm_kva;
  517. bfa->iocfc.cfg_info.pa = dm_pa;
  518. bfa->iocfc.cfginfo = (struct bfi_iocfc_cfg_s *) dm_kva;
  519. dm_kva += BFA_ROUNDUP(sizeof(struct bfi_iocfc_cfg_s), BFA_CACHELINE_SZ);
  520. dm_pa += BFA_ROUNDUP(sizeof(struct bfi_iocfc_cfg_s), BFA_CACHELINE_SZ);
  521. /* Claim IOCFC dma memory - for the config response */
  522. bfa->iocfc.cfgrsp_dma.kva = dm_kva;
  523. bfa->iocfc.cfgrsp_dma.pa = dm_pa;
  524. bfa->iocfc.cfgrsp = (struct bfi_iocfc_cfgrsp_s *) dm_kva;
  525. dm_kva += BFA_ROUNDUP(sizeof(struct bfi_iocfc_cfgrsp_s),
  526. BFA_CACHELINE_SZ);
  527. dm_pa += BFA_ROUNDUP(sizeof(struct bfi_iocfc_cfgrsp_s),
  528. BFA_CACHELINE_SZ);
  529. /* Claim IOCFC kva memory */
  530. dbgsz = (bfa_auto_recover) ? BFA_DBG_FWTRC_LEN : 0;
  531. if (dbgsz > 0) {
  532. bfa_ioc_debug_memclaim(&bfa->ioc, bfa_mem_kva_curp(iocfc));
  533. bfa_mem_kva_curp(iocfc) += dbgsz;
  534. }
  535. }
  536. /*
  537. * Start BFA submodules.
  538. */
  539. static void
  540. bfa_iocfc_start_submod(struct bfa_s *bfa)
  541. {
  542. int i;
  543. bfa->queue_process = BFA_TRUE;
  544. for (i = 0; i < BFI_IOC_MAX_CQS; i++)
  545. bfa_isr_rspq_ack(bfa, i);
  546. for (i = 0; hal_mods[i]; i++)
  547. hal_mods[i]->start(bfa);
  548. }
  549. /*
  550. * Disable BFA submodules.
  551. */
  552. static void
  553. bfa_iocfc_disable_submod(struct bfa_s *bfa)
  554. {
  555. int i;
  556. for (i = 0; hal_mods[i]; i++)
  557. hal_mods[i]->iocdisable(bfa);
  558. }
  559. static void
  560. bfa_iocfc_init_cb(void *bfa_arg, bfa_boolean_t complete)
  561. {
  562. struct bfa_s *bfa = bfa_arg;
  563. if (complete) {
  564. if (bfa->iocfc.cfgdone)
  565. bfa_cb_init(bfa->bfad, BFA_STATUS_OK);
  566. else
  567. bfa_cb_init(bfa->bfad, BFA_STATUS_FAILED);
  568. } else {
  569. if (bfa->iocfc.cfgdone)
  570. bfa->iocfc.action = BFA_IOCFC_ACT_NONE;
  571. }
  572. }
  573. static void
  574. bfa_iocfc_stop_cb(void *bfa_arg, bfa_boolean_t compl)
  575. {
  576. struct bfa_s *bfa = bfa_arg;
  577. struct bfad_s *bfad = bfa->bfad;
  578. if (compl)
  579. complete(&bfad->comp);
  580. else
  581. bfa->iocfc.action = BFA_IOCFC_ACT_NONE;
  582. }
  583. static void
  584. bfa_iocfc_enable_cb(void *bfa_arg, bfa_boolean_t compl)
  585. {
  586. struct bfa_s *bfa = bfa_arg;
  587. struct bfad_s *bfad = bfa->bfad;
  588. if (compl)
  589. complete(&bfad->enable_comp);
  590. }
  591. static void
  592. bfa_iocfc_disable_cb(void *bfa_arg, bfa_boolean_t compl)
  593. {
  594. struct bfa_s *bfa = bfa_arg;
  595. struct bfad_s *bfad = bfa->bfad;
  596. if (compl)
  597. complete(&bfad->disable_comp);
  598. }
  599. /**
  600. * configure queue registers from firmware response
  601. */
  602. static void
  603. bfa_iocfc_qreg(struct bfa_s *bfa, struct bfi_iocfc_qreg_s *qreg)
  604. {
  605. int i;
  606. struct bfa_iocfc_regs_s *r = &bfa->iocfc.bfa_regs;
  607. void __iomem *kva = bfa_ioc_bar0(&bfa->ioc);
  608. for (i = 0; i < BFI_IOC_MAX_CQS; i++) {
  609. bfa->iocfc.hw_qid[i] = qreg->hw_qid[i];
  610. r->cpe_q_ci[i] = kva + be32_to_cpu(qreg->cpe_q_ci_off[i]);
  611. r->cpe_q_pi[i] = kva + be32_to_cpu(qreg->cpe_q_pi_off[i]);
  612. r->cpe_q_ctrl[i] = kva + be32_to_cpu(qreg->cpe_qctl_off[i]);
  613. r->rme_q_ci[i] = kva + be32_to_cpu(qreg->rme_q_ci_off[i]);
  614. r->rme_q_pi[i] = kva + be32_to_cpu(qreg->rme_q_pi_off[i]);
  615. r->rme_q_ctrl[i] = kva + be32_to_cpu(qreg->rme_qctl_off[i]);
  616. }
  617. }
  618. static void
  619. bfa_iocfc_res_recfg(struct bfa_s *bfa, struct bfa_iocfc_fwcfg_s *fwcfg)
  620. {
  621. bfa_fcxp_res_recfg(bfa, fwcfg->num_fcxp_reqs);
  622. bfa_uf_res_recfg(bfa, fwcfg->num_uf_bufs);
  623. bfa_rport_res_recfg(bfa, fwcfg->num_rports);
  624. bfa_fcp_res_recfg(bfa, fwcfg->num_ioim_reqs);
  625. bfa_tskim_res_recfg(bfa, fwcfg->num_tskim_reqs);
  626. }
  627. /*
  628. * Update BFA configuration from firmware configuration.
  629. */
  630. static void
  631. bfa_iocfc_cfgrsp(struct bfa_s *bfa)
  632. {
  633. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  634. struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
  635. struct bfa_iocfc_fwcfg_s *fwcfg = &cfgrsp->fwcfg;
  636. fwcfg->num_cqs = fwcfg->num_cqs;
  637. fwcfg->num_ioim_reqs = be16_to_cpu(fwcfg->num_ioim_reqs);
  638. fwcfg->num_fwtio_reqs = be16_to_cpu(fwcfg->num_fwtio_reqs);
  639. fwcfg->num_tskim_reqs = be16_to_cpu(fwcfg->num_tskim_reqs);
  640. fwcfg->num_fcxp_reqs = be16_to_cpu(fwcfg->num_fcxp_reqs);
  641. fwcfg->num_uf_bufs = be16_to_cpu(fwcfg->num_uf_bufs);
  642. fwcfg->num_rports = be16_to_cpu(fwcfg->num_rports);
  643. iocfc->cfgdone = BFA_TRUE;
  644. /*
  645. * configure queue register offsets as learnt from firmware
  646. */
  647. bfa_iocfc_qreg(bfa, &cfgrsp->qreg);
  648. /*
  649. * Re-configure resources as learnt from Firmware
  650. */
  651. bfa_iocfc_res_recfg(bfa, fwcfg);
  652. /*
  653. * Install MSIX queue handlers
  654. */
  655. bfa_msix_queue_install(bfa);
  656. /*
  657. * Configuration is complete - initialize/start submodules
  658. */
  659. bfa_fcport_init(bfa);
  660. if (iocfc->action == BFA_IOCFC_ACT_INIT)
  661. bfa_cb_queue(bfa, &iocfc->init_hcb_qe, bfa_iocfc_init_cb, bfa);
  662. else {
  663. if (bfa->iocfc.action == BFA_IOCFC_ACT_ENABLE)
  664. bfa_cb_queue(bfa, &bfa->iocfc.en_hcb_qe,
  665. bfa_iocfc_enable_cb, bfa);
  666. bfa_iocfc_start_submod(bfa);
  667. }
  668. }
  669. void
  670. bfa_iocfc_reset_queues(struct bfa_s *bfa)
  671. {
  672. int q;
  673. for (q = 0; q < BFI_IOC_MAX_CQS; q++) {
  674. bfa_reqq_ci(bfa, q) = 0;
  675. bfa_reqq_pi(bfa, q) = 0;
  676. bfa_rspq_ci(bfa, q) = 0;
  677. bfa_rspq_pi(bfa, q) = 0;
  678. }
  679. }
  680. /* Fabric Assigned Address specific functions */
  681. /*
  682. * Check whether IOC is ready before sending command down
  683. */
  684. static bfa_status_t
  685. bfa_faa_validate_request(struct bfa_s *bfa)
  686. {
  687. enum bfa_ioc_type_e ioc_type = bfa_get_type(bfa);
  688. u32 card_type = bfa->ioc.attr->card_type;
  689. if (bfa_ioc_is_operational(&bfa->ioc)) {
  690. if ((ioc_type != BFA_IOC_TYPE_FC) || bfa_mfg_is_mezz(card_type))
  691. return BFA_STATUS_FEATURE_NOT_SUPPORTED;
  692. } else {
  693. if (!bfa_ioc_is_acq_addr(&bfa->ioc))
  694. return BFA_STATUS_IOC_NON_OP;
  695. }
  696. return BFA_STATUS_OK;
  697. }
  698. bfa_status_t
  699. bfa_faa_enable(struct bfa_s *bfa, bfa_cb_iocfc_t cbfn, void *cbarg)
  700. {
  701. struct bfi_faa_en_dis_s faa_enable_req;
  702. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  703. bfa_status_t status;
  704. iocfc->faa_args.faa_cb.faa_cbfn = cbfn;
  705. iocfc->faa_args.faa_cb.faa_cbarg = cbarg;
  706. status = bfa_faa_validate_request(bfa);
  707. if (status != BFA_STATUS_OK)
  708. return status;
  709. if (iocfc->faa_args.busy == BFA_TRUE)
  710. return BFA_STATUS_DEVBUSY;
  711. if (iocfc->faa_args.faa_state == BFA_FAA_ENABLED)
  712. return BFA_STATUS_FAA_ENABLED;
  713. if (bfa_fcport_is_trunk_enabled(bfa))
  714. return BFA_STATUS_ERROR_TRUNK_ENABLED;
  715. bfa_fcport_cfg_faa(bfa, BFA_FAA_ENABLED);
  716. iocfc->faa_args.busy = BFA_TRUE;
  717. memset(&faa_enable_req, 0, sizeof(struct bfi_faa_en_dis_s));
  718. bfi_h2i_set(faa_enable_req.mh, BFI_MC_IOCFC,
  719. BFI_IOCFC_H2I_FAA_ENABLE_REQ, bfa_fn_lpu(bfa));
  720. bfa_ioc_mbox_send(&bfa->ioc, &faa_enable_req,
  721. sizeof(struct bfi_faa_en_dis_s));
  722. return BFA_STATUS_OK;
  723. }
  724. bfa_status_t
  725. bfa_faa_disable(struct bfa_s *bfa, bfa_cb_iocfc_t cbfn,
  726. void *cbarg)
  727. {
  728. struct bfi_faa_en_dis_s faa_disable_req;
  729. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  730. bfa_status_t status;
  731. iocfc->faa_args.faa_cb.faa_cbfn = cbfn;
  732. iocfc->faa_args.faa_cb.faa_cbarg = cbarg;
  733. status = bfa_faa_validate_request(bfa);
  734. if (status != BFA_STATUS_OK)
  735. return status;
  736. if (iocfc->faa_args.busy == BFA_TRUE)
  737. return BFA_STATUS_DEVBUSY;
  738. if (iocfc->faa_args.faa_state == BFA_FAA_DISABLED)
  739. return BFA_STATUS_FAA_DISABLED;
  740. bfa_fcport_cfg_faa(bfa, BFA_FAA_DISABLED);
  741. iocfc->faa_args.busy = BFA_TRUE;
  742. memset(&faa_disable_req, 0, sizeof(struct bfi_faa_en_dis_s));
  743. bfi_h2i_set(faa_disable_req.mh, BFI_MC_IOCFC,
  744. BFI_IOCFC_H2I_FAA_DISABLE_REQ, bfa_fn_lpu(bfa));
  745. bfa_ioc_mbox_send(&bfa->ioc, &faa_disable_req,
  746. sizeof(struct bfi_faa_en_dis_s));
  747. return BFA_STATUS_OK;
  748. }
  749. bfa_status_t
  750. bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s *attr,
  751. bfa_cb_iocfc_t cbfn, void *cbarg)
  752. {
  753. struct bfi_faa_query_s faa_attr_req;
  754. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  755. bfa_status_t status;
  756. iocfc->faa_args.faa_attr = attr;
  757. iocfc->faa_args.faa_cb.faa_cbfn = cbfn;
  758. iocfc->faa_args.faa_cb.faa_cbarg = cbarg;
  759. status = bfa_faa_validate_request(bfa);
  760. if (status != BFA_STATUS_OK)
  761. return status;
  762. if (iocfc->faa_args.busy == BFA_TRUE)
  763. return BFA_STATUS_DEVBUSY;
  764. iocfc->faa_args.busy = BFA_TRUE;
  765. memset(&faa_attr_req, 0, sizeof(struct bfi_faa_query_s));
  766. bfi_h2i_set(faa_attr_req.mh, BFI_MC_IOCFC,
  767. BFI_IOCFC_H2I_FAA_QUERY_REQ, bfa_fn_lpu(bfa));
  768. bfa_ioc_mbox_send(&bfa->ioc, &faa_attr_req,
  769. sizeof(struct bfi_faa_query_s));
  770. return BFA_STATUS_OK;
  771. }
  772. /*
  773. * FAA enable response
  774. */
  775. static void
  776. bfa_faa_enable_reply(struct bfa_iocfc_s *iocfc,
  777. struct bfi_faa_en_dis_rsp_s *rsp)
  778. {
  779. void *cbarg = iocfc->faa_args.faa_cb.faa_cbarg;
  780. bfa_status_t status = rsp->status;
  781. WARN_ON(!iocfc->faa_args.faa_cb.faa_cbfn);
  782. iocfc->faa_args.faa_cb.faa_cbfn(cbarg, status);
  783. iocfc->faa_args.busy = BFA_FALSE;
  784. }
  785. /*
  786. * FAA disable response
  787. */
  788. static void
  789. bfa_faa_disable_reply(struct bfa_iocfc_s *iocfc,
  790. struct bfi_faa_en_dis_rsp_s *rsp)
  791. {
  792. void *cbarg = iocfc->faa_args.faa_cb.faa_cbarg;
  793. bfa_status_t status = rsp->status;
  794. WARN_ON(!iocfc->faa_args.faa_cb.faa_cbfn);
  795. iocfc->faa_args.faa_cb.faa_cbfn(cbarg, status);
  796. iocfc->faa_args.busy = BFA_FALSE;
  797. }
  798. /*
  799. * FAA query response
  800. */
  801. static void
  802. bfa_faa_query_reply(struct bfa_iocfc_s *iocfc,
  803. bfi_faa_query_rsp_t *rsp)
  804. {
  805. void *cbarg = iocfc->faa_args.faa_cb.faa_cbarg;
  806. if (iocfc->faa_args.faa_attr) {
  807. iocfc->faa_args.faa_attr->faa = rsp->faa;
  808. iocfc->faa_args.faa_attr->faa_state = rsp->faa_status;
  809. iocfc->faa_args.faa_attr->pwwn_source = rsp->addr_source;
  810. }
  811. WARN_ON(!iocfc->faa_args.faa_cb.faa_cbfn);
  812. iocfc->faa_args.faa_cb.faa_cbfn(cbarg, BFA_STATUS_OK);
  813. iocfc->faa_args.busy = BFA_FALSE;
  814. }
  815. /*
  816. * IOC enable request is complete
  817. */
  818. static void
  819. bfa_iocfc_enable_cbfn(void *bfa_arg, enum bfa_status status)
  820. {
  821. struct bfa_s *bfa = bfa_arg;
  822. if (status == BFA_STATUS_FAA_ACQ_ADDR) {
  823. bfa_cb_queue(bfa, &bfa->iocfc.init_hcb_qe,
  824. bfa_iocfc_init_cb, bfa);
  825. return;
  826. }
  827. if (status != BFA_STATUS_OK) {
  828. bfa_isr_disable(bfa);
  829. if (bfa->iocfc.action == BFA_IOCFC_ACT_INIT)
  830. bfa_cb_queue(bfa, &bfa->iocfc.init_hcb_qe,
  831. bfa_iocfc_init_cb, bfa);
  832. else if (bfa->iocfc.action == BFA_IOCFC_ACT_ENABLE)
  833. bfa_cb_queue(bfa, &bfa->iocfc.en_hcb_qe,
  834. bfa_iocfc_enable_cb, bfa);
  835. return;
  836. }
  837. bfa_iocfc_send_cfg(bfa);
  838. }
  839. /*
  840. * IOC disable request is complete
  841. */
  842. static void
  843. bfa_iocfc_disable_cbfn(void *bfa_arg)
  844. {
  845. struct bfa_s *bfa = bfa_arg;
  846. bfa_isr_disable(bfa);
  847. bfa_iocfc_disable_submod(bfa);
  848. if (bfa->iocfc.action == BFA_IOCFC_ACT_STOP)
  849. bfa_cb_queue(bfa, &bfa->iocfc.stop_hcb_qe, bfa_iocfc_stop_cb,
  850. bfa);
  851. else {
  852. WARN_ON(bfa->iocfc.action != BFA_IOCFC_ACT_DISABLE);
  853. bfa_cb_queue(bfa, &bfa->iocfc.dis_hcb_qe, bfa_iocfc_disable_cb,
  854. bfa);
  855. }
  856. }
  857. /*
  858. * Notify sub-modules of hardware failure.
  859. */
  860. static void
  861. bfa_iocfc_hbfail_cbfn(void *bfa_arg)
  862. {
  863. struct bfa_s *bfa = bfa_arg;
  864. bfa->queue_process = BFA_FALSE;
  865. bfa_isr_disable(bfa);
  866. bfa_iocfc_disable_submod(bfa);
  867. if (bfa->iocfc.action == BFA_IOCFC_ACT_INIT)
  868. bfa_cb_queue(bfa, &bfa->iocfc.init_hcb_qe, bfa_iocfc_init_cb,
  869. bfa);
  870. }
  871. /*
  872. * Actions on chip-reset completion.
  873. */
  874. static void
  875. bfa_iocfc_reset_cbfn(void *bfa_arg)
  876. {
  877. struct bfa_s *bfa = bfa_arg;
  878. bfa_iocfc_reset_queues(bfa);
  879. bfa_isr_enable(bfa);
  880. }
  881. /*
  882. * Query IOC memory requirement information.
  883. */
  884. void
  885. bfa_iocfc_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
  886. struct bfa_s *bfa)
  887. {
  888. int q, per_reqq_sz, per_rspq_sz;
  889. struct bfa_mem_dma_s *ioc_dma = BFA_MEM_IOC_DMA(bfa);
  890. struct bfa_mem_dma_s *iocfc_dma = BFA_MEM_IOCFC_DMA(bfa);
  891. struct bfa_mem_kva_s *iocfc_kva = BFA_MEM_IOCFC_KVA(bfa);
  892. u32 dm_len = 0;
  893. /* dma memory setup for IOC */
  894. bfa_mem_dma_setup(meminfo, ioc_dma,
  895. BFA_ROUNDUP(sizeof(struct bfi_ioc_attr_s), BFA_DMA_ALIGN_SZ));
  896. /* dma memory setup for REQ/RSP queues */
  897. per_reqq_sz = BFA_ROUNDUP((cfg->drvcfg.num_reqq_elems * BFI_LMSG_SZ),
  898. BFA_DMA_ALIGN_SZ);
  899. per_rspq_sz = BFA_ROUNDUP((cfg->drvcfg.num_rspq_elems * BFI_LMSG_SZ),
  900. BFA_DMA_ALIGN_SZ);
  901. for (q = 0; q < cfg->fwcfg.num_cqs; q++) {
  902. bfa_mem_dma_setup(meminfo, BFA_MEM_REQQ_DMA(bfa, q),
  903. per_reqq_sz);
  904. bfa_mem_dma_setup(meminfo, BFA_MEM_RSPQ_DMA(bfa, q),
  905. per_rspq_sz);
  906. }
  907. /* IOCFC dma memory - calculate Shadow CI/PI size */
  908. for (q = 0; q < cfg->fwcfg.num_cqs; q++)
  909. dm_len += (2 * BFA_CACHELINE_SZ);
  910. /* IOCFC dma memory - calculate config info / rsp size */
  911. dm_len += BFA_ROUNDUP(sizeof(struct bfi_iocfc_cfg_s), BFA_CACHELINE_SZ);
  912. dm_len += BFA_ROUNDUP(sizeof(struct bfi_iocfc_cfgrsp_s),
  913. BFA_CACHELINE_SZ);
  914. /* dma memory setup for IOCFC */
  915. bfa_mem_dma_setup(meminfo, iocfc_dma, dm_len);
  916. /* kva memory setup for IOCFC */
  917. bfa_mem_kva_setup(meminfo, iocfc_kva,
  918. ((bfa_auto_recover) ? BFA_DBG_FWTRC_LEN : 0));
  919. }
  920. /*
  921. * Query IOC memory requirement information.
  922. */
  923. void
  924. bfa_iocfc_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
  925. struct bfa_pcidev_s *pcidev)
  926. {
  927. int i;
  928. struct bfa_ioc_s *ioc = &bfa->ioc;
  929. bfa_iocfc_cbfn.enable_cbfn = bfa_iocfc_enable_cbfn;
  930. bfa_iocfc_cbfn.disable_cbfn = bfa_iocfc_disable_cbfn;
  931. bfa_iocfc_cbfn.hbfail_cbfn = bfa_iocfc_hbfail_cbfn;
  932. bfa_iocfc_cbfn.reset_cbfn = bfa_iocfc_reset_cbfn;
  933. ioc->trcmod = bfa->trcmod;
  934. bfa_ioc_attach(&bfa->ioc, bfa, &bfa_iocfc_cbfn, &bfa->timer_mod);
  935. bfa_ioc_pci_init(&bfa->ioc, pcidev, BFI_PCIFN_CLASS_FC);
  936. bfa_ioc_mbox_register(&bfa->ioc, bfa_mbox_isrs);
  937. bfa_iocfc_init_mem(bfa, bfad, cfg, pcidev);
  938. bfa_iocfc_mem_claim(bfa, cfg);
  939. INIT_LIST_HEAD(&bfa->timer_mod.timer_q);
  940. INIT_LIST_HEAD(&bfa->comp_q);
  941. for (i = 0; i < BFI_IOC_MAX_CQS; i++)
  942. INIT_LIST_HEAD(&bfa->reqq_waitq[i]);
  943. }
  944. /*
  945. * Query IOC memory requirement information.
  946. */
  947. void
  948. bfa_iocfc_init(struct bfa_s *bfa)
  949. {
  950. bfa->iocfc.action = BFA_IOCFC_ACT_INIT;
  951. bfa_ioc_enable(&bfa->ioc);
  952. }
  953. /*
  954. * IOC start called from bfa_start(). Called to start IOC operations
  955. * at driver instantiation for this instance.
  956. */
  957. void
  958. bfa_iocfc_start(struct bfa_s *bfa)
  959. {
  960. if (bfa->iocfc.cfgdone)
  961. bfa_iocfc_start_submod(bfa);
  962. }
  963. /*
  964. * IOC stop called from bfa_stop(). Called only when driver is unloaded
  965. * for this instance.
  966. */
  967. void
  968. bfa_iocfc_stop(struct bfa_s *bfa)
  969. {
  970. bfa->iocfc.action = BFA_IOCFC_ACT_STOP;
  971. bfa->queue_process = BFA_FALSE;
  972. bfa_ioc_disable(&bfa->ioc);
  973. }
  974. void
  975. bfa_iocfc_isr(void *bfaarg, struct bfi_mbmsg_s *m)
  976. {
  977. struct bfa_s *bfa = bfaarg;
  978. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  979. union bfi_iocfc_i2h_msg_u *msg;
  980. msg = (union bfi_iocfc_i2h_msg_u *) m;
  981. bfa_trc(bfa, msg->mh.msg_id);
  982. switch (msg->mh.msg_id) {
  983. case BFI_IOCFC_I2H_CFG_REPLY:
  984. bfa_iocfc_cfgrsp(bfa);
  985. break;
  986. case BFI_IOCFC_I2H_UPDATEQ_RSP:
  987. iocfc->updateq_cbfn(iocfc->updateq_cbarg, BFA_STATUS_OK);
  988. break;
  989. case BFI_IOCFC_I2H_FAA_ENABLE_RSP:
  990. bfa_faa_enable_reply(iocfc,
  991. (struct bfi_faa_en_dis_rsp_s *)msg);
  992. break;
  993. case BFI_IOCFC_I2H_FAA_DISABLE_RSP:
  994. bfa_faa_disable_reply(iocfc,
  995. (struct bfi_faa_en_dis_rsp_s *)msg);
  996. break;
  997. case BFI_IOCFC_I2H_FAA_QUERY_RSP:
  998. bfa_faa_query_reply(iocfc, (bfi_faa_query_rsp_t *)msg);
  999. break;
  1000. default:
  1001. WARN_ON(1);
  1002. }
  1003. }
  1004. void
  1005. bfa_iocfc_get_attr(struct bfa_s *bfa, struct bfa_iocfc_attr_s *attr)
  1006. {
  1007. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  1008. attr->intr_attr.coalesce = iocfc->cfginfo->intr_attr.coalesce;
  1009. attr->intr_attr.delay = iocfc->cfginfo->intr_attr.delay ?
  1010. be16_to_cpu(iocfc->cfginfo->intr_attr.delay) :
  1011. be16_to_cpu(iocfc->cfgrsp->intr_attr.delay);
  1012. attr->intr_attr.latency = iocfc->cfginfo->intr_attr.latency ?
  1013. be16_to_cpu(iocfc->cfginfo->intr_attr.latency) :
  1014. be16_to_cpu(iocfc->cfgrsp->intr_attr.latency);
  1015. attr->config = iocfc->cfg;
  1016. }
  1017. bfa_status_t
  1018. bfa_iocfc_israttr_set(struct bfa_s *bfa, struct bfa_iocfc_intr_attr_s *attr)
  1019. {
  1020. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  1021. struct bfi_iocfc_set_intr_req_s *m;
  1022. iocfc->cfginfo->intr_attr.coalesce = attr->coalesce;
  1023. iocfc->cfginfo->intr_attr.delay = cpu_to_be16(attr->delay);
  1024. iocfc->cfginfo->intr_attr.latency = cpu_to_be16(attr->latency);
  1025. if (!bfa_iocfc_is_operational(bfa))
  1026. return BFA_STATUS_OK;
  1027. m = bfa_reqq_next(bfa, BFA_REQQ_IOC);
  1028. if (!m)
  1029. return BFA_STATUS_DEVBUSY;
  1030. bfi_h2i_set(m->mh, BFI_MC_IOCFC, BFI_IOCFC_H2I_SET_INTR_REQ,
  1031. bfa_fn_lpu(bfa));
  1032. m->coalesce = iocfc->cfginfo->intr_attr.coalesce;
  1033. m->delay = iocfc->cfginfo->intr_attr.delay;
  1034. m->latency = iocfc->cfginfo->intr_attr.latency;
  1035. bfa_trc(bfa, attr->delay);
  1036. bfa_trc(bfa, attr->latency);
  1037. bfa_reqq_produce(bfa, BFA_REQQ_IOC, m->mh);
  1038. return BFA_STATUS_OK;
  1039. }
  1040. void
  1041. bfa_iocfc_set_snsbase(struct bfa_s *bfa, int seg_no, u64 snsbase_pa)
  1042. {
  1043. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  1044. iocfc->cfginfo->sense_buf_len = (BFI_IOIM_SNSLEN - 1);
  1045. bfa_dma_be_addr_set(iocfc->cfginfo->ioim_snsbase[seg_no], snsbase_pa);
  1046. }
  1047. /*
  1048. * Enable IOC after it is disabled.
  1049. */
  1050. void
  1051. bfa_iocfc_enable(struct bfa_s *bfa)
  1052. {
  1053. bfa_plog_str(bfa->plog, BFA_PL_MID_HAL, BFA_PL_EID_MISC, 0,
  1054. "IOC Enable");
  1055. bfa->iocfc.action = BFA_IOCFC_ACT_ENABLE;
  1056. bfa_ioc_enable(&bfa->ioc);
  1057. }
  1058. void
  1059. bfa_iocfc_disable(struct bfa_s *bfa)
  1060. {
  1061. bfa_plog_str(bfa->plog, BFA_PL_MID_HAL, BFA_PL_EID_MISC, 0,
  1062. "IOC Disable");
  1063. bfa->iocfc.action = BFA_IOCFC_ACT_DISABLE;
  1064. bfa->queue_process = BFA_FALSE;
  1065. bfa_ioc_disable(&bfa->ioc);
  1066. }
  1067. bfa_boolean_t
  1068. bfa_iocfc_is_operational(struct bfa_s *bfa)
  1069. {
  1070. return bfa_ioc_is_operational(&bfa->ioc) && bfa->iocfc.cfgdone;
  1071. }
  1072. /*
  1073. * Return boot target port wwns -- read from boot information in flash.
  1074. */
  1075. void
  1076. bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns)
  1077. {
  1078. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  1079. struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
  1080. int i;
  1081. if (cfgrsp->pbc_cfg.boot_enabled && cfgrsp->pbc_cfg.nbluns) {
  1082. bfa_trc(bfa, cfgrsp->pbc_cfg.nbluns);
  1083. *nwwns = cfgrsp->pbc_cfg.nbluns;
  1084. for (i = 0; i < cfgrsp->pbc_cfg.nbluns; i++)
  1085. wwns[i] = cfgrsp->pbc_cfg.blun[i].tgt_pwwn;
  1086. return;
  1087. }
  1088. *nwwns = cfgrsp->bootwwns.nwwns;
  1089. memcpy(wwns, cfgrsp->bootwwns.wwn, sizeof(cfgrsp->bootwwns.wwn));
  1090. }
  1091. int
  1092. bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, struct bfi_pbc_vport_s *pbc_vport)
  1093. {
  1094. struct bfa_iocfc_s *iocfc = &bfa->iocfc;
  1095. struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
  1096. memcpy(pbc_vport, cfgrsp->pbc_cfg.vport, sizeof(cfgrsp->pbc_cfg.vport));
  1097. return cfgrsp->pbc_cfg.nvports;
  1098. }
  1099. /*
  1100. * Use this function query the memory requirement of the BFA library.
  1101. * This function needs to be called before bfa_attach() to get the
  1102. * memory required of the BFA layer for a given driver configuration.
  1103. *
  1104. * This call will fail, if the cap is out of range compared to pre-defined
  1105. * values within the BFA library
  1106. *
  1107. * @param[in] cfg - pointer to bfa_ioc_cfg_t. Driver layer should indicate
  1108. * its configuration in this structure.
  1109. * The default values for struct bfa_iocfc_cfg_s can be
  1110. * fetched using bfa_cfg_get_default() API.
  1111. *
  1112. * If cap's boundary check fails, the library will use
  1113. * the default bfa_cap_t values (and log a warning msg).
  1114. *
  1115. * @param[out] meminfo - pointer to bfa_meminfo_t. This content
  1116. * indicates the memory type (see bfa_mem_type_t) and
  1117. * amount of memory required.
  1118. *
  1119. * Driver should allocate the memory, populate the
  1120. * starting address for each block and provide the same
  1121. * structure as input parameter to bfa_attach() call.
  1122. *
  1123. * @param[in] bfa - pointer to the bfa structure, used while fetching the
  1124. * dma, kva memory information of the bfa sub-modules.
  1125. *
  1126. * @return void
  1127. *
  1128. * Special Considerations: @note
  1129. */
  1130. void
  1131. bfa_cfg_get_meminfo(struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
  1132. struct bfa_s *bfa)
  1133. {
  1134. int i;
  1135. struct bfa_mem_dma_s *port_dma = BFA_MEM_PORT_DMA(bfa);
  1136. struct bfa_mem_dma_s *ablk_dma = BFA_MEM_ABLK_DMA(bfa);
  1137. WARN_ON((cfg == NULL) || (meminfo == NULL));
  1138. memset((void *)meminfo, 0, sizeof(struct bfa_meminfo_s));
  1139. /* Initialize the DMA & KVA meminfo queues */
  1140. INIT_LIST_HEAD(&meminfo->dma_info.qe);
  1141. INIT_LIST_HEAD(&meminfo->kva_info.qe);
  1142. bfa_iocfc_meminfo(cfg, meminfo, bfa);
  1143. for (i = 0; hal_mods[i]; i++)
  1144. hal_mods[i]->meminfo(cfg, meminfo, bfa);
  1145. /* dma info setup */
  1146. bfa_mem_dma_setup(meminfo, port_dma, bfa_port_meminfo());
  1147. bfa_mem_dma_setup(meminfo, ablk_dma, bfa_ablk_meminfo());
  1148. }
  1149. /*
  1150. * Use this function to do attach the driver instance with the BFA
  1151. * library. This function will not trigger any HW initialization
  1152. * process (which will be done in bfa_init() call)
  1153. *
  1154. * This call will fail, if the cap is out of range compared to
  1155. * pre-defined values within the BFA library
  1156. *
  1157. * @param[out] bfa Pointer to bfa_t.
  1158. * @param[in] bfad Opaque handle back to the driver's IOC structure
  1159. * @param[in] cfg Pointer to bfa_ioc_cfg_t. Should be same structure
  1160. * that was used in bfa_cfg_get_meminfo().
  1161. * @param[in] meminfo Pointer to bfa_meminfo_t. The driver should
  1162. * use the bfa_cfg_get_meminfo() call to
  1163. * find the memory blocks required, allocate the
  1164. * required memory and provide the starting addresses.
  1165. * @param[in] pcidev pointer to struct bfa_pcidev_s
  1166. *
  1167. * @return
  1168. * void
  1169. *
  1170. * Special Considerations:
  1171. *
  1172. * @note
  1173. *
  1174. */
  1175. void
  1176. bfa_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
  1177. struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev)
  1178. {
  1179. int i;
  1180. struct bfa_mem_dma_s *dma_info, *dma_elem;
  1181. struct bfa_mem_kva_s *kva_info, *kva_elem;
  1182. struct list_head *dm_qe, *km_qe;
  1183. bfa->fcs = BFA_FALSE;
  1184. WARN_ON((cfg == NULL) || (meminfo == NULL));
  1185. /* Initialize memory pointers for iterative allocation */
  1186. dma_info = &meminfo->dma_info;
  1187. dma_info->kva_curp = dma_info->kva;
  1188. dma_info->dma_curp = dma_info->dma;
  1189. kva_info = &meminfo->kva_info;
  1190. kva_info->kva_curp = kva_info->kva;
  1191. list_for_each(dm_qe, &dma_info->qe) {
  1192. dma_elem = (struct bfa_mem_dma_s *) dm_qe;
  1193. dma_elem->kva_curp = dma_elem->kva;
  1194. dma_elem->dma_curp = dma_elem->dma;
  1195. }
  1196. list_for_each(km_qe, &kva_info->qe) {
  1197. kva_elem = (struct bfa_mem_kva_s *) km_qe;
  1198. kva_elem->kva_curp = kva_elem->kva;
  1199. }
  1200. bfa_iocfc_attach(bfa, bfad, cfg, pcidev);
  1201. for (i = 0; hal_mods[i]; i++)
  1202. hal_mods[i]->attach(bfa, bfad, cfg, pcidev);
  1203. bfa_com_port_attach(bfa);
  1204. bfa_com_ablk_attach(bfa);
  1205. }
  1206. /*
  1207. * Use this function to delete a BFA IOC. IOC should be stopped (by
  1208. * calling bfa_stop()) before this function call.
  1209. *
  1210. * @param[in] bfa - pointer to bfa_t.
  1211. *
  1212. * @return
  1213. * void
  1214. *
  1215. * Special Considerations:
  1216. *
  1217. * @note
  1218. */
  1219. void
  1220. bfa_detach(struct bfa_s *bfa)
  1221. {
  1222. int i;
  1223. for (i = 0; hal_mods[i]; i++)
  1224. hal_mods[i]->detach(bfa);
  1225. bfa_ioc_detach(&bfa->ioc);
  1226. }
  1227. void
  1228. bfa_comp_deq(struct bfa_s *bfa, struct list_head *comp_q)
  1229. {
  1230. INIT_LIST_HEAD(comp_q);
  1231. list_splice_tail_init(&bfa->comp_q, comp_q);
  1232. }
  1233. void
  1234. bfa_comp_process(struct bfa_s *bfa, struct list_head *comp_q)
  1235. {
  1236. struct list_head *qe;
  1237. struct list_head *qen;
  1238. struct bfa_cb_qe_s *hcb_qe;
  1239. list_for_each_safe(qe, qen, comp_q) {
  1240. hcb_qe = (struct bfa_cb_qe_s *) qe;
  1241. hcb_qe->cbfn(hcb_qe->cbarg, BFA_TRUE);
  1242. }
  1243. }
  1244. void
  1245. bfa_comp_free(struct bfa_s *bfa, struct list_head *comp_q)
  1246. {
  1247. struct list_head *qe;
  1248. struct bfa_cb_qe_s *hcb_qe;
  1249. while (!list_empty(comp_q)) {
  1250. bfa_q_deq(comp_q, &qe);
  1251. hcb_qe = (struct bfa_cb_qe_s *) qe;
  1252. hcb_qe->cbfn(hcb_qe->cbarg, BFA_FALSE);
  1253. }
  1254. }
  1255. /*
  1256. * Return the list of PCI vendor/device id lists supported by this
  1257. * BFA instance.
  1258. */
  1259. void
  1260. bfa_get_pciids(struct bfa_pciid_s **pciids, int *npciids)
  1261. {
  1262. static struct bfa_pciid_s __pciids[] = {
  1263. {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G2P},
  1264. {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_FC_8G1P},
  1265. {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT},
  1266. {BFA_PCI_VENDOR_ID_BROCADE, BFA_PCI_DEVICE_ID_CT_FC},
  1267. };
  1268. *npciids = sizeof(__pciids) / sizeof(__pciids[0]);
  1269. *pciids = __pciids;
  1270. }
  1271. /*
  1272. * Use this function query the default struct bfa_iocfc_cfg_s value (compiled
  1273. * into BFA layer). The OS driver can then turn back and overwrite entries that
  1274. * have been configured by the user.
  1275. *
  1276. * @param[in] cfg - pointer to bfa_ioc_cfg_t
  1277. *
  1278. * @return
  1279. * void
  1280. *
  1281. * Special Considerations:
  1282. * note
  1283. */
  1284. void
  1285. bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg)
  1286. {
  1287. cfg->fwcfg.num_fabrics = DEF_CFG_NUM_FABRICS;
  1288. cfg->fwcfg.num_lports = DEF_CFG_NUM_LPORTS;
  1289. cfg->fwcfg.num_rports = DEF_CFG_NUM_RPORTS;
  1290. cfg->fwcfg.num_ioim_reqs = DEF_CFG_NUM_IOIM_REQS;
  1291. cfg->fwcfg.num_tskim_reqs = DEF_CFG_NUM_TSKIM_REQS;
  1292. cfg->fwcfg.num_fcxp_reqs = DEF_CFG_NUM_FCXP_REQS;
  1293. cfg->fwcfg.num_uf_bufs = DEF_CFG_NUM_UF_BUFS;
  1294. cfg->fwcfg.num_cqs = DEF_CFG_NUM_CQS;
  1295. cfg->fwcfg.num_fwtio_reqs = 0;
  1296. cfg->drvcfg.num_reqq_elems = DEF_CFG_NUM_REQQ_ELEMS;
  1297. cfg->drvcfg.num_rspq_elems = DEF_CFG_NUM_RSPQ_ELEMS;
  1298. cfg->drvcfg.num_sgpgs = DEF_CFG_NUM_SGPGS;
  1299. cfg->drvcfg.num_sboot_tgts = DEF_CFG_NUM_SBOOT_TGTS;
  1300. cfg->drvcfg.num_sboot_luns = DEF_CFG_NUM_SBOOT_LUNS;
  1301. cfg->drvcfg.path_tov = BFA_FCPIM_PATHTOV_DEF;
  1302. cfg->drvcfg.ioc_recover = BFA_FALSE;
  1303. cfg->drvcfg.delay_comp = BFA_FALSE;
  1304. }
  1305. void
  1306. bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg)
  1307. {
  1308. bfa_cfg_get_default(cfg);
  1309. cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MIN;
  1310. cfg->fwcfg.num_tskim_reqs = BFA_TSKIM_MIN;
  1311. cfg->fwcfg.num_fcxp_reqs = BFA_FCXP_MIN;
  1312. cfg->fwcfg.num_uf_bufs = BFA_UF_MIN;
  1313. cfg->fwcfg.num_rports = BFA_RPORT_MIN;
  1314. cfg->fwcfg.num_fwtio_reqs = 0;
  1315. cfg->drvcfg.num_sgpgs = BFA_SGPG_MIN;
  1316. cfg->drvcfg.num_reqq_elems = BFA_REQQ_NELEMS_MIN;
  1317. cfg->drvcfg.num_rspq_elems = BFA_RSPQ_NELEMS_MIN;
  1318. cfg->drvcfg.min_cfg = BFA_TRUE;
  1319. }