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