mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 00/30] efi: refactor for upcoming loader support
@ 2021-11-22  8:47 Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 01/30] fs: remove useless AT_FDCWD references Ahmad Fatoum
                   ` (30 more replies)
  0 siblings, 31 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox

Nothing EFI loader support specific yet, just shifting around code to
enable future reuse, fixing some typos found along the way and improving
wide char support a bit.

Ahmad Fatoum (30):
  fs: remove useless AT_FDCWD references
  fs: remove unused struct node_d in struct dir
  block : efi: rename driver variable from efi_fs_driver to
    efi_bio_driver
  include: <linux/types.h>: wrap in #ifndef __ASSEMBLY__
  hw_random: stm32: propagate error codes from rng read
  efi: align LOAD_FILE_PROTOCOL_GUID's name with other PROTOCOL_GUIDs
  asm-generic: move sync_caches_for_execution declaration to
    <asm/cache.h>
  common: move EFI code into new efi/ top level directory
  serial: efi-stdio: move efi-stdio.h header to central location
  efi: use SPDX-License-Identifier where appropriate
  drivers: efi: move Kconfig options to new menu
  efi: factor out errno translation
  efi: rename <efi/efi.h> to <efi/efi-payload.h>
  efi: centralize efivarfs_parse_filename
  kbuild: force 16-bit wchar_t treewide
  include: <linux/nls.h>: remove duplicate wchar_t typedef
  lib: wchar: add wctomb and mbtowc
  lib: implement wcsnlen
  vsprintf: add optional support for %ls format modifier
  libfile: null-terminate read_file of wchar_t buffer
  commands: echo: add wide file output via wecho alias
  efi: make efi_main __noreturn
  efi: define and use new EFI_ERROR_MASK macro
  common: move CONFIG_ELF into General Settings
  efi: don't zero executable buffer before freeing
  partitions: efi: move header to central location
  efi: print early efi_main string on CONFIG_DEBUG_LL=y
  ARM64: board-dt-2nd: remove no longer needed noinline function split
  bus: acpi: register bus even if without ACPI EFI table
  efi: guid: fix typos

 Makefile                                      |   2 +-
 arch/arm/cpu/board-dt-2nd.c                   |  21 ++--
 arch/arm/include/asm/cache.h                  |   3 +
 arch/kvx/include/asm/cache.h                  |   3 +
 arch/riscv/include/asm/barebox-riscv.h        |   3 +-
 .../include/asm/{cacheflush.h => cache.h}     |   9 +-
 arch/riscv/lib/reloc.c                        |   2 +-
 arch/x86/Kconfig                              |   3 -
 arch/x86/Makefile                             |   2 +-
 commands/echo.c                               |  55 ++++++++-
 common/Kconfig                                |  16 +--
 common/Makefile                               |   4 +-
 common/efi/Kconfig                            |  27 ++++
 common/efi/Makefile                           |  10 +-
 common/{efi-devicepath.c => efi/devicepath.c} |   2 +
 common/efi/efivar-filename.c                  | 116 ++++++++++++++++++
 common/efi/errno.c                            |  90 ++++++++++++++
 common/{efi-guid.c => efi/guid.c}             |   8 +-
 common/efi/payload/Makefile                   |   6 +
 .../env-efi/network/eth0-discover             |   0
 common/efi/{efi-image.c => payload/image.c}   |  16 +--
 common/efi/{efi.c => payload/init.c}          | 111 ++---------------
 common/efi/{efi-iomem.c => payload/iomem.c}   |   2 +-
 common/partitions/efi.c                       |   2 +-
 drivers/Kconfig                               |   1 -
 drivers/block/efi-block-io.c                  |   6 +-
 drivers/bus/acpi.c                            |  10 +-
 drivers/clocksource/efi.c                     |   2 +-
 drivers/clocksource/efi_x86.c                 |   2 +-
 drivers/efi/Kconfig                           |   6 -
 drivers/efi/efi-device.c                      |   2 +-
 drivers/hw_random/stm32-rng.c                 |   8 +-
 drivers/net/efi-snp.c                         |   2 +-
 drivers/pci/pci-efi.c                         |   2 +-
 drivers/serial/efi-stdio.c                    |  45 +------
 drivers/serial/efi-stdio.h                    |  59 ---------
 drivers/serial/serial_efi.c                   |   2 +-
 drivers/video/efi_gop.c                       |   2 +-
 drivers/watchdog/efi_wdt.c                    |   2 +-
 fs/efi.c                                      |   2 +-
 fs/efivarfs.c                                 |  78 +-----------
 fs/fs.c                                       |  56 ++++-----
 include/asm-generic/cache.h                   |   9 ++
 include/dirent.h                              |   1 -
 include/efi.h                                 |  71 ++++++-----
 include/efi/debug_ll.h                        |   3 +-
 include/efi/efi-device.h                      |   1 +
 include/efi/{efi.h => efi-payload.h}          |  12 +-
 include/efi/efi-stdio.h                       | 100 +++++++++++++++
 include/efi/efi-util.h                        |  14 +++
 .../efi.h => include/efi/partition.h          |   0
 include/linux/namei.h                         |   4 -
 include/linux/nls.h                           |   3 +-
 include/linux/types.h                         |   2 +
 include/wchar.h                               |   7 ++
 lib/Kconfig                                   |   3 +
 lib/libfile.c                                 |   3 +-
 lib/vsprintf.c                                |  67 ++++++++--
 lib/wchar.c                                   |  31 ++++-
 59 files changed, 667 insertions(+), 464 deletions(-)
 rename arch/riscv/include/asm/{cacheflush.h => cache.h} (59%)
 create mode 100644 common/efi/Kconfig
 rename common/{efi-devicepath.c => efi/devicepath.c} (99%)
 create mode 100644 common/efi/efivar-filename.c
 create mode 100644 common/efi/errno.c
 rename common/{efi-guid.c => efi/guid.c} (96%)
 create mode 100644 common/efi/payload/Makefile
 rename common/efi/{ => payload}/env-efi/network/eth0-discover (100%)
 rename common/efi/{efi-image.c => payload/image.c} (93%)
 rename common/efi/{efi.c => payload/init.c} (66%)
 rename common/efi/{efi-iomem.c => payload/iomem.c} (99%)
 delete mode 100644 drivers/efi/Kconfig
 delete mode 100644 drivers/serial/efi-stdio.h
 create mode 100644 include/asm-generic/cache.h
 rename include/efi/{efi.h => efi-payload.h} (80%)
 create mode 100644 include/efi/efi-stdio.h
 create mode 100644 include/efi/efi-util.h
 rename common/partitions/efi.h => include/efi/partition.h (100%)

-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 01/30] fs: remove useless AT_FDCWD references
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 02/30] fs: remove unused struct node_d in struct dir Ahmad Fatoum
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

All name lookups by barebox are AT_FDCWD and there are no dirfd support
that could be used in its place, so just remove that parameter altogether
from the FS functions.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 fs/fs.c               | 56 +++++++++++++++++++++----------------------
 include/linux/namei.h |  4 ----
 2 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index e6fd57b8ac97..7da3a050c1cb 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -92,7 +92,7 @@ postcore_initcall(init_fs);
 struct filename;
 
 static struct fs_device_d *get_fsdevice_by_path(const char *path);
-static int filename_lookup(int dfd, struct filename *name, unsigned flags,
+static int filename_lookup(struct filename *name, unsigned flags,
 			   struct path *path);;
 static struct filename *getname(const char *filename);
 static void path_put(const struct path *path);
@@ -710,7 +710,7 @@ static void fs_remove(struct device_d *dev)
 	if (fsdev->loop && fsdev->cdev) {
 		cdev_remove_loop(fsdev->cdev);
 
-		ret = filename_lookup(AT_FDCWD, getname(fsdev->backingstore),
+		ret = filename_lookup(getname(fsdev->backingstore),
 				      LOOKUP_FOLLOW, &path);
 		if (!ret) {
 			mntput(path.mnt);
@@ -793,7 +793,7 @@ int fsdev_open_cdev(struct fs_device_d *fsdev)
 	parseopt_b(fsdev->options, "loop", &fsdev->loop);
 	parseopt_llu_suffix(fsdev->options, "offset", &offset);
 	if (fsdev->loop) {
-		ret = filename_lookup(AT_FDCWD, getname(fsdev->backingstore),
+		ret = filename_lookup(getname(fsdev->backingstore),
 				      LOOKUP_FOLLOW, &path);
 		if (ret)
 			return ret;
@@ -1467,7 +1467,6 @@ struct nameidata {
 	struct nameidata *saved;
 	struct inode	*link_inode;
 	unsigned	root_seq;
-	int		dfd;
 };
 
 struct filename {
@@ -1475,10 +1474,9 @@ struct filename {
 	int refcnt;
 };
 
-static void set_nameidata(struct nameidata *p, int dfd, struct filename *name)
+static void set_nameidata(struct nameidata *p, struct filename *name)
 {
 	p->stack = p->internal;
-	p->dfd = dfd;
 	p->name = name;
 	p->total_link_count = 0;
 }
@@ -2041,7 +2039,7 @@ static const char *path_init(struct nameidata *nd, unsigned flags)
 	if (*s == '/') {
 		get_root(&nd->path);
 		return s;
-	} else if (nd->dfd == AT_FDCWD) {
+	} else {
 		get_pwd(&nd->path);
 		nd->inode = nd->path.dentry->d_inode;
 		return s;
@@ -2101,7 +2099,7 @@ static int path_parentat(struct nameidata *nd, unsigned flags,
 	return err;
 }
 
-static struct filename *filename_parentat(int dfd, struct filename *name,
+static struct filename *filename_parentat(struct filename *name,
 				unsigned int flags, struct path *parent,
 				struct qstr *last, int *type)
 {
@@ -2111,7 +2109,7 @@ static struct filename *filename_parentat(int dfd, struct filename *name,
 	if (IS_ERR(name))
 		return name;
 
-	set_nameidata(&nd, dfd, name);
+	set_nameidata(&nd, name);
 
 	retval = path_parentat(&nd, flags, parent);
 	if (likely(!retval)) {
@@ -2125,7 +2123,7 @@ static struct filename *filename_parentat(int dfd, struct filename *name,
 	return name;
 }
 
-static struct dentry *filename_create(int dfd, struct filename *name,
+static struct dentry *filename_create(struct filename *name,
 				struct path *path, unsigned int lookup_flags)
 {
 	struct dentry *dentry = ERR_PTR(-EEXIST);
@@ -2140,7 +2138,7 @@ static struct dentry *filename_create(int dfd, struct filename *name,
 	 */
 	lookup_flags &= LOOKUP_REVAL;
 
-	name = filename_parentat(dfd, name, 0, path, &last, &type);
+	name = filename_parentat(name, 0, path, &last, &type);
 	if (IS_ERR(name))
 		return ERR_CAST(name);
 
@@ -2185,7 +2183,7 @@ out:
 	return dentry;
 }
 
-static int filename_lookup(int dfd, struct filename *name, unsigned flags,
+static int filename_lookup(struct filename *name, unsigned flags,
 			   struct path *path)
 {
 	int err;
@@ -2195,7 +2193,7 @@ static int filename_lookup(int dfd, struct filename *name, unsigned flags,
 	if (IS_ERR(name))
 		return PTR_ERR(name);
 
-	set_nameidata(&nd, dfd, name);
+	set_nameidata(&nd, name);
 
 	s = path_init(&nd, flags);
 
@@ -2228,7 +2226,7 @@ static struct fs_device_d *get_fsdevice_by_path(const char *pathname)
 	struct path path;
 	int ret;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), 0, &path);
+	ret = filename_lookup(getname(pathname), 0, &path);
 	if (ret)
 		return NULL;
 
@@ -2287,7 +2285,7 @@ int mkdir (const char *pathname, mode_t mode)
 	int error;
 	unsigned int lookup_flags = LOOKUP_DIRECTORY;
 
-	dentry = filename_create(AT_FDCWD, getname(pathname), &path, lookup_flags);
+	dentry = filename_create(getname(pathname), &path, lookup_flags);
 	if (IS_ERR(dentry)) {
 		error = PTR_ERR(dentry);
 		goto out;
@@ -2314,7 +2312,7 @@ int rmdir (const char *pathname)
 	struct qstr last;
 	int type;
 
-	name = filename_parentat(AT_FDCWD, getname(pathname), 0,
+	name = filename_parentat(getname(pathname), 0,
 				&path, &last, &type);
 	if (IS_ERR(name))
 		return PTR_ERR(name);
@@ -2377,7 +2375,7 @@ int open(const char *pathname, int flags, ...)
 	if (IS_ERR(filename))
 		return PTR_ERR(filename);
 
-	set_nameidata(&nd, AT_FDCWD, filename);
+	set_nameidata(&nd, filename);
 
 	s = path_init(&nd, LOOKUP_FOLLOW);
 
@@ -2495,7 +2493,7 @@ int unlink(const char *pathname)
 	struct inode *inode;
 	struct path path;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), 0, &path);
+	ret = filename_lookup(getname(pathname), 0, &path);
 	if (ret)
 		goto out;
 
@@ -2543,7 +2541,7 @@ int symlink(const char *pathname, const char *newpath)
 	int error;
 	unsigned int lookup_flags = LOOKUP_DIRECTORY;
 
-	dentry = filename_create(AT_FDCWD, getname(newpath), &path, lookup_flags);
+	dentry = filename_create(getname(newpath), &path, lookup_flags);
 	if (IS_ERR(dentry)) {
 		error = PTR_ERR(dentry);
 		goto out;
@@ -2583,7 +2581,7 @@ DIR *opendir(const char *pathname)
 		},
 	};
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname),
+	ret = filename_lookup(getname(pathname),
 			      LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
 	if (ret)
 		goto out;
@@ -2651,7 +2649,7 @@ int readlink(const char *pathname, char *buf, size_t bufsiz)
 	const char *link;
 	struct path path = {};
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), 0, &path);
+	ret = filename_lookup(getname(pathname), 0, &path);
 	if (ret)
 		goto out;
 
@@ -2695,7 +2693,7 @@ static int stat_filename(const char *filename, struct stat *s, unsigned int flag
 	struct inode *inode;
 	struct path path = {};
 
-	ret = filename_lookup(AT_FDCWD, getname(filename), flags, &path);
+	ret = filename_lookup(getname(filename), flags, &path);
 	if (ret)
 		goto out;
 
@@ -2799,7 +2797,7 @@ char *canonicalize_path(const char *pathname)
 	struct path path;
 	int ret;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), LOOKUP_FOLLOW, &path);
+	ret = filename_lookup(getname(pathname), LOOKUP_FOLLOW, &path);
 	if (ret)
 		goto out;
 
@@ -2823,7 +2821,7 @@ int chdir(const char *pathname)
 	struct path path;
 	int ret;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
+	ret = filename_lookup(getname(pathname), LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
 	if (ret)
 		goto out;
 
@@ -2888,7 +2886,7 @@ int mount(const char *device, const char *fsname, const char *pathname,
 	struct path path = {};
 
 	if (d_root) {
-		ret = filename_lookup(AT_FDCWD, getname(pathname), LOOKUP_FOLLOW, &path);
+		ret = filename_lookup(getname(pathname), LOOKUP_FOLLOW, &path);
 		if (ret)
 			goto out;
 
@@ -3001,7 +2999,7 @@ int umount(const char *pathname)
 	struct path path = {};
 	int ret;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), LOOKUP_FOLLOW, &path);
+	ret = filename_lookup(getname(pathname), LOOKUP_FOLLOW, &path);
 	if (ret)
 		return ret;
 
@@ -3074,7 +3072,7 @@ void automount_remove(const char *pathname)
 	struct path path;
 	int ret;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), LOOKUP_FOLLOW, &path);
+	ret = filename_lookup(getname(pathname), LOOKUP_FOLLOW, &path);
 	if (ret)
 		return;
 
@@ -3090,7 +3088,7 @@ int automount_add(const char *pathname, const char *cmd)
 	struct path path;
 	int ret;
 
-	ret = filename_lookup(AT_FDCWD, getname(pathname), LOOKUP_FOLLOW, &path);
+	ret = filename_lookup(getname(pathname), LOOKUP_FOLLOW, &path);
 	if (ret)
 		return ret;
 
@@ -3199,7 +3197,7 @@ static int do_lookup_dentry(int argc, char *argv[])
 	if (argc < 2)
 		return COMMAND_ERROR_USAGE;
 
-	ret = filename_lookup(AT_FDCWD, getname(argv[1]), 0, &path);
+	ret = filename_lookup(getname(argv[1]), 0, &path);
 	if (ret) {
 		printf("Cannot lookup path \"%s\": %s\n",
 		       argv[1], strerror(-ret));
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 8ed7f8a1cdac..9f6e568591af 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -45,8 +45,4 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
 #define LOOKUP_EMPTY		0x4000
 #define LOOKUP_DOWN		0x8000
 
-#define AT_FDCWD                -100    /* Special value used to indicate
-                                           openat should use the current
-                                           working directory. */
-
 #endif /* _LINUX_NAMEI_H */
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 02/30] fs: remove unused struct node_d in struct dir
  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 ` 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
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This struct member is never used, so it can just be dropped.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/dirent.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/dirent.h b/include/dirent.h
index d7b5e78b2728..61a76c5b59b9 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -11,7 +11,6 @@ struct dirent {
 typedef struct dir {
 	struct device_d *dev;
 	struct fs_driver_d *fsdrv;
-	struct node_d *node;
 	struct dirent d;
 	void *priv; /* private data for the fs driver */
 	struct list_head entries;
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 03/30] block : efi: rename driver variable from efi_fs_driver to efi_bio_driver
  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 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 04/30] include: <linux/types.h>: wrap in #ifndef __ASSEMBLY__ Ahmad Fatoum
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Rename the copy-pasted second efi_fs_driver to a more fitting
efi_bio_driver.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/block/efi-block-io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
index 3475615baf93..04234b5ab2d4 100644
--- a/drivers/block/efi-block-io.c
+++ b/drivers/block/efi-block-io.c
@@ -182,11 +182,11 @@ static int efi_bio_probe(struct efi_device *efidev)
 	return 0;
 }
 
