Root/target/linux/coldfire/files-2.6.31/arch/m68k/include/asm/cf_virtconvert.h

1/*
2 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4#ifndef __CF_VIRTCONVERT__
5#define __CF_VIRTCONVERT__
6
7/*
8 * Macros used for converting between virtual and physical mappings.
9 *
10 * Coldfire Specific
11 */
12
13#ifdef __KERNEL__
14
15#include <linux/compiler.h>
16#include <linux/mmzone.h>
17#include <asm/setup.h>
18#include <asm/page.h>
19
20/*
21 * Change virtual addresses to physical addresses and vv.
22 */
23static inline unsigned long virt_to_phys(void *address)
24{
25    return __pa(address);
26}
27
28static inline void *phys_to_virt(unsigned long address)
29{
30    return __va(address);
31}
32
33/* Permanent address of a page. */
34#ifdef CONFIG_SINGLE_MEMORY_CHUNK
35#define page_to_phys(page) \
36    __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
37#else
38#define page_to_phys(_page) ({ \
39    struct page *__page = _page; \
40    struct pglist_data *pgdat; \
41    pgdat = pg_data_table[page_to_nid(__page)]; \
42    page_to_pfn(__page) << PAGE_SHIFT; \
43})
44#endif
45
46/*
47 * IO bus memory addresses are 1:1 with the physical address,
48 */
49#ifdef CONFIG_PCI
50#define virt_to_bus(a) (a + PCI_DMA_BASE)
51#define bus_to_virt(a) (a - PCI_DMA_BASE)
52#else
53#define virt_to_bus(a) (a)
54#define bus_to_virt(a) (a)
55#endif
56
57#endif /* __KERNEL__ */
58#endif /* __CF_VIRTCONVERT__ */
59

Archive Download this file



interactive