subr_devmap.c (8e9ca1379edad98a957570a2339a9236910e61c1) | subr_devmap.c (7ae99f80b6661760c5de3edd330b279f04b092a2) |
---|---|
1/*- 2 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 311 unchanged lines hidden (view full) --- 320 return ((void *)(va + offset)); 321} 322#endif 323 324/* 325 * Unmap device memory and free the kva space. 326 */ 327void | 1/*- 2 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 311 unchanged lines hidden (view full) --- 320 return ((void *)(va + offset)); 321} 322#endif 323 324/* 325 * Unmap device memory and free the kva space. 326 */ 327void |
328pmap_unmapdev(vm_offset_t va, vm_size_t size) | 328pmap_unmapdev(void *p, vm_size_t size) |
329{ | 329{ |
330 vm_offset_t offset; | 330 vm_offset_t offset, va; |
331 332 /* Nothing to do if we find the mapping in the static table. */ | 331 332 /* Nothing to do if we find the mapping in the static table. */ |
333 if (devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) | 333 if (devmap_vtop(p, size) != DEVMAP_PADDR_NOTFOUND) |
334 return; 335 | 334 return; 335 |
336 va = (vm_offset_t)p; |
|
336 offset = va & PAGE_MASK; 337 va = trunc_page(va); 338 size = round_page(size + offset); 339 340 pmap_kremove_device(va, size); 341 kva_free(va, size); 342} 343 344#ifdef DDB 345#include <ddb/ddb.h> 346 347DB_SHOW_COMMAND_FLAGS(devmap, db_show_devmap, DB_CMD_MEMSAFE) 348{ 349 devmap_dump_table(db_printf); 350} 351 352#endif /* DDB */ | 337 offset = va & PAGE_MASK; 338 va = trunc_page(va); 339 size = round_page(size + offset); 340 341 pmap_kremove_device(va, size); 342 kva_free(va, size); 343} 344 345#ifdef DDB 346#include <ddb/ddb.h> 347 348DB_SHOW_COMMAND_FLAGS(devmap, db_show_devmap, DB_CMD_MEMSAFE) 349{ 350 devmap_dump_table(db_printf); 351} 352 353#endif /* DDB */ |