-static struct efi_driver efi_fs_driver = {
+static struct efi_driver efi_bio_driver = {
         .driver = {
 		.name  = "efi-block-io",
 	},
         .probe = efi_bio_probe,
 	.guid = EFI_BLOCK_IO_PROTOCOL_GUID,
 };
-device_efi_driver(efi_fs_driver);
+device_efi_driver(efi_bio_driver);
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 04/30] include: <linux/types.h>: wrap in #ifndef __ASSEMBLY__
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (2 preceding siblings ...)
  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 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 05/30] hw_random: stm32: propagate error codes from rng read Ahmad Fatoum
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

While it makes no sense for assembly sources to include <linux/types.h>
directly, it may be included transitively outside of an __ASSEMBLY__
guard, thus wrap it completely in the __ASSEMBLY__ guard, just like
Linux does.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/linux/types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/types.h b/include/linux/types.h
index 5716a4c92fac..dfef336c198b 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -1,5 +1,6 @@
 #ifndef _LINUX_TYPES_H
 #define _LINUX_TYPES_H
+#ifndef __ASSEMBLY__
 
 #include <linux/posix_types.h>
 #include <asm/types.h>
@@ -213,4 +214,5 @@ struct hlist_node {
 	struct hlist_node *next, **pprev;
 };
 
+#endif
 #endif /* _LINUX_TYPES_H */
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 05/30] hw_random: stm32: propagate error codes from rng read
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 04/30] include: <linux/types.h>: wrap in #ifndef __ASSEMBLY__ Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 06/30] efi: align LOAD_FILE_PROTOCOL_GUID's name with other PROTOCOL_GUIDs Ahmad Fatoum
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

len is never decremented, so ret won't ever be returned, fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/hw_random/stm32-rng.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/hw_random/stm32-rng.c b/drivers/hw_random/stm32-rng.c
index 440b53684f71..9b28f37ecd88 100644
--- a/drivers/hw_random/stm32-rng.c
+++ b/drivers/hw_random/stm32-rng.c
@@ -51,7 +51,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait
 		ret = readl_poll_timeout(rng->base + RNG_SR, sr,
 					 sr & RNG_SR_DRDY, 10 * USEC_PER_MSEC);
 		if (ret)
-			goto out;
+			return ret;
 
 		if (sr & (RNG_SR_SEIS | RNG_SR_SECS)) {
 			int i;
@@ -61,8 +61,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait
 				readl(rng->base + RNG_DR);
 			if (readl(rng->base + RNG_SR) & RNG_SR_SEIS) {
 				pr_warn("RNG Noise");
-				ret = -EIO;
-				goto out;
+				return -EIO;
 			}
 
 			/* start again */
@@ -84,8 +83,7 @@ static int stm32_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wait
 		}
 	}
 
-out:
-	return len ?: ret;
+	return len;
 }
 
 static int stm32_rng_init(struct hwrng *hwrng)
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 06/30] efi: align LOAD_FILE_PROTOCOL_GUID's name with other PROTOCOL_GUIDs
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 05/30] hw_random: stm32: propagate error codes from rng read Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 07/30] asm-generic: move sync_caches_for_execution declaration to <asm/cache.h> Ahmad Fatoum
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Convention is to m/EFI_.*_PROTOCOLG_GUID/. Rename LOAD_FILE_PROTOCOL_GUID
for uniformity.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi-guid.c | 2 +-
 include/efi.h     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/efi-guid.c b/common/efi-guid.c
index 2bf2395e8540..fbe96ecd048c 100644
--- a/common/efi-guid.c
+++ b/common/efi-guid.c
@@ -72,7 +72,7 @@ const char *efi_guid_string(efi_guid_t *g)
 	EFI_GUID_STRING(EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID, "Managed Network Service Binding Protocol", "Managed Network Service Binding Protocol");
 	EFI_GUID_STRING(EFI_VLAN_CONFIG_PROTOCOL_GUID, "VlanConfig Protocol", "VlanConfig Protocol");
 	EFI_GUID_STRING(EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID, "HII Config Access Protocol", "HII Config Access 2.1 protocol");
-	EFI_GUID_STRING(LOAD_FILE_PROTOCOL_GUID, "LoadFile Protocol", "EFI 1.0 Load File Protocol");
+	EFI_GUID_STRING(EFI_LOAD_FILE_PROTOCOL_GUID, "LoadFile Protocol", "EFI 1.0 Load File Protocol");
 	EFI_GUID_STRING(EFI_COMPONENT_NAME2_PROTOCOL_GUID, "Component Name2 Protocol", "UEFI 2.0 Component Name2 Protocol");
 	EFI_GUID_STRING(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID_31, "Network Interface Identifier Protocol_31",  "EFI1.1 Network Interface Identifier Protocol");
 	EFI_GUID_STRING(EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID, "Network Interface Identifier Protocol", "EFI Network Interface Identifier Protocol");
diff --git a/include/efi.h b/include/efi.h
index 439803c29437..36452d296dd4 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -485,7 +485,7 @@ extern efi_runtime_services_t *RT;
 #define EFI_HII_CONFIG_ACCESS_PROTOCOL_GUID \
 	EFI_GUID(0x330d4706, 0xf2a0, 0x4e4f, 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85)
 
