Blame view
include/linux/bootmem.h
5.1 KB
1da177e4c
|
1 2 3 4 5 |
/* * Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999 */ #ifndef _LINUX_BOOTMEM_H #define _LINUX_BOOTMEM_H |
1da177e4c
|
6 |
#include <linux/mmzone.h> |
e786e86a5
|
7 |
#include <asm/dma.h> |
1da177e4c
|
8 9 10 11 12 13 14 15 16 17 18 19 |
/* * simple boot-time physical memory area allocator. */ extern unsigned long max_low_pfn; extern unsigned long min_low_pfn; /* * highest page */ extern unsigned long max_pfn; |
92aa63a5a
|
20 21 22 |
#ifdef CONFIG_CRASH_DUMP extern unsigned long saved_max_pfn; #endif |
08677214e
|
23 |
#ifndef CONFIG_NO_BOOTMEM |
1da177e4c
|
24 25 26 27 28 |
/* * node_bootmem_map is a map pointer - the bits represent all physical * memory pages (including holes) on the node. */ typedef struct bootmem_data { |
3560e249a
|
29 |
unsigned long node_min_pfn; |
1da177e4c
|
30 31 |
unsigned long node_low_pfn; void *node_bootmem_map; |
5f2809e69
|
32 33 |
unsigned long last_end_off; unsigned long hint_idx; |
679bc9fbb
|
34 |
struct list_head list; |
1da177e4c
|
35 |
} bootmem_data_t; |
b61bfa3c4
|
36 |
extern bootmem_data_t bootmem_node_data[]; |
08677214e
|
37 |
#endif |
b61bfa3c4
|
38 |
|
f71bf0cac
|
39 |
extern unsigned long bootmem_bootmap_pages(unsigned long); |
223e8dc92
|
40 41 42 43 44 |
extern unsigned long init_bootmem_node(pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn); |
f71bf0cac
|
45 |
extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
223e8dc92
|
46 |
|
08677214e
|
47 |
unsigned long free_all_memory_core_early(int nodeid); |
223e8dc92
|
48 49 50 51 52 53 |
extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); extern unsigned long free_all_bootmem(void); extern void free_bootmem_node(pg_data_t *pgdat, unsigned long addr, unsigned long size); |
f71bf0cac
|
54 |
extern void free_bootmem(unsigned long addr, unsigned long size); |
9f993ac3f
|
55 |
extern void free_bootmem_late(unsigned long addr, unsigned long size); |
223e8dc92
|
56 57 58 59 60 61 62 63 64 65 66 |
/* * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, * the architecture-specific code should honor this). * * If flags is 0, then the return value is always 0 (success). If * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the * memory already was reserved. */ #define BOOTMEM_DEFAULT 0 #define BOOTMEM_EXCLUSIVE (1<<0) |
c13293755
|
67 68 69 |
extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); |
2d0aae416
|
70 71 72 73 74 75 |
extern int reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size, int flags); extern void *__alloc_bootmem(unsigned long size, |
f71bf0cac
|
76 77 |
unsigned long align, unsigned long goal); |
2d0aae416
|
78 |
extern void *__alloc_bootmem_nopanic(unsigned long size, |
f71bf0cac
|
79 80 |
unsigned long align, unsigned long goal); |
223e8dc92
|
81 82 83 84 |
extern void *__alloc_bootmem_node(pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); |
08677214e
|
85 86 87 88 |
void *__alloc_bootmem_node_high(pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); |
223e8dc92
|
89 90 91 92 |
extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); |
2d0aae416
|
93 94 95 |
extern void *__alloc_bootmem_low(unsigned long size, unsigned long align, unsigned long goal); |
f71bf0cac
|
96 97 98 99 |
extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); |
c13293755
|
100 |
|
1da177e4c
|
101 |
#define alloc_bootmem(x) \ |
71fb2e8f8
|
102 |
__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
53dde5f38
|
103 104 |
#define alloc_bootmem_align(x, align) \ __alloc_bootmem(x, align, __pa(MAX_DMA_ADDRESS)) |
74768ed83
|
105 106 |
#define alloc_bootmem_nopanic(x) \ __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
1da177e4c
|
107 |
#define alloc_bootmem_pages(x) \ |
71fb2e8f8
|
108 |
__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
74768ed83
|
109 110 |
#define alloc_bootmem_pages_nopanic(x) \ __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
1da177e4c
|
111 |
#define alloc_bootmem_node(pgdat, x) \ |
71fb2e8f8
|
112 |
__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
1da177e4c
|
113 |
#define alloc_bootmem_pages_node(pgdat, x) \ |
71fb2e8f8
|
114 |
__alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
2d0aae416
|
115 116 117 118 119 120 121 |
#define alloc_bootmem_pages_node_nopanic(pgdat, x) \ __alloc_bootmem_node_nopanic(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) #define alloc_bootmem_low(x) \ __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) #define alloc_bootmem_low_pages(x) \ __alloc_bootmem_low(x, PAGE_SIZE, 0) |
1da177e4c
|
122 |
#define alloc_bootmem_low_pages_node(pgdat, x) \ |
71fb2e8f8
|
123 |
__alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) |
c6af5e9f8
|
124 125 126 |
extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, int flags); |
223e8dc92
|
127 128 129 |
extern void *alloc_bootmem_section(unsigned long size, unsigned long section_nr); |
1da177e4c
|
130 |
|
6f167ec72
|
131 132 133 134 135 136 137 |
#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP extern void *alloc_remap(int nid, unsigned long size); #else static inline void *alloc_remap(int nid, unsigned long size) { return NULL; } |
f71bf0cac
|
138 |
#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */ |
6f167ec72
|
139 |
|
f71bf0cac
|
140 141 142 143 144 145 146 147 |
extern void *alloc_large_system_hash(const char *tablename, unsigned long bucketsize, unsigned long numentries, int scale, int flags, unsigned int *_hash_shift, unsigned int *_hash_mask, unsigned long limit); |
1da177e4c
|
148 |
|
049036643
|
149 |
#define HASH_EARLY 0x00000001 /* Allocating during early boot? */ |
2c85f51d2
|
150 151 |
#define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min * shift passed via *_hash_shift */ |
1da177e4c
|
152 |
|
c2fdf3a9b
|
153 154 |
/* Only NUMA needs hash distribution. 64bit NUMA architectures have * sufficient vmalloc space. |
1da177e4c
|
155 |
*/ |
c2fdf3a9b
|
156 |
#if defined(CONFIG_NUMA) && defined(CONFIG_64BIT) |
1da177e4c
|
157 158 159 160 |
#define HASHDIST_DEFAULT 1 #else #define HASHDIST_DEFAULT 0 #endif |
f034b5d4e
|
161 |
extern int hashdist; /* Distribute hashes across NUMA nodes? */ |
1da177e4c
|
162 163 164 |
#endif /* _LINUX_BOOTMEM_H */ |