Meenakshi:
  I suggest to introduce new IoLib library instance, not to add new IoLib APIs. 
New IoLib library instance will perform IO operation as the big endian. You can 
update MdePkg/Library/BaseIoLibIntrinsic instance, add new source file and new 
INF for it. 

UINT32
EFIAPI
MmioRead32 (
  IN  UINTN     Address
  )
{
  UINT32                            Value;

  ASSERT ((Address & 3) == 0);
  Value = *(volatile UINT32*)Address;
  return SwapBytes32(Value);
}

Thanks
Liming
>-----Original Message-----
>From: Meenakshi Aggarwal [mailto:[email protected]]
>Sent: Friday, October 13, 2017 2:07 PM
>To: Ard Biesheuvel <[email protected]>; Kinney, Michael D
><[email protected]>; [email protected]; Gao, Liming
><[email protected]>
>Subject: RE: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-endian
>MMIO
>
>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 <[email protected]>; Kinney, Michael D
>> <[email protected]>
>> Cc: Gao, Liming <[email protected]>; [email protected];
>> Meenakshi Aggarwal <[email protected]>
>> Subject: RE: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-endian
>> MMIO
>>
>> Hi Ard,
>>
>> > -----Original Message-----
>> > From: Ard Biesheuvel [mailto:[email protected]]
>> > Sent: Monday, October 17, 2016 1:12 PM
>> > To: Kinney, Michael D <[email protected]>
>> > Cc: Gao, Liming <[email protected]>; Bhupesh Sharma
>> > <[email protected]>; [email protected]
>> > Subject: Re: [edk2] [PATCH 1/1] MdePkg/IoLib: Add support for big-
>> > endian MMIO
>> >
>> > On 17 October 2016 at 05:10, Kinney, Michael D
>> > <[email protected]> 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
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to