1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2020 Oxide Computer Company
*/
#ifndef _SYS_PROM_DEBUG_H
#define _SYS_PROM_DEBUG_H
#include <sys/promif.h>
/*
* These macros are used to emit coarse-grained early boot debugging
* information when the user sets "prom_debug" in the boot environment. They
* should only be used for information that we cannot easily obtain through a
* richer mechanism because the machine hangs or crashes before other debugging
* tools are available.
*/
#ifdef __cplusplus
extern "C" {
#endif
extern int prom_debug;
/*
* Print a string message, used to signal that we have at least reached a
* particular point in the code:
*/
#define PRM_POINT(q) do { \
if (prom_debug) { \
prom_printf("%s:%d: %s\n", \
__FILE__, __LINE__, (q)); \
} \
} while (0)
/*
* Print the name and value of an integer variable:
*/
#define PRM_DEBUG(q) do { \
if (prom_debug) { \
prom_printf("%s:%d: '%s' is 0x%llx\n", \
__FILE__, __LINE__, #q, (long long)(q)); \
} \
} while (0)
/*
* Print the name and value of a string (char *) variable (which may be NULL):
*/
#define PRM_DEBUGS(q) do { \
if (prom_debug) { \
const char *qq = q; \
prom_printf("%s:%d: '%s' is '%s'\n", \
__FILE__, __LINE__, #q, \
qq != NULL ? qq : "<NULL>"); \
} \
} while (0)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PROM_DEBUG_H */
|