[U-Boot] [PATCH 7/9] net: tsec: Use portable types and accessors for BDs

Timur Tabi timur at tabi.org
Fri Oct 4 05:12:42 CEST 2013


On Mon, Sep 30, 2013 at 4:44 AM, Claudiu Manoil
<claudiu.manoil at freescale.com> wrote:
> +#define GET_BD_STAT(T, i) be16_to_cpu((__force __be16)T##BD(i).status)
> +#define SET_BD_STAT(T, i, v) T##BD(i).status = (__force __u16)cpu_to_be16(v)
> +#define GET_BD_BLEN(T, i) be16_to_cpu((__force __be16)T##BD(i).length)
> +#define SET_BD_BLEN(T, i, v) T##BD(i).length = (__force __u16)cpu_to_be16(v)
> +#define GET_BD_BPTR(T, i) be32_to_cpu((__force __be32)T##BD(i).bufptr)
> +#define SET_BD_BPTR(T, i, v) T##BD(i).bufptr = (__force __u32)cpu_to_be32(v)

This is pretty ugly.  There's got to be a better way to handle this.
Are you going to be doing stuff like this for every driver for
bi-endian hardware?

Some time ago I suggest that we re-purpose iowrite() and ioread() to
be native-endian, and not just little endian.  I think something like
that would make more sense than hacky macros like this.


More information about the U-Boot mailing list