hal_reo.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #include "hal_api.h"
  19. #include "hal_hw_headers.h"
  20. #include "hal_reo.h"
  21. #include "qdf_module.h"
  22. void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl,
  23. hal_ring_handle_t hal_ring_hdl)
  24. {
  25. int cmd_num;
  26. uint32_t *desc_addr;
  27. struct hal_srng_params srng_params;
  28. uint32_t desc_size;
  29. uint32_t num_desc;
  30. struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl;
  31. uint8_t tlv_hdr_size;
  32. hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
  33. desc_addr = (uint32_t *)(srng_params.ring_base_vaddr);
  34. tlv_hdr_size = hal_get_tlv_hdr_size(hal_soc_hdl);
  35. desc_addr += HAL_GET_NUM_DWORDS(tlv_hdr_size);
  36. desc_size = HAL_GET_NUM_DWORDS(hal_srng_get_entrysize(soc, REO_CMD));
  37. num_desc = srng_params.num_entries;
  38. cmd_num = 1;
  39. while (num_desc) {
  40. /* Offsets of descriptor fields defined in HW headers start
  41. * from the field after TLV header */
  42. HAL_DESC_SET_FIELD(desc_addr, HAL_UNIFORM_REO_CMD_HEADER,
  43. REO_CMD_NUMBER, cmd_num);
  44. desc_addr += desc_size;
  45. num_desc--; cmd_num++;
  46. }
  47. soc->reo_res_bitmap = 0;
  48. }
  49. qdf_export_symbol(hal_reo_init_cmd_ring);