-#define LOAD_FILE_PROTOCOL_GUID \
+#define EFI_LOAD_FILE_PROTOCOL_GUID \
 	EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
 #define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 07/30] asm-generic: move sync_caches_for_execution declaration to <asm/cache.h>
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (5 preceding siblings ...)
  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 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 08/30] common: move EFI code into new efi/ top level directory Ahmad Fatoum
                   ` (23 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We have three architectures defining sync_caches_for_execution(). Have
them all do so in a header of the same name to allow using it in common
code later on, like in an EFI image loading routine.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/cache.h                     | 3 +++
 arch/kvx/include/asm/cache.h                     | 3 +++
 arch/riscv/include/asm/barebox-riscv.h           | 3 +--
 arch/riscv/include/asm/{cacheflush.h => cache.h} | 9 +++++++--
 arch/riscv/lib/reloc.c                           | 2 +-
 include/asm-generic/cache.h                      | 9 +++++++++
 6 files changed, 24 insertions(+), 5 deletions(-)
 rename arch/riscv/include/asm/{cacheflush.h => cache.h} (59%)
 create mode 100644 include/asm-generic/cache.h

diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h
index bf3a1a0ed291..9ebe80dc89bc 100644
--- a/arch/arm/include/asm/cache.h
+++ b/arch/arm/include/asm/cache.h
@@ -21,6 +21,9 @@ int arm_set_cache_functions(void);
 void arm_early_mmu_cache_flush(void);
 void arm_early_mmu_cache_invalidate(void);
 
+#define sync_caches_for_execution sync_caches_for_execution
 void sync_caches_for_execution(void);
 
+#include <asm-generic/cache.h>
+
 #endif
diff --git a/arch/kvx/include/asm/cache.h b/arch/kvx/include/asm/cache.h
index 0bf3c8f06ef5..72de5d804faa 100644
--- a/arch/kvx/include/asm/cache.h
+++ b/arch/kvx/include/asm/cache.h
@@ -10,6 +10,7 @@
 
 void invalidate_dcache_range(unsigned long addr, unsigned long stop);
 
+#define sync_caches_for_execution sync_caches_for_execution
 static inline void sync_caches_for_execution(void)
 {
 	__builtin_kvx_fence();
@@ -28,4 +29,6 @@ static inline void dcache_inval(void)
 	__builtin_kvx_dinval();
 }
 
+#include <asm-generic/cache.h>
+
 #endif /* __KVX_CACHE_H */
diff --git a/arch/riscv/include/asm/barebox-riscv.h b/arch/riscv/include/asm/barebox-riscv.h
index abb320242769..5c87d37c9eb8 100644
--- a/arch/riscv/include/asm/barebox-riscv.h
+++ b/arch/riscv/include/asm/barebox-riscv.h
@@ -20,6 +20,7 @@
 #include <asm/sections.h>
 #include <asm/barebox-riscv-head.h>
 #include <asm/system.h>
+#include <asm/cache.h>
 
 unsigned long get_runtime_offset(void);
 
@@ -27,8 +28,6 @@ void setup_c(void);
 void relocate_to_current_adr(void);
 void relocate_to_adr(unsigned long target);
 
-void sync_caches_for_execution(void);
-
 void __noreturn __naked barebox_riscv_entry(unsigned long membase, unsigned long memsize,
 					    void *boarddata, unsigned int flags);
 
diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cache.h
similarity index 59%
rename from arch/riscv/include/asm/cacheflush.h
rename to arch/riscv/include/asm/cache.h
index 9ff25740c66b..9a0b9326b22d 100644
--- a/arch/riscv/include/asm/cacheflush.h
+++ b/arch/riscv/include/asm/cache.h
@@ -3,8 +3,8 @@
  * Copyright (C) 2015 Regents of the University of California
  */
 
-#ifndef _ASM_RISCV_CACHEFLUSH_H
-#define _ASM_RISCV_CACHEFLUSH_H
+#ifndef _ASM_RISCV_CACHE_H
+#define _ASM_RISCV_CACHE_H
 
 static inline void local_flush_icache_all(void)
 {
@@ -13,4 +13,9 @@ static inline void local_flush_icache_all(void)
 #endif
 }
 
+#define sync_caches_for_execution sync_caches_for_execution
+void sync_caches_for_execution(void);
+
+#include <asm-generic/cache.h>
+
 #endif /* _ASM_RISCV_CACHEFLUSH_H */
diff --git a/arch/riscv/lib/reloc.c b/arch/riscv/lib/reloc.c
index 479d586afdee..da53c50448d7 100644
--- a/arch/riscv/lib/reloc.c
+++ b/arch/riscv/lib/reloc.c
@@ -5,7 +5,7 @@
 #include <linux/linkage.h>
 #include <asm/sections.h>
 #include <asm/barebox-riscv.h>
-#include <asm/cacheflush.h>
+#include <asm/cache.h>
 #include <debug_ll.h>
 #include <asm-generic/module.h>
 
diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h
new file mode 100644
index 000000000000..a766d835fdd7
--- /dev/null
+++ b/include/asm-generic/cache.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __ASM_GENERIC_CACHE_H_
+
+#ifndef sync_caches_for_execution
+#define sync_caches_for_execution() (void)0
+#endif
+
+#endif
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 08/30] common: move EFI code into new efi/ top level directory
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (6 preceding siblings ...)
  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 ` Ahmad Fatoum
  2021-11-23  8:55   ` Jules Maselbas
  2021-11-22  8:47 ` [PATCH 09/30] serial: efi-stdio: move efi-stdio.h header to central location Ahmad Fatoum
                   ` (22 subsequent siblings)
  30 siblings, 1 reply; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

So far, barebox EFI meant EFI payload support on x86. Upcoming changes
will extend barebox to support EFI payload _and_ loader on ARM64.
Prepare for this by renaming files and directories appropriately, so
it's immediately clear whether a file is about paylaod, loader or common
support.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/Kconfig                                   | 10 ++--------
 common/Makefile                                  |  4 +---
 common/efi/Kconfig                               | 16 ++++++++++++++++
 common/efi/Makefile                              |  9 +++++----
 common/{efi-devicepath.c => efi/devicepath.c}    |  0
 common/{efi-guid.c => efi/guid.c}                |  0
 common/efi/payload/Makefile                      |  6 ++++++
 .../{ => payload}/env-efi/network/eth0-discover  |  0
 common/efi/{efi-image.c => payload/image.c}      |  2 +-
 common/efi/{efi.c => payload/init.c}             |  2 +-
 common/efi/{efi-iomem.c => payload/iomem.c}      |  0
 drivers/efi/Kconfig                              |  1 +
 12 files changed, 33 insertions(+), 17 deletions(-)
 create mode 100644 common/efi/Kconfig
 rename common/{efi-devicepath.c => efi/devicepath.c} (100%)
 rename common/{efi-guid.c => efi/guid.c} (100%)
 create mode 100644 common/efi/payload/Makefile
 rename common/efi/{ => payload}/env-efi/network/eth0-discover (100%)
 rename common/efi/{efi-image.c => payload/image.c} (99%)
 rename common/efi/{efi.c => payload/init.c} (99%)
 rename common/efi/{efi-iomem.c => payload/iomem.c} (100%)

diff --git a/common/Kconfig b/common/Kconfig
index f4120b2083ee..42240ae8411b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -78,14 +78,6 @@ config MENUTREE
 	select GLOB
 	select GLOB_SORT
 
-config EFI_GUID
-	bool
-	help
-	  With this option a table of EFI guids is compiled in.
-
-config EFI_DEVICEPATH
-	bool
-
 config ARCH_DMA_ADDR_T_64BIT
 	bool
 
@@ -1538,6 +1530,8 @@ config COMPILE_TEST
 
 endmenu
 
+source "common/efi/Kconfig"
+
 config HAS_DEBUG_LL
 	bool
 
diff --git a/common/Makefile b/common/Makefile
index 4b45f678c7de..9ed279806a08 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -63,9 +63,7 @@ obj-$(CONFIG_BOOTCHOOSER)	+= bootchooser.o
 obj-$(CONFIG_UIMAGE)		+= image.o uimage.o
 obj-$(CONFIG_FITIMAGE)		+= image-fit.o
 obj-$(CONFIG_MENUTREE)		+= menutree.o
-obj-$(CONFIG_EFI_BOOTUP)	+= efi/
-obj-$(CONFIG_EFI_GUID)		+= efi-guid.o
-obj-$(CONFIG_EFI_DEVICEPATH)	+= efi-devicepath.o
+obj-$(CONFIG_EFI)		+= efi/
 lwl-$(CONFIG_IMD)		+= imd-barebox.o
 obj-$(CONFIG_IMD)		+= imd.o
 obj-y				+= file-list.o
diff --git a/common/efi/Kconfig b/common/efi/Kconfig
new file mode 100644
index 000000000000..a0565854c2f5
--- /dev/null
+++ b/common/efi/Kconfig
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0
+
+menu "EFI (Extensible Firmware Interface) Support"
+
+config EFI
+	bool
+
+config EFI_GUID
+	bool
+	help
+	  With this option a table of EFI guids is compiled in.
+
+config EFI_DEVICEPATH
+	bool
+
+endmenu
diff --git a/common/efi/Makefile b/common/efi/Makefile
index d746fabe2109..1ed5d45c1f5e 100644
--- a/common/efi/Makefile
+++ b/common/efi/Makefile
@@ -1,4 +1,5 @@
-obj-y += efi.o
-obj-y += efi-image.o
-bbenv-y += env-efi
-obj-$(CONFIG_CMD_IOMEM) += efi-iomem.o
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_EFI_BOOTUP)	+= payload/
+obj-$(CONFIG_EFI_GUID)		+= guid.o
+obj-$(CONFIG_EFI_DEVICEPATH)	+= devicepath.o
diff --git a/common/efi-devicepath.c b/common/efi/devicepath.c
similarity index 100%
rename from common/efi-devicepath.c
rename to common/efi/devicepath.c
diff --git a/common/efi-guid.c b/common/efi/guid.c
similarity index 100%
rename from common/efi-guid.c
rename to common/efi/guid.c
diff --git a/common/efi/payload/Makefile b/common/efi/payload/Makefile
new file mode 100644
index 000000000000..bcbdda335f06
--- /dev/null
+++ b/common/efi/payload/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-y += init.o
+obj-y += image.o
+bbenv-y += env-efi
+obj-$(CONFIG_CMD_IOMEM) += iomem.o
diff --git a/common/efi/env-efi/network/eth0-discover b/common/efi/payload/env-efi/network/eth0-discover
similarity index 100%
rename from common/efi/env-efi/network/eth0-discover
rename to common/efi/payload/env-efi/network/eth0-discover
diff --git a/common/efi/efi-image.c b/common/efi/payload/image.c
similarity index 99%
rename from common/efi/efi-image.c
rename to common/efi/payload/image.c
index bd1c58438e84..3c55a457eae3 100644
--- a/common/efi/efi-image.c
+++ b/common/efi/payload/image.c
@@ -1,5 +1,5 @@
 /*
- * efi-image.c - barebox EFI payload support
+ * image.c - barebox EFI payload support
  *
  * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
  *
diff --git a/common/efi/efi.c b/common/efi/payload/init.c
similarity index 99%
rename from common/efi/efi.c
rename to common/efi/payload/init.c
index 7f12342cf91b..88d0bfa939ec 100644
--- a/common/efi/efi.c
+++ b/common/efi/payload/init.c
@@ -1,5 +1,5 @@
 /*
- * efi.c - barebox EFI payload support
+ * init.c - barebox EFI payload support
  *
  * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
  *
diff --git a/common/efi/efi-iomem.c b/common/efi/payload/iomem.c
similarity index 100%
rename from common/efi/efi-iomem.c
rename to common/efi/payload/iomem.c
diff --git a/drivers/efi/Kconfig b/drivers/efi/Kconfig
index dd3ac7525f9f..e8abc2709e26 100644
--- a/drivers/efi/Kconfig
+++ b/drivers/efi/Kconfig
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 config EFI_BOOTUP
 	bool
+	select EFI
 	select BLOCK
 	select PARTITION_DISK
 	select HW_HAS_PCI
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 09/30] serial: efi-stdio: move efi-stdio.h header to central location
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (7 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 08/30] common: move EFI code into new efi/ top level directory Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 10/30] efi: use SPDX-License-Identifier where appropriate Ahmad Fatoum
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 10/30] efi: use SPDX-License-Identifier where appropriate
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (8 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 09/30] serial: efi-stdio: move efi-stdio.h header to central location Ahmad Fatoum
@ 2021-11-22  8:47 ` 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
                   ` (20 subsequent siblings)
  30 siblings, 1 reply; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Couple of files lack an explicit embedded license or cotnain
boilerplate. Replace with the appropriate SPDX-License-Identifier.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/devicepath.c    |  2 ++
 common/efi/guid.c          |  2 ++
 common/efi/payload/image.c | 11 +----------
 common/efi/payload/init.c  | 11 +----------
 include/efi/debug_ll.h     |  1 +
 include/efi/efi-device.h   |  1 +
 include/efi/efi.h          |  1 +
 7 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/common/efi/devicepath.c b/common/efi/devicepath.c
index f17b9294cc1b..6341ca005ba5 100644
--- a/common/efi/devicepath.c
+++ b/common/efi/devicepath.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
 #include <common.h>
 #include <efi.h>
 #include <malloc.h>
diff --git a/common/efi/guid.c b/common/efi/guid.c
index fbe96ecd048c..f1a918f91e19 100644
--- a/common/efi/guid.c
+++ b/common/efi/guid.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
 #include <common.h>
 #include <efi.h>
 
diff --git a/common/efi/payload/image.c b/common/efi/payload/image.c
index 3c55a457eae3..53b444eef60f 100644
--- a/common/efi/payload/image.c
+++ b/common/efi/payload/image.c
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * image.c - barebox EFI payload support
  *
  * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #include <clock.h>
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index 88d0bfa939ec..0e672a6b56d2 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -1,17 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * init.c - barebox EFI payload support
  *
  * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
  */
 
 #include <linux/linkage.h>
diff --git a/include/efi/debug_ll.h b/include/efi/debug_ll.h
index 4ca72de312af..905f1c43cd23 100644
--- a/include/efi/debug_ll.h
+++ b/include/efi/debug_ll.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __MACH_DEBUG_LL_H__
 #define __MACH_DEBUG_LL_H__
 
diff --git a/include/efi/efi-device.h b/include/efi/efi-device.h
index 5ec59a8a2ddd..cd8a374c32fe 100644
--- a/include/efi/efi-device.h
+++ b/include/efi/efi-device.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __EFI_EFI_DEVICE_H
 #define __EFI_EFI_DEVICE_H
 
diff --git a/include/efi/efi.h b/include/efi/efi.h
index 648afb9ec5a7..c7679b4b8f28 100644
--- a/include/efi/efi.h
+++ b/include/efi/efi.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __MACH_EFI_H
 #define __MACH_EFI_H
 
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 11/30] drivers: efi: move Kconfig options to new menu
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (9 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 10/30] efi: use SPDX-License-Identifier where appropriate Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 12/30] efi: factor out errno translation Ahmad Fatoum
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

CONFIG_EFI_BOOTUP isn't really a driver option and we got a new menu now
for all things EFI, so let's move it there.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/x86/Kconfig    |  3 ---
 common/efi/Kconfig  | 10 ++++++++++
 drivers/Kconfig     |  1 -
 drivers/efi/Kconfig |  7 -------
 4 files changed, 10 insertions(+), 11 deletions(-)
 delete mode 100644 drivers/efi/Kconfig

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index bcb44b23f05a..f40b14dddc00 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -47,7 +47,4 @@ config MACH_EFI_GENERIC
 config X86_EFI
 	def_bool y
 	select EFI_BOOTUP
-	select EFI_GUID
-	select EFI_DEVICEPATH
-	select PRINTF_UUID
 	select CLOCKSOURCE_EFI_X86
diff --git a/common/efi/Kconfig b/common/efi/Kconfig
index a0565854c2f5..55939b43d684 100644
--- a/common/efi/Kconfig
+++ b/common/efi/Kconfig
@@ -2,6 +2,16 @@
 
 menu "EFI (Extensible Firmware Interface) Support"
 
+config EFI_BOOTUP
+	bool
+	select EFI
+	select EFI_GUID
+	select EFI_DEVICEPATH
+	select PRINTF_UUID
+	select BLOCK
+	select PARTITION_DISK
+	select HW_HAS_PCI
+
 config EFI
 	bool
 
diff --git a/drivers/Kconfig b/drivers/Kconfig
index dbdf3c06f552..f8d58b0697ba 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -2,7 +2,6 @@
 menu "Drivers"
 
 source "drivers/base/Kconfig"
-source "drivers/efi/Kconfig"
 source "drivers/of/Kconfig"
 source "drivers/aiodev/Kconfig"
 source "drivers/amba/Kconfig"
diff --git a/drivers/efi/Kconfig b/drivers/efi/Kconfig
deleted file mode 100644
index e8abc2709e26..000000000000
--- a/drivers/efi/Kconfig
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-config EFI_BOOTUP
-	bool
-	select EFI
-	select BLOCK
-	select PARTITION_DISK
-	select HW_HAS_PCI
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 12/30] efi: factor out errno translation
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (10 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 11/30] drivers: efi: move Kconfig options to new menu Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 13/30] efi: rename <efi/efi.h> to <efi/efi-payload.h> Ahmad Fatoum
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The errno translation will come in handy for the EFI loader support, so
factor that out.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/Makefile       |  1 +
 common/efi/errno.c        | 90 +++++++++++++++++++++++++++++++++++++++
 common/efi/payload/init.c | 86 -------------------------------------
 include/efi/efi-util.h    | 10 +++++
 include/efi/efi.h         |  5 +--
 5 files changed, 102 insertions(+), 90 deletions(-)
 create mode 100644 common/efi/errno.c
 create mode 100644 include/efi/efi-util.h

diff --git a/common/efi/Makefile b/common/efi/Makefile
index 1ed5d45c1f5e..ed110f5a6899 100644
--- a/common/efi/Makefile
+++ b/common/efi/Makefile
@@ -3,3 +3,4 @@
 obj-$(CONFIG_EFI_BOOTUP)	+= payload/
 obj-$(CONFIG_EFI_GUID)		+= guid.o
 obj-$(CONFIG_EFI_DEVICEPATH)	+= devicepath.o
+obj-y				+= errno.o
diff --git a/common/efi/errno.c b/common/efi/errno.c
new file mode 100644
index 000000000000..3bb68e7781e6
--- /dev/null
+++ b/common/efi/errno.c
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <efi/efi-util.h>
+#include <errno.h>
+
+const char *efi_strerror(efi_status_t err)
+{
+	const char *str;
+
+	switch (err) {
+	case EFI_SUCCESS: str = "Success"; break;
+	case EFI_LOAD_ERROR: str = "Load Error"; break;
+	case EFI_INVALID_PARAMETER: str = "Invalid Parameter"; break;
+	case EFI_UNSUPPORTED: str = "Unsupported"; break;
+	case EFI_BAD_BUFFER_SIZE: str = "Bad Buffer Size"; break;
+	case EFI_BUFFER_TOO_SMALL: str = "Buffer Too Small"; break;
+	case EFI_NOT_READY: str = "Not Ready"; break;
+	case EFI_DEVICE_ERROR: str = "Device Error"; break;
+	case EFI_WRITE_PROTECTED: str = "Write Protected"; break;
+	case EFI_OUT_OF_RESOURCES: str = "Out of Resources"; break;
+	case EFI_VOLUME_CORRUPTED: str = "Volume Corrupt"; break;
+	case EFI_VOLUME_FULL: str = "Volume Full"; break;
+	case EFI_NO_MEDIA: str = "No Media"; break;
+	case EFI_MEDIA_CHANGED: str = "Media changed"; break;
+	case EFI_NOT_FOUND: str = "Not Found"; break;
+	case EFI_ACCESS_DENIED: str = "Access Denied"; break;
+	case EFI_NO_RESPONSE: str = "No Response"; break;
+	case EFI_NO_MAPPING: str = "No mapping"; break;
+	case EFI_TIMEOUT: str = "Time out"; break;
+	case EFI_NOT_STARTED: str = "Not started"; break;
+	case EFI_ALREADY_STARTED: str = "Already started"; break;
+	case EFI_ABORTED: str = "Aborted"; break;
+	case EFI_ICMP_ERROR: str = "ICMP Error"; break;
+	case EFI_TFTP_ERROR: str = "TFTP Error"; break;
+	case EFI_PROTOCOL_ERROR: str = "Protocol Error"; break;
+	case EFI_INCOMPATIBLE_VERSION: str = "Incompatible Version"; break;
+	case EFI_SECURITY_VIOLATION: str = "Security Violation"; break;
+	case EFI_CRC_ERROR: str = "CRC Error"; break;
+	case EFI_END_OF_MEDIA: str = "End of Media"; break;
+	case EFI_END_OF_FILE: str = "End of File"; break;
+	case EFI_INVALID_LANGUAGE: str = "Invalid Language"; break;
+	case EFI_COMPROMISED_DATA: str = "Compromised Data"; break;
+	default: str = "unknown error";
+	}
+
+	return str;
+}
+
+int efi_errno(efi_status_t err)
+{
+	int ret;
+
+	switch (err) {
+	case EFI_SUCCESS: ret = 0; break;
+	case EFI_LOAD_ERROR: ret = EIO; break;
+	case EFI_INVALID_PARAMETER: ret = EINVAL; break;
+	case EFI_UNSUPPORTED: ret = ENOTSUPP; break;
+	case EFI_BAD_BUFFER_SIZE: ret = EINVAL; break;
+	case EFI_BUFFER_TOO_SMALL: ret = EINVAL; break;
+	case EFI_NOT_READY: ret = EAGAIN; break;
+	case EFI_DEVICE_ERROR: ret = EIO; break;
+	case EFI_WRITE_PROTECTED: ret = EROFS; break;
+	case EFI_OUT_OF_RESOURCES: ret = ENOMEM; break;
+	case EFI_VOLUME_CORRUPTED: ret = EIO; break;
+	case EFI_VOLUME_FULL: ret = ENOSPC; break;
+	case EFI_NO_MEDIA: ret = ENOMEDIUM; break;
+	case EFI_MEDIA_CHANGED: ret = ENOMEDIUM; break;
+	case EFI_NOT_FOUND: ret = ENODEV; break;
+	case EFI_ACCESS_DENIED: ret = EACCES; break;
+	case EFI_NO_RESPONSE: ret = ETIMEDOUT; break;
+	case EFI_NO_MAPPING: ret = EINVAL; break;
+	case EFI_TIMEOUT: ret = ETIMEDOUT; break;
+	case EFI_NOT_STARTED: ret = EINVAL; break;
+	case EFI_ALREADY_STARTED: ret = EINVAL; break;
+	case EFI_ABORTED: ret = EINTR; break;
+	case EFI_ICMP_ERROR: ret = EINVAL; break;
+	case EFI_TFTP_ERROR: ret = EINVAL; break;
+	case EFI_PROTOCOL_ERROR: ret = EPROTO; break;
+	case EFI_INCOMPATIBLE_VERSION: ret = EINVAL; break;
+	case EFI_SECURITY_VIOLATION: ret = EINVAL; break;
+	case EFI_CRC_ERROR: ret = EINVAL; break;
+	case EFI_END_OF_MEDIA: ret = EINVAL; break;
+	case EFI_END_OF_FILE: ret = EINVAL; break;
+	case EFI_INVALID_LANGUAGE: ret = EINVAL; break;
+	case EFI_COMPROMISED_DATA: ret = EINVAL; break;
+	default: ret = EINVAL;
+	}
+
+	return ret;
+}
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index 0e672a6b56d2..5149b5b5d0d3 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -163,92 +163,6 @@ static int misc_init(void)
 }
 late_initcall(misc_init);
 
-const char *efi_strerror(efi_status_t err)
-{
-	const char *str;
-
-	switch (err) {
-	case EFI_SUCCESS: str = "Success"; break;
-	case EFI_LOAD_ERROR: str = "Load Error"; break;
-	case EFI_INVALID_PARAMETER: str = "Invalid Parameter"; break;
-	case EFI_UNSUPPORTED: str = "Unsupported"; break;
-	case EFI_BAD_BUFFER_SIZE: str = "Bad Buffer Size"; break;
-	case EFI_BUFFER_TOO_SMALL: str = "Buffer Too Small"; break;
-	case EFI_NOT_READY: str = "Not Ready"; break;
-	case EFI_DEVICE_ERROR: str = "Device Error"; break;
-	case EFI_WRITE_PROTECTED: str = "Write Protected"; break;
-	case EFI_OUT_OF_RESOURCES: str = "Out of Resources"; break;
-	case EFI_VOLUME_CORRUPTED: str = "Volume Corrupt"; break;
-	case EFI_VOLUME_FULL: str = "Volume Full"; break;
-	case EFI_NO_MEDIA: str = "No Media"; break;
-	case EFI_MEDIA_CHANGED: str = "Media changed"; break;
-	case EFI_NOT_FOUND: str = "Not Found"; break;
-	case EFI_ACCESS_DENIED: str = "Access Denied"; break;
-	case EFI_NO_RESPONSE: str = "No Response"; break;
-	case EFI_NO_MAPPING: str = "No mapping"; break;
-	case EFI_TIMEOUT: str = "Time out"; break;
-	case EFI_NOT_STARTED: str = "Not started"; break;
-	case EFI_ALREADY_STARTED: str = "Already started"; break;
-	case EFI_ABORTED: str = "Aborted"; break;
-	case EFI_ICMP_ERROR: str = "ICMP Error"; break;
-	case EFI_TFTP_ERROR: str = "TFTP Error"; break;
-	case EFI_PROTOCOL_ERROR: str = "Protocol Error"; break;
-	case EFI_INCOMPATIBLE_VERSION: str = "Incompatible Version"; break;
-	case EFI_SECURITY_VIOLATION: str = "Security Violation"; break;
-	case EFI_CRC_ERROR: str = "CRC Error"; break;
-	case EFI_END_OF_MEDIA: str = "End of Media"; break;
-	case EFI_END_OF_FILE: str = "End of File"; break;
-	case EFI_INVALID_LANGUAGE: str = "Invalid Language"; break;
-	case EFI_COMPROMISED_DATA: str = "Compromised Data"; break;
-	default: str = "unknown error";
-	}
-
-	return str;
-}
-
-int efi_errno(efi_status_t err)
-{
-	int ret;
-
-	switch (err) {
-	case EFI_SUCCESS: ret = 0; break;
-	case EFI_LOAD_ERROR: ret = EIO; break;
-	case EFI_INVALID_PARAMETER: ret = EINVAL; break;
-	case EFI_UNSUPPORTED: ret = ENOTSUPP; break;
-	case EFI_BAD_BUFFER_SIZE: ret = EINVAL; break;
-	case EFI_BUFFER_TOO_SMALL: ret = EINVAL; break;
-	case EFI_NOT_READY: ret = EAGAIN; break;
-	case EFI_DEVICE_ERROR: ret = EIO; break;
-	case EFI_WRITE_PROTECTED: ret = EROFS; break;
-	case EFI_OUT_OF_RESOURCES: ret = ENOMEM; break;
-	case EFI_VOLUME_CORRUPTED: ret = EIO; break;
-	case EFI_VOLUME_FULL: ret = ENOSPC; break;
-	case EFI_NO_MEDIA: ret = ENOMEDIUM; break;
-	case EFI_MEDIA_CHANGED: ret = ENOMEDIUM; break;
-	case EFI_NOT_FOUND: ret = ENODEV; break;
-	case EFI_ACCESS_DENIED: ret = EACCES; break;
-	case EFI_NO_RESPONSE: ret = ETIMEDOUT; break;
-	case EFI_NO_MAPPING: ret = EINVAL; break;
-	case EFI_TIMEOUT: ret = ETIMEDOUT; break;
-	case EFI_NOT_STARTED: ret = EINVAL; break;
-	case EFI_ALREADY_STARTED: ret = EINVAL; break;
-	case EFI_ABORTED: ret = EINTR; break;
-	case EFI_ICMP_ERROR: ret = EINVAL; break;
-	case EFI_TFTP_ERROR: ret = EINVAL; break;
-	case EFI_PROTOCOL_ERROR: ret = EPROTO; break;
-	case EFI_INCOMPATIBLE_VERSION: ret = EINVAL; break;
-	case EFI_SECURITY_VIOLATION: ret = EINVAL; break;
-	case EFI_CRC_ERROR: ret = EINVAL; break;
-	case EFI_END_OF_MEDIA: ret = EINVAL; break;
-	case EFI_END_OF_FILE: ret = EINVAL; break;
-	case EFI_INVALID_LANGUAGE: ret = EINVAL; break;
-	case EFI_COMPROMISED_DATA: ret = EINVAL; break;
-	default: ret = EINVAL;
-	}
-
-	return ret;
-}
-
 static struct NS16550_plat ns16550_plat = {
 	.clock = 115200 * 16,
 };
diff --git a/include/efi/efi-util.h b/include/efi/efi-util.h
new file mode 100644
index 000000000000..0645af270769
--- /dev/null
+++ b/include/efi/efi-util.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __EFI_UTIL_H
+#define __EFI_UTIL_H
+
+#include <efi.h>
+
+const char *efi_strerror(efi_status_t err);
+int efi_errno(efi_status_t err);
+
+#endif
diff --git a/include/efi/efi.h b/include/efi/efi.h
index c7679b4b8f28..e77b1c5feb52 100644
--- a/include/efi/efi.h
+++ b/include/efi/efi.h
@@ -3,16 +3,13 @@
 #define __MACH_EFI_H
 
 #include <efi.h>
-
-const char *efi_strerror(efi_status_t err);
+#include <efi/efi-util.h>
 
 extern efi_system_table_t *efi_sys_table;
 extern efi_handle_t efi_parent_image;
 extern struct efi_device_path *efi_device_path;
 extern efi_loaded_image_t *efi_loaded_image;
 
-int efi_errno(efi_status_t err);
-
 void *efi_get_variable(char *name, efi_guid_t *vendor, int *var_size);
 
 static inline void *efi_get_global_var(char *name, int *var_size)
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 13/30] efi: rename <efi/efi.h> to <efi/efi-payload.h>
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (11 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 12/30] efi: factor out errno translation Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 14/30] efi: centralize efivarfs_parse_filename Ahmad Fatoum
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The split between <efi.h> and <efi/efi.h> is confusing: The former
contains universal definitions, while the latter contains barebox
utilities on top. To make the distinction clear, rename <efi/efi.h>
to <efi/efi-payload.h> as it's used for EFI payloads.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/payload/image.c           | 2 +-
 common/efi/payload/init.c            | 2 +-
 common/efi/payload/iomem.c           | 2 +-
 drivers/block/efi-block-io.c         | 2 +-
 drivers/bus/acpi.c                   | 3 ++-
 drivers/clocksource/efi.c            | 2 +-
 drivers/clocksource/efi_x86.c        | 2 +-
 drivers/efi/efi-device.c             | 2 +-
 drivers/net/efi-snp.c                | 2 +-
 drivers/pci/pci-efi.c                | 2 +-
 drivers/serial/efi-stdio.c           | 2 +-
 drivers/serial/serial_efi.c          | 2 +-
 drivers/video/efi_gop.c              | 2 +-
 drivers/watchdog/efi_wdt.c           | 2 +-
 fs/efi.c                             | 2 +-
 fs/efivarfs.c                        | 2 +-
 include/efi/debug_ll.h               | 2 +-
 include/efi/{efi.h => efi-payload.h} | 6 +++---
 18 files changed, 21 insertions(+), 20 deletions(-)
 rename include/efi/{efi.h => efi-payload.h} (90%)

diff --git a/common/efi/payload/image.c b/common/efi/payload/image.c
index 53b444eef60f..3bcb8fce2df5 100644
--- a/common/efi/payload/image.c
+++ b/common/efi/payload/image.c
@@ -24,7 +24,7 @@
 #include <libfile.h>
 #include <binfmt.h>
 #include <wchar.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 
 struct linux_kernel_header {
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index 5149b5b5d0d3..e1f968117a01 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -28,7 +28,7 @@
 #include <wchar.h>
 #include <envfs.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <libfile.h>
 #include <state.h>
diff --git a/common/efi/payload/iomem.c b/common/efi/payload/iomem.c
index 4d34328a5802..6b92ca993aa7 100644
--- a/common/efi/payload/iomem.c
+++ b/common/efi/payload/iomem.c
@@ -6,7 +6,7 @@
 #include <common.h>
 #include <init.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <memory.h>
 #include <linux/sizes.h>
 
diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
index 04234b5ab2d4..5fd82296dc54 100644
--- a/drivers/block/efi-block-io.c
+++ b/drivers/block/efi-block-io.c
@@ -13,7 +13,7 @@
 #include <efi.h>
 #include <block.h>
 #include <disks.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <bootsource.h>
 
diff --git a/drivers/bus/acpi.c b/drivers/bus/acpi.c
index 2515b6633b33..efba3f4c1671 100644
--- a/drivers/bus/acpi.c
+++ b/drivers/bus/acpi.c
@@ -6,7 +6,8 @@
 #include <common.h>
 #include <driver.h>
 #include <init.h>
-#include <efi/efi.h>
+#include <efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <acpi.h>
 
diff --git a/drivers/clocksource/efi.c b/drivers/clocksource/efi.c
index 10f75c033ea8..924ab1c34607 100644
--- a/drivers/clocksource/efi.c
+++ b/drivers/clocksource/efi.c
@@ -7,7 +7,7 @@
 #include <driver.h>
 #include <clock.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <linux/err.h>
 
diff --git a/drivers/clocksource/efi_x86.c b/drivers/clocksource/efi_x86.c
index c79862fb990f..75163d6e4774 100644
--- a/drivers/clocksource/efi_x86.c
+++ b/drivers/clocksource/efi_x86.c
@@ -3,7 +3,7 @@
 #include <init.h>
 #include <driver.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <clock.h>
 
 #ifdef __x86_64__
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 25c8eeaf01cb..4c10f419b11e 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -16,7 +16,7 @@
 #include <wchar.h>
 #include <init.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <linux/err.h>
 
diff --git a/drivers/net/efi-snp.c b/drivers/net/efi-snp.c
index def2714bee47..cc34ad5aafa7 100644
--- a/drivers/net/efi-snp.c
+++ b/drivers/net/efi-snp.c
@@ -11,7 +11,7 @@
 #include <net.h>
 #include <init.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 
 struct efi_network_statistics {
diff --git a/drivers/pci/pci-efi.c b/drivers/pci/pci-efi.c
index 846449c4b0e0..c0bcc10044ce 100644
--- a/drivers/pci/pci-efi.c
+++ b/drivers/pci/pci-efi.c
@@ -9,7 +9,7 @@
 #include <init.h>
 #include <xfuncs.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <linux/pci.h>
 
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index d5049dfdadf3..7509f16b86c2 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -13,7 +13,7 @@
 #include <efi.h>
 #include <readkey.h>
 #include <linux/ctype.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <efi/efi-stdio.h>
 
diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c
index 5da90965755b..24a53a9019ba 100644
--- a/drivers/serial/serial_efi.c
+++ b/drivers/serial/serial_efi.c
@@ -8,7 +8,7 @@
 #include <init.h>
 #include <malloc.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 
 /*
diff --git a/drivers/video/efi_gop.c b/drivers/video/efi_gop.c
index 2155ec163fd2..45dc42fa3e55 100644
--- a/drivers/video/efi_gop.c
+++ b/drivers/video/efi_gop.c
@@ -12,7 +12,7 @@
 #include <errno.h>
 #include <gui/graphic_utils.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 
 #define PIXEL_RGB_RESERVED_8BIT_PER_COLOR		0
diff --git a/drivers/watchdog/efi_wdt.c b/drivers/watchdog/efi_wdt.c
index 1512b1d99aae..eb50f24aed57 100644
--- a/drivers/watchdog/efi_wdt.c
+++ b/drivers/watchdog/efi_wdt.c
@@ -7,7 +7,7 @@
 #include <init.h>
 #include <driver.h>
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <watchdog.h>
 
 struct efi_wdt_priv {
diff --git a/fs/efi.c b/fs/efi.c
index edf65179fdbd..ca43cf6c48ab 100644
--- a/fs/efi.c
+++ b/fs/efi.c
@@ -28,7 +28,7 @@
 #include <wchar.h>
 #include <efi.h>
 #include <libfile.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 #include <linux/stddef.h>
 
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index 659716f845f2..01947439ff6c 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -28,7 +28,7 @@
 #include <wchar.h>
 #include <linux/err.h>
 #include <linux/ctype.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 #include <efi/efi-device.h>
 
 struct efivarfs_inode {
diff --git a/include/efi/debug_ll.h b/include/efi/debug_ll.h
index 905f1c43cd23..279e8995f2b3 100644
--- a/include/efi/debug_ll.h
+++ b/include/efi/debug_ll.h
@@ -6,7 +6,7 @@
 #define EFI_DEBUG_CLEAR_MEMORY 0
 
 #include <efi.h>
-#include <efi/efi.h>
+#include <efi/efi-payload.h>
 
 static inline void PUTC_LL(char c)
 {
diff --git a/include/efi/efi.h b/include/efi/efi-payload.h
similarity index 90%
rename from include/efi/efi.h
rename to include/efi/efi-payload.h
index e77b1c5feb52..a2daff08bb3f 100644
--- a/include/efi/efi.h
+++ b/include/efi/efi-payload.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __MACH_EFI_H
-#define __MACH_EFI_H
+#ifndef __EFI_PAYLOAD_H
+#define __EFI_PAYLOAD_H
 
 #include <efi.h>
 #include <efi/efi-util.h>
@@ -21,4 +21,4 @@ int efi_set_variable(char *name, efi_guid_t *vendor, uint32_t attributes,
 		     void *buf, unsigned long size);
 int efi_set_variable_usec(char *name, efi_guid_t *vendor, uint64_t usec);
 
-#endif /* __MACH_EFI_H */
+#endif
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 14/30] efi: centralize efivarfs_parse_filename
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (12 preceding siblings ...)
  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 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 15/30] kbuild: force 16-bit wchar_t treewide Ahmad Fatoum
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Turning an EFI varfs filename into its components will be useful for the
EFI loader as well, so factor that out.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/Makefile          |   2 +-
 common/efi/efivar-filename.c | 116 +++++++++++++++++++++++++++++++++++
 fs/efivarfs.c                |  76 -----------------------
 include/efi/efi-util.h       |   4 ++
 4 files changed, 121 insertions(+), 77 deletions(-)
 create mode 100644 common/efi/efivar-filename.c

diff --git a/common/efi/Makefile b/common/efi/Makefile
index ed110f5a6899..a7cebde4f1b3 100644
--- a/common/efi/Makefile
+++ b/common/efi/Makefile
@@ -3,4 +3,4 @@
 obj-$(CONFIG_EFI_BOOTUP)	+= payload/
 obj-$(CONFIG_EFI_GUID)		+= guid.o
 obj-$(CONFIG_EFI_DEVICEPATH)	+= devicepath.o
-obj-y				+= errno.o
+obj-y				+= errno.o efivar-filename.o
diff --git a/common/efi/efivar-filename.c b/common/efi/efivar-filename.c
new file mode 100644
index 000000000000..51d0130fa774
--- /dev/null
+++ b/common/efi/efivar-filename.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/ctype.h>
+#include <string.h>
+#include <efi/efi-util.h>
+
+static int char_to_nibble(char c)
+{
+	int ret = tolower(c);
+
+	return ret <= '9' ? ret - '0' : ret - 'a' + 10;
+}
+
+static int read_byte_str(const char *str, u8 *out)
+{
+	if (!isxdigit(*str) || !isxdigit(*(str + 1)))
+		return -EINVAL;
+
+	*out = (char_to_nibble(*str) << 4) | char_to_nibble(*(str + 1));
+
+	return 0;
+}
+
+static int efi_guid_parse(const char *str, efi_guid_t *guid)
+{
+	int i, ret;
+	u8 idx[] = { 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15 };
+
+	for (i = 0; i < 16; i++) {
+		ret = read_byte_str(str, &guid->b[idx[i]]);
+		if (ret)
+			return ret;
+		str += 2;
+
+		switch (i) {
+		case 3:
+		case 5:
+		case 7:
+		case 9:
+			if (*str != '-')
+				return -EINVAL;
+			str++;
+			break;
+		}
+	}
+
+	return 0;
+}
+
+
+int __efivarfs_parse_filename(const char *filename, efi_guid_t *vendor,
+			      s16 *name, size_t *namelen)
+{
+	int len, ret;
+	const char *guidstr;
+	int i;
+
+	len = strlen(filename);
+
+	if (len < sizeof("-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"))
+		return -EINVAL;
+
+	guidstr = filename + len - sizeof("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
+	if (*guidstr != '-' || guidstr == filename)
+		return -EINVAL;
+
+	guidstr++;
+
+	ret = efi_guid_parse(guidstr, vendor);
+	if (ret)
+		return ret;
+
+	if (guidstr - filename > *namelen)
+		ret = -EFBIG;
+
+	*namelen = guidstr - filename;
+
+	if (ret)
+		return ret;
+
+	for (i = 0; i < *namelen - 1; i++)
+		name[i] = filename[i];
+
+	name[i] = L'\0';
+
+	return 0;
+}
+
+int efivarfs_parse_filename(const char *filename, efi_guid_t *vendor,
+			    s16 **name)
+{
+	int ret;
+	s16 *varname;
+	size_t namelen = 0;
+	int i;
+
+	if (*filename == '/')
+		filename++;
+
+	ret = __efivarfs_parse_filename(filename, vendor, NULL, &namelen);
+	if (ret != -EFBIG)
+		return ret;
+
+	varname = xzalloc(namelen * sizeof(s16));
+
+	for (i = 0; i < namelen - 1; i++)
+		varname[i] = filename[i];
+
+	varname[i] = L'\0';
+
+	*name = varname;
+
+	return 0;
+}
+
+
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index 01947439ff6c..2e72bb885265 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -47,82 +47,6 @@ struct efivarfs_priv {
 	struct list_head inodes;
 };
 
-static int char_to_nibble(char c)
-{
-	int ret = tolower(c);
-
-	return ret <= '9' ? ret - '0' : ret - 'a' + 10;
-}
-
-static int read_byte_str(const char *str, u8 *out)
-{
-	if (!isxdigit(*str) || !isxdigit(*(str + 1)))
-		return -EINVAL;
-
-	*out = (char_to_nibble(*str) << 4) | char_to_nibble(*(str + 1));
-
-	return 0;
-}
-
-static int efi_guid_parse(const char *str, efi_guid_t *guid)
-{
-	int i, ret;
-	u8 idx[] = { 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15 };
-
-	for (i = 0; i < 16; i++) {
-		ret = read_byte_str(str, &guid->b[idx[i]]);
-		if (ret)
-			return ret;
-		str += 2;
-
-		switch (i) {
-		case 3:
-		case 5:
-		case 7:
-		case 9:
-			if (*str != '-')
-				return -EINVAL;
-			str++;
-			break;
-		}
-	}
-
-	return 0;
-}
-
-static int efivarfs_parse_filename(const char *filename, efi_guid_t *vendor, s16 **name)
-{
-	int len, ret;
-	const char *guidstr;
-	s16 *varname;
-	int i;
-
-	if (*filename == '/')
-		filename++;
-
-	len = strlen(filename);
-
-	if (len < sizeof("-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"))
-		return -EINVAL;
-
-	guidstr = filename + len - sizeof("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
-	if (*guidstr != '-')
-		return -EINVAL;
-
-	guidstr++;
-
-	ret = efi_guid_parse(guidstr, vendor);
-
-	varname = xzalloc((guidstr - filename) * sizeof(s16));
-
-	for (i = 0; i < guidstr - filename - 1; i++)
-		varname[i] = filename[i];
-
-	*name = varname;
-
-	return 0;
-}
-
 static int efivars_create(struct device_d *dev, const char *pathname, mode_t mode)
 {
 	struct efivarfs_priv *priv = dev->priv;
diff --git a/include/efi/efi-util.h b/include/efi/efi-util.h
index 0645af270769..78e352456ad1 100644
--- a/include/efi/efi-util.h
+++ b/include/efi/efi-util.h
@@ -7,4 +7,8 @@
 const char *efi_strerror(efi_status_t err);
 int efi_errno(efi_status_t err);
 
+int __efivarfs_parse_filename(const char *filename, efi_guid_t *vendor,
+			      s16 *name, size_t *namelen);
+int efivarfs_parse_filename(const char *filename, efi_guid_t *vendor, s16 **name);
+
 #endif
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 15/30] kbuild: force 16-bit wchar_t treewide
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (13 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 14/30] efi: centralize efivarfs_parse_filename Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 16/30] include: <linux/nls.h>: remove duplicate wchar_t typedef Ahmad Fatoum
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

-fshort-wchar ensures L"" expands to code units of 16-bit each. We
already enforce this on x86, but as a small step towards ARM and
RISC-V EFI support in barebox, enable it globally. We already treat
wchar_t as 16-bit everywhere where it's used (It's typedef'ed in
<linux/nls.h> and <linux/stddef.h>.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Makefile          | 2 +-
 arch/x86/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 77edecd1f72f..2e4c60d55ab2 100644
--- a/Makefile
+++ b/Makefile
@@ -440,7 +440,7 @@ LINUXINCLUDE    := -Iinclude -I$(srctree)/dts/include \
 KBUILD_CPPFLAGS        := -D__KERNEL__ -D__BAREBOX__ $(LINUXINCLUDE) -fno-builtin -ffreestanding
 
 KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-		   -fno-strict-aliasing -fno-common \
+		   -fno-strict-aliasing -fno-common -fshort-wchar \
                    -Werror=implicit-function-declaration -Werror=implicit-int \
                    -Os -pipe -Wmissing-prototypes -std=gnu89
 KBUILD_AFLAGS          := -D__ASSEMBLY__
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 53cbd5088117..a0ce8c17f181 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -5,7 +5,7 @@ KBUILD_CPPFLAGS += -D__X86__
 TEXT_BASE = $(CONFIG_TEXT_BASE)
 
 machine-y := efi
-KBUILD_CFLAGS += -fpic -fshort-wchar -mno-sse -mno-mmx
+KBUILD_CFLAGS += -fpic -mno-sse -mno-mmx
 ifeq ($(CONFIG_X86_32),y)
 	TARGET = efi-app-ia32
 else
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 16/30] include: <linux/nls.h>: remove duplicate wchar_t typedef
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (14 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 15/30] kbuild: force 16-bit wchar_t treewide Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 17/30] lib: wchar: add wctomb and mbtowc Ahmad Fatoum
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We already define it in <linux/stddef.h> as typedef of an unsigned
short.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/linux/nls.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/nls.h b/include/linux/nls.h
index 62fb7b5a970b..ee0e1ffd5888 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -2,6 +2,8 @@
 #ifndef _LINUX_NLS_H
 #define _LINUX_NLS_H
 
+#include <linux/stddef.h>
+
 /* Unicode has changed over the years.  Unicode code points no longer
  * fit into 16 bits; as of Unicode 5 valid code points range from 0
  * to 0x10ffff (17 planes, where each plane holds 65536 code points).
@@ -14,7 +16,6 @@
  */
 
 /* Plane-0 Unicode character */
-typedef u16 wchar_t;
 #define MAX_WCHAR_T	0xffff
 
 /* Arbitrary Unicode character */
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 17/30] lib: wchar: add wctomb and mbtowc
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (15 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 16/30] include: <linux/nls.h>: remove duplicate wchar_t typedef Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 18/30] lib: implement wcsnlen Ahmad Fatoum
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We currently convert wchar_t to char by truncating to 8-bit.
In future, we may want to do UTF-16 to UTF-8 conversion.
Prepare for this by wrapping each conversion direction in a function.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/wchar.h |  5 +++++
 lib/wchar.c     | 22 ++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/include/wchar.h b/include/wchar.h
index b601cc62079b..fb9b127a8c04 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -17,4 +17,9 @@ char *strdup_wchar_to_char(const wchar_t *src);
 
 size_t wcslen(const wchar_t *s);
 
+#define MB_CUR_MAX 4
+
+int mbtowc(wchar_t *pwc, const char *s, size_t n);
+int wctomb(char *s, wchar_t wc);
+
 #endif /* __WCHAR_H */
diff --git a/lib/wchar.c b/lib/wchar.c
index 4d49431e8653..3be228b5a77a 100644
--- a/lib/wchar.c
+++ b/lib/wchar.c
@@ -44,12 +44,30 @@ wchar_t *strdup_wchar(const wchar_t *src)
 	return tmp;
 }
 
+int mbtowc(wchar_t *pwc, const char *s, size_t n)
+{
+	if (!s)
+		return 0; /* we don't mantain a non-trivial shift state */
+
+	if (n < 1)
+		return -1;
+
+	*pwc = *s;
+	return 1;
+}
+
+int wctomb(char *s, wchar_t wc)
+{
+	*s = wc & 0xFF;
+	return 1;
+}
+
 char *strcpy_wchar_to_char(char *dst, const wchar_t *src)
 {
 	char *ret = dst;
 
 	while (*src)
-		*dst++ = *src++ & 0xff;
+		wctomb(dst++, *src++);
 
 	*dst = 0;
 
@@ -61,7 +79,7 @@ wchar_t *strcpy_char_to_wchar(wchar_t *dst, const char *src)
 	wchar_t *ret = dst;
 
 	while (*src)
-		*dst++ = *src++;
+		mbtowc(dst++, src++, 1);
 
 	*dst = 0;
 
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 18/30] lib: implement wcsnlen
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (16 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 17/30] lib: wchar: add wctomb and mbtowc Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 19/30] vsprintf: add optional support for %ls format modifier Ahmad Fatoum
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This will come in handy for implementing %ls in the follow up commit.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/wchar.h | 2 ++
 lib/wchar.c     | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/wchar.h b/include/wchar.h
index fb9b127a8c04..392211039a61 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -17,6 +17,8 @@ char *strdup_wchar_to_char(const wchar_t *src);
 
 size_t wcslen(const wchar_t *s);
 
+size_t wcsnlen(const wchar_t *s, size_t maxlen);
+
 #define MB_CUR_MAX 4
 
 int mbtowc(wchar_t *pwc, const char *s, size_t n);
diff --git a/lib/wchar.c b/lib/wchar.c
index 3be228b5a77a..250538dd8511 100644
--- a/lib/wchar.c
+++ b/lib/wchar.c
@@ -28,6 +28,15 @@ size_t wcslen(const wchar_t *s)
 	return len;
 }
 
+size_t wcsnlen(const wchar_t * s, size_t count)
+{
+	const wchar_t *sc;
+
+	for (sc = s; count-- && *sc != L'\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+
 wchar_t *strdup_wchar(const wchar_t *src)
 {
 	int len = wcslen(src);
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 19/30] vsprintf: add optional support for %ls format modifier
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (17 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 18/30] lib: implement wcsnlen Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 20/30] libfile: null-terminate read_file of wchar_t buffer Ahmad Fatoum
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Incoming EFI loader support will deal a lot with wide strings, so it
makes sense to have printf directly support printing it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/Kconfig |  1 +
 lib/Kconfig        |  3 +++
 lib/vsprintf.c     | 67 +++++++++++++++++++++++++++++++++++++---------
 3 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/common/efi/Kconfig b/common/efi/Kconfig
index 55939b43d684..b4d94f739ce4 100644
--- a/common/efi/Kconfig
+++ b/common/efi/Kconfig
@@ -8,6 +8,7 @@ config EFI_BOOTUP
 	select EFI_GUID
 	select EFI_DEVICEPATH
 	select PRINTF_UUID
+	select PRINTF_WCHAR
 	select BLOCK
 	select PARTITION_DISK
 	select HW_HAS_PCI
diff --git a/lib/Kconfig b/lib/Kconfig
index ea6de76a22f9..718033e56e64 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -163,6 +163,9 @@ config PROGRESS_NOTIFIER
 config PRINTF_UUID
 	bool
 
+config PRINTF_WCHAR
+	bool
+
 config GENERIC_LIB_ASHLDI3
 	bool
 
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 237aab0c02a1..85147e8d2e25 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -16,8 +16,10 @@
 #include <linux/math64.h>
 #include <malloc.h>
 #include <kallsyms.h>
+#include <wchar.h>
 
 #include <common.h>
+#include <pbl.h>
 
 /* we use this so that we can do without the ctype library */
 #define is_digit(c)	((c) >= '0' && (c) <= '9')
@@ -147,6 +149,32 @@ static char *number(char *buf, const char *end, unsigned long long num, int base
 #define PAGE_SIZE 4096
 #endif
 
+static char *leading_spaces(char *buf, const char *end,
+			    int len, int *field_width, int flags)
+{
+	if (!(flags & LEFT)) {
+		while (len < *field_width--) {
+			if (buf < end)
+				*buf = ' ';
+			++buf;
+		}
+	}
+
+	return buf;
+}
+
+static char *trailing_spaces(char *buf, const char *end,
+			     int len, int *field_width, int flags)
+{
+	while (len < *field_width--) {
+		if (buf < end)
+			*buf = ' ';
+		++buf;
+	}
+
+	return buf;
+}
+
 static char *string(char *buf, const char *end, const char *s, int field_width,
 		    int precision, int flags)
 {
@@ -156,25 +184,35 @@ static char *string(char *buf, const char *end, const char *s, int field_width,
 		s = "<NULL>";
 
 	len = strnlen(s, precision);
+	buf = leading_spaces(buf, end, len, &field_width, flags);
 
-	if (!(flags & LEFT)) {
-		while (len < field_width--) {
-			if (buf < end)
-				*buf = ' ';
-			++buf;
-		}
-	}
 	for (i = 0; i < len; ++i) {
 		if (buf < end)
 			*buf = *s;
 		++buf; ++s;
 	}
-	while (len < field_width--) {
+
+	return trailing_spaces(buf, end, len, &field_width, flags);
+}
+
+static char *wstring(char *buf, const char *end, const wchar_t *s, int field_width,
+		     int precision, int flags)
+{
+	int len, i;
+
+	if ((unsigned long)s < PAGE_SIZE)
+		s = L"<NULL>";
+
+	len = wcsnlen(s, precision);
+	leading_spaces(buf, end, len, &field_width, flags);
+
+	for (i = 0; i < len; ++i) {
 		if (buf < end)
-			*buf = ' ';
-		++buf;
+			wctomb(buf, *s);
+		++buf; ++s;
 	}
-	return buf;
+
+	return trailing_spaces(buf, end, len, &field_width, flags);
 }
 
 static char *raw_pointer(char *buf, const char *end, const void *ptr, int field_width,
@@ -528,7 +566,12 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
 				continue;
 
 			case 's':
-				str = string(str, end, va_arg(args, char *), field_width, precision, flags);
+				if (IS_ENABLED(CONFIG_PRINTF_WCHAR) && !IN_PBL && qualifier == 'l')
+					str = wstring(str, end, va_arg(args, wchar_t *),
+						      field_width, precision, flags);
+				else
+					str = string(str, end, va_arg(args, char *),
+						     field_width, precision, flags);
 				continue;
 
 			case 'p':
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 20/30] libfile: null-terminate read_file of wchar_t buffer
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (18 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 19/30] vsprintf: add optional support for %ls format modifier Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 21/30] commands: echo: add wide file output via wecho alias Ahmad Fatoum
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

read_file always nul-terminates the buffer, which is useful when
slurping ASCII text into a variable. This doesn't work as well for
UCS-2, because we need two aligned nuls there. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 lib/libfile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/libfile.c b/lib/libfile.c
index 40b1d8bb2717..6b373f05ca72 100644
--- a/lib/libfile.c
+++ b/lib/libfile.c
@@ -213,7 +213,8 @@ again:
 		goto again;
 	}
 
-	buf = calloc(read_size + 1, 1);
+	/* ensure wchar_t nul termination */
+	buf = calloc(ALIGN(read_size, 2) + 2, 1);
 	if (!buf) {
 		ret = -ENOMEM;
 		errno = ENOMEM;
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 21/30] commands: echo: add wide file output via wecho alias
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (19 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 20/30] libfile: null-terminate read_file of wchar_t buffer Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 22/30] efi: make efi_main __noreturn Ahmad Fatoum
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For interacting with EFI, it can be useful to write UCS-2 files from the
shell. Add an optional wecho alias to facilitate this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/echo.c | 55 +++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 51 insertions(+), 4 deletions(-)

diff --git a/commands/echo.c b/commands/echo.c
index 99575b4c0c35..572b852ea32a 100644
--- a/commands/echo.c
+++ b/commands/echo.c
@@ -10,6 +10,40 @@
 #include <errno.h>
 #include <libbb.h>
 
+static void echo_dputc(int fd, char c, bool wide)
+{
+	wchar_t wc;
+	int n;
+
+	if (!wide || fd == 1 || fd == 2) {
+		dputc(fd, c);
+		return;
+	}
+
+	n = mbtowc(&wc, &c, 1);
+	if (n < 0)
+		return;
+
+	write(fd, &wc, sizeof(wchar_t));
+}
+
+static void echo_dputs(int fd, const char *s, bool wide)
+{
+	wchar_t *ws;
+
+	if (!wide || fd == 1 || fd == 2) {
+		dputs(fd, s);
+		return;
+	}
+
+	ws = strdup_char_to_wchar(s);
+	if (!ws)
+		return;
+
+	write(fd, ws, wcslen(ws) * sizeof(wchar_t));
+	free(ws);
+}
+
 static int do_echo(int argc, char *argv[])
 {
 	int i, optind = 1;
@@ -18,6 +52,10 @@ static int do_echo(int argc, char *argv[])
 	int oflags = O_WRONLY | O_CREAT;
 	char str[CONFIG_CBSIZE];
 	int process_escape = 0;
+	bool wide = false;
+
+	if (IS_ENABLED(CONFIG_PRINTF_WCHAR) && *argv[0] == 'w')
+		wide = true;
 
 	/* We can't use getopt() here because we want to
 	 * echo all things we don't understand.
@@ -66,18 +104,22 @@ exit_parse:
 	}
 
 	for (i = optind; i < argc; i++) {
+		const char *out;
+
 		if (i > optind)
-			dputc(fd, ' ');
+			echo_dputc(fd, ' ', wide);
 		if (process_escape) {
 			process_escape_sequence(argv[i], str, CONFIG_CBSIZE);
-			dputs(fd, str);
+			out = str;
 		} else {
-			dputs(fd, argv[i]);
+			out = argv[i];
 		}
+
+		echo_dputs(fd, out, wide);
 	}
 
 	if (newline)
-		dputc(fd, '\n');
+		echo_dputc(fd, '\n', wide);
 
 	if (file)
 		close(fd);
@@ -99,8 +141,13 @@ BAREBOX_CMD_HELP_OPT ("-a FILE", "append to FILE instead of using stdout")
 BAREBOX_CMD_HELP_OPT ("-o FILE", "overwrite FILE instead of using stdout")
 BAREBOX_CMD_HELP_END
 
+static __maybe_unused const char * const echo_aliases[] = { "wecho", NULL};
+
 BAREBOX_CMD_START(echo)
 	.cmd		= do_echo,
+#ifdef CONFIG_PRINTF_WCHAR
+	.aliases	= echo_aliases,
+#endif
 	BAREBOX_CMD_DESC("echo args to console")
 	BAREBOX_CMD_OPTS("[-neao] STRING")
 	BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 22/30] efi: make efi_main __noreturn
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (20 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 21/30] commands: echo: add wide file output via wecho alias Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 23/30] efi: define and use new EFI_ERROR_MASK macro Ahmad Fatoum
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The function never returns, so mark it as such.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/payload/init.c | 6 +-----
 include/efi.h             | 2 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index e1f968117a01..d8a43e88856c 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -221,12 +221,10 @@ static int efi_init(void)
 }
 device_initcall(efi_init);
 
-asmlinkage efi_status_t efi_main(efi_handle_t, efi_system_table_t *);
-
 /**
  * efi-main - Entry point for EFI images
  */
-efi_status_t efi_main(efi_handle_t image, efi_system_table_t *sys_table)
+void efi_main(efi_handle_t image, efi_system_table_t *sys_table)
 {
 	efi_physical_addr_t mem;
 	size_t memsize;
@@ -266,8 +264,6 @@ efi_status_t efi_main(efi_handle_t image, efi_system_table_t *sys_table)
 	mem_malloc_init((void *)mem, (void *)mem + memsize - 1);
 
 	start_barebox();
-
-	return EFI_SUCCESS;
 }
 
 static int efi_core_init(void)
diff --git a/include/efi.h b/include/efi.h
index 36452d296dd4..51382f5bfea0 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -591,6 +591,8 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
 	return memcmp(&left, &right, sizeof (efi_guid_t));
 }
 
+__attribute__((noreturn)) void efi_main(efi_handle_t, efi_system_table_t *);
+
 /*
  * Variable Attributes
  */
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 23/30] efi: define and use new EFI_ERROR_MASK macro
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (21 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 22/30] efi: make efi_main __noreturn Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 24/30] common: move CONFIG_ELF into General Settings Ahmad Fatoum
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Future code may want to differentiate between warnings and errors, so
add a new macro for the error mask and use it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/efi.h | 67 +++++++++++++++++++++++++++------------------------
 1 file changed, 35 insertions(+), 32 deletions(-)

diff --git a/include/efi.h b/include/efi.h
index 51382f5bfea0..c20e7ad2b53a 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -23,38 +23,41 @@
 
 struct efi_device_path;
 
-#define EFI_SUCCESS                             0
-#define EFI_LOAD_ERROR                  ( 1 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_INVALID_PARAMETER           ( 2 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_UNSUPPORTED                 ( 3 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_BAD_BUFFER_SIZE             ( 4 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_BUFFER_TOO_SMALL            ( 5 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NOT_READY                   ( 6 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_DEVICE_ERROR                ( 7 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_WRITE_PROTECTED             ( 8 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_OUT_OF_RESOURCES            ( 9 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_VOLUME_CORRUPTED            ( 10 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_VOLUME_FULL                 ( 11 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NO_MEDIA                    ( 12 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_MEDIA_CHANGED               ( 13 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NOT_FOUND                   ( 14 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ACCESS_DENIED               ( 15 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NO_RESPONSE                 ( 16 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NO_MAPPING                  ( 17 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_TIMEOUT                     ( 18 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_NOT_STARTED                 ( 19 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ALREADY_STARTED             ( 20 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ABORTED                     ( 21 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_ICMP_ERROR                  ( 22 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_TFTP_ERROR                  ( 23 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_PROTOCOL_ERROR              ( 24 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_INCOMPATIBLE_VERSION        ( 25 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_SECURITY_VIOLATION          ( 26 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_CRC_ERROR                   ( 27 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_END_OF_MEDIA                ( 28 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_END_OF_FILE                 ( 31 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_INVALID_LANGUAGE            ( 32 | (1UL << (BITS_PER_LONG-1)))
-#define EFI_COMPROMISED_DATA            ( 33 | (1UL << (BITS_PER_LONG-1)))
+/* Bit mask for EFI status code with error */
+#define EFI_ERROR_MASK (1UL << (BITS_PER_LONG-1))
+
+#define EFI_SUCCESS                       0
+#define EFI_LOAD_ERROR                  ( 1 | EFI_ERROR_MASK)
+#define EFI_INVALID_PARAMETER           ( 2 | EFI_ERROR_MASK)
+#define EFI_UNSUPPORTED                 ( 3 | EFI_ERROR_MASK)
+#define EFI_BAD_BUFFER_SIZE             ( 4 | EFI_ERROR_MASK)
+#define EFI_BUFFER_TOO_SMALL            ( 5 | EFI_ERROR_MASK)
+#define EFI_NOT_READY                   ( 6 | EFI_ERROR_MASK)
+#define EFI_DEVICE_ERROR                ( 7 | EFI_ERROR_MASK)
+#define EFI_WRITE_PROTECTED             ( 8 | EFI_ERROR_MASK)
+#define EFI_OUT_OF_RESOURCES            ( 9 | EFI_ERROR_MASK)
+#define EFI_VOLUME_CORRUPTED            (10 | EFI_ERROR_MASK)
+#define EFI_VOLUME_FULL                 (11 | EFI_ERROR_MASK)
+#define EFI_NO_MEDIA                    (12 | EFI_ERROR_MASK)
+#define EFI_MEDIA_CHANGED               (13 | EFI_ERROR_MASK)
+#define EFI_NOT_FOUND                   (14 | EFI_ERROR_MASK)
+#define EFI_ACCESS_DENIED               (15 | EFI_ERROR_MASK)
+#define EFI_NO_RESPONSE                 (16 | EFI_ERROR_MASK)
+#define EFI_NO_MAPPING                  (17 | EFI_ERROR_MASK)
+#define EFI_TIMEOUT                     (18 | EFI_ERROR_MASK)
+#define EFI_NOT_STARTED                 (19 | EFI_ERROR_MASK)
+#define EFI_ALREADY_STARTED             (20 | EFI_ERROR_MASK)
+#define EFI_ABORTED                     (21 | EFI_ERROR_MASK)
+#define EFI_ICMP_ERROR                  (22 | EFI_ERROR_MASK)
+#define EFI_TFTP_ERROR                  (23 | EFI_ERROR_MASK)
+#define EFI_PROTOCOL_ERROR              (24 | EFI_ERROR_MASK)
+#define EFI_INCOMPATIBLE_VERSION        (25 | EFI_ERROR_MASK)
+#define EFI_SECURITY_VIOLATION          (26 | EFI_ERROR_MASK)
+#define EFI_CRC_ERROR                   (27 | EFI_ERROR_MASK)
+#define EFI_END_OF_MEDIA                (28 | EFI_ERROR_MASK)
+#define EFI_END_OF_FILE                 (31 | EFI_ERROR_MASK)
+#define EFI_INVALID_LANGUAGE            (32 | EFI_ERROR_MASK)
+#define EFI_COMPROMISED_DATA            (33 | EFI_ERROR_MASK)
 
 #define EFI_ERROR(a)	(((signed long) a) < 0)
 
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 24/30] common: move CONFIG_ELF into General Settings
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (22 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 23/30] efi: define and use new EFI_ERROR_MASK macro Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 25/30] efi: don't zero executable buffer before freeing Ahmad Fatoum
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Currently, when ELF prompt is visible, it's shown top level in the
menuconfig. Move it to the General Settings menu instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/Kconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 42240ae8411b..77410c958b4c 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -43,9 +43,6 @@ config USE_COMPRESSED_DTB
 	select UNCOMPRESS
 	select LZO_DECOMPRESS
 
-config ELF
-	bool "ELF Support" if COMPILE_TEST
-
 config FILETYPE
 	bool
 
@@ -608,6 +605,9 @@ config BOOTM_AIMAGE
 	help
 	  Support using Android Images.
 
+config ELF
+	bool "ELF Support" if COMPILE_TEST
+
 config BOOTM_ELF
 	bool
 	depends on BOOTM
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 25/30] efi: don't zero executable buffer before freeing
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (23 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 24/30] common: move CONFIG_ELF into General Settings Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 26/30] partitions: efi: move header to central location Ahmad Fatoum
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

For security, it sometimes makes sense to zero memory before freeing.
This is not the case here, so remove the memset.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/payload/image.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/common/efi/payload/image.c b/common/efi/payload/image.c
index 3bcb8fce2df5..c1206cd6e211 100644
--- a/common/efi/payload/image.c
+++ b/common/efi/payload/image.c
@@ -106,7 +106,6 @@ static int efi_load_image(const char *file, efi_loaded_image_t **loaded_image,
 
 	*h = handle;
 out:
-	memset(exe, 0, size);
 	free(exe);
 	return -efi_errno(efiret);
 }
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 26/30] partitions: efi: move header to central location
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (24 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 25/30] efi: don't zero executable buffer before freeing Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 27/30] efi: print early efi_main string on CONFIG_DEBUG_LL=y Ahmad Fatoum
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The header contains GUIDs and definitions that will become applicable outside
of the GPT partition parser as well, so move them out.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/partitions/efi.c                            | 2 +-
 common/partitions/efi.h => include/efi/partition.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename common/partitions/efi.h => include/efi/partition.h (100%)

diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index 135b08901a5c..6d811bfb3b01 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -19,7 +19,7 @@
 #include <crc.h>
 #include <linux/ctype.h>
 
-#include "efi.h"
+#include <efi/partition.h>
 #include "parser.h"
 
 static const int force_gpt = IS_ENABLED(CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE);
diff --git a/common/partitions/efi.h b/include/efi/partition.h
similarity index 100%
rename from common/partitions/efi.h
rename to include/efi/partition.h
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 27/30] efi: print early efi_main string on CONFIG_DEBUG_LL=y
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (25 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 26/30] partitions: efi: move header to central location Ahmad Fatoum
@ 2021-11-22  8:47 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 28/30] ARM64: board-dt-2nd: remove no longer needed noinline function split Ahmad Fatoum
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Similarly to how DEBUG_LL on non-EFI platforms often prints a >, make it
print L"barebox" as well on start of execution.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/payload/init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
index d8a43e88856c..6db6b2389540 100644
--- a/common/efi/payload/init.c
+++ b/common/efi/payload/init.c
@@ -5,6 +5,10 @@
  * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
  */
 
+#ifdef CONFIG_DEBUG_LL
+#define DEBUG
+#endif
+
 #include <linux/linkage.h>
 #include <common.h>
 #include <linux/sizes.h>
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 28/30] ARM64: board-dt-2nd: remove no longer needed noinline function split
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (26 preceding siblings ...)
  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 ` Ahmad Fatoum
  2021-11-22  8:47 ` [PATCH 29/30] bus: acpi: register bus even if without ACPI EFI table Ahmad Fatoum
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

dt_2nd_aarch64 is called with stack already set up, so no need to split
the entry point into a stackless and stackful part.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/board-dt-2nd.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/arch/arm/cpu/board-dt-2nd.c b/arch/arm/cpu/board-dt-2nd.c
index 6f6f53591844..0731aecd1a51 100644
--- a/arch/arm/cpu/board-dt-2nd.c
+++ b/arch/arm/cpu/board-dt-2nd.c
@@ -12,29 +12,24 @@
 
 #ifdef CONFIG_CPU_V8
 
-static noinline void dt_2nd_continue_aarch64(void *fdt)
-{
-	unsigned long membase, memsize;
-
-	if (!fdt)
-		hang();
-
-	fdt_find_mem(fdt, &membase, &memsize);
-
-	barebox_arm_entry(membase, memsize, fdt);
-}
-
 /* called from assembly */
 void dt_2nd_aarch64(void *fdt);
 
 void dt_2nd_aarch64(void *fdt)
 {
+	unsigned long membase, memsize;
+
 	/* entry point already set up stack */
 
 	relocate_to_current_adr();
 	setup_c();
 
-	dt_2nd_continue_aarch64(fdt);
+	if (!fdt)
+		hang();
+
+	fdt_find_mem(fdt, &membase, &memsize);
+
+	barebox_arm_entry(membase, memsize, fdt);
 }
 
 #else
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 29/30] bus: acpi: register bus even if without ACPI EFI table
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (27 preceding siblings ...)
  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 ` 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
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The ACPI bus must be registered if there are ACPI drivers compiled in.
Thus the ACPI bus registration must be decoupled from the existence of
the ACPI table.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/bus/acpi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/acpi.c b/drivers/bus/acpi.c
index efba3f4c1671..54c60856570d 100644
--- a/drivers/bus/acpi.c
+++ b/drivers/bus/acpi.c
@@ -223,6 +223,7 @@ static void acpi_bus_remove(struct device_d *dev)
 }
 
 struct bus_type acpi_bus = {
+	.name = "acpi",
 	.match = acpi_bus_match,
 	.probe = acpi_bus_probe,
 	.remove = acpi_bus_remove,
@@ -240,17 +241,17 @@ static int efi_acpi_probe(void)
 			acpi_bus.name = "acpi2";
 			table = ect;
 		} else if (!table && !efi_guidcmp(ect->guid, EFI_ACPI_TABLE_GUID)) {
-			acpi_bus.name = "acpi";
+			acpi_bus.name = "acpi1";
 			table = ect;
 		}
 	}
 
