[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH 02/22] plat/include: Use macro-ed helper to simplify ioreg_read/write for Arm64



Hi Julien,

> -----Original Message-----
> From: Julien Grall
> Sent: 2018年11月8日 19:58
> To: Wei Chen (Arm Technology China) <Wei.Chen@xxxxxxx>; minios-
> devel@xxxxxxxxxxxxxxxxxxxx; simon.kuenzer@xxxxxxxxx
> Cc: Kaly Xin (Arm Technology China) <Kaly.Xin@xxxxxxx>; nd <nd@xxxxxxx>; nd
> <nd@xxxxxxx>
> Subject: Re: [Minios-devel] [UNIKRAFT PATCH 02/22] plat/include: Use macro-ed
> helper to simplify ioreg_read/write for Arm64
> 
> 
> 
> On 11/8/18 9:51 AM, Wei Chen wrote:
> > As discussed in mailing list [1], we can use macro-ed helpers to avoid
> > having to write 4 times of the same things of ioreg_read_8/16/32/64 and
> > ioreg_write8/16/32/64.
> 
> [1] does not exist in the commit message.
> 

Oh, I forgot to paste the link, I will fix it in next version:

https://lists.xen.org/archives/html/minios-devel/2018-08/msg00240.html

> >
> > Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
> > ---
> >   plat/common/include/arm/arm64/cpu.h | 64 +++++++++++------------------
> >   1 file changed, 25 insertions(+), 39 deletions(-)
> >
> > diff --git a/plat/common/include/arm/arm64/cpu.h
> b/plat/common/include/arm/arm64/cpu.h
> > index bfea461..53fa577 100644
> > --- a/plat/common/include/arm/arm64/cpu.h
> > +++ b/plat/common/include/arm/arm64/cpu.h
> > @@ -34,45 +34,31 @@
> >
> >   #include <inttypes.h>
> >
> > -static inline uint8_t ioreg_read8(const volatile uint8_t *addr)
> > -{
> > -   return *addr;
> > -}
> > -
> > -static inline void ioreg_write8(volatile uint8_t *addr, uint8_t value)
> > -{
> > -   *addr = value;
> > -}
> > -
> > -static inline uint16_t ioreg_read16(const volatile uint16_t *addr)
> > -{
> > -   return *addr;
> > -}
> > -
> > -static inline void ioreg_write16(volatile uint16_t *addr, uint16_t value)
> > -{
> > -   *addr = value;
> > -}
> > -
> > -static inline uint32_t ioreg_read32(const volatile uint32_t *addr)
> > -{
> > -   return *addr;
> > -}
> > -
> > -static inline void ioreg_write32(volatile uint32_t *addr, uint32_t value)
> > -{
> > -   *addr = value;
> > -}
> > -
> > -static inline uint64_t ioreg_read64(const volatile uint64_t *addr)
> > -{
> > -   return *addr;
> > -}
> > -
> > -static inline void ioreg_write64(volatile uint64_t *addr, uint64_t value)
> > -{
> > -   *addr = value;
> > -}
> > +/* Define macros to access IO registers */
> > +#define __IOREG_READ(bits) \
> > +   static inline uint##bits##_t \
> > +   ioreg_read##bits(const volatile uint##bits##_t *addr) \
> > +           { return *addr; }
> > +
> > +#define __IOREG_WRITE(bits) \
> > +   static inline void \
> > +   ioreg_write##bits(volatile uint##bits##_t *addr, \
> > +                   uint##bits##_t value) \
> > +           { *addr = value; }
> > +
> > +
> > +#define __IOREG_READ_ALL() __IOREG_READ(8)  \
> > +                           __IOREG_READ(16) \
> > +                           __IOREG_READ(32) \
> > +                           __IOREG_READ(64) \
> > +
> > +#define __IOREG_WRITE_ALL()        __IOREG_WRITE(8)  \
> > +                           __IOREG_WRITE(16) \
> > +                           __IOREG_WRITE(32) \
> > +                           __IOREG_WRITE(64) \
> > +
> > +__IOREG_READ_ALL()
> > +__IOREG_WRITE_ALL()
> >
> >   /* Define compatibility IO macros */
> >   #define outb(addr, v)   UK_BUG()
> >
> 
> --
> Julien Grall
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.