dp_arch_ops.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. #include "dp_types.h"
  20. #include "cdp_txrx_cmn_reg.h"
  21. void dp_configure_arch_ops(struct dp_soc *soc);
  22. qdf_size_t dp_get_soc_context_size(uint16_t device_id);
  23. #ifdef CONFIG_LITHIUM
  24. void dp_initialize_arch_ops_li(struct dp_arch_ops *arch_ops);
  25. qdf_size_t dp_get_soc_context_size_li(void);
  26. #endif
  27. #ifdef CONFIG_BERYLLIUM
  28. void dp_initialize_arch_ops_be(struct dp_arch_ops *arch_ops);
  29. qdf_size_t dp_get_soc_context_size_be(void);
  30. #endif
  31. #ifdef CONFIG_RHINE
  32. void dp_initialize_arch_ops_rh(struct dp_arch_ops *arch_ops);
  33. qdf_size_t dp_get_soc_context_size_rh(void);
  34. #endif
  35. static void dp_initialize_default_arch_ops(struct dp_arch_ops *arch_ops)
  36. {
  37. /* assign dummy functions for arch_ops which are architecture specific */
  38. }
  39. qdf_size_t dp_get_soc_context_size(uint16_t device_id)
  40. {
  41. switch (cdp_get_arch_type_from_devid(device_id)) {
  42. #ifdef CONFIG_LITHIUM
  43. case CDP_ARCH_TYPE_LI:
  44. return dp_get_soc_context_size_li();
  45. #endif
  46. #ifdef CONFIG_BERYLLIUM
  47. case CDP_ARCH_TYPE_BE:
  48. return dp_get_soc_context_size_be();
  49. break;
  50. #endif
  51. #ifdef CONFIG_RHINE
  52. case CDP_ARCH_TYPE_RH:
  53. return dp_get_soc_context_size_rh();
  54. break;
  55. #endif
  56. default:
  57. QDF_BUG(0);
  58. }
  59. return 0;
  60. }
  61. void dp_configure_arch_ops(struct dp_soc *soc)
  62. {
  63. dp_initialize_default_arch_ops(&soc->arch_ops);
  64. switch (cdp_get_arch_type_from_devid(soc->device_id)) {
  65. #ifdef CONFIG_LITHIUM
  66. case CDP_ARCH_TYPE_LI:
  67. dp_initialize_arch_ops_li(&soc->arch_ops);
  68. break;
  69. #endif
  70. #ifdef CONFIG_BERYLLIUM
  71. case CDP_ARCH_TYPE_BE:
  72. dp_initialize_arch_ops_be(&soc->arch_ops);
  73. break;
  74. #endif
  75. #ifdef CONFIG_RHINE
  76. case CDP_ARCH_TYPE_RH:
  77. dp_initialize_arch_ops_rh(&soc->arch_ops);
  78. break;
  79. #endif
  80. default:
  81. QDF_BUG(0);
  82. }
  83. }