~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/skiboot/include/trace_types.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2013-2014 IBM Corp.
 
2
 *
 
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
 
6
 *
 
7
 *      http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
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
 
12
 * implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
/* API for kernel to read trace buffer. */
 
17
#ifndef __TRACE_TYPES_H
 
18
#define __TRACE_TYPES_H
 
19
 
 
20
#include <types.h>
 
21
 
 
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 */
 
28
 
 
29
/* One per cpu, plus one for NMIs */
 
30
struct tracebuf {
 
31
        /* Mask to apply to get buffer offset. */
 
32
        __be64 mask;
 
33
        /* This where the buffer starts. */
 
34
        __be64 start;
 
35
        /* This is where writer has written to. */
 
36
        __be64 end;
 
37
        /* This is where the writer wrote to previously. */
 
38
        __be64 last;
 
39
        /* This is where the reader is up to. */
 
40
        __be64 rpos;
 
41
        /* If the last one we read was a repeat, this shows how many. */
 
42
        __be32 last_repeat;
 
43
        /* Maximum possible size of a record. */
 
44
        __be32 max_size;
 
45
 
 
46
        char buf[/* TBUF_SZ + max_size */];
 
47
};
 
48
 
 
49
/* Common header for all trace entries. */
 
50
struct trace_hdr {
 
51
        __be64 timestamp;
 
52
        u8 type;
 
53
        u8 len_div_8;
 
54
        __be16 cpu;
 
55
        u8 unused[4];
 
56
};
 
57
 
 
58
/* Note: all other entries must be at least as large as this! */
 
59
struct trace_repeat {
 
60
        __be64 timestamp; /* Last repeat happened at this timestamp */
 
61
        u8 type; /* == TRACE_REPEAT */
 
62
        u8 len_div_8;
 
63
        __be16 cpu;
 
64
        __be16 prev_len;
 
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. */
 
67
};
 
68
 
 
69
/* Overflow is special */
 
70
struct trace_overflow {
 
71
        __be64 unused64; /* Timestamp is unused */
 
72
        u8 type; /* == TRACE_OVERFLOW */
 
73
        u8 len_div_8;
 
74
        u8 unused[6]; /* ie. hdr.cpu is indeterminate */
 
75
        __be64 bytes_missed;
 
76
};
 
77
 
 
78
/* All other trace types have a full header */
 
79
struct trace_opal {
 
80
        struct trace_hdr hdr;
 
81
        __be64 token, lr, sp, r3_to_11[9];
 
82
};
 
83
 
 
84
#define TRACE_FSP_MSG_IN        0
 
85
#define TRACE_FSP_MSG_OUT       1
 
86
 
 
87
struct trace_fsp_msg {
 
88
        struct trace_hdr hdr;
 
89
        __be32 word0;
 
90
        __be32 word1;
 
91
        u8 dlen;
 
92
        u8 dir; /* TRACE_FSP_MSG_IN or TRACE_FSP_MSG_OUT */
 
93
        u8 data[56]; /* See dlen, but max is 56 bytes. */
 
94
};
 
95
 
 
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 */
 
102
 
 
103
struct trace_fsp_event {
 
104
        struct trace_hdr hdr;
 
105
        __be16 event;
 
106
        __be16 fsp_state;
 
107
        __be32 data[4]; /* event type specific */
 
108
};
 
109
 
 
110
#define TRACE_UART_CTX_IRQ              0
 
111
#define TRACE_UART_CTX_POLL             1
 
112
#define TRACE_UART_CTX_READ             2
 
113
 
 
114
struct trace_uart {
 
115
        struct trace_hdr hdr;
 
116
        u8 ctx;
 
117
        u8 cnt;
 
118
        u8 irq_state;
 
119
        u8 unused;
 
120
        __be16 in_count;
 
121
};
 
122
 
 
123
union trace {
 
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;
 
132
};
 
133
 
 
134
#endif /* __TRACE_TYPES_H */