uncached.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <linux/init.h>
  2. #include <linux/module.h>
  3. #include <asm/sizes.h>
  4. #include <asm/page.h>
  5. #include <asm/addrspace.h>
  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. */
  16. unsigned long cached_to_uncached = SZ_512M;
  17. unsigned long uncached_size = SZ_512M;
  18. unsigned long uncached_start, uncached_end;
  19. EXPORT_SYMBOL(uncached_start);
  20. EXPORT_SYMBOL(uncached_end);
  21. int virt_addr_uncached(unsigned long kaddr)
  22. {
  23. return (kaddr >= uncached_start) && (kaddr < uncached_end);
  24. }
  25. EXPORT_SYMBOL(virt_addr_uncached);
  26. void __init uncached_init(void)
  27. {
  28. #if defined(CONFIG_29BIT) || !defined(CONFIG_MMU)
  29. uncached_start = P2SEG;
  30. #else
  31. uncached_start = memory_end;
  32. #endif
  33. uncached_end = uncached_start + uncached_size;
  34. }
  35. void __init uncached_resize(unsigned long size)
  36. {
  37. uncached_size = size;
  38. uncached_end = uncached_start + uncached_size;
  39. }