* [PATCH edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation
@ 2018-10-19 10:48 Ard Biesheuvel
2018-10-20 6:52 ` Leif Lindholm
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2018-10-19 10:48 UTC (permalink / raw)
To: edk2-devel
Commit 9dd8190e4995 ("Silicon/SynQuacer: tweak PCI I/O windows for
ACPI/Linux support") updated the min/max/offset definitions for the
PCIe I/O resource windows on SynQuacer, and updated the read path of
the platform's EfiCpuIo2 protocol implementation, but failed to update
the write path as well, resulting in spurious errors if when attempting
to write to PCIe I/O ports on PCIe RC #1, which uses translation for the
I/O BAR window.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
index 736b20cd5129..e5cc3aef908d 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
@@ -518,12 +518,18 @@ CpuIoServiceWrite (
return Status;
}
- if ((Address >= SYNQUACER_PCI_SEG0_PORTIO_MIN) &&
- (Address <= SYNQUACER_PCI_SEG0_PORTIO_MAX)) {
- Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE;
- } else if ((Address >= SYNQUACER_PCI_SEG1_PORTIO_MIN) &&
- (Address <= SYNQUACER_PCI_SEG1_PORTIO_MAX)) {
- Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE;
+ if ((Address >= (SYNQUACER_PCI_SEG0_PORTIO_MIN +
+ SYNQUACER_PCI_SEG0_PORTIO_OFFSET)) &&
+ (Address <= (SYNQUACER_PCI_SEG0_PORTIO_MAX +
+ SYNQUACER_PCI_SEG0_PORTIO_OFFSET))) {
+ Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE -
+ SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
+ } else if ((Address >= (SYNQUACER_PCI_SEG1_PORTIO_MIN +
+ SYNQUACER_PCI_SEG1_PORTIO_OFFSET)) &&
+ (Address <= (SYNQUACER_PCI_SEG1_PORTIO_MAX +
+ SYNQUACER_PCI_SEG1_PORTIO_OFFSET))) {
+ Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE -
+ SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
} else {
ASSERT (FALSE);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation
2018-10-19 10:48 [PATCH edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation Ard Biesheuvel
@ 2018-10-20 6:52 ` Leif Lindholm
2018-10-20 14:06 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2018-10-20 6:52 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: edk2-devel (edk2-devel@lists.01.org), Masahisa Kojima
Looks good functionality-wise, but is a bit of a handful to look at (and
not just because I'm code reviewing on a phone).
Could you do it with a couple of temp vars?
/
Leif
On Fri, 19 Oct 2018, 18:48 Ard Biesheuvel, <ard.biesheuvel@linaro.org>
wrote:
> Commit 9dd8190e4995 ("Silicon/SynQuacer: tweak PCI I/O windows for
> ACPI/Linux support") updated the min/max/offset definitions for the
> PCIe I/O resource windows on SynQuacer, and updated the read path of
> the platform's EfiCpuIo2 protocol implementation, but failed to update
> the write path as well, resulting in spurious errors if when attempting
> to write to PCIe I/O ports on PCIe RC #1, which uses translation for the
> I/O BAR window.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
> | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git
> a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
> b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
> index 736b20cd5129..e5cc3aef908d 100644
> ---
> a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
> +++
> b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
> @@ -518,12 +518,18 @@ CpuIoServiceWrite (
> return Status;
> }
>
> - if ((Address >= SYNQUACER_PCI_SEG0_PORTIO_MIN) &&
> - (Address <= SYNQUACER_PCI_SEG0_PORTIO_MAX)) {
> - Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE;
> - } else if ((Address >= SYNQUACER_PCI_SEG1_PORTIO_MIN) &&
> - (Address <= SYNQUACER_PCI_SEG1_PORTIO_MAX)) {
> - Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE;
> + if ((Address >= (SYNQUACER_PCI_SEG0_PORTIO_MIN +
> + SYNQUACER_PCI_SEG0_PORTIO_OFFSET)) &&
> + (Address <= (SYNQUACER_PCI_SEG0_PORTIO_MAX +
> + SYNQUACER_PCI_SEG0_PORTIO_OFFSET))) {
> + Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE -
> + SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
> + } else if ((Address >= (SYNQUACER_PCI_SEG1_PORTIO_MIN +
> + SYNQUACER_PCI_SEG1_PORTIO_OFFSET)) &&
> + (Address <= (SYNQUACER_PCI_SEG1_PORTIO_MAX +
> + SYNQUACER_PCI_SEG1_PORTIO_OFFSET))) {
> + Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE -
> + SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
>
> } else {
> ASSERT (FALSE);
> --
> 2.17.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation
2018-10-20 6:52 ` Leif Lindholm
@ 2018-10-20 14:06 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-10-20 14:06 UTC (permalink / raw)
To: Leif Lindholm; +Cc: edk2-devel (edk2-devel@lists.01.org), Masahisa Kojima
On 20 October 2018 at 14:52, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> Looks good functionality-wise, but is a bit of a handful to look at (and not
> just because I'm code reviewing on a phone).
> Could you do it with a couple of temp vars?
>
Yes, but then CpuIoServiceWrite would deviate from CpuIoServiceRead,
so I should probably break this out into a helper function as well.
> On Fri, 19 Oct 2018, 18:48 Ard Biesheuvel, <ard.biesheuvel@linaro.org>
> wrote:
>>
>> Commit 9dd8190e4995 ("Silicon/SynQuacer: tweak PCI I/O windows for
>> ACPI/Linux support") updated the min/max/offset definitions for the
>> PCIe I/O resource windows on SynQuacer, and updated the read path of
>> the platform's EfiCpuIo2 protocol implementation, but failed to update
>> the write path as well, resulting in spurious errors if when attempting
>> to write to PCIe I/O ports on PCIe RC #1, which uses translation for the
>> I/O BAR window.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>
>> Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
>> | 18 ++++++++++++------
>> 1 file changed, 12 insertions(+), 6 deletions(-)
>>
>> diff --git
>> a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
>> b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
>> index 736b20cd5129..e5cc3aef908d 100644
>> ---
>> a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
>> +++
>> b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerPciCpuIo2Dxe/SynQuacerPciCpuIo2Dxe.c
>> @@ -518,12 +518,18 @@ CpuIoServiceWrite (
>> return Status;
>> }
>>
>> - if ((Address >= SYNQUACER_PCI_SEG0_PORTIO_MIN) &&
>> - (Address <= SYNQUACER_PCI_SEG0_PORTIO_MAX)) {
>> - Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE;
>> - } else if ((Address >= SYNQUACER_PCI_SEG1_PORTIO_MIN) &&
>> - (Address <= SYNQUACER_PCI_SEG1_PORTIO_MAX)) {
>> - Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE;
>> + if ((Address >= (SYNQUACER_PCI_SEG0_PORTIO_MIN +
>> + SYNQUACER_PCI_SEG0_PORTIO_OFFSET)) &&
>> + (Address <= (SYNQUACER_PCI_SEG0_PORTIO_MAX +
>> + SYNQUACER_PCI_SEG0_PORTIO_OFFSET))) {
>> + Address += SYNQUACER_PCI_SEG0_PORTIO_MEMBASE -
>> + SYNQUACER_PCI_SEG0_PORTIO_OFFSET;
>> + } else if ((Address >= (SYNQUACER_PCI_SEG1_PORTIO_MIN +
>> + SYNQUACER_PCI_SEG1_PORTIO_OFFSET)) &&
>> + (Address <= (SYNQUACER_PCI_SEG1_PORTIO_MAX +
>> + SYNQUACER_PCI_SEG1_PORTIO_OFFSET))) {
>> + Address += SYNQUACER_PCI_SEG1_PORTIO_MEMBASE -
>> + SYNQUACER_PCI_SEG1_PORTIO_OFFSET;
>>
>> } else {
>> ASSERT (FALSE);
>> --
>> 2.17.1
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-20 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-19 10:48 [PATCH edk2-platforms] Silicon/SynQuacerPciCpuIo2Dxe: fix PCIe I/O translation Ard Biesheuvel
2018-10-20 6:52 ` Leif Lindholm
2018-10-20 14:06 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox