]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: LPAE: add support for ATAG_MEM64
authorWill Deacon <will.deacon@arm.com>
Mon, 31 Jan 2011 13:50:46 +0000 (13:50 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 8 Nov 2011 10:26:22 +0000 (10:26 +0000)
LPAE provides support for memory banks with physical addresses of up
to 40 bits.

This patch adds a new atag, ATAG_MEM64, so that the Kernel can be
informed about memory that exists above the 4GB boundary.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm/include/asm/setup.h
arch/arm/kernel/setup.c

index 915696dd9c7c32d4d9702d54c933d50bbc4ca1e0..3842ce732daee061d3a5dc66b70035802b4a3cdb 100644 (file)
@@ -43,6 +43,13 @@ struct tag_mem32 {
        __u32   start;  /* physical start address */
 };
 
+#define ATAG_MEM64     0x54420002
+
+struct tag_mem64 {
+       __u32   size;
+       __u64   start;  /* physical start address */
+};
+
 /* VGA text type displays */
 #define ATAG_VIDEOTEXT 0x54410003
 
@@ -148,6 +155,7 @@ struct tag {
        union {
                struct tag_core         core;
                struct tag_mem32        mem;
+               struct tag_mem64        mem64;
                struct tag_videotext    videotext;
                struct tag_ramdisk      ramdisk;
                struct tag_initrd       initrd;
index 7e7977ab994ff92ee4ded30ee728d92ed6c3a520..223af7185676903097d7735b69e3c9a3f2561dc5 100644 (file)
@@ -638,6 +638,29 @@ static int __init parse_tag_mem32(const struct tag *tag)
 
 __tagtable(ATAG_MEM, parse_tag_mem32);
 
+static int __init parse_tag_mem64(const struct tag *tag)
+{
+       /* We only use 32-bits for the size. */
+       unsigned long size;
+       phys_addr_t start, end;
+
+       start = tag->u.mem64.start;
+       size = tag->u.mem64.size;
+       end = start + size;
+
+       /* Ensure that the memory region is in range. */
+       if (end & ~PHYS_MASK)
+               pr_warning("Ignoring out-of-range mem64 tag (%.8llx-%.8llx)\n",
+                          (unsigned long long)start,
+                          (unsigned long long)end - 1);
+       else
+               arm_add_memory(start, size);
+
+       return 0;
+}
+
+__tagtable(ATAG_MEM64, parse_tag_mem64);
+
 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
 struct screen_info screen_info = {
  .orig_video_lines     = 30,