help:How to map a physical address into a kernel address?

Scott Long scottl at
Wed May 17 02:48:23 UTC 2006

hongz at wrote:

> Hi guys:
> 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!
> Thanks a lot!

What kind of memory are you trying to access?  Are you trying to access
memory on the card that is pointed to by PCI base address registers?  If
so then you need to use the bus_space API.  Or are you trying to 
allocate memory in the kernel and then give the physical address of that
memory to your card?  If so then you need to use bus_dma.  Both Warner 
and I are happy to help guide you with these APIs.


More information about the freebsd-hackers mailing list