Date: Sun, 26 Aug 2001 14:16:12 -0400 (EDT) From: Zhihui Zhang <zzhang@cs.binghamton.edu> To: freebsd-hackers@freebsd.org Subject: Re: ata0-master: non aligned DMA transfer attempted Message-ID: <Pine.SOL.4.21.0108261415301.9351-100000@opal>
next in thread | raw e-mail | index | archive | help
Thanks for your replay. I use gdb to find out that the buffer address is not 16-byte aligned. This leads to a question as to how to align a statically allocated data structure properly. Using union seems to be able to align you on a long boundary (or even long long?), but that is not 16 byte aligned. union { my_data_structure_t xyz; long pad; } The natural alignment seems to work only on primitive data types. If you define: unsigned char sector_buf[512]; It will not always be aligned on a 512 byte boundary, even 16-byte alignment is not guaranteed. Is there a way to achieve this? -Zhihui On Fri, 24 Aug 2001, Julian Elischer wrote: > Zhihui Zhang wrote: > > > > I write a program that writes into a raw device directly. Although the > > program runs OK, the system prints messages like: > > > > ata0-master: non aligned DMA transfer attempted > make sure your DMA buffer is alligned on a 64 byte boundary... > (a page would be best) > and that you are transferring an exact bultiple of 512 bytes. > > The DMA hardware on some macines cannot handle a buffer on less than 16 byte > allignment, (some on odd allignment,.. (it's a bit hardware dependent). > > so be safe and allign your buffers. > > > when it detects it cannot do it, i used PIO instead, so your data is still > transferred... > > > > > What exactly happens here? Is there any problem in my program? > > > > Thanks. > > > > -Zhihui > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-hackers" in the body of the message > > -- > +------------------------------------+ ______ _ __ > | __--_|\ Julian Elischer | \ U \/ / hard at work in > | / \ julian@elischer.org +------>x USA \ a very strange > | ( OZ ) \___ ___ | country ! > +- X_.---._/ presently in San Francisco \_/ \\ > v > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SOL.4.21.0108261415301.9351-100000>