diff options
Diffstat (limited to 'include/linux/bootmem.h')
-rw-r--r-- | include/linux/bootmem.h | 97 |
1 files changed, 50 insertions, 47 deletions
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index a1d9b79078e..4ddf2922fc8 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -28,52 +28,73 @@ extern unsigned long saved_max_pfn; | |||
28 | * memory pages (including holes) on the node. | 28 | * memory pages (including holes) on the node. |
29 | */ | 29 | */ |
30 | typedef struct bootmem_data { | 30 | typedef struct bootmem_data { |
31 | unsigned long node_boot_start; | 31 | unsigned long node_min_pfn; |
32 | unsigned long node_low_pfn; | 32 | unsigned long node_low_pfn; |
33 | void *node_bootmem_map; | 33 | void *node_bootmem_map; |
34 | unsigned long last_offset; | 34 | unsigned long last_end_off; |
35 | unsigned long last_pos; | 35 | unsigned long hint_idx; |
36 | unsigned long last_success; /* Previous allocation point. To speed | ||
37 | * up searching */ | ||
38 | struct list_head list; | 36 | struct list_head list; |
39 | } bootmem_data_t; | 37 | } bootmem_data_t; |
40 | 38 | ||
39 | extern bootmem_data_t bootmem_node_data[]; | ||
40 | |||
41 | extern unsigned long bootmem_bootmap_pages(unsigned long); | 41 | extern unsigned long bootmem_bootmap_pages(unsigned long); |
42 | |||
43 | extern unsigned long init_bootmem_node(pg_data_t *pgdat, | ||
44 | unsigned long freepfn, | ||
45 | unsigned long startpfn, | ||
46 | unsigned long endpfn); | ||
42 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); | 47 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
48 | |||
49 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | ||
50 | extern unsigned long free_all_bootmem(void); | ||
51 | |||
52 | extern void free_bootmem_node(pg_data_t *pgdat, | ||
53 | unsigned long addr, | ||
54 | unsigned long size); | ||
43 | extern void free_bootmem(unsigned long addr, unsigned long size); | 55 | extern void free_bootmem(unsigned long addr, unsigned long size); |
44 | extern void *__alloc_bootmem(unsigned long size, | 56 | |
57 | /* | ||
58 | * Flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, | ||
59 | * the architecture-specific code should honor this). | ||
60 | * | ||
61 | * If flags is 0, then the return value is always 0 (success). If | ||
62 | * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the | ||
63 | * memory already was reserved. | ||
64 | */ | ||
65 | #define BOOTMEM_DEFAULT 0 | ||
66 | #define BOOTMEM_EXCLUSIVE (1<<0) | ||
67 | |||
68 | extern int reserve_bootmem_node(pg_data_t *pgdat, | ||
69 | unsigned long physaddr, | ||
70 | unsigned long size, | ||
71 | int flags); | ||
72 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | ||
73 | extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | ||
74 | #endif | ||
75 | |||
76 | extern void *__alloc_bootmem_nopanic(unsigned long size, | ||
45 | unsigned long align, | 77 | unsigned long align, |
46 | unsigned long goal); | 78 | unsigned long goal); |
47 | extern void *__alloc_bootmem_nopanic(unsigned long size, | 79 | extern void *__alloc_bootmem(unsigned long size, |
48 | unsigned long align, | 80 | unsigned long align, |
49 | unsigned long goal); | 81 | unsigned long goal); |
50 | extern void *__alloc_bootmem_low(unsigned long size, | 82 | extern void *__alloc_bootmem_low(unsigned long size, |
51 | unsigned long align, | 83 | unsigned long align, |
52 | unsigned long goal); | 84 | unsigned long goal); |
85 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, | ||
86 | unsigned long size, | ||
87 | unsigned long align, | ||
88 | unsigned long goal); | ||
89 | extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | ||
90 | unsigned long size, | ||
91 | unsigned long align, | ||
92 | unsigned long goal); | ||
53 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, | 93 | extern void *__alloc_bootmem_low_node(pg_data_t *pgdat, |
54 | unsigned long size, | 94 | unsigned long size, |
55 | unsigned long align, | 95 | unsigned long align, |
56 | unsigned long goal); | 96 | unsigned long goal); |
57 | extern void *__alloc_bootmem_core(struct bootmem_data *bdata, | ||
58 | unsigned long size, | ||
59 | unsigned long align, | ||
60 | unsigned long goal, | ||
61 | unsigned long limit); | ||
62 | |||
63 | /* | ||
64 | * flags for reserve_bootmem (also if CONFIG_HAVE_ARCH_BOOTMEM_NODE, | ||
65 | * the architecture-specific code should honor this) | ||
66 | */ | ||
67 | #define BOOTMEM_DEFAULT 0 | ||
68 | #define BOOTMEM_EXCLUSIVE (1<<0) | ||
69 | |||
70 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 97 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
71 | /* | ||
72 | * If flags is 0, then the return value is always 0 (success). If | ||
73 | * flags contains BOOTMEM_EXCLUSIVE, then -EBUSY is returned if the | ||
74 | * memory already was reserved. | ||
75 | */ | ||
76 | extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | ||
77 | #define alloc_bootmem(x) \ | 98 | #define alloc_bootmem(x) \ |
78 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 99 | __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
79 | #define alloc_bootmem_low(x) \ | 100 | #define alloc_bootmem_low(x) \ |
@@ -86,34 +107,16 @@ extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); | |||
86 | 107 | ||
87 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, | 108 | extern int reserve_bootmem_generic(unsigned long addr, unsigned long size, |
88 | int flags); | 109 | int flags); |
89 | extern unsigned long free_all_bootmem(void); | ||
90 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | ||
91 | extern void *__alloc_bootmem_node(pg_data_t *pgdat, | ||
92 | unsigned long size, | ||
93 | unsigned long align, | ||
94 | unsigned long goal); | ||
95 | extern unsigned long init_bootmem_node(pg_data_t *pgdat, | ||
96 | unsigned long freepfn, | ||
97 | unsigned long startpfn, | ||
98 | unsigned long endpfn); | ||
99 | extern int reserve_bootmem_node(pg_data_t *pgdat, | ||
100 | unsigned long physaddr, | ||
101 | unsigned long size, | ||
102 | int flags); | ||
103 | extern void free_bootmem_node(pg_data_t *pgdat, | ||
104 | unsigned long addr, | ||
105 | unsigned long size); | ||
106 | extern void *alloc_bootmem_section(unsigned long size, | ||
107 | unsigned long section_nr); | ||
108 | 110 | ||
109 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | ||
110 | #define alloc_bootmem_node(pgdat, x) \ | 111 | #define alloc_bootmem_node(pgdat, x) \ |
111 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 112 | __alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
112 | #define alloc_bootmem_pages_node(pgdat, x) \ | 113 | #define alloc_bootmem_pages_node(pgdat, x) \ |
113 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 114 | __alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
114 | #define alloc_bootmem_low_pages_node(pgdat, x) \ | 115 | #define alloc_bootmem_low_pages_node(pgdat, x) \ |
115 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) | 116 | __alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0) |
116 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 117 | |
118 | extern void *alloc_bootmem_section(unsigned long size, | ||
119 | unsigned long section_nr); | ||
117 | 120 | ||
118 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP | 121 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP |
119 | extern void *alloc_remap(int nid, unsigned long size); | 122 | extern void *alloc_remap(int nid, unsigned long size); |