From: Laszlo Ersek <lersek@redhat.com>
To: Bhupesh Sharma <bhupesh.sharma@nxp.com>
Cc: "edk2-devel@ml01.01.org" <edk2-devel@ml01.01.org>
Subject: Re: [PATCH 1/1] MdePkg/IoLib: Add support for big-endian MMIO
Date: Fri, 14 Oct 2016 15:32:48 +0200 [thread overview]
Message-ID: <53299f19-a5f8-99c8-78cd-219c4fb31699@redhat.com> (raw)
In-Reply-To: <AM4PR0401MB228905DC745B21DCE17AB61088DF0@AM4PR0401MB2289.eurprd04.prod.outlook.com>
On 10/14/16 15:17, Bhupesh Sharma wrote:
> Hi Laszlo,
>
>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>> Sent: Friday, October 14, 2016 5:37 PM
>>
>> On 10/14/16 11:33, Bhupesh Sharma wrote:
>>> Various IPs on NXP/FSL SoCs having ARM64 cores have big-endian MMIO
>>> interfaces.
>>>
>>> This implies that a byte-swap operation is needed to read/write such
>>> BE MMIO registers from the LE ARM64 cores.
>>>
>>> This patch adds the support for the same.
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
>>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@nxp.com>
>>> ---
>>> MdePkg/Include/Library/IoLib.h | 364
>> ++++++++++++++++++++
>>> MdePkg/Library/BaseIoLibIntrinsic/IoLibArm.c | 479
>>> +++++++++++++++++++++++++++
>>> 2 files changed, 843 insertions(+)
>>
>> I think this is both overkill and incomplete, at the same time :)
>>
>> - Incomplete because only one IoLib instance gets the implementation.
>
> Agree, but do we have an example of similar BE MMIO IPs on other
> Architectures/soc? I was only aware of NXP/FSL having such MMIO
> interfaces as the IPs have been reused from PPC SoC, which used
> to have a BE core and hence did not require a SwapByte.
For example, the fw_cfg device of QEMU is big endian. OvmfPkg and
ArmVirtPkg call SwapBytesXX as necessary, in combination with MmioWriteXX.
In general, I think it's expected that a library declared under MdePkg
will not cause build failures (unresolved symbols) in any platform code,
once the library is resolved correctly in the platform DSC.
>
>> - Overkill because you can easily use the SwapBytes16, SwapBytes32,
>> SwapBytes64 functions -- also from BaseLib --, for transforming
>> MmioWrite arguments and MmioRead results.
>>
>
> Yes, but that means at every IP driver needs to especially carry such
> arguments and transform the results.
Indeed.
> That might be an overkill.
I think it should be possible to factor out these functions to a
separate library, or non-standard protocol, that is central enough for
the platform or device in question, but not core enough for putting into
MdePkg.
> We already have similar implementations MMIO implementations in Linux for e.g.
> http://lxr.free-electrons.com/source/include/asm-generic/io.h#L642
Hmmm. That does detract from the value of my "overkill" argument. So I
guess I'll have to defer to the MdePkg maintainers on that.
Regarding my "incomplete" argument, it still stands. I think it's
logically impossible to introduce a library class that is simultaneously
- central enough to merit a place under MdePkg, but
- not central enough to receive implementations (library instances) for
all the platforms supported by edk2 at the moment.
Thanks
Laszlo
next prev parent reply other threads:[~2016-10-14 13:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 9:33 [PATCH 1/1] MdePkg/IoLib: Add support for big-endian MMIO Bhupesh Sharma
2016-10-14 12:06 ` Laszlo Ersek
2016-10-14 13:17 ` Bhupesh Sharma
2016-10-14 13:32 ` Laszlo Ersek [this message]
2016-10-17 3:10 ` Gao, Liming
2016-10-17 4:10 ` Kinney, Michael D
2016-10-17 7:42 ` Ard Biesheuvel
2016-10-17 9:57 ` Bhupesh Sharma
2017-10-13 6:07 ` Meenakshi Aggarwal
2017-10-16 3:17 ` Gao, Liming
2017-10-23 7:07 ` Udit Kumar
2017-11-27 6:06 ` Meenakshi Aggarwal
2017-11-27 11:07 ` Leif Lindholm
2017-11-29 12:51 ` Leif Lindholm
2017-11-29 19:25 ` Kinney, Michael D
2017-11-29 19:48 ` Leif Lindholm
2017-11-30 4:15 ` Meenakshi Aggarwal
2017-12-01 10:57 ` Leif Lindholm
2017-12-01 17:57 ` Udit Kumar
2017-12-01 22:41 ` Kinney, Michael D
2017-12-04 6:18 ` Meenakshi Aggarwal
2017-12-04 12:36 ` Leif Lindholm
2017-12-04 15:31 ` Kinney, Michael D
2017-12-04 15:54 ` Leif Lindholm
2017-12-04 16:19 ` Kinney, Michael D
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53299f19-a5f8-99c8-78cd-219c4fb31699@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox