#ifndef _i386_SETUP_H
#define _i386_SETUP_H

#define PFN_UP(x)	(((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
#define PFN_DOWN(x)	((x) >> PAGE_SHIFT)
#define PFN_PHYS(x)	((x) << PAGE_SHIFT)

/*
 * Reserved space for vmalloc and iomap - defined in asm/page.h
 */
#ifdef CONFIG_HIGHMEM_EMULATION
#define ORDER_DOWN(x)	((x >> (MAX_ORDER-1)) << (MAX_ORDER-1))
#define MAXMEM_PFN					\
({							\
	int __max_pfn;					\
	if (max_pfn > PFN_DOWN(MAXMEM))			\
	     __max_pfn = PFN_DOWN(MAXMEM);		\
	else						\
	     __max_pfn = ORDER_DOWN(max_pfn / 5);	\
	__max_pfn;					\
})
#else
#define MAXMEM_PFN	PFN_DOWN(MAXMEM)
#endif
#define MAX_NONPAE_PFN	(1 << 20)

#endif /* _i386_SETUP_H */
