how to convert a virutal address to physical address in Solaris driver

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.

=====

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值