From fdcca78f421670bb8f04d68bc3f2762a4b5342be Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sat, 12 Sep 2020 16:51:32 -0700 Subject: 13042 make prom_debug more useful outside startup.c Reviewed by: Dan McDonald Reviewed by: Garrett D'Amore Approved by: Robert Mustacchi --- usr/src/uts/i86pc/sys/prom_debug.h | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 usr/src/uts/i86pc/sys/prom_debug.h (limited to 'usr/src/uts/i86pc/sys/prom_debug.h') 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 + +/* + * 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 : ""); \ + } \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_PROM_DEBUG_H */ -- cgit v1.2.3