> I find that busdma can not help on this. Please note that we need access the > data buffer in kernel space, so we must get the kernel virtual address of > the data buffer. Using busdma can only access the data buffer in firmware, > however, I need to access the data buffer in kernel space! Please help me!
I'm unclear why busdma can't help you. You get access to both the PA and VA via the busdma interface. Otherwise, it would be impossible to write a network driver. The PA is given to you in the bus_dmamap_load's callback function's segs and nseg argument. The VA is passed in via the bus_dmamap_load's 'buf' address and is allocated elsewhere. The typical usage is to fill in what you are calling the sg_table in the callback and start the device's DMA. You can get to this information at runtime, but it causes driver portability problems and its use is strongly discouraged. Since the busdma functions deal with all these details, including bounce buffering on large memory configurations, thier use is strongly encouraged. If I'm not understanding your needs, then you can find all you need in the i386/i386/pmap.c and i386/include/pmap.h. The vm mapping functions can be found in include/vm*.h and vm/vm*.c. Careful study is needed to use them correctly, although some of them are documented in man pages. Warner > Best wishes, > > Hong > > -----邮件原件----- > 发件人: M. Warner Losh [mailto:[EMAIL PROTECTED] > 发送时间: 2006年5月13日 8:33 > 收件人: [EMAIL PROTECTED] > 抄送: freebsd-hackers@freebsd.org > 主题: Re: help:How to map a physical address into a kernel address? > > In message: <[EMAIL PROTECTED]@promisechina.com> > <[EMAIL PROTECTED]> writes: > : To access sg_table in kernel address, I need to map the starting physical > : address of a segment into a kernel address. As I know that, we can use > : phystovirt()/bustovirt(), or kmap()/kmap_atomic() to map a bus/physical > : address or a physical page into a kernel address in Linux, but I did not > : find such a function in FreeBSD. Please help me on this, it is very > urgent! > > Use busdma. > > Warner > > >
_______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"