summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0154858)
raw | patch | inline | side by side (parent: 0154858)
author | Ovidiu Panait <ovidiu.panait@windriver.com> | |
Sat, 28 Nov 2020 08:43:16 +0000 (10:43 +0200) | ||
committer | Tom Rini <trini@konsulko.com> | |
Fri, 15 Jan 2021 19:36:12 +0000 (14:36 -0500) |
Add a return value to api_init and use it directly in the
post-relocation init sequence, rather than using a wrapper stub.
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
post-relocation init sequence, rather than using a wrapper stub.
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
api/api.c | patch | blob | history | |
api/api_private.h | patch | blob | history | |
common/board_r.c | patch | blob | history | |
include/api.h | patch | blob | history |
diff --git a/api/api.c b/api/api.c
index 493b77f80942c1eb7c9c035a995e605e027d0b13..89003c161c2fbf58cf147a248b7028f38d0f5dea 100644 (file)
--- a/api/api.c
+++ b/api/api.c
return 1;
}
-void api_init(void)
+int api_init(void)
{
struct api_signature *sig;
sig = malloc(sizeof(struct api_signature));
if (sig == NULL) {
printf("API: could not allocate memory for the signature!\n");
- return;
+ return -ENOMEM;
}
env_set_hex("api_address", (unsigned long)sig);
sig->checksum = crc32(0, (unsigned char *)sig,
sizeof(struct api_signature));
debugf("syscall entry: 0x%lX\n", (unsigned long)sig->syscall);
+
+ return 0;
}
void platform_set_mr(struct sys_info *si, unsigned long start, unsigned long size,
diff --git a/api/api_private.h b/api/api_private.h
index 07fd50ad3a363f42c1070158ff1fa2d3378452f2..bb23821c2c0ff3a150bfd577977e37fc237c3b6e 100644 (file)
--- a/api/api_private.h
+++ b/api/api_private.h
#ifndef _API_PRIVATE_H_
#define _API_PRIVATE_H_
-void api_init(void);
+int api_init(void);
void platform_set_mr(struct sys_info *, unsigned long, unsigned long, int);
int platform_sys_info(struct sys_info *);
diff --git a/common/board_r.c b/common/board_r.c
index 32ad40d372723149373a738bf1bfd0f3901953a2..500457b080992871d27dc50726ae7e42fcf670f3 100644 (file)
--- a/common/board_r.c
+++ b/common/board_r.c
}
#endif
-#if defined(CONFIG_API)
-static int initr_api(void)
-{
- /* Initialize API */
- api_init();
- return 0;
-}
-#endif
-
#ifdef CONFIG_CMD_NET
static int initr_ethaddr(void)
{
stdio_add_devices,
jumptable_init,
#ifdef CONFIG_API
- initr_api,
+ api_init,
#endif
console_init_r, /* fully init console as a device */
#ifdef CONFIG_DISPLAY_BOARDINFO_LATE
diff --git a/include/api.h b/include/api.h
index 84d81dc8177f0dc820241cc6d39f4e2d4b17d21d..83412a7c87f26baace6631a5ca93215e1d1625c3 100644 (file)
--- a/include/api.h
+++ b/include/api.h
#ifndef __API_H
#define __API_H
-void api_init(void);
+/**
+ * api_init() - Initialize API for external applications
+ *
+ * Initialize API for external (standalone) applications running on top of
+ * U-Boot. It is called during the generic post-relocation init sequence.
+ *
+ * Return: 0 if OK
+ */
+int api_init(void);
#endif