cmd: simplify command efidebug
[platform/kernel/u-boot.git] / cmd / addrmap.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
4  */
5
6 #include <common.h>
7 #include <command.h>
8 #include <addr_map.h>
9
10 static int do_addrmap(struct cmd_tbl *cmdtp, int flag, int argc,
11                       char *const argv[])
12 {
13         int i;
14
15         printf("           vaddr            paddr             size\n");
16         printf("================ ================ ================\n");
17
18         for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++) {
19                 if (address_map[i].size == 0)
20                         continue;
21
22                 printf("%16.8lx %16.8llx %16.8llx\n",
23                        address_map[i].vaddr,
24                        (unsigned long long)address_map[i].paddr,
25                        (unsigned long long)address_map[i].size);
26         }
27
28         return 0;
29 }
30
31 U_BOOT_CMD(
32         addrmap,        1,      1,      do_addrmap,
33         "List non-identity virtual-physical memory mappings for 32-bit CPUs",
34         ""
35 );