page_32.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_POWERPC_PAGE_32_H
  3. #define _ASM_POWERPC_PAGE_32_H
  4. #include <asm/cache.h>
  5. #if defined(CONFIG_PHYSICAL_ALIGN) && (CONFIG_PHYSICAL_START != 0)
  6. #if (CONFIG_PHYSICAL_START % CONFIG_PHYSICAL_ALIGN) != 0
  7. #error "CONFIG_PHYSICAL_START must be a multiple of CONFIG_PHYSICAL_ALIGN"
  8. #endif
  9. #endif
  10. #define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
  11. #ifdef CONFIG_NOT_COHERENT_CACHE
  12. #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
  13. #endif
  14. #if defined(CONFIG_PPC_256K_PAGES) || \
  15. (defined(CONFIG_PPC_8xx) && defined(CONFIG_PPC_16K_PAGES))
  16. #define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2 - 2) /* 1/4 of a page */
  17. #else
  18. #define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2) /* full page */
  19. #endif
  20. #ifndef __ASSEMBLY__
  21. /*
  22. * The basic type of a PTE - 64 bits for those CPUs with > 32 bit
  23. * physical addressing.
  24. */
  25. #ifdef CONFIG_PTE_64BIT
  26. typedef unsigned long long pte_basic_t;
  27. #else
  28. typedef unsigned long pte_basic_t;
  29. #endif
  30. #include <asm/bug.h>
  31. /*
  32. * Clear page using the dcbz instruction, which doesn't cause any
  33. * memory traffic (except to write out any cache lines which get
  34. * displaced). This only works on cacheable memory.
  35. */
  36. static inline void clear_page(void *addr)
  37. {
  38. unsigned int i;
  39. WARN_ON((unsigned long)addr & (L1_CACHE_BYTES - 1));
  40. for (i = 0; i < PAGE_SIZE / L1_CACHE_BYTES; i++, addr += L1_CACHE_BYTES)
  41. dcbz(addr);
  42. }
  43. extern void copy_page(void *to, void *from);
  44. #include <asm-generic/getorder.h>
  45. #define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
  46. #define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
  47. #endif /* __ASSEMBLY__ */
  48. #endif /* _ASM_POWERPC_PAGE_32_H */