Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / mm / dump.c
index d54dc9ac4b70874af52e4c94054c850b576c9f0d..74c256744b254e09c989cabcd9072aee93c9fd6d 100644 (file)
  * of the License.
  */
 #include <linux/debugfs.h>
+#include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/io.h>
+#include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
 
 #include <asm/fixmap.h>
+#include <asm/memory.h>
 #include <asm/pgtable.h>
+#include <asm/pgtable-hwdef.h>
 
 #define LOWEST_ADDR    (UL(0xffffffffffffffff) << VA_BITS)
 
@@ -37,10 +41,10 @@ enum address_markers_idx {
        VMEMMAP_START_NR,
        VMEMMAP_END_NR,
 #endif
-       PCI_START_NR,
-       PCI_END_NR,
        FIXADDR_START_NR,
        FIXADDR_END_NR,
+       PCI_START_NR,
+       PCI_END_NR,
        MODULES_START_NR,
        MODUELS_END_NR,
        KERNEL_SPACE_NR,
@@ -53,10 +57,10 @@ static struct addr_marker address_markers[] = {
        { 0,                    "vmemmap start" },
        { 0,                    "vmemmap end" },
 #endif
-       { (unsigned long) PCI_IOBASE,           "PCI I/O start" },
-       { (unsigned long) PCI_IOBASE + SZ_16M,  "PCI I/O end" },
        { FIXADDR_START,        "Fixmap start" },
        { FIXADDR_TOP,          "Fixmap end" },
+       { PCI_IO_START,         "PCI I/O start" },
+       { PCI_IO_END,           "PCI I/O end" },
        { MODULES_VADDR,        "Modules start" },
        { MODULES_END,          "Modules end" },
        { PAGE_OFFSET,          "Kernel Mapping" },
@@ -246,10 +250,12 @@ static void walk_pmd(struct pg_state *st, pud_t *pud, unsigned long start)
 
        for (i = 0; i < PTRS_PER_PMD; i++, pmd++) {
                addr = start + i * PMD_SIZE;
-               if (pmd_none(*pmd) || pmd_sect(*pmd) || pmd_bad(*pmd))
+               if (pmd_none(*pmd) || pmd_sect(*pmd)) {
                        note_page(st, addr, 3, pmd_val(*pmd));
-               else
+               } else {
+                       BUG_ON(pmd_bad(*pmd));
                        walk_pte(st, pmd, addr);
+               }
        }
 }
 
@@ -261,10 +267,12 @@ static void walk_pud(struct pg_state *st, pgd_t *pgd, unsigned long start)
 
        for (i = 0; i < PTRS_PER_PUD; i++, pud++) {
                addr = start + i * PUD_SIZE;
-               if (pud_none(*pud) || pud_sect(*pud) || pud_bad(*pud))
+               if (pud_none(*pud) || pud_sect(*pud)) {
                        note_page(st, addr, 2, pud_val(*pud));
-               else
+               } else {
+                       BUG_ON(pud_bad(*pud));
                        walk_pmd(st, pud, addr);
+               }
        }
 }
 
@@ -276,10 +284,12 @@ static void walk_pgd(struct pg_state *st, struct mm_struct *mm, unsigned long st
 
        for (i = 0; i < PTRS_PER_PGD; i++, pgd++) {
                addr = start + i * PGDIR_SIZE;
-               if (pgd_none(*pgd) || pgd_bad(*pgd))
+               if (pgd_none(*pgd)) {
                        note_page(st, addr, 1, pgd_val(*pgd));
-               else
+               } else {
+                       BUG_ON(pgd_bad(*pgd));
                        walk_pud(st, pgd, addr);
+               }
        }
 }