xref: /openbmc/linux/arch/ia64/include/asm/meminit.h (revision 627308c90775399ea15f890723926d144874d782)
17f30491cSTony Luck #ifndef meminit_h
27f30491cSTony Luck #define meminit_h
37f30491cSTony Luck 
47f30491cSTony Luck /*
57f30491cSTony Luck  * This file is subject to the terms and conditions of the GNU General Public
67f30491cSTony Luck  * License.  See the file "COPYING" in the main directory of this archive
77f30491cSTony Luck  * for more details.
87f30491cSTony Luck  */
97f30491cSTony Luck 
107f30491cSTony Luck 
117f30491cSTony Luck /*
127f30491cSTony Luck  * Entries defined so far:
137f30491cSTony Luck  * 	- boot param structure itself
147f30491cSTony Luck  * 	- memory map
157f30491cSTony Luck  * 	- initrd (optional)
167f30491cSTony Luck  * 	- command line string
177f30491cSTony Luck  * 	- kernel code & data
187f30491cSTony Luck  * 	- crash dumping code reserved region
197f30491cSTony Luck  * 	- Kernel memory map built from EFI memory map
207f30491cSTony Luck  * 	- ELF core header
21*627308c9SIsaku Yamahata  *	- xen start info if CONFIG_XEN
227f30491cSTony Luck  *
237f30491cSTony Luck  * More could be added if necessary
247f30491cSTony Luck  */
25*627308c9SIsaku Yamahata #define IA64_MAX_RSVD_REGIONS 9
267f30491cSTony Luck 
277f30491cSTony Luck struct rsvd_region {
287f30491cSTony Luck 	unsigned long start;	/* virtual address of beginning of element */
297f30491cSTony Luck 	unsigned long end;	/* virtual address of end of element + 1 */
307f30491cSTony Luck };
317f30491cSTony Luck 
327f30491cSTony Luck extern struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1];
337f30491cSTony Luck extern int num_rsvd_regions;
347f30491cSTony Luck 
357f30491cSTony Luck extern void find_memory (void);
367f30491cSTony Luck extern void reserve_memory (void);
377f30491cSTony Luck extern void find_initrd (void);
387f30491cSTony Luck extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
397f30491cSTony Luck extern int filter_memory (unsigned long start, unsigned long end, void *arg);
407f30491cSTony Luck extern unsigned long efi_memmap_init(unsigned long *s, unsigned long *e);
417f30491cSTony Luck extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
427f30491cSTony Luck 
437f30491cSTony Luck extern unsigned long vmcore_find_descriptor_size(unsigned long address);
447f30491cSTony Luck extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end);
457f30491cSTony Luck 
467f30491cSTony Luck /*
477f30491cSTony Luck  * For rounding an address to the next IA64_GRANULE_SIZE or order
487f30491cSTony Luck  */
497f30491cSTony Luck #define GRANULEROUNDDOWN(n)	((n) & ~(IA64_GRANULE_SIZE-1))
507f30491cSTony Luck #define GRANULEROUNDUP(n)	(((n)+IA64_GRANULE_SIZE-1) & ~(IA64_GRANULE_SIZE-1))
517f30491cSTony Luck #define ORDERROUNDDOWN(n)	((n) & ~((PAGE_SIZE<<MAX_ORDER)-1))
527f30491cSTony Luck 
537f30491cSTony Luck #ifdef CONFIG_NUMA
547f30491cSTony Luck   extern void call_pernode_memory (unsigned long start, unsigned long len, void *func);
557f30491cSTony Luck #else
567f30491cSTony Luck # define call_pernode_memory(start, len, func)	(*func)(start, len, 0)
577f30491cSTony Luck #endif
587f30491cSTony Luck 
597f30491cSTony Luck #define IGNORE_PFN0	1	/* XXX fix me: ignore pfn 0 until TLB miss handler is updated... */
607f30491cSTony Luck 
617f30491cSTony Luck extern int register_active_ranges(u64 start, u64 len, int nid);
627f30491cSTony Luck 
637f30491cSTony Luck #ifdef CONFIG_VIRTUAL_MEM_MAP
647f30491cSTony Luck # define LARGE_GAP	0x40000000 /* Use virtual mem map if hole is > than this */
657f30491cSTony Luck   extern unsigned long vmalloc_end;
667f30491cSTony Luck   extern struct page *vmem_map;
677f30491cSTony Luck   extern int find_largest_hole (u64 start, u64 end, void *arg);
687f30491cSTony Luck   extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
697f30491cSTony Luck   extern int vmemmap_find_next_valid_pfn(int, int);
707f30491cSTony Luck #else
717f30491cSTony Luck static inline int vmemmap_find_next_valid_pfn(int node, int i)
727f30491cSTony Luck {
737f30491cSTony Luck 	return i + 1;
747f30491cSTony Luck }
757f30491cSTony Luck #endif
767f30491cSTony Luck #endif /* meminit_h */
77