[U-Boot] [PATCH 06/44] sandbox: Add string and 16-bit I/O functions

Stephen Warren swarren at wwwdotorg.org
Tue Apr 12 22:02:43 CEST 2016


On 04/09/2016 08:44 PM, Simon Glass wrote:
> Add outsw() and insw() functions for sandbox, as these are needed by the IDE
> code. The functions will not do anything useful if called, but allow the
> code to be compiled.

> diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h

> +static inline void _insw(volatile u16 *port, void *buf, int ns)
> +{
> +	u16 *data = (u16 *) buf;
> +	while (ns--)
> +		*data++ = *port;
> +}
> +
> +static inline void _outsw(volatile u16 *port, const void *buf, int ns)
> +{
> +	u16 *data = (u16 *) buf;
> +	while (ns--) {
> +		*port = *data++;
> +	}
> +}

Why make those have anything other than an empty body if they don't need 
to do anything? The other functions in this file (e.g. out16/in16 added 
in this patch) are just no-ops. If those functions are called, they'll 
cause memory corruption or a crash.

> +/* For systemace.c */
> +#define out16(addr, val)
> +#define in16(addr)		0



More information about the U-Boot mailing list