xref: /openbmc/linux/arch/ia64/include/asm/meminit.h (revision 7f30491ccd28627742e37899453ae20e3da8e18f)
1*7f30491cSTony Luck #ifndef meminit_h
2*7f30491cSTony Luck #define meminit_h
3*7f30491cSTony Luck 
4*7f30491cSTony Luck /*
5*7f30491cSTony Luck  * This file is subject to the terms and conditions of the GNU General Public
6*7f30491cSTony Luck  * License.  See the file "COPYING" in the main directory of this archive
7*7f30491cSTony Luck  * for more details.
8*7f30491cSTony Luck  */
9*7f30491cSTony Luck 
10*7f30491cSTony Luck 
11*7f30491cSTony Luck /*
12*7f30491cSTony Luck  * Entries defined so far:
13*7f30491cSTony Luck  * 	- boot param structure itself
14*7f30491cSTony Luck  * 	- memory map
15*7f30491cSTony Luck  * 	- initrd (optional)
16*7f30491cSTony Luck  * 	- command line string
17*7f30491cSTony Luck  * 	- kernel code & data
18*7f30491cSTony Luck  * 	- crash dumping code reserved region
19*7f30491cSTony Luck  * 	- Kernel memory map built from EFI memory map
20*7f30491cSTony Luck  * 	- ELF core header
21*7f30491cSTony Luck  *
22*7f30491cSTony Luck  * More could be added if necessary
23*7f30491cSTony Luck  */
24*7f30491cSTony Luck #define IA64_MAX_RSVD_REGIONS 8
25*7f30491cSTony Luck 
26*7f30491cSTony Luck struct rsvd_region {
27*7f30491cSTony Luck 	unsigned long start;	/* virtual address of beginning of element */
28*7f30491cSTony Luck 	unsigned long end;	/* virtual address of end of element + 1 */
29*7f30491cSTony Luck };
30*7f30491cSTony Luck 
31*7f30491cSTony Luck extern struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
32*7f30491cSTony Luck extern int num_rsvd_regions;
33*7f30491cSTony Luck 
34*7f30491cSTony Luck extern void find_memory (void);
35*7f30491cSTony Luck extern void reserve_memory (void);
36*7f30491cSTony Luck extern void find_initrd (void);
37*7f30491cSTony Luck extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
38*7f30491cSTony Luck extern int filter_memory (unsigned long start, unsigned long end, void *arg);
39*7f30491cSTony Luck extern unsigned long efi_memmap_init(unsigned long *s, unsigned long *e);
40*7f30491cSTony Luck extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
41*7f30491cSTony Luck 
42*7f30491cSTony Luck extern unsigned long vmcore_find_descriptor_size(unsigned long address);
43*7f30491cSTony Luck extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end);
44*7f30491cSTony Luck 
45*7f30491cSTony Luck /*
46*7f30491cSTony Luck  * For rounding an address to the next IA64_GRANULE_SIZE or order
47*7f30491cSTony Luck  */
48*7f30491cSTony Luck #define GRANULEROUNDDOWN(n)	((n) & ~(IA64_GRANULE_SIZE-1))
49*7f30491cSTony Luck #define GRANULEROUNDUP(n)	(((n)+IA64_GRANULE_SIZE-1) & ~(IA64_GRANULE_SIZE-1))
50*7f30491cSTony Luck #define ORDERROUNDDOWN(n)	((n) & ~((PAGE_SIZE<<MAX_ORDER)-1))
51*7f30491cSTony Luck 
52*7f30491cSTony Luck #ifdef CONFIG_NUMA
53*7f30491cSTony Luck   extern void call_pernode_memory (unsigned long start, unsigned long len, void *func);
54*7f30491cSTony Luck #else
55*7f30491cSTony Luck # define call_pernode_memory(start, len, func)	(*func)(start, len, 0)
56*7f30491cSTony Luck #endif
57*7f30491cSTony Luck 
58*7f30491cSTony Luck #define IGNORE_PFN0	1	/* XXX fix me: ignore pfn 0 until TLB miss handler is updated... */
59*7f30491cSTony Luck 
60*7f30491cSTony Luck extern int register_active_ranges(u64 start, u64 len, int nid);
61*7f30491cSTony Luck 
62*7f30491cSTony Luck #ifdef CONFIG_VIRTUAL_MEM_MAP
63*7f30491cSTony Luck # define LARGE_GAP	0x40000000 /* Use virtual mem map if hole is > than this */
64*7f30491cSTony Luck   extern unsigned long vmalloc_end;
65*7f30491cSTony Luck   extern struct page *vmem_map;
66*7f30491cSTony Luck   extern int find_largest_hole (u64 start, u64 end, void *arg);
67*7f30491cSTony Luck   extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
68*7f30491cSTony Luck   extern int vmemmap_find_next_valid_pfn(int, int);
69*7f30491cSTony Luck #else
70*7f30491cSTony Luck static inline int vmemmap_find_next_valid_pfn(int node, int i)
71*7f30491cSTony Luck {
72*7f30491cSTony Luck 	return i + 1;
73*7f30491cSTony Luck }
74*7f30491cSTony Luck #endif
75*7f30491cSTony Luck #endif /* meminit_h */
76