[edk2-devel] [PATCH v4 edk2-platforms 1/1] Silicon/DesignWare/Driver: DwEmacSnpDxe: Add DesignWare EMAC driver

Ard Biesheuvel ard.biesheuvel at linaro.org
Wed Jun 19 10:12:10 UTC 2019


On Wed, 19 Jun 2019 at 12:09, Ooi, Tzy Way <tzy.way.ooi at intel.com> wrote:
>
> Hi Bieshuevel,
>
> In the DmaMap function, there is one line where my code look like this:
>
> "Status = DmaMap (MapOperationBusMasterCommonBuffer, Snp->MacDriver.TxdescRing[0], &BufferSize, &Snp->MacDriver.TxdescRingMap[0], &Snp->MappingTxdesc);"
>
> You asked me why the [0] and how many descriptor I am mapping. In my code, there is total 10 descriptors. The way I did in current code was I use DmaAllocateBuffer to allocate a memory size which is big enough for 10 descriptors. After that, I just map the first descriptor and I access the rest of the descriptor by using the first descriptor address plus the size for each descriptor to get the next descriptor address. Wonder if this method is ok? Or do I need to use DmaAllocateBuffer and DmaMap for 10 times for total 10 descriptors?
>

No, this is not ok. You have to allocate and map the size of the
memory that you will use. As long as you don't use more than a page,
it will not matter in practice, but it is wrong nonetheless

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#42589): https://edk2.groups.io/g/devel/message/42589
Mute This Topic: https://groups.io/mt/31541649/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list