aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memblock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/memblock.h')
-rw-r--r--include/linux/memblock.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index f388203db7e8..77c60e52939d 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -35,6 +35,7 @@ struct memblock_type {
35}; 35};
36 36
37struct memblock { 37struct memblock {
38 bool bottom_up; /* is bottom up direction? */
38 phys_addr_t current_limit; 39 phys_addr_t current_limit;
39 struct memblock_type memory; 40 struct memblock_type memory;
40 struct memblock_type reserved; 41 struct memblock_type reserved;
@@ -60,6 +61,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
60void memblock_trim_memory(phys_addr_t align); 61void memblock_trim_memory(phys_addr_t align);
61 62
62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 63#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
64int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
65 unsigned long *end_pfn);
63void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, 66void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
64 unsigned long *out_end_pfn, int *out_nid); 67 unsigned long *out_end_pfn, int *out_nid);
65 68
@@ -146,6 +149,29 @@ phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
146 149
147phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align); 150phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
148 151
152#ifdef CONFIG_MOVABLE_NODE
153/*
154 * Set the allocation direction to bottom-up or top-down.
155 */
156static inline void memblock_set_bottom_up(bool enable)
157{
158 memblock.bottom_up = enable;
159}
160
161/*
162 * Check if the allocation direction is bottom-up or not.
163 * if this is true, that said, memblock will allocate memory
164 * in bottom-up direction.
165 */
166static inline bool memblock_bottom_up(void)
167{
168 return memblock.bottom_up;
169}
170#else
171static inline void memblock_set_bottom_up(bool enable) {}
172static inline bool memblock_bottom_up(void) { return false; }
173#endif
174
149/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */ 175/* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
150#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 176#define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0)
151#define MEMBLOCK_ALLOC_ACCESSIBLE 0 177#define MEMBLOCK_ALLOC_ACCESSIBLE 0