blob: a7767da815e91453c5b5526a05f4c72405e4afba [file] [log] [blame]
Paul Mundt9edef282010-02-17 16:28:00 +09001#include <linux/init.h>
Paul Mundt5b34d1e2010-03-10 16:46:58 +09002#include <linux/module.h>
Paul Mundt9edef282010-02-17 16:28:00 +09003#include <asm/sizes.h>
4#include <asm/page.h>
Paul Mundt40d1f002010-03-08 21:03:21 +09005#include <asm/addrspace.h>
Paul Mundt9edef282010-02-17 16:28:00 +09006
7/*
8 * This is the offset of the uncached section from its cached alias.
9 *
10 * Legacy platforms handle trivial transitions between cached and
11 * uncached segments by making use of the 1:1 mapping relationship in
12 * 512MB lowmem, others via a special uncached mapping.
13 *
14 * Default value only valid in 29 bit mode, in 32bit mode this will be
15 * updated by the early PMB initialization code.
16 */
17unsigned long cached_to_uncached = SZ_512M;
18unsigned long uncached_size = SZ_512M;
19unsigned long uncached_start, uncached_end;
Paul Mundt5b34d1e2010-03-10 16:46:58 +090020EXPORT_SYMBOL(uncached_start);
21EXPORT_SYMBOL(uncached_end);
Paul Mundt9edef282010-02-17 16:28:00 +090022
23int virt_addr_uncached(unsigned long kaddr)
24{
25 return (kaddr >= uncached_start) && (kaddr < uncached_end);
26}
Paul Mundt5b34d1e2010-03-10 16:46:58 +090027EXPORT_SYMBOL(virt_addr_uncached);
Paul Mundt9edef282010-02-17 16:28:00 +090028
29void __init uncached_init(void)
30{
Paul Mundte2fcf742010-11-04 12:32:24 +090031#if defined(CONFIG_29BIT) || !defined(CONFIG_MMU)
Paul Mundt40d1f002010-03-08 21:03:21 +090032 uncached_start = P2SEG;
33#else
Paul Mundt9edef282010-02-17 16:28:00 +090034 uncached_start = memory_end;
Paul Mundt40d1f002010-03-08 21:03:21 +090035#endif
Paul Mundt9edef282010-02-17 16:28:00 +090036 uncached_end = uncached_start + uncached_size;
37}
Paul Mundtd01447b2010-02-18 18:13:51 +090038
39void __init uncached_resize(unsigned long size)
40{
41 uncached_size = size;
42 uncached_end = uncached_start + uncached_size;
43}