diff mbox series

[1/1] cmd: map addresses to sysmem in efidebug memmap

Message ID 20200314082124.68978-1-xypron.glpk@gmx.de
State Accepted
Commit a415d61eac26a9108c26ef779f2009dc3062f5d8
Headers show
Series [1/1] cmd: map addresses to sysmem in efidebug memmap | expand

Commit Message

Heinrich Schuchardt March 14, 2020, 8:21 a.m. UTC
Addresses in the sandbox's device tree are in the sandbox's virtual address
space. If we want to compare memory reservations in the device-tree with
the output of 'efidebug memmap', we need to convert back to this address
space.

Adjust the output of the 'efidebug memmap' command.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 cmd/efidebug.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--
2.25.1

Comments

Simon Glass March 14, 2020, 8:35 p.m. UTC | #1
On Sat, 14 Mar 2020 at 02:21, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> Addresses in the sandbox's device tree are in the sandbox's virtual address
> space. If we want to compare memory reservations in the device-tree with
> the output of 'efidebug memmap', we need to convert back to this address
> space.
>
> Adjust the output of the 'efidebug memmap' command.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  cmd/efidebug.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg at chromum.org>
diff mbox series

Patch

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index 8c3681c37d..bb7c13d6a1 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -12,6 +12,7 @@ 
 #include <exports.h>
 #include <hexdump.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <search.h>
 #include <linux/ctype.h>

@@ -488,9 +489,10 @@  static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,

 		printf("%-16s %.*llx-%.*llx", type,
 		       EFI_PHYS_ADDR_WIDTH,
-		       map->physical_start,
+		       (u64)map_to_sysmem((void *)map->physical_start),
 		       EFI_PHYS_ADDR_WIDTH,
-		       map->physical_start + map->num_pages * EFI_PAGE_SIZE);
+		       (u64)map_to_sysmem((void *)map->physical_start +
+					  map->num_pages * EFI_PAGE_SIZE));

 		print_memory_attributes(map->attribute);
 		putc('\n');