From aef6d0df5cf4e4c917e44d6b145802fa206da246 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sun, 12 Oct 2008 02:11:50 +0100 Subject: [ioapi] Absorb virt_to_phys() and phys_to_virt() into the I/O API --- src/include/gpxe/io.h | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'src/include/gpxe') diff --git a/src/include/gpxe/io.h b/src/include/gpxe/io.h index 58755e6f9..24cc180f1 100644 --- a/src/include/gpxe/io.h +++ b/src/include/gpxe/io.h @@ -149,28 +149,24 @@ } while ( 0 ) /** - * Map bus address as an I/O address + * Convert virtual address to a physical address * - * @v bus_addr Bus address - * @v len Length of region - * @ret io_addr I/O address + * @v addr Virtual address + * @ret phys_addr Physical address */ -void * ioremap ( unsigned long bus_addr, size_t len ); +unsigned long virt_to_phys ( volatile const void *addr ); /** - * Unmap I/O address + * Convert physical address to a virtual address * - * @v io_addr I/O address - */ -void iounmap ( volatile const void *io_addr ); - -/** - * Convert I/O address to bus address (for debug only) + * @v addr Virtual address + * @ret phys_addr Physical address * - * @v io_addr I/O address - * @ret bus_addr Bus address + * This operation isn't actually valid within our memory model, and is + * impossible to achieve under -DKEEP_IT_REAL. Some drivers haven't + * been updated to avoid it yet, though. */ -unsigned long io_to_bus ( volatile const void *io_addr ); +void * phys_to_virt ( unsigned long phys_addr ); /** * Convert virtual address to a bus address @@ -192,6 +188,30 @@ unsigned long virt_to_bus ( volatile const void *addr ); */ void * bus_to_virt ( unsigned long bus_addr ); +/** + * Map bus address as an I/O address + * + * @v bus_addr Bus address + * @v len Length of region + * @ret io_addr I/O address + */ +void * ioremap ( unsigned long bus_addr, size_t len ); + +/** + * Unmap I/O address + * + * @v io_addr I/O address + */ +void iounmap ( volatile const void *io_addr ); + +/** + * Convert I/O address to bus address (for debug only) + * + * @v io_addr I/O address + * @ret bus_addr Bus address + */ +unsigned long io_to_bus ( volatile const void *io_addr ); + /** * Read byte from memory-mapped device * -- cgit v1.2.3-55-g7522