diff options
author | Dan McDonald <danmcd@joyent.com> | 2020-09-22 10:39:49 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2020-09-22 10:39:49 -0400 |
commit | 267e12a7d9bf6e5fcefb9cc00f46bfff0dc5226e (patch) | |
tree | 19a3941920d0039c35d53a5cbee189b5ca51995a /usr/src/uts/i86pc/sys/prom_debug.h | |
parent | 517abc5c668925e6092495bf332233c3599980d2 (diff) | |
parent | e9faba760cdf80d7dfa110fe0830917ab94668c2 (diff) | |
download | illumos-joyent-vpc.tar.gz |
Merge branch 'master' into vpcvpc
Diffstat (limited to 'usr/src/uts/i86pc/sys/prom_debug.h')
-rw-r--r-- | usr/src/uts/i86pc/sys/prom_debug.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/usr/src/uts/i86pc/sys/prom_debug.h b/usr/src/uts/i86pc/sys/prom_debug.h new file mode 100644 index 0000000000..ae64d91711 --- /dev/null +++ b/usr/src/uts/i86pc/sys/prom_debug.h @@ -0,0 +1,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 */ |