答复: 答复: help:How to map a physical address into a kernel address?
scottl at samsco.org
Wed May 17 08:11:23 PDT 2006
hongz at promisechina.com wrote:
> Hi guys:
> The attached file is the sample codes of my HBA driver. I make notes on the
> place where the address transfer is needed. Please make comments if
> Thanks a lot!
It looks like the primary question that you are asking in the code is this:
How to get the kernel virtual address of csio->data_ptr?
Correct? The answer is that csio->data_ptr is a kernel virtual address
already if the CAM_DATA_PHYS flag is not set. For prepare_sg_table,
you can just ignore the case where it isn't unless you expect to also
write software that will use the flag (CAM was originally written for an
application that did use this flag, but it's use is no longer common). As
for ft_map_sg, the only way that you can be in there is if CAM_DATA_PHYS
was not set, so it's safe to say that csio->data_ptr is a kernel virtaul
One thing to note about your code is that Local_StartIO should be called
within ft_map_sg instead of ft_cam_action. That way the EINPROGRESS
status of bus_dmamap_load will be handled correctly. I can' describe this
more if you have questions.
More information about the freebsd-hackers