page.h 895 B

123456789101112131415161718192021222324252627282930
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _PPC_BOOT_PAGE_H
  3. #define _PPC_BOOT_PAGE_H
  4. /*
  5. * Copyright (C) 2001 PPC64 Team, IBM Corp
  6. */
  7. #ifdef __ASSEMBLY__
  8. #define ASM_CONST(x) x
  9. #else
  10. #define __ASM_CONST(x) x##UL
  11. #define ASM_CONST(x) __ASM_CONST(x)
  12. #endif
  13. /* PAGE_SHIFT determines the page size */
  14. #define PAGE_SHIFT 12
  15. #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
  16. #define PAGE_MASK (~(PAGE_SIZE-1))
  17. /* align addr on a size boundary - adjust address up/down if needed */
  18. #define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((typeof(addr))(size)-1)))
  19. #define _ALIGN_DOWN(addr, size) ((addr)&(~((typeof(addr))(size)-1)))
  20. /* align addr on a size boundary - adjust address up if needed */
  21. #define _ALIGN(addr,size) _ALIGN_UP(addr,size)
  22. /* to align the pointer to the (next) page boundary */
  23. #define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE)
  24. #endif /* _PPC_BOOT_PAGE_H */