summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/compiler.h16
-rw-r--r--src/include/ipxe/console.h51
2 files changed, 53 insertions, 14 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index 9a751d3bb..ed9af237d 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -260,19 +260,9 @@ REQUEST_EXPANDED ( CONFIG_SYMBOL );
#ifndef ASSEMBLY
-/** printf() for debugging
- *
- * This function exists so that the DBG() macros can expand to
- * printf() calls without dragging the printf() prototype into scope.
- *
- * As far as the compiler is concerned, dbg_printf() and printf() are
- * completely unrelated calls; it's only at the assembly stage that
- * references to the dbg_printf symbol are collapsed into references
- * to the printf symbol.
- */
-extern int __attribute__ (( format ( printf, 1, 2 ) ))
-dbg_printf ( const char *fmt, ... ) asm ( "printf" );
-
+/** printf() for debugging */
+extern void __attribute__ (( format ( printf, 1, 2 ) ))
+dbg_printf ( const char *fmt, ... );
extern void dbg_autocolourise ( unsigned long id );
extern void dbg_decolourise ( void );
extern void dbg_hex_dump_da ( unsigned long dispaddr,
diff --git a/src/include/ipxe/console.h b/src/include/ipxe/console.h
index 5188f9855..f70dd714a 100644
--- a/src/include/ipxe/console.h
+++ b/src/include/ipxe/console.h
@@ -75,6 +75,13 @@ struct console_driver {
*
*/
int ( *iskey ) ( void );
+
+ /** Console usage bitmask
+ *
+ * This is the bitwise OR of zero or more @c CONSOLE_USAGE_XXX
+ * values.
+ */
+ int usage;
};
/** Console driver table */
@@ -99,7 +106,49 @@ struct console_driver {
*/
#define __console_driver __table_entry ( CONSOLES, 01 )
-/* Function prototypes */
+/**
+ * @defgroup consoleusage Console usages
+ * @{
+ */
+
+/** Standard output */
+#define CONSOLE_USAGE_STDOUT 0x0001
+
+/** Debug messages */
+#define CONSOLE_USAGE_DEBUG 0x0002
+
+/** All console usages */
+#define CONSOLE_USAGE_ALL ( CONSOLE_USAGE_STDOUT | CONSOLE_USAGE_DEBUG )
+
+/** @} */
+
+/**
+ * Test to see if console has an explicit usage
+ *
+ * @v console Console definition (e.g. CONSOLE_PCBIOS)
+ * @ret explicit Console has an explicit usage
+ *
+ * This relies upon the trick that the expression ( 2 * N + 1 ) will
+ * be valid even if N is defined to be empty, since it will then
+ * evaluate to give ( 2 * + 1 ) == ( 2 * +1 ) == 2.
+ */
+#define CONSOLE_EXPLICIT( console ) ( ( 2 * console + 1 ) != 2 )
+
+extern int console_usage;
+
+/**
+ * Set console usage
+ *
+ * @v usage New console usage
+ * @ret old_usage Previous console usage
+ */
+static inline __attribute__ (( always_inline )) int
+console_set_usage ( int usage ) {
+ int old_usage = console_usage;
+
+ console_usage = usage;
+ return old_usage;
+}
extern int iskey ( void );
extern int getkey ( unsigned long timeout );