mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 09/30] serial: efi-stdio: move efi-stdio.h header to central location
Date: Mon, 22 Nov 2021 09:47:11 +0100	[thread overview]
Message-ID: <20211122084732.2597109-10-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20211122084732.2597109-1-a.fatoum@pengutronix.de>

EFI loader will provide simple text input/output protocols, so it makes
sense to reuse the same definitions for both loader and payload.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/serial/efi-stdio.c |  43 +---------------
 drivers/serial/efi-stdio.h |  59 ----------------------
 include/efi/efi-stdio.h    | 100 +++++++++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+), 101 deletions(-)
 delete mode 100644 drivers/serial/efi-stdio.h
 create mode 100644 include/efi/efi-stdio.h

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index 7b943aaa3b7e..d5049dfdadf3 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -15,48 +15,7 @@
 #include <linux/ctype.h>
 #include <efi/efi.h>
 #include <efi/efi-device.h>
-#include "efi-stdio.h"
-
-#define EFI_SHIFT_STATE_VALID           0x80000000
-#define EFI_RIGHT_CONTROL_PRESSED       0x00000004
-#define EFI_LEFT_CONTROL_PRESSED        0x00000008
-#define EFI_RIGHT_ALT_PRESSED           0x00000010
-#define EFI_LEFT_ALT_PRESSED            0x00000020
-
-#define EFI_CONTROL_PRESSED             (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)
-#define EFI_ALT_PRESSED                 (EFI_RIGHT_ALT_PRESSED | EFI_LEFT_ALT_PRESSED)
-#define KEYPRESS(keys, scan, uni) ((((uint64_t)keys) << 32) | ((scan) << 16) | (uni))
-#define KEYCHAR(k) ((k) & 0xffff)
-#define CHAR_CTRL(c) ((c) - 'a' + 1)
-
-#define EFI_BLACK   0x00
-#define EFI_BLUE    0x01
-#define EFI_GREEN   0x02
-#define EFI_CYAN            (EFI_BLUE | EFI_GREEN)
-#define EFI_RED     0x04
-#define EFI_MAGENTA         (EFI_BLUE | EFI_RED)
-#define EFI_BROWN           (EFI_GREEN | EFI_RED)
-#define EFI_LIGHTGRAY       (EFI_BLUE | EFI_GREEN | EFI_RED)
-#define EFI_BRIGHT  0x08
-#define EFI_DARKGRAY        (EFI_BRIGHT)
-#define EFI_LIGHTBLUE       (EFI_BLUE | EFI_BRIGHT)
-#define EFI_LIGHTGREEN      (EFI_GREEN | EFI_BRIGHT)
-#define EFI_LIGHTCYAN       (EFI_CYAN | EFI_BRIGHT)
-#define EFI_LIGHTRED        (EFI_RED | EFI_BRIGHT)
-#define EFI_LIGHTMAGENTA    (EFI_MAGENTA | EFI_BRIGHT)
-#define EFI_YELLOW          (EFI_BROWN | EFI_BRIGHT)
-#define EFI_WHITE           (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
-
-#define EFI_TEXT_ATTR(f,b)  ((f) | ((b) << 4))
-
-#define EFI_BACKGROUND_BLACK        0x00
-#define EFI_BACKGROUND_BLUE         0x10
-#define EFI_BACKGROUND_GREEN        0x20
-#define EFI_BACKGROUND_CYAN         (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
-#define EFI_BACKGROUND_RED          0x40
-#define EFI_BACKGROUND_MAGENTA      (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
-#define EFI_BACKGROUND_BROWN        (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
-#define EFI_BACKGROUND_LIGHTGRAY    (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
+#include <efi/efi-stdio.h>
 
 struct efi_console_priv {
 	struct efi_simple_text_output_protocol *out;
diff --git a/drivers/serial/efi-stdio.h b/drivers/serial/efi-stdio.h
deleted file mode 100644
index e2edd8b32ec1..000000000000
--- a/drivers/serial/efi-stdio.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef EFI_STDIO_H_
-#define EFI_STDIO_H_
-
-#include <efi.h>
-
-struct efi_simple_text_input_ex_protocol;
-
-typedef efi_status_t (EFIAPI *efi_input_reset_ex)(
-	struct efi_simple_text_input_ex_protocol *this,
-	efi_bool_t extended_verification
-);
-
-struct efi_key_state {
-	u32 shift_state;
-	u8 toggle_state;
-};
-
-struct efi_key_data {
-	struct efi_input_key key;
-	struct efi_key_state state;
-};
-
-typedef efi_status_t (EFIAPI *efi_input_read_key_ex)(
-	struct efi_simple_text_input_ex_protocol *this,
-	struct efi_key_data *keydata
-);
-
-typedef efi_status_t (EFIAPI *efi_set_state)(
-	struct efi_simple_text_input_ex_protocol *this,
-	u8 *key_toggle_state
-);
-
-typedef efi_status_t (EFIAPI *efi_key_notify_function)(
-	struct efi_key_data *keydata
-);
-
-typedef efi_status_t (EFIAPI *efi_register_keystroke_notify)(
-	struct efi_simple_text_input_ex_protocol *this,
-	struct efi_key_data keydata,
-	efi_key_notify_function key_notification_function,
-	void **notify_handle
-);
-
-typedef efi_status_t (EFIAPI *efi_unregister_keystroke_notify)(
-	struct efi_simple_text_input_ex_protocol *this,
-	void *notification_handle
-);
-
-struct efi_simple_text_input_ex_protocol {
-	efi_input_reset_ex reset;
-	efi_input_read_key_ex read_key_stroke_ex;
-	void *wait_for_key_ex;
-	efi_set_state set_state;
-	efi_register_keystroke_notify register_key_notify;
-	efi_unregister_keystroke_notify unregister_key_notify;
-};
-
-#endif
diff --git a/include/efi/efi-stdio.h b/include/efi/efi-stdio.h
new file mode 100644
index 000000000000..4086604e432d
--- /dev/null
+++ b/include/efi/efi-stdio.h
@@ -0,0 +1,100 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef EFI_STDIO_H_
+#define EFI_STDIO_H_
+
+#include <efi.h>
+
+struct efi_simple_text_input_ex_protocol;
+
+typedef efi_status_t (EFIAPI *efi_input_reset_ex)(
+	struct efi_simple_text_input_ex_protocol *this,
+	efi_bool_t extended_verification
+);
+
+struct efi_key_state {
+	u32 shift_state;
+	u8 toggle_state;
+};
+
+struct efi_key_data {
+	struct efi_input_key key;
+	struct efi_key_state state;
+};
+
+typedef efi_status_t (EFIAPI *efi_input_read_key_ex)(
+	struct efi_simple_text_input_ex_protocol *this,
+	struct efi_key_data *keydata
+);
+
+typedef efi_status_t (EFIAPI *efi_set_state)(
+	struct efi_simple_text_input_ex_protocol *this,
+	u8 *key_toggle_state
+);
+
+typedef efi_status_t (EFIAPI *efi_key_notify_function)(
+	struct efi_key_data *keydata
+);
+
+typedef efi_status_t (EFIAPI *efi_register_keystroke_notify)(
+	struct efi_simple_text_input_ex_protocol *this,
+	struct efi_key_data keydata,
+	efi_key_notify_function key_notification_function,
+	void **notify_handle
+);
+
+typedef efi_status_t (EFIAPI *efi_unregister_keystroke_notify)(
+	struct efi_simple_text_input_ex_protocol *this,
+	void *notification_handle
+);
+
+struct efi_simple_text_input_ex_protocol {
+	efi_input_reset_ex reset;
+	efi_input_read_key_ex read_key_stroke_ex;
+	void *wait_for_key_ex;
+	efi_set_state set_state;
+	efi_register_keystroke_notify register_key_notify;
+	efi_unregister_keystroke_notify unregister_key_notify;
+};
+
+#define EFI_SHIFT_STATE_VALID           0x80000000
+#define EFI_RIGHT_CONTROL_PRESSED       0x00000004
+#define EFI_LEFT_CONTROL_PRESSED        0x00000008
+#define EFI_RIGHT_ALT_PRESSED           0x00000010
+#define EFI_LEFT_ALT_PRESSED            0x00000020
+
+#define EFI_CONTROL_PRESSED             (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)
+#define EFI_ALT_PRESSED                 (EFI_RIGHT_ALT_PRESSED | EFI_LEFT_ALT_PRESSED)
+#define KEYPRESS(keys, scan, uni) ((((uint64_t)keys) << 32) | ((scan) << 16) | (uni))
+#define KEYCHAR(k) ((k) & 0xffff)
+#define CHAR_CTRL(c) ((c) - 'a' + 1)
+
+#define EFI_BLACK   0x00
+#define EFI_BLUE    0x01
+#define EFI_GREEN   0x02
+#define EFI_CYAN            (EFI_BLUE | EFI_GREEN)
+#define EFI_RED     0x04
+#define EFI_MAGENTA         (EFI_BLUE | EFI_RED)
+#define EFI_BROWN           (EFI_GREEN | EFI_RED)
+#define EFI_LIGHTGRAY       (EFI_BLUE | EFI_GREEN | EFI_RED)
+#define EFI_BRIGHT  0x08
+#define EFI_DARKGRAY        (EFI_BRIGHT)
+#define EFI_LIGHTBLUE       (EFI_BLUE | EFI_BRIGHT)
+#define EFI_LIGHTGREEN      (EFI_GREEN | EFI_BRIGHT)
+#define EFI_LIGHTCYAN       (EFI_CYAN | EFI_BRIGHT)
+#define EFI_LIGHTRED        (EFI_RED | EFI_BRIGHT)
+#define EFI_LIGHTMAGENTA    (EFI_MAGENTA | EFI_BRIGHT)
+#define EFI_YELLOW          (EFI_BROWN | EFI_BRIGHT)
+#define EFI_WHITE           (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)
+
+#define EFI_TEXT_ATTR(f,b)  ((f) | ((b) << 4))
+
+#define EFI_BACKGROUND_BLACK        0x00
+#define EFI_BACKGROUND_BLUE         0x10
+#define EFI_BACKGROUND_GREEN        0x20
+#define EFI_BACKGROUND_CYAN         (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)
+#define EFI_BACKGROUND_RED          0x40
+#define EFI_BACKGROUND_MAGENTA      (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)
+#define EFI_BACKGROUND_BROWN        (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
+#define EFI_BACKGROUND_LIGHTGRAY    (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)
+
+#endif
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-11-22  8:54 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 01/30] fs: remove useless AT_FDCWD references Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 02/30] fs: remove unused struct node_d in struct dir Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 03/30] block : efi: rename driver variable from efi_fs_driver to efi_bio_driver Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 04/30] include: <linux/types.h>: wrap in #ifndef __ASSEMBLY__ Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 05/30] hw_random: stm32: propagate error codes from rng read Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 06/30] efi: align LOAD_FILE_PROTOCOL_GUID's name with other PROTOCOL_GUIDs Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 07/30] asm-generic: move sync_caches_for_execution declaration to <asm/cache.h> Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 08/30] common: move EFI code into new efi/ top level directory Ahmad Fatoum
2021-11-23  8:55   ` Jules Maselbas
2021-11-22  8:47 ` Ahmad Fatoum [this message]
2021-11-22  8:47 ` [PATCH 10/30] efi: use SPDX-License-Identifier where appropriate Ahmad Fatoum
2021-11-23  8:52   ` Jules Maselbas
2021-11-22  8:47 ` [PATCH 11/30] drivers: efi: move Kconfig options to new menu Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 12/30] efi: factor out errno translation Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 13/30] efi: rename <efi/efi.h> to <efi/efi-payload.h> Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 14/30] efi: centralize efivarfs_parse_filename Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 15/30] kbuild: force 16-bit wchar_t treewide Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 16/30] include: <linux/nls.h>: remove duplicate wchar_t typedef Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 17/30] lib: wchar: add wctomb and mbtowc Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 18/30] lib: implement wcsnlen Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 19/30] vsprintf: add optional support for %ls format modifier Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 20/30] libfile: null-terminate read_file of wchar_t buffer Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 21/30] commands: echo: add wide file output via wecho alias Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 22/30] efi: make efi_main __noreturn Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 23/30] efi: define and use new EFI_ERROR_MASK macro Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 24/30] common: move CONFIG_ELF into General Settings Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 25/30] efi: don't zero executable buffer before freeing Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 26/30] partitions: efi: move header to central location Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 27/30] efi: print early efi_main string on CONFIG_DEBUG_LL=y Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 28/30] ARM64: board-dt-2nd: remove no longer needed noinline function split Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 29/30] bus: acpi: register bus even if without ACPI EFI table Ahmad Fatoum
2021-11-22  8:47 ` [PATCH 30/30] efi: guid: fix typos Ahmad Fatoum
2021-11-25  7:44 ` [PATCH 00/30] efi: refactor for upcoming loader support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211122084732.2597109-10-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox