]> git.karo-electronics.de Git - linux-beck.git/blobdiff - arch/x86/platform/efi/efi.c
x86, mirror: x86 enabling - find mirrored memory ranges
[linux-beck.git] / arch / x86 / platform / efi / efi.c
index 3b984c3aa1b0b5ba6e7b5e5321edb4fbc7013e5d..c1c382c58c60d58c3ea7a93e09b5f2e04112c6d8 100644 (file)
@@ -117,6 +117,27 @@ void efi_get_time(struct timespec *now)
        now->tv_nsec = 0;
 }
 
+void __init efi_find_mirror(void)
+{
+       void *p;
+       u64 mirror_size = 0, total_size = 0;
+
+       for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
+               efi_memory_desc_t *md = p;
+               unsigned long long start = md->phys_addr;
+               unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
+
+               total_size += size;
+               if (md->attribute & EFI_MEMORY_MORE_RELIABLE) {
+                       memblock_mark_mirror(start, size);
+                       mirror_size += size;
+               }
+       }
+       if (mirror_size)
+               pr_info("Memory: %lldM/%lldM mirrored memory\n",
+                       mirror_size>>20, total_size>>20);
+}
+
 /*
  * Tell the kernel about the EFI memory map.  This might include
  * more than the max 128 entries that can fit in the e820 legacy