1
/* Copyright 2013-2014 IBM Corp.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
7
* http://www.apache.org/licenses/LICENSE-2.0
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
16
/* API for kernel to read trace buffer. */
17
#ifndef __TRACE_TYPES_H
18
#define __TRACE_TYPES_H
22
#define TRACE_REPEAT 1
23
#define TRACE_OVERFLOW 2
24
#define TRACE_OPAL 3 /* OPAL call */
25
#define TRACE_FSP_MSG 4 /* FSP message sent/received */
26
#define TRACE_FSP_EVENT 5 /* FSP driver event */
27
#define TRACE_UART 6 /* UART driver traces */
29
/* One per cpu, plus one for NMIs */
31
/* Mask to apply to get buffer offset. */
33
/* This where the buffer starts. */
35
/* This is where writer has written to. */
37
/* This is where the writer wrote to previously. */
39
/* This is where the reader is up to. */
41
/* If the last one we read was a repeat, this shows how many. */
43
/* Maximum possible size of a record. */
46
char buf[/* TBUF_SZ + max_size */];
49
/* Common header for all trace entries. */
58
/* Note: all other entries must be at least as large as this! */
60
__be64 timestamp; /* Last repeat happened at this timestamp */
61
u8 type; /* == TRACE_REPEAT */
65
__be16 num; /* Starts at 1, ie. 1 repeat, or two traces. */
66
/* Note that the count can be one short, if read races a repeat. */
69
/* Overflow is special */
70
struct trace_overflow {
71
__be64 unused64; /* Timestamp is unused */
72
u8 type; /* == TRACE_OVERFLOW */
74
u8 unused[6]; /* ie. hdr.cpu is indeterminate */
78
/* All other trace types have a full header */
81
__be64 token, lr, sp, r3_to_11[9];
84
#define TRACE_FSP_MSG_IN 0
85
#define TRACE_FSP_MSG_OUT 1
87
struct trace_fsp_msg {
92
u8 dir; /* TRACE_FSP_MSG_IN or TRACE_FSP_MSG_OUT */
93
u8 data[56]; /* See dlen, but max is 56 bytes. */
96
#define TRACE_FSP_EVT_LINK_DOWN 0
97
#define TRACE_FSP_EVT_DISR_CHG 1 /* 0:disr */
98
#define TRACE_FSP_EVT_SOFT_RR 2 /* 0:disr */
99
#define TRACE_FSP_EVT_RR_COMPL 3
100
#define TRACE_FSP_EVT_HDES_CHG 4 /* 0:hdes */
101
#define TRACE_FSP_EVT_POLL_IRQ 5 /* 0:irq? 1:hdir 2:ctl 3:psi_irq */
103
struct trace_fsp_event {
104
struct trace_hdr hdr;
107
__be32 data[4]; /* event type specific */
110
#define TRACE_UART_CTX_IRQ 0
111
#define TRACE_UART_CTX_POLL 1
112
#define TRACE_UART_CTX_READ 2
115
struct trace_hdr hdr;
124
struct trace_hdr hdr;
125
/* Trace types go here... */
126
struct trace_repeat repeat;
127
struct trace_overflow overflow;
128
struct trace_opal opal;
129
struct trace_fsp_msg fsp_msg;
130
struct trace_fsp_event fsp_evt;
131
struct trace_uart uart;
134
#endif /* __TRACE_TYPES_H */