Re: [edk2] [PATCH v2 1/9] Platform/NXP: Add support for Big Endian Mmio APIs

2017-11-26 Thread Udit Kumar
Hi Leif, 

> Hmm, was there a cover letter for this v2? I can only find the one from v1 in 
> my
> inbox? Usually it is helpful to keep the cover letter and add comments on what
> has changed since the previous revision.
> 
> Also, can you generate the patches with
> --subject-prefix="PATCH edk2-platforms"
> to ensure a predictable email header for edk2-platforms patches?
> 
> Now, for this actual patch...
> This looks like a useful thing. It also looks like a very generic thing. I 
> would think
> it could live in edk2/MdePkg, but perhaps we can simply migrate it there if we
> see additional users outside of the NXM platforms.

This is our preferred way, if this can be pushed to edk2/MdePkg but 
in another discussion , Liming suggested to keep as local lib.

regards
Udit
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 1/9] Platform/NXP: Add support for Big Endian Mmio APIs

2017-11-26 Thread Meenakshi Aggarwal
Hi Leif,

I forgot to attach a cover letter for v2, sent v3 with cover letter and added 
--subject-prefix="PATCH edk2-platforms".

Thanks for the review.

Regards,
Meenakshi

> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Sunday, November 26, 2017 9:19 PM
> To: Meenakshi Aggarwal 
> Cc: ard.biesheu...@linaro.org; michael.d.kin...@intel.com; edk2-
> de...@lists.01.org; Udit Kumar ; Varun Sethi
> 
> Subject: Re: [PATCH v2 1/9] Platform/NXP: Add support for Big Endian Mmio
> APIs
> 
> Hmm, was there a cover letter for this v2? I can only find the one from v1 in
> my inbox? Usually it is helpful to keep the cover letter and add comments on
> what has changed since the previous revision.
> 
> Also, can you generate the patches with
> --subject-prefix="PATCH edk2-platforms"
> to ensure a predictable email header for edk2-platforms patches?
> 
> Now, for this actual patch...
> This looks like a useful thing. It also looks like a very generic thing. I 
> would
> think it could live in edk2/MdePkg, but perhaps we can simply migrate it
> there if we see additional users outside of the NXM platforms.
> 
> Reviewed-by: Leif Lindholm 
> 
> On Wed, Nov 22, 2017 at 09:18:52PM +0530, Meenakshi Aggarwal wrote:
> > This library add supports for BE read/write and other MMIO helper
> > function.
> > In this data swapped after reading from MMIO and before write using
> > MMIO.
> > It can be used by any module with BE address space.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Meenakshi Aggarwal 
> > ---
> >  Platform/NXP/Include/Library/BeIoLib.h   | 332
> +
> >  Platform/NXP/Library/BeIoLib/BeIoLib.c   | 400
> +++
> >  Platform/NXP/Library/BeIoLib/BeIoLib.inf |  31 +++
> >  3 files changed, 763 insertions(+)
> >  create mode 100644 Platform/NXP/Include/Library/BeIoLib.h
> >  create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.c
> >  create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.inf
> >
> > diff --git a/Platform/NXP/Include/Library/BeIoLib.h
> > b/Platform/NXP/Include/Library/BeIoLib.h
> > new file mode 100644
> > index 000..a58883a
> > --- /dev/null
> > +++ b/Platform/NXP/Include/Library/BeIoLib.h
> > @@ -0,0 +1,332 @@
> > +/** BeIoLib.h
> > + *
> > + *  Copyright 2017 NXP
> > + *
> > + *  This program and the accompanying materials
> > + *  are licensed and made available under the terms and conditions of
> > +the BSD License
> > + *  which accompanies this distribution.  The full text of the
> > +license may be found at
> > + *
> >
> +https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fop
> e
> > +nsource.org%2Flicenses%2Fbsd-
> license.php=02%7C01%7Cmeenakshi.agg
> >
> +arwal%40nxp.com%7C88e69067b33644a1f74108d534e53282%7C686ea1d3bc
> 2b4c6f
> >
> +a92cd99c5c301635%7C0%7C0%7C636473081368216265=o8KmMYvlGT
> AzBP0rI
> > +bOQTOAWY3fJEpfkpCwnKHWZ9Y0%3D=0
> > + *
> > + *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> > +BASIS,
> > + *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> > + *
> > + **/
> > +
> > +#ifndef __BE_IOLIB_H__
> > +#define __BE_IOLIB_H__
> > +
> > +#include 
> > +
> > +/**
> > +  MmioRead8 for Big-Endian modules.
> > +
> > +  @param  Address The MMIO register to read.
> > +
> > +  @return The value read.
> > +
> > +**/
> > +UINT8
> > +EFIAPI
> > +BeMmioRead8 (
> > +  IN  UINTN Address
> > +  );
> > +
> > +/**
> > +  MmioRead16 for Big-Endian modules.
> > +
> > +  @param  Address The MMIO register to read.
> > +
> > +  @return The value read.
> > +
> > +**/
> > +UINT16
> > +EFIAPI
> > +BeMmioRead16 (
> > +  IN  UINTN Address
> > +  );
> > +
> > +/**
> > +  MmioRead32 for Big-Endian modules.
> > +
> > +  @param  Address The MMIO register to read.
> > +
> > +  @return The value read.
> > +
> > +**/
> > +UINT32
> > +EFIAPI
> > +BeMmioRead32 (
> > +  IN  UINTN Address
> > +  );
> > +
> > +/**
> > +  MmioRead64 for Big-Endian modules.
> > +
> > +  @param  Address The MMIO register to read.
> > +
> > +  @return The value read.
> > +
> > +**/
> > +UINT64
> > +EFIAPI
> > +BeMmioRead64 (
> > +  IN  UINTN Address
> > +  );
> > +
> > +/**
> > +  MmioWrite8 for Big-Endian modules.
> > +
> > +  @param  Address The MMIO register to write.
> > +  @param  Value   The value to write to the MMIO register.
> > +
> > +**/
> > +UINT8
> > +EFIAPI
> > +BeMmioWrite8 (
> > +  IN  UINTN Address,
> > +  IN  UINT8 Value
> > +  );
> > +
> > +/**
> > +  MmioWrite16 for Big-Endian modules.
> > +
> > +  @param  Address The MMIO register to write.
> > +  @param  Value   The value to write to the MMIO register.
> > +
> > +**/
> > +UINT16
> > +EFIAPI
> > +BeMmioWrite16 (
> > +  IN  UINTN Address,
> > +  IN  UINT16Value
> > +  );
> > +
> > +/**
> > +  MmioWrite32 for 

Re: [edk2] [PATCH v2 1/9] Platform/NXP: Add support for Big Endian Mmio APIs

2017-11-26 Thread Leif Lindholm
Hmm, was there a cover letter for this v2? I can only find the one
from v1 in my inbox? Usually it is helpful to keep the cover letter
and add comments on what has changed since the previous revision.

Also, can you generate the patches with
--subject-prefix="PATCH edk2-platforms"
to ensure a predictable email header for edk2-platforms patches?

Now, for this actual patch...
This looks like a useful thing. It also looks like a very generic
thing. I would think it could live in edk2/MdePkg, but perhaps we can
simply migrate it there if we see additional users outside of the NXM
platforms.

Reviewed-by: Leif Lindholm 

On Wed, Nov 22, 2017 at 09:18:52PM +0530, Meenakshi Aggarwal wrote:
> This library add supports for BE read/write and other
> MMIO helper function.
> In this data swapped after reading from MMIO and before
> write using MMIO.
> It can be used by any module with BE address space.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Meenakshi Aggarwal 
> ---
>  Platform/NXP/Include/Library/BeIoLib.h   | 332 +
>  Platform/NXP/Library/BeIoLib/BeIoLib.c   | 400 
> +++
>  Platform/NXP/Library/BeIoLib/BeIoLib.inf |  31 +++
>  3 files changed, 763 insertions(+)
>  create mode 100644 Platform/NXP/Include/Library/BeIoLib.h
>  create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.c
>  create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.inf
> 
> diff --git a/Platform/NXP/Include/Library/BeIoLib.h 
> b/Platform/NXP/Include/Library/BeIoLib.h
> new file mode 100644
> index 000..a58883a
> --- /dev/null
> +++ b/Platform/NXP/Include/Library/BeIoLib.h
> @@ -0,0 +1,332 @@
> +/** BeIoLib.h
> + *
> + *  Copyright 2017 NXP
> + *
> + *  This program and the accompanying materials
> + *  are licensed and made available under the terms and conditions of the 
> BSD License
> + *  which accompanies this distribution.  The full text of the license may 
> be found at
> + *  http://opensource.org/licenses/bsd-license.php
> + *
> + *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> + *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> + *
> + **/
> +
> +#ifndef __BE_IOLIB_H__
> +#define __BE_IOLIB_H__
> +
> +#include 
> +
> +/**
> +  MmioRead8 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to read.
> +
> +  @return The value read.
> +
> +**/
> +UINT8
> +EFIAPI
> +BeMmioRead8 (
> +  IN  UINTN Address
> +  );
> +
> +/**
> +  MmioRead16 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to read.
> +
> +  @return The value read.
> +
> +**/
> +UINT16
> +EFIAPI
> +BeMmioRead16 (
> +  IN  UINTN Address
> +  );
> +
> +/**
> +  MmioRead32 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to read.
> +
> +  @return The value read.
> +
> +**/
> +UINT32
> +EFIAPI
> +BeMmioRead32 (
> +  IN  UINTN Address
> +  );
> +
> +/**
> +  MmioRead64 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to read.
> +
> +  @return The value read.
> +
> +**/
> +UINT64
> +EFIAPI
> +BeMmioRead64 (
> +  IN  UINTN Address
> +  );
> +
> +/**
> +  MmioWrite8 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to write.
> +  @param  Value   The value to write to the MMIO register.
> +
> +**/
> +UINT8
> +EFIAPI
> +BeMmioWrite8 (
> +  IN  UINTN Address,
> +  IN  UINT8 Value
> +  );
> +
> +/**
> +  MmioWrite16 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to write.
> +  @param  Value   The value to write to the MMIO register.
> +
> +**/
> +UINT16
> +EFIAPI
> +BeMmioWrite16 (
> +  IN  UINTN Address,
> +  IN  UINT16Value
> +  );
> +
> +/**
> +  MmioWrite32 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to write.
> +  @param  Value   The value to write to the MMIO register.
> +
> +**/
> +UINT32
> +EFIAPI
> +BeMmioWrite32 (
> +  IN  UINTN Address,
> +  IN  UINT32Value
> +  );
> +
> +/**
> +  MmioWrite64 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to write.
> +  @param  Value   The value to write to the MMIO register.
> +
> +**/
> +UINT64
> +EFIAPI
> +BeMmioWrite64 (
> +  IN  UINTN Address,
> +  IN  UINT64Value
> +  );
> +
> +/**
> +  MmioAndThenOr8 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to write.
> +  @param  AndData The value to AND with the read value from the MMIO 
> register.
> +  @param  OrData  The value to OR with the result of the AND operation.
> +
> +  @return The value written back to the MMIO register.
> +
> +**/
> +UINT8
> +EFIAPI
> +BeMmioAndThenOr8 (
> +  IN  UINTN Address,
> +  IN  UINT8 AndData,
> +  IN  UINT8 OrData
> +  );
> +
> +/**
> +  MmioAndThenOr16 for Big-Endian modules.
> +
> +  @param  Address The MMIO register to write.
> +  @param  AndData The value to AND with the read value from the MMIO 
> register.
> +  

[edk2] [PATCH v2 1/9] Platform/NXP: Add support for Big Endian Mmio APIs

2017-11-22 Thread Meenakshi Aggarwal
This library add supports for BE read/write and other
MMIO helper function.
In this data swapped after reading from MMIO and before
write using MMIO.
It can be used by any module with BE address space.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Meenakshi Aggarwal 
---
 Platform/NXP/Include/Library/BeIoLib.h   | 332 +
 Platform/NXP/Library/BeIoLib/BeIoLib.c   | 400 +++
 Platform/NXP/Library/BeIoLib/BeIoLib.inf |  31 +++
 3 files changed, 763 insertions(+)
 create mode 100644 Platform/NXP/Include/Library/BeIoLib.h
 create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.c
 create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.inf

diff --git a/Platform/NXP/Include/Library/BeIoLib.h 
b/Platform/NXP/Include/Library/BeIoLib.h
new file mode 100644
index 000..a58883a
--- /dev/null
+++ b/Platform/NXP/Include/Library/BeIoLib.h
@@ -0,0 +1,332 @@
+/** BeIoLib.h
+ *
+ *  Copyright 2017 NXP
+ *
+ *  This program and the accompanying materials
+ *  are licensed and made available under the terms and conditions of the BSD 
License
+ *  which accompanies this distribution.  The full text of the license may be 
found at
+ *  http://opensource.org/licenses/bsd-license.php
+ *
+ *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+ *
+ **/
+
+#ifndef __BE_IOLIB_H__
+#define __BE_IOLIB_H__
+
+#include 
+
+/**
+  MmioRead8 for Big-Endian modules.
+
+  @param  Address The MMIO register to read.
+
+  @return The value read.
+
+**/
+UINT8
+EFIAPI
+BeMmioRead8 (
+  IN  UINTN Address
+  );
+
+/**
+  MmioRead16 for Big-Endian modules.
+
+  @param  Address The MMIO register to read.
+
+  @return The value read.
+
+**/
+UINT16
+EFIAPI
+BeMmioRead16 (
+  IN  UINTN Address
+  );
+
+/**
+  MmioRead32 for Big-Endian modules.
+
+  @param  Address The MMIO register to read.
+
+  @return The value read.
+
+**/
+UINT32
+EFIAPI
+BeMmioRead32 (
+  IN  UINTN Address
+  );
+
+/**
+  MmioRead64 for Big-Endian modules.
+
+  @param  Address The MMIO register to read.
+
+  @return The value read.
+
+**/
+UINT64
+EFIAPI
+BeMmioRead64 (
+  IN  UINTN Address
+  );
+
+/**
+  MmioWrite8 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  Value   The value to write to the MMIO register.
+
+**/
+UINT8
+EFIAPI
+BeMmioWrite8 (
+  IN  UINTN Address,
+  IN  UINT8 Value
+  );
+
+/**
+  MmioWrite16 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  Value   The value to write to the MMIO register.
+
+**/
+UINT16
+EFIAPI
+BeMmioWrite16 (
+  IN  UINTN Address,
+  IN  UINT16Value
+  );
+
+/**
+  MmioWrite32 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  Value   The value to write to the MMIO register.
+
+**/
+UINT32
+EFIAPI
+BeMmioWrite32 (
+  IN  UINTN Address,
+  IN  UINT32Value
+  );
+
+/**
+  MmioWrite64 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  Value   The value to write to the MMIO register.
+
+**/
+UINT64
+EFIAPI
+BeMmioWrite64 (
+  IN  UINTN Address,
+  IN  UINT64Value
+  );
+
+/**
+  MmioAndThenOr8 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  AndData The value to AND with the read value from the MMIO register.
+  @param  OrData  The value to OR with the result of the AND operation.
+
+  @return The value written back to the MMIO register.
+
+**/
+UINT8
+EFIAPI
+BeMmioAndThenOr8 (
+  IN  UINTN Address,
+  IN  UINT8 AndData,
+  IN  UINT8 OrData
+  );
+
+/**
+  MmioAndThenOr16 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  AndData The value to AND with the read value from the MMIO register.
+  @param  OrData  The value to OR with the result of the AND operation.
+
+  @return The value written back to the MMIO register.
+
+**/
+UINT16
+EFIAPI
+BeMmioAndThenOr16 (
+  IN  UINTN Address,
+  IN  UINT16AndData,
+  IN  UINT16OrData
+  );
+
+/**
+  MmioAndThenOr32 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  AndData The value to AND with the read value from the MMIO register.
+  @param  OrData  The value to OR with the result of the AND operation.
+
+  @return The value written back to the MMIO register.
+
+**/
+UINT32
+EFIAPI
+BeMmioAndThenOr32 (
+  IN  UINTN Address,
+  IN  UINT32AndData,
+  IN  UINT32OrData
+  );
+
+/**
+  MmioAndThenOr64 for Big-Endian modules.
+
+  @param  Address The MMIO register to write.
+  @param  AndData The value to AND with the read value from the MMIO register.
+  @param  OrData  The value to OR with the result of the AND operation.
+
+  @return The value written back to the MMIO register.
+
+**/
+UINT64
+EFIAPI
+BeMmioAndThenOr64 (
+  IN  UINTN Address,
+  IN  UINT64AndData,
+