uncached.c 1.1 KB
Newer Older
P
Paul Mundt 已提交
1
#include <linux/init.h>
P
Paul Mundt 已提交
2
#include <linux/module.h>
P
Paul Mundt 已提交
3 4
#include <asm/sizes.h>
#include <asm/page.h>
5
#include <asm/addrspace.h>
P
Paul Mundt 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18 19

/*
 * This is the offset of the uncached section from its cached alias.
 *
 * Legacy platforms handle trivial transitions between cached and
 * uncached segments by making use of the 1:1 mapping relationship in
 * 512MB lowmem, others via a special uncached mapping.
 *
 * Default value only valid in 29 bit mode, in 32bit mode this will be
 * updated by the early PMB initialization code.
 */
unsigned long cached_to_uncached = SZ_512M;
unsigned long uncached_size = SZ_512M;
unsigned long uncached_start, uncached_end;
P
Paul Mundt 已提交
20 21
EXPORT_SYMBOL(uncached_start);
EXPORT_SYMBOL(uncached_end);
P
Paul Mundt 已提交
22 23 24 25 26

int virt_addr_uncached(unsigned long kaddr)
{
	return (kaddr >= uncached_start) && (kaddr < uncached_end);
}
P
Paul Mundt 已提交
27
EXPORT_SYMBOL(virt_addr_uncached);
P
Paul Mundt 已提交
28 29 30

void __init uncached_init(void)
{
31 32 33
#ifdef CONFIG_29BIT
	uncached_start = P2SEG;
#else
P
Paul Mundt 已提交
34
	uncached_start = memory_end;
35
#endif
P
Paul Mundt 已提交
36 37
	uncached_end = uncached_start + uncached_size;
}
38 39 40 41 42 43

void __init uncached_resize(unsigned long size)
{
	uncached_size = size;
	uncached_end = uncached_start + uncached_size;
}