[Linaro-uefi] OpenPlatformPkg/Platforms/ARM/Juno: Add NullDmaLib for ArmJunoPkg/Drivers/PciHostBridgeDxe

Message ID CAKv+Gu-dy18EJK9e1fe=MNMDT64Ps5aWkgyAaQJiicNOmDC2ug@mail.gmail.com
State New
Headers show

Commit Message

Ard Biesheuvel Sept. 23, 2016, 12:08 p.m.
On 23 September 2016 at 09:02, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 23 September 2016 at 00:49, Daniil Egranov <daniil.egranov@arm.com> wrote:
>> Added NullDmaLib needed for ArmJunoPkg/Drivers/PciHostBridgeDxe with
>> the fix for PCI DMA issue on Juno.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
>> ---
>>  Platforms/ARM/Juno/ArmJuno.dsc | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc
>> index 751225a..4456ff6 100644
>> --- a/Platforms/ARM/Juno/ArmJuno.dsc
>> +++ b/Platforms/ARM/Juno/ArmJuno.dsc
>> @@ -52,6 +52,8 @@
>>    # USB Requirements
>>    UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
>>
>> +  NullDmaLib|EmbeddedPkg/Library/NullDmaLib/NullDmaLib.inf
>> +
>
> Is the PCI host bridge driver the only user of DmaLib on Juno?
> If not, are all other PCI bus masters coherent as well?

Looking at ArmJunoDxe, it seems that the PCI emulation for USB also
uses this library. Are those DMA coherent on Juno?

If not, we should add this DmaLib resolution for the PCI root complex driver as



Also, the reference to  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf does not
make sense, given that it ASSERT()s on all I/O range accesses.

Comments

Ard Biesheuvel Sept. 23, 2016, 2:54 p.m. | #1
On 23 September 2016 at 15:27, Jeremy Linton <jeremy.linton@arm.com> wrote:
> On 09/23/2016 07:08 AM, Ard Biesheuvel wrote:
>>
>> On 23 September 2016 at 09:02, Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> wrote:
>>>
>>> On 23 September 2016 at 00:49, Daniil Egranov <daniil.egranov@arm.com>
>>> wrote:
>>>>
>>>> Added NullDmaLib needed for ArmJunoPkg/Drivers/PciHostBridgeDxe with
>>>> the fix for PCI DMA issue on Juno.
>>>>
>>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>>> Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
>>>> ---
>>>>  Platforms/ARM/Juno/ArmJuno.dsc | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/Platforms/ARM/Juno/ArmJuno.dsc
>>>> b/Platforms/ARM/Juno/ArmJuno.dsc
>>>> index 751225a..4456ff6 100644
>>>> --- a/Platforms/ARM/Juno/ArmJuno.dsc
>>>> +++ b/Platforms/ARM/Juno/ArmJuno.dsc
>>>> @@ -52,6 +52,8 @@
>>>>    # USB Requirements
>>>>    UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
>>>>
>>>> +  NullDmaLib|EmbeddedPkg/Library/NullDmaLib/NullDmaLib.inf
>>>> +
>>>
>>>
>>> Is the PCI host bridge driver the only user of DmaLib on Juno?
>>> If not, are all other PCI bus masters coherent as well?
>>
>>
>> Looking at ArmJunoDxe, it seems that the PCI emulation for USB also
>> uses this library. Are those DMA coherent on Juno?
>
>
> The USB/EHCI controller is not coherent on Juno (its not PCIe attached). Of
> course if someone plugs say a XHCI controller in, that should be coherent.
>

Indeed. So this change would break the onboard EHCI/OHCI controllers
(although the library class is called 'DmaLib' not 'NullDmaLib', so
the patch does nothing as is.)

Patch

diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc
index 751225ab112d..3913bd7caeae 100644
--- a/Platforms/ARM/Juno/ArmJuno.dsc
+++ b/Platforms/ARM/Juno/ArmJuno.dsc
@@ -277,7 +277,10 @@ 
   # PCI Support
   #
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
-  ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  ArmPlatformPkg/ArmJunoPkg/Drivers/PciHostBridgeDxe/PciHostBridgeDxe.inf {
+    <LibraryClasses>
+      DmaLib|EmbeddedPkg/Library/NullDmaLib/NullDmaLib.inf
+  }

   #
   # SATA Controller