Commit bacb8330 authored by Abhiram Balasubramanian's avatar Abhiram Balasubramanian Committed by Vikram Narayanan

Add ioremap functions to liblcd interface

- rename functions
- add them to mem.h
Signed-off-by: Abhiram Balasubramanian's avatarAbhiram Balasubramanian <abhiram@cs.utah.edu>
parent 4328b4eb
......@@ -591,4 +591,34 @@ void *lcd_page_address(const struct page *page);
*/
void lcd_free_memcg_kmem_pages(unsigned long addr, unsigned int order);
/**
* lcd_ioremap_phys -- Map host device memory to guest physical region
*
* @phys_addr: Capability to device memory
* @size: size of memory region in bytes
* @base: guest physical memory address returned by the function
*
* The function converts the size in bytes into order (no of pages).
*/
int lcd_ioremap_phys(cptr_t phys_addr, unsigned int size, gpa_t *base);
/**
* lcd_iounmap_phys - Unmap the device memory region from guest physical region
*
* @phys_addr - guest physical address to be unmapped
* @size - number of bytes to be unmapped
*/
void lcd_iounmap_phys(gpa_t phys_addr, unsigned long size);
/**
* lcd_ioremap -- Returns the guest virtual address mapped for the corresponding
* guest physical address
*
* @phys_addr - guest physical address returned from lcd_ioremap_phys
* @size - number of bytes. This parameter is not used, kept for
* providing compatibility to actual linux kernel's interface
*
* returns the guest virtual address
*/
void *lcd_ioremap(unsigned long phys_addr, unsigned int size);
#endif /* LCD_DOMAINS_MEM_H */
......@@ -28,7 +28,7 @@ static inline struct lcd_page_block *ioremap_addr_to_page_block(gpa_t addr)
gpa_val(addr) - gpa_val(LCD_IOREMAP_GP_ADDR));
}
int _lcd_ioremap(cptr_t phys_addr, unsigned int size, gpa_t *base) {
int lcd_ioremap_phys(cptr_t phys_addr, unsigned int size, gpa_t *base) {
unsigned int order = 0;
struct lcd_page_block *pb = NULL;
......@@ -75,7 +75,7 @@ exit:
return ret;
}
void _lcd_iounmap(gpa_t phys_addr, unsigned long size)
void lcd_iounmap_phys(gpa_t phys_addr, unsigned long size)
{
int ret;
struct lcd_resource_node *n;
......@@ -146,7 +146,7 @@ int __liblcd__ioremap_init(void)
0, /* don't embed metadata */
&ioremap_allocator);
if (ret) {
LIBLCD_ERR("failed to initialize RAM map allocator");
LIBLCD_ERR("failed to initialize ioremap map allocator");
goto exit;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment