blob: 2ef57efeb225c515615f7e22a46fda3c9d5f762c [file] [log] [blame]
Paul Mundt9edef282010-02-17 16:28:00 +09001#include <linux/init.h>
2#include <asm/sizes.h>
3#include <asm/page.h>
Paul Mundt40d1f002010-03-08 21:03:21 +09004#include <asm/addrspace.h>
Paul Mundt9edef282010-02-17 16:28:00 +09005
6/*
7 * This is the offset of the uncached section from its cached alias.
8 *
9 * Legacy platforms handle trivial transitions between cached and
10 * uncached segments by making use of the 1:1 mapping relationship in
11 * 512MB lowmem, others via a special uncached mapping.
12 *
13 * Default value only valid in 29 bit mode, in 32bit mode this will be
14 * updated by the early PMB initialization code.
15 */
16unsigned long cached_to_uncached = SZ_512M;
17unsigned long uncached_size = SZ_512M;
18unsigned long uncached_start, uncached_end;
19
20int virt_addr_uncached(unsigned long kaddr)
21{
22 return (kaddr >= uncached_start) && (kaddr < uncached_end);
23}
24
25void __init uncached_init(void)
26{
Paul Mundt40d1f002010-03-08 21:03:21 +090027#ifdef CONFIG_29BIT
28 uncached_start = P2SEG;
29#else
Paul Mundt9edef282010-02-17 16:28:00 +090030 uncached_start = memory_end;
Paul Mundt40d1f002010-03-08 21:03:21 +090031#endif
Paul Mundt9edef282010-02-17 16:28:00 +090032 uncached_end = uncached_start + uncached_size;
33}
Paul Mundtd01447b2010-02-18 18:13:51 +090034
35void __init uncached_resize(unsigned long size)
36{
37 uncached_size = size;
38 uncached_end = uncached_start + uncached_size;
39}