Aligned malloc for dma and mbufs for powerpc ppc405gp (was d ma-vm-cache)
Feng, Shuchen
feng at bnl.gov
Thu Nov 11 04:51:58 UTC 2004
Gene Smith wrote :
>Feng, Shuchen wrote, On 11/09/2004 10:56 PM:
>> For 32 bytes aligned, one can do :
>>
>> struct GTeth_softc *sc;
>>
>> /* Make certain elements e.g. descriptor lists are aligned. */
>> softc_mem = rtems_bsdnet_malloc(sizeof(*sc) + SOFTC_ALIGN, M_FREE,
>> M_NOWAIT);
>>
>> /* Check for the very unlikely case of no memory. */
>> if (softc_mem == NULL)
>> rtems_panic("GT64260eth: OUT OF MEMORY");
>>
>> sc = (void *)(((long)softc_mem + SOFTC_ALIGN) & ~SOFTC_ALIGN);
>> memset(sc, 0, sizeof(*sc))
>Thank, this does the trick. Driver now works! The 405pgr manual states
>you need 4KB alignment in one place for descriptors and 8 byte in
>another. I stayed with 4KB for now to be safe.
How about the dma-vme-cache issue ?
Did the hardware/firmware take care of the cache snoop ?
Did you have to write the software snoop as what Joel suggested earlier ?
If so, is it shareable ?
Joel Sherrill wrote :
>THen it would be the BSPs responsibility to provide the implementation
>of these routines with some shared code having default no-op versions.
Thanks,
Kate
More information about the users
mailing list