trace.c 787 B

123456789101112131415161718192021222324252627282930313233
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. //
  3. // Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
  4. //
  5. // Author: Cezary Rojewski <[email protected]>
  6. // Amadeusz Slawinski <[email protected]>
  7. //
  8. #include <linux/types.h>
  9. #define CREATE_TRACE_POINTS
  10. #include "trace.h"
  11. #define BYTES_PER_LINE 16
  12. #define MAX_CHUNK_SIZE ((PAGE_SIZE - 150) /* Place for trace header */ \
  13. / (2 * BYTES_PER_LINE + 4) /* chars per line */ \
  14. * BYTES_PER_LINE)
  15. void trace_avs_msg_payload(const void *data, size_t size)
  16. {
  17. size_t remaining = size;
  18. size_t offset = 0;
  19. while (remaining > 0) {
  20. u32 chunk;
  21. chunk = min(remaining, (size_t)MAX_CHUNK_SIZE);
  22. trace_avs_ipc_msg_payload(data, chunk, offset, size);
  23. remaining -= chunk;
  24. offset += chunk;
  25. }
  26. }