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