1 /* promdevmap.c: Map device/IO areas to virtual addresses.
2 *
3 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
4 */
5
6 #include <asm/openprom.h>
7 #include <asm/oplib.h>
8
9 /* Just like the routines in palloc.c, these should not be used
10 * by the kernel at all. Bootloader facility mainly. And again,
11 * this is only available on V2 proms and above.
12 */
13
14 /* Map physical device address 'paddr' in IO space 'ios' of size
15 * 'num_bytes' to a virtual address, with 'vhint' being a hint to
16 * the prom as to where you would prefer the mapping. We return
17 * where the prom actually mapped it.
18 */
19 char *
20 prom_mapio(char *vhint, int ios, unsigned int paddr, unsigned int num_bytes)
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
21 {
22 if((num_bytes == 0) || (paddr == 0)) return (char *) 0x0;
23 return (*(romvec->pv_v2devops.v2_dumb_mmap))(vhint, ios, paddr,
24 num_bytes);
25 }
26
27 /* Unmap an IO/device area that was mapped using the above routine. */
28 void
29 prom_unmapio(char *vaddr, unsigned int num_bytes)
/* ![[previous]](../icons/left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
30 {
31 if(num_bytes == 0x0) return;
32 (*(romvec->pv_v2devops.v2_dumb_munmap))(vaddr, num_bytes);
33 return;
34 }