Below discussion posted in osol-code mailing list tells how to use ddi interface to convert virtual address to physical address in Solaris driver.
====
If you are writing a device driver, or porting one, then you're going about this entirely the wrong way. These APIs should only be used by low level platform code, not from within device drivers. In fact, hat_getkpfnum generates warnings if you use it!
Assuming that this is an ordinary device driver, and not something really unusual (really unusual would mean something like a new MMU layer or somesuch), then you need to use the Solaris DDI DMA interfaces.
ddi_dma_alloc_handle() to get a handle.
ddi_dma_mem_alloc() to allocate memory (unless you already have memory).
ddi_dma_addr_bind_handle() to bind DMA addresses, and get the "cookie" for the corresponding physical address.
ddi_dma_buf_bind_handle() if you're working buf(9S) structures instead of arbitrary memory
This may sound like more work, but the end result is portable and safe, and will even work on amd64 and SPARC systems.
=====
Solaris中DMA地址转换
本文介绍了在Solaris操作系统中如何正确使用设备驱动程序进行虚拟地址到物理地址的转换。文章强调了避免直接使用底层平台API的重要性,并推荐使用DDI DMA接口来实现这一功能。
3007

被折叠的 条评论
为什么被折叠?



