[U-Boot] [PATCH v5 1/2] x86: Add 64-bit memory-mapped I/O functions

Andy Shevchenko andriy.shevchenko at linux.intel.com
Fri Apr 6 19:40:55 UTC 2018


On Fri, 2018-04-06 at 12:17 -0700, Ivan Gorinov wrote:
> Add readq() and writeq() definitions for x86.
> 
> Please note: in 32-bit code readq/writeq will generate two 32-bit
> memory access instructions instead of one atomic 64-bit operation.
> 

 
> -#define readb(addr) (*(volatile unsigned char *) (addr))
> -#define readw(addr) (*(volatile unsigned short *) (addr))
> -#define readl(addr) (*(volatile unsigned int *) (addr))
> +#define readb(addr) (*(volatile u8 *) (addr))
> +#define readw(addr) (*(volatile u16 *) (addr))
> +#define readl(addr) (*(volatile u32 *) (addr))


> -#define writeb(b,addr) (*(volatile unsigned char *) (addr) = (b))
> -#define writew(b,addr) (*(volatile unsigned short *) (addr) = (b))
> -#define writel(b,addr) (*(volatile unsigned int *) (addr) = (b))
> +#define writeb(b, addr) (*(volatile u8 *) (addr) = (b))
> +#define writew(b, addr) (*(volatile u16 *) (addr) = (b))
> +#define writel(b, addr) (*(volatile u32 *) (addr) = (b))

What's wrong with the existing types?

Even in ARM case they are using unsigned long long for 64-bit variant.

-- 
Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Intel Finland Oy


More information about the U-Boot mailing list