xref: /openbmc/linux/sound/soc/intel/avs/trace.c (revision e847c767)
1 // SPDX-License-Identifier: GPL-2.0-only
2 //
3 // Copyright(c) 2021-2022 Intel Corporation. All rights reserved.
4 //
5 // Author: Cezary Rojewski <cezary.rojewski@intel.com>
6 //         Amadeusz Slawinski <amadeuszx.slawinski@linux.intel.com>
7 //
8 
9 #include <linux/types.h>
10 
11 #define CREATE_TRACE_POINTS
12 #include "trace.h"
13 
14 #define BYTES_PER_LINE 16
15 #define MAX_CHUNK_SIZE ((PAGE_SIZE - 150) /* Place for trace header */	\
16 			/ (2 * BYTES_PER_LINE + 4) /* chars per line */	\
17 			* BYTES_PER_LINE)
18 
19 void trace_avs_msg_payload(const void *data, size_t size)
20 {
21 	size_t remaining = size;
22 	size_t offset = 0;
23 
24 	while (remaining > 0) {
25 		u32 chunk;
26 
27 		chunk = min_t(size_t, remaining, MAX_CHUNK_SIZE);
28 		trace_avs_ipc_msg_payload(data, chunk, offset, size);
29 
30 		remaining -= chunk;
31 		offset += chunk;
32 	}
33 }
34