config 64BIT
bool
+config PHYS_ADDR_T_32
+ bool
+
config NR_CPUS
int "Maximum number of CPUs"
range 1 4095
menu "Architecture Features"
+choice
+ prompt "Physical address space size" if ARM_32
+ default ARM_PA_BITS_40 if ARM_32
+ help
+ User can choose to represent the width of physical address. This can
+ sometimes help in optimizing the size of image when user chooses a
+ smaller size to represent physical address.
+
+config ARM_PA_BITS_32
+ bool "32-bit"
+ depends on ARM_32
+ select PHYS_ADDR_T_32
+ help
+ On platforms where any physical address can be represented within 32 bits,
+ user should choose this option. This will help in reduced size of the
+ binary.
+ Xen uses "unsigned long" and not "uint32_t" to denote the datatype of
+ physical address. This is done to avoid using a cast each time PAGE_*
+ macros are used on paddr_t. For eg PAGE_SIZE is defined as unsigned long.
+ On 32-bit architecture, "unsigned long" is 32-bit wide. Thus, it can be
+ used to denote physical address.
+
+config ARM_PA_BITS_40
+ bool "40-bit"
+ depends on ARM_32
+endchoice
+
+config PADDR_BITS
+ int
+ default 32 if ARM_PA_BITS_32
+ default 40 if ARM_PA_BITS_40
+ default 48 if ARM_64
+
source "arch/Kconfig"
config ACPI
#define PAGE_SHIFT 12
-#ifdef CONFIG_ARM_64
-#define PADDR_BITS 48
-#else
-#define PADDR_BITS 40
-#endif
+#define PADDR_BITS CONFIG_PADDR_BITS
#endif /* __ARM_PAGE_SHIFT_H__ */
typedef unsigned long long u64;
typedef u32 vaddr_t;
#define PRIvaddr PRIx32
+#if defined(CONFIG_PHYS_ADDR_T_32)
+
+/*
+ * We use "unsigned long" and not "uint32_t" to denote the type. This is done
+ * to avoid having a cast each time PAGE_* macros are used on paddr_t. For eg
+ * PAGE_SIZE is defined as unsigned long.
+ * On 32-bit architecture, "unsigned long" is 32-bit wide. Thus, we can use it
+ * to denote physical address.
+ */
+typedef unsigned long paddr_t;
+#define INVALID_PADDR (~0UL)
+#define PRIpaddr "08lx"
+#else
typedef u64 paddr_t;
#define INVALID_PADDR (~0ULL)
#define PRIpaddr "016llx"
+#endif
typedef u32 register_t;
#define PRIregister "08x"
#elif defined (CONFIG_ARM_64)
const unsigned long mapping_size = frametable_size < MB(32) ? MB(2) : MB(32);
int rc;
+ /*
+ * The size of paddr_t should be sufficient for the complete range of
+ * physical address.
+ */
+ BUILD_BUG_ON((sizeof(paddr_t) * BITS_PER_BYTE) < PADDR_BITS);
BUILD_BUG_ON(sizeof(struct page_info) != PAGE_INFO_SIZE);
if ( frametable_size > FRAMETABLE_SIZE )