On 08/26/2016 05:57 PM, Alan Ott wrote:
These patches are for the MarvellYukon driver which is currently part of OpenPlatformPkg.
The impetus was to get this driver to work on a SoftIron Overdrive 1000 board using the AMD Opteron-A (Seattle/Styx) SoC. On this platform, in my testing, edk2 allocates DMA buffers with 64-bit addresses. The Marvell Yukon driver as posted did not support 64-bit addresses, and simply truncated any DMA address to 32-bits. After consulting with Ard Biesheuvel and Leif Lindholm on IRC, it seemed the proper fix was to add support for 64-bit DMA. For this I went back to the original source of this driver (FreeBSD), and brought over the appropriate code.
A couple of patches are basic fixes, but the one titled "Don't re-use DMA buffers" changes how handling of DMA buffers works. This patch makes it work closer to how the FreeBSD implementation works and also adds some required DMA function calls. Its commit message is worth a read.
I don't have a Juno board to test this on, so while this does work on my Overdrive 1000, there's a chance I broke something for other users.
Changes from v1:
- Update to the version of the driver committed in OpenPlatformPkg.
Changes from v2:
- Base on what's currently upstream (Leif Lindholm took patches 1 and 2 from v2, reducing the patch count from 6 to 4).
- Use functions for CopyMem() and SetMem() from EFI Boot Services (gBS->CopyMem(), etc.).
- Add Signoff and Contributed-Under
Changes from v3:
- Change some DEBUG() messages to EFI_D_NET
Changes from v4:
- Move the call to FreeBuffer() in msk_rxeof() to happen regardless of other allocation failures.
- Add patch to free the link object if the link's buffer can't be created.
Alan Ott (5): Drivers/Net/MarvellYukon: Don't re-use DMA buffers Drivers/Net/MarvellYukon: Zero allocated memory for DMA receive buffers Drivers/Net/MarvellYukon: Add 64-bit DMA support Drivers/Net/MarvellYukon: Set Dual Address Cycle Attribute Drivers/Net/MarvellYukon: Free link if its DMA buffer can't be allocated
Drivers/Net/MarvellYukonDxe/if_msk.c | 91 +++++++++++++++++++++++++-------- Drivers/Net/MarvellYukonDxe/if_mskreg.h | 13 +++++ 2 files changed, 84 insertions(+), 20 deletions(-)
Verified on Juno with AARCH64 build. The Juno PCI Root Bridge PciRbMap() does not handle the Dual Address Cycle Attribute case. The new Marvell driver requires "[PATCH] ArmJunoPkg/PciHostBridgeDxe: Fix for PCI Dual Address Cycle Attribute" patch.
Additional changes may needed for EBC build.
Thanks,
Daniil