In <Pin...@ca...rg>, on
11/27/00
at 08:30 AM, Geert Uytterhoeven <ge...@li...> said:
>On Sun, 26 Nov 2000 fh...@at... wrote:
>>
>> It looks like what most of the drivers I looked at do is add
>> a little extra to the size of the chunk and then move the
>> pointer so it's on a 32 bit boundary. Seems simple enough.
BTW I have been playing with a newer version of the LSI
SCSI driver. In those versions, the data structure is allocated using a
power of two buddy malloc algorithm. In the 53c770 driver I started with
the data structure is statically allocated. What would be the difference.
i.e. you have
( I call this statically allocated. )
struct mystruct {
<blah>
}
instead of
typedef struct mystruct {
<blah>
} MYS;
MYS *mys;
mys = (MYS *)malloc( sizeof(MYS) );
I noticed that whenever I tried using the malloc procedure like the new
drivers, I would lose DMA to the data structure.
>> What if the chip that wants to do DMA only needs 16 bit
>> (or 8 bit) alignment? It seems that then there is a further problem
>> where the memory needs to be "synced" so the
>> 16bit or 8 bit parts line up with the 32bit parts.
>Doesn't get_free_pages() simply return page-aligned data?
Hmmm. I don't know much about get_free_pages. The Linux
Device Driver book says nothing about how it aligns data.
Some of the driver codes I have looked at do strange things
to align memory accesses. This would appear, on the surface, to be a
rather large short coming in the Linux kernel if true. But I am a dummy so
it's probably not. :)
Fred
|