ddi_dma_xxxx are the serials DDI functions in solaris to allocated
continueous memory.
You can use ddi_dma_alloc_handle(9F) to allocate a handle first, then
ddi_dma_mem_alloc(9F),
Finally ddi_dma_addr_bind_handle(9F) would bind your memory to a dma
handle. You can get
the physical address from dmac_address of ddi_dma_cookie_t(9S).
Through adjust ddi_dma_attr(9S), you can get any what your want page
alignment.
If you want to find a example, please search and see how other
drivers(HBA/NIC/WIFI)
use ddi_dma_alloc_handle(), ddi_dma_mem_alloc(),
ddi_dma_addr_bind_handle() and please
refer to manpage of ddi_dma_attr(9S), adjust appropriate dma attribute
before you start
use ddi_dma_xxx interfaces.

Javen

Baolu Lu Wrote:
> int ddi_dma_mem_alloc(ddi_dma_handle_t handle, size_t length,
>      ddi_device_acc_attr_t *accattrp, uint_t flags,
>      int (*waitfp) (caddr_t), caddr_t arg, caddr_t *kaddrp,
>      size_t *real_length, ddi_acc_handle_t *handlep);
>
> ddi_dma_mem_alloc needs a dma handle. But I can't get a dma handle any way.
>
> Actually, I need the pages to build the page tables used to translate
> the guest io address to the virtual io address.
>
> On Dec 2, 2007 5:47 PM, Michael Li <[EMAIL PROTECTED]> wrote:
>   
>> Baolu Lu 写道:
>>
>>     
>>> Hi,
>>>
>>> How can I allocate a locked page in the driver? The kmem_allocate
>>> interface can't guarantee the physical continuity on that large. I
>>> searched the kernel source tree, and some drivers, such as the ramdisk
>>> driver, have some functions to allocate a hole page. But, does the
>>> Solaris kernel has an interface to allocate a page? Or, if I want one,
>>> what are the general steps to allocate? And, which interfaces should
>>> be used?
>>>
>>> Thanks,
>>> Allen
>>> _______________________________________________
>>> driver-discuss mailing list
>>> [email protected]
>>> http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>>>
>>>       
>> One way is to use ddi_dma_mem_alloc(9F). You can easily find the example
>> code in NIC/WiFi driver.
>>
>> - Michael
>>
>>     
> _______________________________________________
> driver-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>   

_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to