+	bus_register(&acpi_bus);
+
 	if (!table)
 		return 0;
 
-	bus_register(&acpi_bus);
 	acpi_bus.dev->priv = table;
-
 	return acpi_register_devices(&acpi_bus);
 }
 postcore_initcall(efi_acpi_probe);
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 30/30] efi: guid: fix typos
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (28 preceding siblings ...)
  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 ` Ahmad Fatoum
  2021-11-25  7:44 ` [PATCH 00/30] efi: refactor for upcoming loader support Sascha Hauer
  30 siblings, 0 replies; 34+ messages in thread
From: Ahmad Fatoum @ 2021-11-22  8:47 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Messages have some typos, fix them.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/efi/guid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/efi/guid.c b/common/efi/guid.c
index f1a918f91e19..f16c597a20fc 100644
--- a/common/efi/guid.c
+++ b/common/efi/guid.c
@@ -30,7 +30,7 @@ const char *efi_guid_string(efi_guid_t *g)
 	EFI_GUID_STRING(EFI_HCDP_TABLE_GUID, "HDCP Table", "HDCP Table GUID in EFI System Table");
 	EFI_GUID_STRING(EFI_UGA_IO_PROTOCOL_GUID, "UGA Protocol", "EFI 1.1 UGA Protocol");
 	EFI_GUID_STRING(EFI_GLOBAL_VARIABLE_GUID, "Efi", "Efi Variable GUID");
