OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-m68k/] [virtconvert.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
#ifndef __VIRT_CONVERT__
2
#define __VIRT_CONVERT__
3
 
4
/*
5
 * Macros used for converting between virtual and physical mappings.
6
 */
7
 
8
#ifdef __KERNEL__
9
 
10
#include <linux/config.h>
11
#include <asm/setup.h>
12
#include <asm/page.h>
13
 
14
#ifdef CONFIG_AMIGA
15
#include <asm/amigahw.h>
16
#endif
17
 
18
/*
19
 * Change virtual addresses to physical addresses and vv.
20
 */
21
#ifndef CONFIG_SUN3
22
extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const));
23
extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const));
24
#else
25
static inline unsigned long mm_vtop(unsigned long vaddr)
26
{
27
        return __pa(vaddr);
28
}
29
 
30
static inline unsigned long mm_ptov(unsigned long paddr)
31
{
32
        return (unsigned long)__va(paddr);
33
}
34
#endif 
35
 
36
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
37
static inline unsigned long virt_to_phys(void *vaddr)
38
{
39
        return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr;
40
}
41
 
42
static inline void * phys_to_virt(unsigned long paddr)
43
{
44
        return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET);
45
}
46
#else
47
static inline unsigned long virt_to_phys(void *address)
48
{
49
        return mm_vtop((unsigned long)address);
50
}
51
 
52
static inline void *phys_to_virt(unsigned long address)
53
{
54
        return (void *) mm_ptov(address);
55
}
56
#endif
57
 
58
/*
59
 * IO bus memory addresses are 1:1 with the physical address,
60
 * except on the PCI bus of the Hades.
61
 */
62
#ifdef CONFIG_HADES
63
#define virt_to_bus(a) (virt_to_phys(a) + (MACH_IS_HADES ? 0x80000000 : 0))
64
#define bus_to_virt(a) (phys_to_virt((a) - (MACH_IS_HADES ? 0x80000000 : 0)))
65
#else
66
#define virt_to_bus virt_to_phys
67
#define bus_to_virt phys_to_virt
68
#endif
69
 
70
/*
71
 * Change "struct page" to physical address.
72
 */
73
 
74
#define __page_address(page)      (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
75
#define page_to_phys(page)       virt_to_phys((void *)__page_address(page))
76
 
77
#endif
78
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.