• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014, Michael Ellerman, IBM Corp.
3  * Licensed under GPLv2.
4  */
5 
6 #ifndef _SELFTESTS_POWERPC_PMU_EBB_TRACE_H
7 #define _SELFTESTS_POWERPC_PMU_EBB_TRACE_H
8 
9 #include "utils.h"
10 
11 #define TRACE_TYPE_REG		1
12 #define TRACE_TYPE_COUNTER	2
13 #define TRACE_TYPE_STRING	3
14 #define TRACE_TYPE_INDENT	4
15 #define TRACE_TYPE_OUTDENT	5
16 
17 struct trace_entry
18 {
19 	u8 type;
20 	u8 length;
21 	u8 data[0];
22 };
23 
24 struct trace_buffer
25 {
26 	u64  size;
27 	bool overflow;
28 	void *tail;
29 	u8   data[0];
30 };
31 
32 struct trace_buffer *trace_buffer_allocate(u64 size);
33 int trace_log_reg(struct trace_buffer *tb, u64 reg, u64 value);
34 int trace_log_counter(struct trace_buffer *tb, u64 value);
35 int trace_log_string(struct trace_buffer *tb, char *str);
36 int trace_log_indent(struct trace_buffer *tb);
37 int trace_log_outdent(struct trace_buffer *tb);
38 void trace_buffer_print(struct trace_buffer *tb);
39 void trace_print_location(struct trace_buffer *tb);
40 
41 #endif /* _SELFTESTS_POWERPC_PMU_EBB_TRACE_H */
42