-	EFI_GUID_STRING(EFI_UV_SYSTEM_TABLE_GUID, "SAL System Table", "SAL System Table GUID in EFI System Table");
+	EFI_GUID_STRING(EFI_UV_SYSTEM_TABLE_GUID, "UV System Table", "UV System Table GUID in EFI System Table");
 	EFI_GUID_STRING(EFI_LINUX_EFI_CRASH_GUID, "Linux EFI Crash", "Linux EFI Crash GUID");
 	EFI_GUID_STRING(EFI_LOADED_IMAGE_PROTOCOL_GUID, "LoadedImage Protocol", "EFI 1.0 Loaded Image Protocol");
 	EFI_GUID_STRING(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID, "EFI Graphics Output Protocol", "UEFI Graphics Output Protocol");
@@ -38,7 +38,7 @@ const char *efi_guid_string(efi_guid_t *g)
 	EFI_GUID_STRING(EFI_UGA_IO_PROTOCOL_GUID, "UGA Protocol", "EFI 1.1 UGA Protocol");
 	EFI_GUID_STRING(EFI_PCI_IO_PROTOCOL_GUID, "PCI IO Protocol", "EFI 1.1 PCI IO Protocol");
 	EFI_GUID_STRING(EFI_USB_IO_PROTOCOL_GUID, "USB IO Protocol", "EFI 1.0 USB IO Protocol");
