Hi All,
It’s a pretty old discussion, we have left the upstreaming of NXP package in between because of some other work, but have started it again now. Issue : Few NXP modules support Big Endian MMIOs as these are ported from PowerPC. Solution suggested : Create a separate library for BE MMIO APIs. So what I have done is, I have created a separate library to support BE MMIO APIs and currently keeping it to my package. This library is basically a wrapper over existing MMIO APIs. UINT32 EFIAPI BeMmioRead32 ( IN UINTN Address ) { UINT32 Value; Value = MmioRead32(Address); return SwapBytes32(Value); } Need your opinion on below optinos: 1. Will this be a good idea to make this library a part of MdePkg? OR 2. Add a new file e.g. IoBeMmio.c like IoHighLevel.c in MdePkg/Library/BaseIoLibIntrinsic/ And made these APIs a part of IoLib itself. OR 3. Keep this library internal to NXP package. Please provide your inputs. Thanks & Regards, Meenakshi > -----Original Message----- > From: Bhupesh Sharma > Sent: Monday, October 17, 2016 3:28 PM > To: Ard Biesheuvel <ard.biesheu...@linaro.org>; Kinney, Michael D > <michael.d.kin...@intel.com> > Cc: Gao, Liming <liming....@intel.com>; edk2-de...@ml01.01.org; > Meenakshi Aggarwal <meenakshi.aggar...@nxp.com> > Subject: RE: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-endian > MMIO > > Hi Ard, > > > -----Original Message----- > > From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] > > Sent: Monday, October 17, 2016 1:12 PM > > To: Kinney, Michael D <michael.d.kin...@intel.com> > > Cc: Gao, Liming <liming....@intel.com>; Bhupesh Sharma > > <bhupesh.sha...@nxp.com>; edk2-de...@ml01.01.org > > Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big- > > endian MMIO > > > > On 17 October 2016 at 05:10, Kinney, Michael D > > <michael.d.kin...@intel.com> wrote: > > > Bhupesh, > > > > > > It is also possible to add an ARM specific PCD to select endianness > > > and update MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c to use that > > > PCD in MmioRead/Write() APIs in that file to support both endian > > > types. You can use the SwapBytesxx() functions from BaseLib(as > > Laszlo > > > suggested) based on the setting of this ARM specific PCD. > > > > > > Modules that link against this lib can select endianness by setting > > > PCD in the scope of that module. > > > > > > The IPF version of IoLib uses an IPF specific PCD to translate I/O > > > port accesses to MMIO accesses. So there is already an example of > > > an arch specific PCD in this lib instance. > > > > > > > This is not a platform wide thing, it is a per-device property whether > > the MMIO occurs in big endian or little endian manner. > > > > So I think Liming's suggestion makes sense: create an IoLib > > implementation that performs the byte swapping, and selectively > > incorporate it into drivers that require it using > > > > BeMmioDeviceDxe.inf { > > <LibraryClasses> > > IoLib|SomePkg/Library/BigEndianIoLib.inf > > } > > That's correct. I think creating a separate IoLib for byte-swapping makes > sense. > > We will rework the patch accordingly. > > Regards, > Bhupesh _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel