[PATCH 1/8] semihosting: Change semihosting file operation functions into global symbols

Akashi Takahiro takahiro.akashi at linaro.org
Mon May 11 05:05:07 CEST 2020


On Thu, Apr 30, 2020 at 11:06:23PM +0530, Sughosh Ganu wrote:
> Change the semihosting file operation functions into external symbols
> so that they can be called from outside the file. These functions
> would be required to be called for implementing firmware update
> functionality for the qemu arm64 platform.
> 
> Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
> ---
>  arch/arm/lib/semihosting.c |  7 ++++---
>  include/semihosting.h      | 13 +++++++++++++
>  2 files changed, 17 insertions(+), 3 deletions(-)
>  create mode 100644 include/semihosting.h
> 
> diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
> index 2658026cf4..3aeda1303a 100644
> --- a/arch/arm/lib/semihosting.c
> +++ b/arch/arm/lib/semihosting.c
> @@ -13,6 +13,7 @@
>   */
>  #include <common.h>
>  #include <command.h>
> +#include <semihosting.h>

Do we need this file here?

-Takahiro Akashi

>  #define SYSOPEN		0x01
>  #define SYSCLOSE	0x02
> @@ -43,7 +44,7 @@ static noinline long smh_trap(unsigned int sysnum, void *addr)
>   * Open a file on the host. Mode is "r" or "rb" currently. Returns a file
>   * descriptor or -1 on error.
>   */
> -static long smh_open(const char *fname, char *modestr)
> +long smh_open(const char *fname, char *modestr)
>  {
>  	long fd;
>  	unsigned long mode;
> @@ -82,7 +83,7 @@ static long smh_open(const char *fname, char *modestr)
>  /*
>   * Read 'len' bytes of file into 'memp'. Returns 0 on success, else failure
>   */
> -static long smh_read(long fd, void *memp, size_t len)
> +long smh_read(long fd, void *memp, size_t len)
>  {
>  	long ret;
>  	struct smh_read_s {
> @@ -116,7 +117,7 @@ static long smh_read(long fd, void *memp, size_t len)
>  /*
>   * Close the file using the file descriptor
>   */
> -static long smh_close(long fd)
> +long smh_close(long fd)
>  {
>  	long ret;
>  
> diff --git a/include/semihosting.h b/include/semihosting.h
> new file mode 100644
> index 0000000000..f1bf419275
> --- /dev/null
> +++ b/include/semihosting.h
> @@ -0,0 +1,13 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (c) 2020, Linaro Limited
> + */
> +
> +#if !defined _SEMIHOSTING_H_
> +#define _SEMIHOSTING_H_
> +
> +long smh_open(const char *fname, char *modestr);
> +long smh_read(long fd, void *memp, size_t len);
> +long smh_close(long fd);
> +
> +#endif /* _SEMIHOSTING_H_ */
> -- 
> 2.17.1
> 


More information about the U-Boot mailing list