Tentitive (untested) ISA DMA space allocation fix.

Matthew Dillon dillon at apollo.backplane.com
Sun Sep 14 11:26:57 PDT 2003


:>     then hopefully I will be able to track it down when I get my TWE
:>     card in about two weeks.  I'll also take a quick look at the TWE
:>     code to see if there is something obvious.
:
:Still no love from the twe driver with this patch applied.... :-(
:
:
:-DR

    It could be this line in twe_freebsd.c:

        /*
         * Data must be 64-byte aligned; allocate a fixup buffer if it's not.
         */
        if (((vm_offset_t)tr->tr_data % TWE_ALIGNMENT) != 0) {
            tr->tr_realdata = tr->tr_data;                              /* save
pointer to 'real' data */   
            tr->tr_flags |= TWE_CMD_ALIGNBUF;
            tr->tr_data = malloc(tr->tr_length, TWE_MALLOC_CLASS, M_NOWAIT);
/* XXX check result here */
        }

    It is assuming that malloc returns 64-byte aligned data.  I'm not sure
    if this is going to be true in all cases, it depends on the actual
    length being sent to malloc.  Try adding a check and a panic after
    the malloc:

    tr->tr_data = malloc ...
    if ((vm_offset_t)tr->tr_data % TWE_ALIGNMENT)
	panic("TWE malloc %d bytes not %d-aligned", tr->tr_length, TWE_ALIGNMENT);

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>





More information about the Kernel mailing list