Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef _PPC_BOOT_PAGE_H
0003 #define _PPC_BOOT_PAGE_H
0004 /*
0005  * Copyright (C) 2001 PPC64 Team, IBM Corp
0006  */
0007 
0008 #ifdef __ASSEMBLY__
0009 #define ASM_CONST(x) x
0010 #else
0011 #define __ASM_CONST(x) x##UL
0012 #define ASM_CONST(x) __ASM_CONST(x)
0013 #endif
0014 
0015 /* PAGE_SHIFT determines the page size */
0016 #define PAGE_SHIFT  12
0017 #define PAGE_SIZE   (ASM_CONST(1) << PAGE_SHIFT)
0018 #define PAGE_MASK   (~(PAGE_SIZE-1))
0019 
0020 /* align addr on a size boundary - adjust address up/down if needed */
0021 #define _ALIGN_UP(addr, size)   (((addr)+((size)-1))&(~((typeof(addr))(size)-1)))
0022 #define _ALIGN_DOWN(addr, size) ((addr)&(~((typeof(addr))(size)-1)))
0023 
0024 /* align addr on a size boundary - adjust address up if needed */
0025 #define _ALIGN(addr,size)     _ALIGN_UP(addr,size)
0026 
0027 /* to align the pointer to the (next) page boundary */
0028 #define PAGE_ALIGN(addr)    _ALIGN(addr, PAGE_SIZE)
0029 
0030 #endif              /* _PPC_BOOT_PAGE_H */