Remove MULTI_CONSOLE_API flag and references to it
[project/bcm63xx/atf.git] / include / drivers / console.h
index 0855170eb928708c1f0b3e0eee00d553e5d894d3..f31de95493d802f13c7e5176b1af58a0f30b06b3 100644 (file)
@@ -4,10 +4,10 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#ifndef __CONSOLE_H__
-#define __CONSOLE_H__
+#ifndef CONSOLE_H
+#define CONSOLE_H
 
-#include <utils_def.h>
+#include <lib/utils_def.h>
 
 #define CONSOLE_T_NEXT                 (U(0) * REGSZ)
 #define CONSOLE_T_FLAGS                        (U(1) * REGSZ)
@@ -16,9 +16,9 @@
 #define CONSOLE_T_FLUSH                        (U(4) * REGSZ)
 #define CONSOLE_T_DRVDATA              (U(5) * REGSZ)
 
-#define CONSOLE_FLAG_BOOT              BIT(0)
-#define CONSOLE_FLAG_RUNTIME           BIT(1)
-#define CONSOLE_FLAG_CRASH             BIT(2)
+#define CONSOLE_FLAG_BOOT              (U(1) << 0)
+#define CONSOLE_FLAG_RUNTIME           (U(1) << 1)
+#define CONSOLE_FLAG_CRASH             (U(1) << 2)
 /* Bits 3 to 7 reserved for additional scopes in future expansion. */
 #define CONSOLE_FLAG_SCOPE_MASK                ((U(1) << 8) - 1)
 /* Bits 8 to 31 reserved for non-scope use in future expansion. */
 
 #ifndef __ASSEMBLY__
 
-#include <types.h>
+#include <stdint.h>
 
 typedef struct console {
        struct console *next;
+       /*
+        * Only the low 32 bits are used. The type is u_register_t to align the
+        * fields of the struct to 64 bits in AArch64 and 32 bits in AArch32
+        */
        u_register_t flags;
-       int (*putc)(int character, struct console *console);
-       int (*getc)(struct console *console);
-       int (*flush)(struct console *console);
+       int (*const putc)(int character, struct console *console);
+       int (*const getc)(struct console *console);
+       int (*const flush)(struct console *console);
        /* Additional private driver data may follow here. */
 } console_t;
-#include <console_assertions.h>        /* offset macro assertions for console_t */
+
+/* offset macro assertions for console_t */
+#include <drivers/console_assertions.h>
 
 /*
- * NOTE: There is no publicly accessible console_register() function. Consoles
- * are registered by directly calling the register function of a specific
- * implementation, e.g. console_16550_register() from <uart_16550.h>. Consoles
- * registered that way can be unregistered/reconfigured with below functions.
+ * Add a console_t instance to the console list. This should only be called by
+ * console drivers after they have initialized all fields in the console
+ * structure. Platforms seeking to register a new console need to call the
+ * respective console__register() function instead.
  */
-/* Remove a single console_t instance from the console list. */
-int console_unregister(console_t *console);
+int console_register(console_t *console);
+/* Remove a single console_t instance from the console list. Return a pointer to
+ * the console that was removed if it was found, or NULL if not. */
+console_t *console_unregister(console_t *console);
 /* Returns 1 if this console is already registered, 0 if not */
 int console_is_registered(console_t *console);
 /*
@@ -67,14 +75,6 @@ int console_getc(void);
 /* Flush all consoles registered for the current state. */
 int console_flush(void);
 
-#if !MULTI_CONSOLE_API
-/* REMOVED on AArch64 -- use console_<driver>_register() instead! */
-int console_init(uintptr_t base_addr,
-                unsigned int uart_clk, unsigned int baud_rate);
-void console_uninit(void);
-#endif
-
 #endif /* __ASSEMBLY__ */
 
-#endif /* __CONSOLE_H__ */
-
+#endif /* CONSOLE_H */