]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
lmb/bdinfo: dump lmb info via bdinfo
authorTero Kristo <t-kristo@ti.com>
Mon, 20 Jul 2020 08:10:45 +0000 (11:10 +0300)
committerTom Rini <trini@konsulko.com>
Wed, 5 Aug 2020 03:30:02 +0000 (23:30 -0400)
Dump lmb status from the bdinfo command. This is useful for seeing the
reserved memory regions from the u-boot cmdline.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
cmd/bdinfo.c
include/lmb.h
lib/lmb.c

index 8b2c105e7777face303e021e26be84f5008b8478..2a6dd6c67a5000ac900f41694853178cc7436b20 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <lmb.h>
 #include <net.h>
 #include <vsprintf.h>
 #include <asm/cache.h>
@@ -96,6 +97,12 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
        bdinfo_print_num("multi_dtb_fit", (ulong)gd->multi_dtb_fit);
 #endif
+       if (gd->fdt_blob) {
+               struct lmb lmb;
+
+               lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
+               lmb_dump_all_force(&lmb);
+       }
 
        arch_print_bdinfo();
 
index 73b7a5cbe3d821055d46fb92bc2ef84d048da669..e9f19b16ea0bd637bfbb0a9dc0457933c1dd0037 100644 (file)
@@ -49,6 +49,7 @@ extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
 extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
 
 extern void lmb_dump_all(struct lmb *lmb);
+extern void lmb_dump_all_force(struct lmb *lmb);
 
 static inline phys_size_t
 lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
index 2d680d8d02fd53382b5deb0fbb8f9051d2b4ff86..75082f35599b6131984d655d4e2b017ef49128b9 100644 (file)
--- a/lib/lmb.c
+++ b/lib/lmb.c
 
 #define LMB_ALLOC_ANYWHERE     0
 
-void lmb_dump_all(struct lmb *lmb)
+void lmb_dump_all_force(struct lmb *lmb)
 {
-#ifdef DEBUG
        unsigned long i;
 
-       debug("lmb_dump_all:\n");
-       debug("    memory.cnt              = 0x%lx\n", lmb->memory.cnt);
-       debug("    memory.size             = 0x%llx\n",
-             (unsigned long long)lmb->memory.size);
+       printf("lmb_dump_all:\n");
+       printf("    memory.cnt             = 0x%lx\n", lmb->memory.cnt);
+       printf("    memory.size            = 0x%llx\n",
+              (unsigned long long)lmb->memory.size);
        for (i = 0; i < lmb->memory.cnt; i++) {
-               debug("    memory.reg[0x%lx].base   = 0x%llx\n", i,
-                     (unsigned long long)lmb->memory.region[i].base);
-               debug("            .size   = 0x%llx\n",
-                     (unsigned long long)lmb->memory.region[i].size);
+               printf("    memory.reg[0x%lx].base   = 0x%llx\n", i,
+                      (unsigned long long)lmb->memory.region[i].base);
+               printf("                   .size   = 0x%llx\n",
+                      (unsigned long long)lmb->memory.region[i].size);
        }
 
-       debug("\n    reserved.cnt          = 0x%lx\n",
-               lmb->reserved.cnt);
-       debug("    reserved.size           = 0x%llx\n",
-               (unsigned long long)lmb->reserved.size);
+       printf("\n    reserved.cnt         = 0x%lx\n", lmb->reserved.cnt);
+       printf("    reserved.size          = 0x%llx\n",
+              (unsigned long long)lmb->reserved.size);
        for (i = 0; i < lmb->reserved.cnt; i++) {
-               debug("    reserved.reg[0x%lx].base = 0x%llx\n", i,
-                     (unsigned long long)lmb->reserved.region[i].base);
-               debug("              .size = 0x%llx\n",
-                     (unsigned long long)lmb->reserved.region[i].size);
+               printf("    reserved.reg[0x%lx].base = 0x%llx\n", i,
+                      (unsigned long long)lmb->reserved.region[i].base);
+               printf("                     .size = 0x%llx\n",
+                      (unsigned long long)lmb->reserved.region[i].size);
        }
-#endif /* DEBUG */
+}
+
+void lmb_dump_all(struct lmb *lmb)
+{
+#ifdef DEBUG
+       lmb_dump_all_force(lmb);
+#endif
 }
 
 static long lmb_addrs_overlap(phys_addr_t base1, phys_size_t size1,