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

John-Mark Gurney gurney_j at
Thu May 11 15:54:53 UTC 2006

hongz at wrote this message on Thu, May 11, 2006 at 17:45 +0800:
> 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!

That's what bus_space is used for...  You need to allocate the resource
that contains the sg_table, and then you can use the bus_space macros
to access the table..  you could use bus_space_write_region to copy
the table from kernel memory to your device, or just write the updated

  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."

More information about the freebsd-hackers mailing list