[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Aligned malloc for dma and mbufs for powerpc ppc405gp (was d ma-vm-cache)
- Date: Wed, 10 Nov 2004 23:51:58 -0500
- From: feng at bnl.gov (Feng, Shuchen)
- Subject: Aligned malloc for dma and mbufs for powerpc ppc405gp (was d ma-vm-cache)
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,
>> /* 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.