From: Laszlo Ersek <lersek@redhat.com>
To: Phil Dennis-Jordan <lists@philjordan.eu>
Cc: edk2-devel-01 <edk2-devel@lists.01.org>,
Jordan Justen <jordan.l.justen@intel.com>,
Phil Dennis-Jordan <phil@philjordan.eu>
Subject: Re: [PATCH v2 2/3] OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O.
Date: Wed, 5 Apr 2017 11:37:24 +0200 [thread overview]
Message-ID: <183d7d9c-54e6-ace3-203c-950c0f08454e@redhat.com> (raw)
In-Reply-To: <CAGCz3vvyDCc1_tSbgkZf-hZbAp680gzSvmjRg9CacnrLfiyJdg@mail.gmail.com>
On 04/05/17 11:16, Phil Dennis-Jordan wrote:
> On Tue, Apr 4, 2017 at 8:19 PM, Laszlo Ersek <lersek@redhat.com> wrote:
>> On 04/03/17 00:44, Phil Dennis-Jordan wrote:
>>> +/**
>>> + Performs a 32-bit write to the specified, possibly unaligned I/O-type address.
>>> +
>>> + Writes the 32-bit I/O port specified by Port with the value specified by Value
>>> + and returns Value. This function must guarantee that all I/O read and write
>>> + operations are serialized.
>>> +
>>> + If 32-bit unaligned I/O port operations are not supported, then ASSERT().
>>> +
>>> + @param[in] Port I/O port address
>>> + @param[in] Value 32-bit word to write
>>> +
>>> + @return The value written to the I/O port.
>>> +
>>> +**/
>>> +UINT32
>>> +UnalignedIoWrite32 (
>>> + IN UINTN Port,
>>> + IN UINT32 Value
>>> + )
>>> +{
>>> + __asm__ __volatile__ ( "outl %0, %1" : : "a"(Value), "Nd"((UINT16)Port) );
>>
>> Please insert a space after each second quote character:
>>
>> "a" (Value)
>>
>> "Nd" ((UINT16)Port)
>>
>> Also, a question: what does the N character (constraint?) do in the
>> input operand specification? I tried to check the gcc inline assembly
>> docs at <https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html>, and I
>> couldn't find it. Thanks.
>
> The N constraint is x86-specific and indicates an 8-bit unsigned
> immediate value can be used as the operand. This enables emitting the
> OUT imm8, EAX
> instruction variant, see
> https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
> In practice, this is most likely not going to happen here, even if
> link time optimisation happens to inline the call, as the port number
> isn't hardcoded. I can remove it if you like.
Either a comment or removal would be fine, I think.
I feel slightly more attracted to removal because the "N" diverges from
IoWrite32() in "MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c", and that
difference seems to deserve justification.
Thanks
Laszlo
next prev parent reply other threads:[~2017-04-05 9:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-02 22:44 [PATCH v2 0/3] OvmfPkg/QemuVideoDxe: Add VMWare SVGA2 framebuffer support Phil Dennis-Jordan
2017-04-02 22:44 ` [PATCH v2 1/3] OvmfPkg: VMWare SVGA2 display device register definitions Phil Dennis-Jordan
2017-04-03 23:17 ` Jordan Justen
2017-04-04 10:40 ` Laszlo Ersek
2017-04-04 7:54 ` Laszlo Ersek
2017-04-02 22:44 ` [PATCH v2 2/3] OvmfPkg/QemuVideoDxe: Helper functions for unaligned port I/O Phil Dennis-Jordan
2017-04-04 8:19 ` Laszlo Ersek
2017-04-05 9:16 ` Phil Dennis-Jordan
2017-04-05 9:37 ` Laszlo Ersek [this message]
2017-04-02 22:44 ` [PATCH v2 3/3] OvmfPkg/QemuVideoDxe: VMWare SVGA II device support Phil Dennis-Jordan
2017-04-04 10:13 ` Laszlo Ersek
2017-04-02 22:48 ` [PATCH v2 0/3] OvmfPkg/QemuVideoDxe: Add VMWare SVGA2 framebuffer support Phil Dennis-Jordan
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=183d7d9c-54e6-ace3-203c-950c0f08454e@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