swap.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2015 Qualcomm Atheros, Inc.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef _SWAP_H_
  17. #define _SWAP_H_
  18. #define ATH10K_SWAP_CODE_SEG_BIN_LEN_MAX (512 * 1024)
  19. #define ATH10K_SWAP_CODE_SEG_MAGIC_BYTES_SZ 12
  20. #define ATH10K_SWAP_CODE_SEG_NUM_MAX 16
  21. /* Currently only one swap segment is supported */
  22. #define ATH10K_SWAP_CODE_SEG_NUM_SUPPORTED 1
  23. struct ath10k_fw_file;
  24. struct ath10k_swap_code_seg_tlv {
  25. __le32 address;
  26. __le32 length;
  27. u8 data[0];
  28. } __packed;
  29. struct ath10k_swap_code_seg_tail {
  30. u8 magic_signature[ATH10K_SWAP_CODE_SEG_MAGIC_BYTES_SZ];
  31. __le32 bmi_write_addr;
  32. } __packed;
  33. union ath10k_swap_code_seg_item {
  34. struct ath10k_swap_code_seg_tlv tlv;
  35. struct ath10k_swap_code_seg_tail tail;
  36. } __packed;
  37. struct ath10k_swap_code_seg_hw_info {
  38. /* Swap binary image size */
  39. __le32 swap_size;
  40. __le32 num_segs;
  41. /* Swap data size */
  42. __le32 size;
  43. __le32 size_log2;
  44. __le32 bus_addr[ATH10K_SWAP_CODE_SEG_NUM_MAX];
  45. __le64 reserved[ATH10K_SWAP_CODE_SEG_NUM_MAX];
  46. } __packed;
  47. struct ath10k_swap_code_seg_info {
  48. struct ath10k_swap_code_seg_hw_info seg_hw_info;
  49. void *virt_address[ATH10K_SWAP_CODE_SEG_NUM_SUPPORTED];
  50. u32 target_addr;
  51. dma_addr_t paddr[ATH10K_SWAP_CODE_SEG_NUM_SUPPORTED];
  52. };
  53. int ath10k_swap_code_seg_configure(struct ath10k *ar,
  54. const struct ath10k_fw_file *fw_file);
  55. void ath10k_swap_code_seg_release(struct ath10k *ar,
  56. struct ath10k_fw_file *fw_file);
  57. int ath10k_swap_code_seg_init(struct ath10k *ar,
  58. struct ath10k_fw_file *fw_file);
  59. #endif