18c2ecf20Sopenharmony_ci#ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
28c2ecf20Sopenharmony_ci#define _ASM_GENERIC_HUGETLB_ENCODE_H_
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci/*
58c2ecf20Sopenharmony_ci * Several system calls take a flag to request "hugetlb" huge pages.
68c2ecf20Sopenharmony_ci * Without further specification, these system calls will use the
78c2ecf20Sopenharmony_ci * system's default huge page size.  If a system supports multiple
88c2ecf20Sopenharmony_ci * huge page sizes, the desired huge page size can be specified in
98c2ecf20Sopenharmony_ci * bits [26:31] of the flag arguments.  The value in these 6 bits
108c2ecf20Sopenharmony_ci * will encode the log2 of the huge page size.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * The following definitions are associated with this huge page size
138c2ecf20Sopenharmony_ci * encoding in flag arguments.  System call specific header files
148c2ecf20Sopenharmony_ci * that use this encoding should include this file.  They can then
158c2ecf20Sopenharmony_ci * provide definitions based on these with their own specific prefix.
168c2ecf20Sopenharmony_ci * for example:
178c2ecf20Sopenharmony_ci * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_SHIFT	26
218c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_MASK	0x3f
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_64KB	(16 << HUGETLB_FLAG_ENCODE_SHIFT)
248c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_512KB	(19 << HUGETLB_FLAG_ENCODE_SHIFT)
258c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_1MB		(20 << HUGETLB_FLAG_ENCODE_SHIFT)
268c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_2MB		(21 << HUGETLB_FLAG_ENCODE_SHIFT)
278c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_8MB		(23 << HUGETLB_FLAG_ENCODE_SHIFT)
288c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_16MB	(24 << HUGETLB_FLAG_ENCODE_SHIFT)
298c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_256MB	(28 << HUGETLB_FLAG_ENCODE_SHIFT)
308c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_1GB		(30 << HUGETLB_FLAG_ENCODE_SHIFT)
318c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_2GB		(31 << HUGETLB_FLAG_ENCODE_SHIFT)
328c2ecf20Sopenharmony_ci#define HUGETLB_FLAG_ENCODE_16GB	(34 << HUGETLB_FLAG_ENCODE_SHIFT)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
35