bfa_drv.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 "bfa_modules.h"
  18. /*
  19. * BFA module list terminated by NULL
  20. */
  21. struct bfa_module_s *hal_mods[] = {
  22. &hal_mod_sgpg,
  23. &hal_mod_fcport,
  24. &hal_mod_fcxp,
  25. &hal_mod_lps,
  26. &hal_mod_uf,
  27. &hal_mod_rport,
  28. &hal_mod_fcpim,
  29. NULL
  30. };
  31. /*
  32. * Message handlers for various modules.
  33. */
  34. bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = {
  35. bfa_isr_unhandled, /* NONE */
  36. bfa_isr_unhandled, /* BFI_MC_IOC */
  37. bfa_isr_unhandled, /* BFI_MC_DIAG */
  38. bfa_isr_unhandled, /* BFI_MC_FLASH */
  39. bfa_isr_unhandled, /* BFI_MC_CEE */
  40. bfa_fcport_isr, /* BFI_MC_FCPORT */
  41. bfa_isr_unhandled, /* BFI_MC_IOCFC */
  42. bfa_isr_unhandled, /* BFI_MC_LL */
  43. bfa_uf_isr, /* BFI_MC_UF */
  44. bfa_fcxp_isr, /* BFI_MC_FCXP */
  45. bfa_lps_isr, /* BFI_MC_LPS */
  46. bfa_rport_isr, /* BFI_MC_RPORT */
  47. bfa_itnim_isr, /* BFI_MC_ITNIM */
  48. bfa_isr_unhandled, /* BFI_MC_IOIM_READ */
  49. bfa_isr_unhandled, /* BFI_MC_IOIM_WRITE */
  50. bfa_isr_unhandled, /* BFI_MC_IOIM_IO */
  51. bfa_ioim_isr, /* BFI_MC_IOIM */
  52. bfa_ioim_good_comp_isr, /* BFI_MC_IOIM_IOCOM */
  53. bfa_tskim_isr, /* BFI_MC_TSKIM */
  54. bfa_isr_unhandled, /* BFI_MC_SBOOT */
  55. bfa_isr_unhandled, /* BFI_MC_IPFC */
  56. bfa_isr_unhandled, /* BFI_MC_PORT */
  57. bfa_isr_unhandled, /* --------- */
  58. bfa_isr_unhandled, /* --------- */
  59. bfa_isr_unhandled, /* --------- */
  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. };
  68. /*
  69. * Message handlers for mailbox command classes
  70. */
  71. bfa_ioc_mbox_mcfunc_t bfa_mbox_isrs[BFI_MC_MAX] = {
  72. NULL,
  73. NULL, /* BFI_MC_IOC */
  74. NULL, /* BFI_MC_DIAG */
  75. NULL, /* BFI_MC_FLASH */
  76. NULL, /* BFI_MC_CEE */
  77. NULL, /* BFI_MC_PORT */
  78. bfa_iocfc_isr, /* BFI_MC_IOCFC */
  79. NULL,
  80. };
  81. void
  82. bfa_com_port_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi)
  83. {
  84. struct bfa_port_s *port = &bfa->modules.port;
  85. u32 dm_len;
  86. u8 *dm_kva;
  87. u64 dm_pa;
  88. dm_len = bfa_port_meminfo();
  89. dm_kva = bfa_meminfo_dma_virt(mi);
  90. dm_pa = bfa_meminfo_dma_phys(mi);
  91. memset(port, 0, sizeof(struct bfa_port_s));
  92. bfa_port_attach(port, &bfa->ioc, bfa, bfa->trcmod);
  93. bfa_port_mem_claim(port, dm_kva, dm_pa);
  94. bfa_meminfo_dma_virt(mi) = dm_kva + dm_len;
  95. bfa_meminfo_dma_phys(mi) = dm_pa + dm_len;
  96. }