Re: [edk2] [PATCH 03/10] Platform/NXP: Add support for Big Endian Mmio APIs
> -Original Message- > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] > Sent: Monday, November 13, 2017 5:56 PM > To: Meenakshi Aggarwal> Cc: Leif Lindholm ; Kinney, Michael D > ; edk2-devel@lists.01.org; Udit Kumar > ; Varun Sethi > Subject: Re: [PATCH 03/10] Platform/NXP: Add support for Big Endian Mmio > APIs > > On 7 November 2017 at 14:42, 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..209262d > > --- /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%7Cd233bd96ea6c4c16416a08d52a91bdca%7C686ea1d3b > c2b4c6f > > > +a92cd99c5c301635%7C0%7C0%7C636461727802004484=kL%2FOMen > 61jeQlPG > > +3YK2wA2oWgHFrykVMxLQcRNA63Ks%3D=0 > > + * > > + * HE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > +BASIS, > > Missing T ^^^ > Thanks for catching this. > > + * 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
Re: [edk2] [PATCH 03/10] Platform/NXP: Add support for Big Endian Mmio APIs
On 7 November 2017 at 14:42, Meenakshi Aggarwalwrote: > 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..209262d > --- /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 > + * > + * HE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, Missing T ^^^ > + * 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
[edk2] [PATCH 03/10] Platform/NXP: Add support for Big Endian Mmio APIs
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..209262d --- /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 + * + * HE 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, +