summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/serial.h
diff options
context:
space:
mode:
authorSimon Rettberg2026-01-28 12:53:53 +0100
committerSimon Rettberg2026-01-28 12:53:53 +0100
commit8e82785c584dc13e20f9229decb95bd17bbe9cd1 (patch)
treea8b359e59196be5b2e3862bed189107f4bc9975f /src/include/ipxe/serial.h
parentMerge branch 'master' into openslx (diff)
parent[prefix] Make unlzma.S compatible with 386 class CPUs (diff)
downloadipxe-openslx.tar.gz
ipxe-openslx.tar.xz
ipxe-openslx.zip
Merge branch 'master' into openslxopenslx
Diffstat (limited to 'src/include/ipxe/serial.h')
-rw-r--r--src/include/ipxe/serial.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/src/include/ipxe/serial.h b/src/include/ipxe/serial.h
index 83be59c31..04347a89e 100644
--- a/src/include/ipxe/serial.h
+++ b/src/include/ipxe/serial.h
@@ -9,8 +9,64 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+#include <ipxe/api.h>
#include <ipxe/uart.h>
+#include <config/serial.h>
-extern struct uart serial_console;
+#ifdef SERIAL_NULL
+#define SERIAL_PREFIX_null
+#else
+#define SERIAL_PREFIX_null __null_
+#endif
+
+/**
+ * Calculate static inline serial API function name
+ *
+ * @v _prefix Subsystem prefix
+ * @v _api_func API function
+ * @ret _subsys_func Subsystem API function
+ */
+#define SERIAL_INLINE( _subsys, _api_func ) \
+ SINGLE_API_INLINE ( SERIAL_PREFIX_ ## _subsys, _api_func )
+
+/**
+ * Provide a serial API implementation
+ *
+ * @v _prefix Subsystem prefix
+ * @v _api_func API function
+ * @v _func Implementing function
+ */
+#define PROVIDE_SERIAL( _subsys, _api_func, _func ) \
+ PROVIDE_SINGLE_API ( SERIAL_PREFIX_ ## _subsys, _api_func, _func )
+
+/**
+ * Provide a static inline serial API implementation
+ *
+ * @v _prefix Subsystem prefix
+ * @v _api_func API function
+ */
+#define PROVIDE_SERIAL_INLINE( _subsys, _api_func ) \
+ PROVIDE_SINGLE_API_INLINE ( SERIAL_PREFIX_ ## _subsys, _api_func )
+
+/**
+ * Get null serial console UART
+ *
+ * @ret uart Serial console UART, or NULL
+ */
+static inline __always_inline struct uart *
+SERIAL_INLINE ( null, default_serial_console ) ( void ) {
+ return NULL;
+}
+
+/**
+ * Get serial console UART
+ *
+ * @ret uart Serial console UART, or NULL
+ */
+struct uart * default_serial_console ( void );
+
+extern struct uart *serial_console;
+
+extern struct uart * fixed_serial_console ( void );
#endif /* _IPXE_SERIAL_H */