-	EFI_GUID_STRING(EFI_FILE_INFO_GUID, "File Info", "EFI File Infom");
+	EFI_GUID_STRING(EFI_FILE_INFO_GUID, "File Info", "EFI File Info");
 	EFI_GUID_STRING(EFI_SIMPLE_FILE_SYSTEM_GUID, "Filesystem", "EFI 1.0 Simple FileSystem");
 	EFI_GUID_STRING(EFI_DEVICE_TREE_GUID, "Device Tree", "EFI Device Tree GUID");
 	EFI_GUID_STRING(EFI_DEVICE_PATH_PROTOCOL_GUID, "Device Path Protocol", "EFI 1.0 Device Path protocol");
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 10/30] efi: use SPDX-License-Identifier where appropriate
  2021-11-22  8:47 ` [PATCH 10/30] efi: use SPDX-License-Identifier where appropriate Ahmad Fatoum
@ 2021-11-23  8:52   ` Jules Maselbas
  0 siblings, 0 replies; 34+ messages in thread
From: Jules Maselbas @ 2021-11-23  8:52 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Nov 22, 2021 at 09:47:12AM +0100, Ahmad Fatoum wrote:
> Couple of files lack an explicit embedded license or cotnain
s/cotnain/contain/

> boilerplate. Replace with the appropriate SPDX-License-Identifier.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/efi/devicepath.c    |  2 ++
>  common/efi/guid.c          |  2 ++
>  common/efi/payload/image.c | 11 +----------
>  common/efi/payload/init.c  | 11 +----------
>  include/efi/debug_ll.h     |  1 +
>  include/efi/efi-device.h   |  1 +
>  include/efi/efi.h          |  1 +
>  7 files changed, 9 insertions(+), 20 deletions(-)
> 
> diff --git a/common/efi/devicepath.c b/common/efi/devicepath.c
> index f17b9294cc1b..6341ca005ba5 100644
> --- a/common/efi/devicepath.c
> +++ b/common/efi/devicepath.c
> @@ -1,3 +1,5 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
>  #include <common.h>
>  #include <efi.h>
>  #include <malloc.h>
> diff --git a/common/efi/guid.c b/common/efi/guid.c
> index fbe96ecd048c..f1a918f91e19 100644
> --- a/common/efi/guid.c
> +++ b/common/efi/guid.c
> @@ -1,3 +1,5 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
>  #include <common.h>
>  #include <efi.h>
>  
> diff --git a/common/efi/payload/image.c b/common/efi/payload/image.c
> index 3c55a457eae3..53b444eef60f 100644
> --- a/common/efi/payload/image.c
> +++ b/common/efi/payload/image.c
> @@ -1,17 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0-only
>  /*
>   * image.c - barebox EFI payload support
>   *
>   * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
>   */
>  
>  #include <clock.h>
> diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c
> index 88d0bfa939ec..0e672a6b56d2 100644
> --- a/common/efi/payload/init.c
> +++ b/common/efi/payload/init.c
> @@ -1,17 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0-only
>  /*
>   * init.c - barebox EFI payload support
>   *
>   * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2
> - * as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
>   */
>  
>  #include <linux/linkage.h>
> diff --git a/include/efi/debug_ll.h b/include/efi/debug_ll.h
> index 4ca72de312af..905f1c43cd23 100644
> --- a/include/efi/debug_ll.h
> +++ b/include/efi/debug_ll.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  #ifndef __MACH_DEBUG_LL_H__
>  #define __MACH_DEBUG_LL_H__
>  
> diff --git a/include/efi/efi-device.h b/include/efi/efi-device.h
> index 5ec59a8a2ddd..cd8a374c32fe 100644
> --- a/include/efi/efi-device.h
> +++ b/include/efi/efi-device.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  #ifndef __EFI_EFI_DEVICE_H
>  #define __EFI_EFI_DEVICE_H
>  
> diff --git a/include/efi/efi.h b/include/efi/efi.h
> index 648afb9ec5a7..c7679b4b8f28 100644
> --- a/include/efi/efi.h
> +++ b/include/efi/efi.h
> @@ -1,3 +1,4 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  #ifndef __MACH_EFI_H
>  #define __MACH_EFI_H
>  
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 
> 
> To declare a filtering error, please use the following link : https://www.security-mail.net/reporter.php?mid=17c3a.619b5a65.16acd.0&r=jmaselbas%40kalray.eu&s=barebox-bounces%2Bjmaselbas%3Dkalray.eu%40lists.infradead.org&o=%5BPATCH+10%2F30%5D+efi%3A+use+SPDX-License-Identifier+where+appropriate&verdict=C&c=b22b249ef71fa4af3fb70743334b7eff7aaf4614
> 





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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/30] common: move EFI code into new efi/ top level directory
  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
  0 siblings, 0 replies; 34+ messages in thread
