From: Simon Glass <sjg@chromium.org>
The API is not very useful these days, since it doesn't support driver
model. It is laborious to add new functions to the API as there are so
many needed.
A better approach would be to create a library containing all of U-Boot,
then have the API be generated by a script containing a list of
functions, perhaps with wildcards. Then a stub could be created, with
a list of entry points, which links with and calls through into the
library.
In preparation for heading in this direction, rename some of the
existing files and directories:
- examples/api -> examples/legacy_api
- include/api*.h -> include/legacy_api*.h
- API_BUILD to LEGACY_API_BUILD
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
---
api/api.c | 2 +-
api/api_display.c | 2 +-
api/api_net.c | 2 +-
api/api_platform-arm.c | 2 +-
api/api_platform-mips.c | 2 +-
api/api_platform-powerpc.c | 2 +-
api/api_storage.c | 2 +-
common/board_r.c | 2 +-
examples/{api => legacy_api}/.gitignore | 0
examples/{api => legacy_api}/Makefile | 8 ++++----
examples/{api => legacy_api}/crt0.S | 0
examples/{api => legacy_api}/demo.c | 2 +-
examples/{api => legacy_api}/glue.c | 2 +-
examples/{api => legacy_api}/glue.h | 0
examples/{api => legacy_api}/libgenwrap.c | 2 +-
include/{api.h => legacy_api.h} | 4 ++--
include/{api_public.h => legacy_api_public.h} | 6 +++---
lib/Makefile | 2 +-
lib/vsprintf.c | 6 +++---
test/common/print.c | 2 +-
test/lib/unicode.c | 2 +-
21 files changed, 26 insertions(+), 26 deletions(-)
rename examples/{api => legacy_api}/.gitignore (100%)
rename examples/{api => legacy_api}/Makefile (87%)
rename examples/{api => legacy_api}/crt0.S (100%)
rename examples/{api => legacy_api}/demo.c (99%)
rename examples/{api => legacy_api}/glue.c (99%)
rename examples/{api => legacy_api}/glue.h (100%)
rename examples/{api => legacy_api}/libgenwrap.c (96%)
rename include/{api.h => legacy_api.h} (89%)
rename include/{api_public.h => legacy_api_public.h} (96%)
@@ -15,7 +15,7 @@
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <u-boot/crc.h>
#include "api_private.h"
@@ -3,7 +3,7 @@
* Copyright (c) 2011 The Chromium OS Authors.
*/
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <log.h>
#include <linux/types.h>
@@ -8,7 +8,7 @@
#include <config.h>
#include <net.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#define DEBUG
#undef DEBUG
@@ -10,7 +10,7 @@
#include <config.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <asm/global_data.h>
@@ -7,7 +7,7 @@
#include <config.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <asm/global_data.h>
@@ -10,7 +10,7 @@
#include <config.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <asm/global_data.h>
@@ -6,7 +6,7 @@
*/
#include <config.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <part.h>
#include <scsi.h>
#include <linux/types.h>
@@ -10,7 +10,7 @@
*/
#include <config.h>
-#include <api.h>
+#include <legacy_api.h>
#include <bootstage.h>
#include <cpu_func.h>
#include <cyclic.h>
similarity index 100%
rename from examples/api/.gitignore
rename to examples/legacy_api/.gitignore
similarity index 87%
rename from examples/api/Makefile
rename to examples/legacy_api/Makefile
@@ -2,8 +2,8 @@
#
# (C) Copyright 2007 Semihalf
-# Provide symbol API_BUILD to signal that the API example is being built.
-KBUILD_CPPFLAGS += -DAPI_BUILD
+# Provide symbol LEGACY_API_BUILD to signal that the legacy API example is being built.
+KBUILD_CPPFLAGS += -DLEGACY_API_BUILD
ifeq ($(ARCH),powerpc)
LOAD_ADDR = 0x40000
@@ -26,13 +26,13 @@ endif
# Resulting ELF and binary exectuables will be named demo and demo.bin
extra-y = demo
-# Source files located in the examples/api directory
+# Source files located in the examples/legacy_api directory
OBJ-y += crt0.o
OBJ-y += demo.o
OBJ-y += glue.o
OBJ-y += libgenwrap.o
-# Source files which exist outside the examples/api directory
+# Source files which exist outside the examples/legacy_api directory
EXT_COBJ-y += lib/crc32.o
EXT_COBJ-y += lib/ctype.o
EXT_COBJ-y += lib/div64.o
similarity index 100%
rename from examples/api/crt0.S
rename to examples/legacy_api/crt0.S
similarity index 99%
rename from examples/api/demo.c
rename to examples/legacy_api/demo.c
@@ -8,7 +8,7 @@
#include <stdio.h>
#include <env.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include "glue.h"
similarity index 99%
rename from examples/api/glue.c
rename to examples/legacy_api/glue.c
@@ -5,7 +5,7 @@
#include <env.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include <u-boot/crc.h>
#include "glue.h"
similarity index 100%
rename from examples/api/glue.h
rename to examples/legacy_api/glue.h
similarity index 96%
rename from examples/api/libgenwrap.c
rename to examples/legacy_api/libgenwrap.c
@@ -13,7 +13,7 @@
#include <hang.h>
#include <linux/delay.h>
#include <linux/types.h>
-#include <api_public.h>
+#include <legacy_api_public.h>
#include "glue.h"
similarity index 89%
rename from include/api.h
rename to include/legacy_api.h
@@ -4,8 +4,8 @@
* Written by Simon Glass <sjg@chromium.org>
*/
-#ifndef __API_H
-#define __API_H
+#ifndef __LEGACY_API_H
+#define __LEGACY_API_H
/**
* api_init() - Initialize API for external applications
similarity index 96%
rename from include/api_public.h
rename to include/legacy_api_public.h
@@ -5,8 +5,8 @@
* Written by: Rafal Jaworowski <raj@semihalf.com>
*/
-#ifndef _API_PUBLIC_H_
-#define _API_PUBLIC_H_
+#ifndef _LEGACY_API_PUBLIC_H_
+#define _LEGACY_API_PUBLIC_H_
#include <linux/types.h>
@@ -139,4 +139,4 @@ struct display_info {
int screen_cols;
};
-#endif /* _API_PUBLIC_H_ */
+#endif /* _LEGACY_API_PUBLIC_H_ */
@@ -23,7 +23,7 @@ obj-$(CONFIG_AES) += aes.o
obj-$(CONFIG_AES) += aes/
obj-$(CONFIG_$(PHASE_)BINMAN_FDT) += binman.o
-ifndef API_BUILD
+ifndef LEGACY_API_BUILD
ifneq ($(CONFIG_CHARSET),)
obj-y += charset.o
endif
@@ -308,7 +308,7 @@ static __maybe_unused char *string16(char *buf, char *end, u16 *s,
return buf;
}
-#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(API_BUILD)
+#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(LEGACY_API_BUILD)
static char *device_path_string(char *buf, char *end, void *dp, int field_width,
int precision, int flags)
{
@@ -469,7 +469,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
switch (*fmt) {
/* Device paths only exist in the EFI context. */
-#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(API_BUILD)
+#if CONFIG_IS_ENABLED(EFI_DEVICE_PATH_TO_TEXT) && !defined(LEGACY_API_BUILD)
case 'D':
return device_path_string(buf, end, ptr, field_width,
precision, flags);
@@ -630,7 +630,7 @@ repeat:
case 's':
/* U-Boot uses UTF-16 strings in the EFI context only. */
#if (CONFIG_IS_ENABLED(EFI_LOADER) || IS_ENABLED(CONFIG_EFI_APP)) && \
- !defined(API_BUILD)
+ !defined(LEGACY_API_BUILD)
if (qualifier == 'l') {
str = string16(str, end, va_arg(args, u16 *),
field_width, precision, flags);
@@ -59,7 +59,7 @@ static int print_guid(struct unit_test_state *uts)
COMMON_TEST(print_guid, 0);
#endif
-#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(LEGACY_API_BUILD)
/* Test efi_loader specific printing */
static int print_efi_ut(struct unit_test_state *uts)
{
@@ -100,7 +100,7 @@ static int unicode_test_u16_strcpy(struct unit_test_state *uts)
LIB_TEST(unicode_test_u16_strcpy, 0);
/* U-Boot uses UTF-16 strings in the EFI context only. */
-#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(LEGACY_API_BUILD)
static int unicode_test_string16(struct unit_test_state *uts)
{
char buf[20];