Changes in kernel/generic/src/ddi/ddi.c [8df5f20:5a5269d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/ddi.c
r8df5f20 r5a5269d 46 46 #include <mm/frame.h> 47 47 #include <mm/as.h> 48 #include <mm/km.h> 48 49 #include <mm/page.h> 49 50 #include <synch/mutex.h> … … 56 57 #include <trace.h> 57 58 #include <bitops.h> 59 #include <arch/asm.h> 58 60 59 61 /** This lock protects the @c pareas ordered dictionary. */ … … 246 248 */ 247 249 sys_errno_t sys_physmem_map(uintptr_t phys, size_t pages, unsigned int flags, 248 void *virt_ptr, uintptr_t bound)250 uspace_ptr_uintptr_t virt_ptr, uintptr_t bound) 249 251 { 250 252 uintptr_t virt; … … 260 262 rc = copy_to_uspace(virt_ptr, &virt, sizeof(virt)); 261 263 if (rc != EOK) { 262 physmem_unmap( (uintptr_t)virt);264 physmem_unmap(virt); 263 265 return rc; 264 266 } … … 391 393 * 392 394 */ 393 sys_errno_t sys_iospace_enable( ddi_ioarg_t *uspace_io_arg)395 sys_errno_t sys_iospace_enable(uspace_ptr_ddi_ioarg_t uspace_io_arg) 394 396 { 395 397 ddi_ioarg_t arg; … … 402 404 } 403 405 404 sys_errno_t sys_iospace_disable( ddi_ioarg_t *uspace_io_arg)406 sys_errno_t sys_iospace_disable(uspace_ptr_ddi_ioarg_t uspace_io_arg) 405 407 { 406 408 ddi_ioarg_t arg; … … 463 465 464 466 sys_errno_t sys_dmamem_map(size_t size, unsigned int map_flags, unsigned int flags, 465 void *phys_ptr, void *virt_ptr, uintptr_t bound)467 uspace_ptr_uintptr_t phys_ptr, uspace_ptr_uintptr_t virt_ptr, uintptr_t bound) 466 468 { 467 469 if ((flags & DMAMEM_FLAGS_ANONYMOUS) == 0) { … … 471 473 472 474 uintptr_t phys; 473 errno_t rc = dmamem_map( (uintptr_t)virt_ptr, size, map_flags,475 errno_t rc = dmamem_map(virt_ptr, size, map_flags, 474 476 flags, &phys); 475 477 … … 479 481 rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys)); 480 482 if (rc != EOK) { 481 dmamem_unmap( (uintptr_t)virt_ptr, size);483 dmamem_unmap(virt_ptr, size); 482 484 return rc; 483 485 } … … 506 508 rc = copy_to_uspace(phys_ptr, &phys, sizeof(phys)); 507 509 if (rc != EOK) { 508 dmamem_unmap_anonymous( (uintptr_t)virt);510 dmamem_unmap_anonymous(virt); 509 511 return rc; 510 512 } … … 512 514 rc = copy_to_uspace(virt_ptr, &virt, sizeof(virt)); 513 515 if (rc != EOK) { 514 dmamem_unmap_anonymous( (uintptr_t)virt);516 dmamem_unmap_anonymous(virt); 515 517 return rc; 516 518 } … … 527 529 return dmamem_unmap_anonymous(virt); 528 530 } 531 void *pio_map(void *phys, size_t size) 532 { 533 #ifdef IO_SPACE_BOUNDARY 534 if (phys < IO_SPACE_BOUNDARY) 535 return phys; 536 #endif 537 return (void *) km_map((uintptr_t) phys, size, KM_NATURAL_ALIGNMENT, 538 PAGE_READ | PAGE_WRITE | PAGE_NOT_CACHEABLE); 539 } 540 541 void pio_unmap(void *phys, void *virt, size_t size) 542 { 543 #ifdef IO_SPACE_BOUNDARY 544 if (phys < IO_SPACE_BOUNDARY) 545 return; 546 #endif 547 km_unmap((uintptr_t) virt, size); 548 } 529 549 530 550 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.