2 * Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
4 #ifndef _LINUX_BOOTMEM_H
5 #define _LINUX_BOOTMEM_H
7 #include <asm/pgtable.h>
9 #include <linux/cache.h>
10 #include <linux/init.h>
11 #include <linux/mmzone.h>
14 * simple boot-time physical memory area allocator.
17 extern unsigned long max_low_pfn
;
18 extern unsigned long min_low_pfn
;
21 * node_bootmem_map is a map pointer - the bits represent all physical
22 * memory pages (including holes) on the node.
24 typedef struct bootmem_data
{
25 unsigned long node_boot_start
;
26 unsigned long node_low_pfn
;
27 void *node_bootmem_map
;
28 unsigned long last_offset
;
29 unsigned long last_pos
;
32 extern unsigned long __init
bootmem_bootmap_pages (unsigned long);
33 extern unsigned long __init
init_bootmem (unsigned long addr
, unsigned long memend
);
34 extern void __init
reserve_bootmem (unsigned long addr
, unsigned long size
);
35 extern void __init
free_bootmem (unsigned long addr
, unsigned long size
);
36 extern void * __init
__alloc_bootmem (unsigned long size
, unsigned long align
, unsigned long goal
);
37 #define alloc_bootmem(x) \
38 __alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
39 #define alloc_bootmem_low(x) \
40 __alloc_bootmem((x), SMP_CACHE_BYTES, 0)
41 #define alloc_bootmem_pages(x) \
42 __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
43 #define alloc_bootmem_low_pages(x) \
44 __alloc_bootmem((x), PAGE_SIZE, 0)
45 extern unsigned long __init
free_all_bootmem (void);
47 extern unsigned long __init
init_bootmem_node (pg_data_t
*pgdat
, unsigned long freepfn
, unsigned long startpfn
, unsigned long endpfn
);
48 extern void __init
reserve_bootmem_node (pg_data_t
*pgdat
, unsigned long physaddr
, unsigned long size
);
49 extern void __init
free_bootmem_node (pg_data_t
*pgdat
, unsigned long addr
, unsigned long size
);
50 extern unsigned long __init
free_all_bootmem_node (pg_data_t
*pgdat
);
51 extern void * __init
__alloc_bootmem_node (pg_data_t
*pgdat
, unsigned long size
, unsigned long align
, unsigned long goal
);
52 #define alloc_bootmem_node(pgdat, x) \
53 __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
54 #define alloc_bootmem_pages_node(pgdat, x) \
55 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
56 #define alloc_bootmem_low_pages_node(pgdat, x) \
57 __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
59 #endif /* _LINUX_BOOTMEM_H */