1 /* Copyright 2013-2018 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 
17 #ifndef __DEBUG_DESCRIPTOR_H
18 #define __DEBUG_DESCRIPTOR_H
19 
20 #define OPAL_BOOT_COMPLETE 0x1
21 /* Debug descriptor. This structure is pointed to by the word at offset
22  * 0x80 in the sapphire binary
23  */
24 struct debug_descriptor {
25 	u8	eye_catcher[8];	/* "OPALdbug" */
26 #define DEBUG_DESC_VERSION	1
27 	u32	version;
28 	u8	console_log_levels;	/* high 4 bits in memory,
29 					 * low 4 bits driver (e.g. uart). */
30 	u8	state_flags; /* various state flags - OPAL_BOOT_COMPLETE etc */
31 	u16	reserved2;
32 	u32	reserved[2];
33 
34 	/* Memory console */
35 	u64	memcons_phys;
36 	u32	memcons_tce;
37 	u32	memcons_obuf_tce;
38 	u32	memcons_ibuf_tce;
39 
40 	/* Traces */
41 	u64	trace_mask;
42 	u32	num_traces;
43 #define DEBUG_DESC_MAX_TRACES	256
44 	u64	trace_phys[DEBUG_DESC_MAX_TRACES];
45 	u32	trace_size[DEBUG_DESC_MAX_TRACES];
46 	u32	trace_tce[DEBUG_DESC_MAX_TRACES];
47 	u16	trace_pir[DEBUG_DESC_MAX_TRACES];
48 };
49 extern struct debug_descriptor debug_descriptor;
50 
opal_booting(void)51 static inline bool opal_booting(void)
52 {
53 	return !(debug_descriptor.state_flags & OPAL_BOOT_COMPLETE);
54 }
55 
56 #endif
57