From: Jules Maselbas @ 2021-11-23  8:55 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Nov 22, 2021 at 09:47:10AM +0100, Ahmad Fatoum wrote:
> So far, barebox EFI meant EFI payload support on x86. Upcoming changes
> will extend barebox to support EFI payload _and_ loader on ARM64.
> Prepare for this by renaming files and directories appropriately, so
> it's immediately clear whether a file is about paylaod, loader or common
s/paylaod/payload/
> support.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/Kconfig                                   | 10 ++--------
>  common/Makefile                                  |  4 +---
>  common/efi/Kconfig                               | 16 ++++++++++++++++
>  common/efi/Makefile                              |  9 +++++----
>  common/{efi-devicepath.c => efi/devicepath.c}    |  0
>  common/{efi-guid.c => efi/guid.c}                |  0
>  common/efi/payload/Makefile                      |  6 ++++++
>  .../{ => payload}/env-efi/network/eth0-discover  |  0
>  common/efi/{efi-image.c => payload/image.c}      |  2 +-
>  common/efi/{efi.c => payload/init.c}             |  2 +-
>  common/efi/{efi-iomem.c => payload/iomem.c}      |  0
>  drivers/efi/Kconfig                              |  1 +
>  12 files changed, 33 insertions(+), 17 deletions(-)
>  create mode 100644 common/efi/Kconfig
>  rename common/{efi-devicepath.c => efi/devicepath.c} (100%)
>  rename common/{efi-guid.c => efi/guid.c} (100%)
>  create mode 100644 common/efi/payload/Makefile
>  rename common/efi/{ => payload}/env-efi/network/eth0-discover (100%)
>  rename common/efi/{efi-image.c => payload/image.c} (99%)
>  rename common/efi/{efi.c => payload/init.c} (99%)
>  rename common/efi/{efi-iomem.c => payload/iomem.c} (100%)
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index f4120b2083ee..42240ae8411b 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -78,14 +78,6 @@ config MENUTREE
>  	select GLOB
>  	select GLOB_SORT
>  
> -config EFI_GUID
> -	bool
> -	help
> -	  With this option a table of EFI guids is compiled in.
> -
> -config EFI_DEVICEPATH
> -	bool
> -
>  config ARCH_DMA_ADDR_T_64BIT
>  	bool
>  
> @@ -1538,6 +1530,8 @@ config COMPILE_TEST
>  
>  endmenu
>  
> +source "common/efi/Kconfig"
> +
>  config HAS_DEBUG_LL
>  	bool
>  
> diff --git a/common/Makefile b/common/Makefile
> index 4b45f678c7de..9ed279806a08 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -63,9 +63,7 @@ obj-$(CONFIG_BOOTCHOOSER)	+= bootchooser.o
>  obj-$(CONFIG_UIMAGE)		+= image.o uimage.o
>  obj-$(CONFIG_FITIMAGE)		+= image-fit.o
>  obj-$(CONFIG_MENUTREE)		+= menutree.o
> -obj-$(CONFIG_EFI_BOOTUP)	+= efi/
> -obj-$(CONFIG_EFI_GUID)		+= efi-guid.o
> -obj-$(CONFIG_EFI_DEVICEPATH)	+= efi-devicepath.o
> +obj-$(CONFIG_EFI)		+= efi/
>  lwl-$(CONFIG_IMD)		+= imd-barebox.o
>  obj-$(CONFIG_IMD)		+= imd.o
>  obj-y				+= file-list.o
> diff --git a/common/efi/Kconfig b/common/efi/Kconfig
> new file mode 100644
> index 000000000000..a0565854c2f5
> --- /dev/null
> +++ b/common/efi/Kconfig
> @@ -0,0 +1,16 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +menu "EFI (Extensible Firmware Interface) Support"
> +
> +config EFI
> +	bool
> +
> +config EFI_GUID
> +	bool
> +	help
> +	  With this option a table of EFI guids is compiled in.
> +
> +config EFI_DEVICEPATH
> +	bool
> +
> +endmenu
> diff --git a/common/efi/Makefile b/common/efi/Makefile
> index d746fabe2109..1ed5d45c1f5e 100644
> --- a/common/efi/Makefile
> +++ b/common/efi/Makefile
> @@ -1,4 +1,5 @@
> -obj-y += efi.o
> -obj-y += efi-image.o
> -bbenv-y += env-efi
> -obj-$(CONFIG_CMD_IOMEM) += efi-iomem.o
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +obj-$(CONFIG_EFI_BOOTUP)	+= payload/
> +obj-$(CONFIG_EFI_GUID)		+= guid.o
> +obj-$(CONFIG_EFI_DEVICEPATH)	+= devicepath.o
> diff --git a/common/efi-devicepath.c b/common/efi/devicepath.c
> similarity index 100%
> rename from common/efi-devicepath.c
> rename to common/efi/devicepath.c
> diff --git a/common/efi-guid.c b/common/efi/guid.c
> similarity index 100%
> rename from common/efi-guid.c
> rename to common/efi/guid.c
> diff --git a/common/efi/payload/Makefile b/common/efi/payload/Makefile
> new file mode 100644
> index 000000000000..bcbdda335f06
> --- /dev/null
> +++ b/common/efi/payload/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +obj-y += init.o
> +obj-y += image.o
> +bbenv-y += env-efi
> +obj-$(CONFIG_CMD_IOMEM) += iomem.o
> diff --git a/common/efi/env-efi/network/eth0-discover b/common/efi/payload/env-efi/network/eth0-discover
> similarity index 100%
> rename from common/efi/env-efi/network/eth0-discover
> rename to common/efi/payload/env-efi/network/eth0-discover
> diff --git a/common/efi/efi-image.c b/common/efi/payload/image.c
> similarity index 99%
> rename from common/efi/efi-image.c
> rename to common/efi/payload/image.c
> index bd1c58438e84..3c55a457eae3 100644
> --- a/common/efi/efi-image.c
> +++ b/common/efi/payload/image.c
> @@ -1,5 +1,5 @@
>  /*
> - * efi-image.c - barebox EFI payload support
> + * image.c - barebox EFI payload support
>   *
>   * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
>   *
> diff --git a/common/efi/efi.c b/common/efi/payload/init.c
> similarity index 99%
> rename from common/efi/efi.c
> rename to common/efi/payload/init.c
> index 7f12342cf91b..88d0bfa939ec 100644
> --- a/common/efi/efi.c
> +++ b/common/efi/payload/init.c
> @@ -1,5 +1,5 @@
>  /*
> - * efi.c - barebox EFI payload support
> + * init.c - barebox EFI payload support
>   *
>   * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
>   *
> diff --git a/common/efi/efi-iomem.c b/common/efi/payload/iomem.c
> similarity index 100%
> rename from common/efi/efi-iomem.c
> rename to common/efi/payload/iomem.c
> diff --git a/drivers/efi/Kconfig b/drivers/efi/Kconfig
> index dd3ac7525f9f..e8abc2709e26 100644
> --- a/drivers/efi/Kconfig
> +++ b/drivers/efi/Kconfig
> @@ -1,6 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
>  config EFI_BOOTUP
>  	bool
> +	select EFI
>  	select BLOCK
>  	select PARTITION_DISK
>  	select HW_HAS_PCI
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 
> 
> To declare a filtering error, please use the following link : https://www.security-mail.net/reporter.php?mid=d96b.619b5a76.a8745.0&r=jmaselbas%40kalray.eu&s=barebox-bounces%2Bjmaselbas%3Dkalray.eu%40lists.infradead.org&o=%5BPATCH+08%2F30%5D+common%3A+move+EFI+code+into+new+efi%2F+top+level+directory&verdict=C&c=45252004e55fff892806525f875d47f7eb127606
> 





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


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/30] efi: refactor for upcoming loader support
  2021-11-22  8:47 [PATCH 00/30] efi: refactor for upcoming loader support Ahmad Fatoum
                   ` (29 preceding siblings ...)
  2021-11-22  8:47 ` [PATCH 30/30] efi: guid: fix typos Ahmad Fatoum
@ 2021-11-25  7:44 ` Sascha Hauer
  30 siblings, 0 replies; 34+ messages in thread
From: Sascha Hauer @ 2021-11-25  7:44 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, Nov 22, 2021 at 09:47:02AM +0100, Ahmad Fatoum wrote:
> Nothing EFI loader support specific yet, just shifting around code to
> enable future reuse, fixing some typos found along the way and improving
> wide char support a bit.
> 
> Ahmad Fatoum (30):
>   fs: remove useless AT_FDCWD references
>   fs: remove unused struct node_d in struct dir
>   block : efi: rename driver variable from efi_fs_driver to
>     efi_bio_driver
>   include: <linux/types.h>: wrap in #ifndef __ASSEMBLY__
>   hw_random: stm32: propagate error codes from rng read
>   efi: align LOAD_FILE_PROTOCOL_GUID's name with other PROTOCOL_GUIDs
>   asm-generic: move sync_caches_for_execution declaration to
>     <asm/cache.h>
>   common: move EFI code into new efi/ top level directory
>   serial: efi-stdio: move efi-stdio.h header to central location
>   efi: use SPDX-License-Identifier where appropriate
>   drivers: efi: move Kconfig options to new menu
>   efi: factor out errno translation
>   efi: rename <efi/efi.h> to <efi/efi-payload.h>
>   efi: centralize efivarfs_parse_filename
>   kbuild: force 16-bit wchar_t treewide
>   include: <linux/nls.h>: remove duplicate wchar_t typedef
>   lib: wchar: add wctomb and mbtowc
>   lib: implement wcsnlen
>   vsprintf: add optional support for %ls format modifier
>   libfile: null-terminate read_file of wchar_t buffer
>   commands: echo: add wide file output via wecho alias
>   efi: make efi_main __noreturn
>   efi: define and use new EFI_ERROR_MASK macro
>   common: move CONFIG_ELF into General Settings
>   efi: don't zero executable buffer before freeing
>   partitions: efi: move header to central location
>   efi: print early efi_main string on CONFIG_DEBUG_LL=y
>   ARM64: board-dt-2nd: remove no longer needed noinline function split
>   bus: acpi: register bus even if without ACPI EFI table
>   efi: guid: fix typos

Applied with typos fixed, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2021-11-25  7:45 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 09/30] serial: efi-stdio: move efi-stdio.h header to central location Ahmad Fatoum
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

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git