odd bus_dma_tag_create(...maxsegsize..) . question for some devices..

Julian Elischer julian at elischer.org
Fri Apr 8 11:58:15 PDT 2005


The man page specifies: for the maxsegsz parameter:
--------
    maxsegsz    
              Maximum size, in bytes, of a segment in any DMA
    mapped region associated with dmat.
----------
some devices seem to use the highest address in the buffer here...
it seems wrong..

anyone know if these devices need this, or their maxsegsiz and maxsize
values should be 1 greater?

Most devices use BUS_SPACE_MAXSIZE_24BIT or BUS_SPACE_MAXSIZE_32BIT
which are defined as odd values (not even) as well (see below, at end).
Probably this is where the misunderstanding came from.


the (bad?) examples

an/if_an_pci.c-                        0x3ffff,                 /* 
maxsize XXX */
an/if_an_pci.c-                        1,                       /* 
nsegments */
an/if_an_pci.c-                        0xffff,                  /* 
maxsegsize XXX */

I'm guessing this should be  0x10000 and 0x 10000 (nsegs = 1).


./sound/usb/uaudio_pcm.c-                               /*maxsize*/      
bufsz,
./sound/usb/uaudio_pcm.c-                               /*nsegments*/ 1,
./sound/usb/uaudio_pcm.c-                               /*maxsegz*/     
0x3fff,


I'm guessing these should be 0x1000 , 4, 0x4000 (depending possibly on 
the USB adapter used.)


./ubsec/ubsec.c-                               0x3ffff,                 
/* maxsize */
./ubsec/ubsec.c-                               UBS_MAX_SCATTER,         
/* nsegments */
./ubsec/ubsec.c-                               0xffff,                  
/* maxsegsize */

I think this should be:
0x40000, UBS_MAX_SCATTER, 0x10000

but I dont know the hardware.


i386/include/bus_at386.h:#define BUS_SPACE_MAXSIZE_24BIT     0xFFFFFF
i386/include/bus_pc98.h:#define BUS_SPACE_MAXSIZE_24BIT      0xFFFFFF
i386/include/bus_at386.h:#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF
i386/include/bus_pc98.h:#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF



More information about the freebsd-current mailing list