diff mbox series

[U-Boot,26/30] bdinfo: riscv: print fdt_blob address

Message ID 20181019220743.15020-27-lukas.auer@aisec.fraunhofer.de
State Superseded
Delegated to: Andes
Headers show
Series General fixes / cleanup for RISC-V and improvements to qemu-riscv | expand

Commit Message

Lukas Auer Oct. 19, 2018, 10:07 p.m. UTC
Print the address of the u-boot device tree.

Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
---

 cmd/bdinfo.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bin Meng Oct. 22, 2018, 9:35 a.m. UTC | #1
Hi Lukas,

On Sat, Oct 20, 2018 at 6:11 AM Lukas Auer
<lukas.auer@aisec.fraunhofer.de> wrote:
>
> Print the address of the u-boot device tree.
>

This is unnecessary as it is already done by 'fdt' command.

> Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
> ---
>
>  cmd/bdinfo.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Regards,
Bin
Rick Chen Oct. 24, 2018, 6:54 a.m. UTC | #2
> > > Print the address of the u-boot device tree.
> > >
> >
> > This is unnecessary as it is already done by 'fdt' command.
> >

Hi Bin & Lukas

At the beginning, I really don't understand the fdt Usage:
Maybe I am not so familiar with fdt.
I can't find any string about fdt_blob. It seem not describe so clearly
After I trace fdt.c, I finally know to get it as below.

RISC-V # bdinfo
boot_params = 0x00000400
...
baudrate    = 38400 bps
fdt_blob    = 0x3FF0F340
RISC-V #

RISC-V # fdt addr -c
The address of the fdt is 0x3ff0f340

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize [<extrasize>]            - Resize fdt to size + padding to
4k addr + some optional <extrasize> if needed
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and
store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property>
and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num
nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header                          - Display header info
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr

It seem that other arch (MICROBLAZE, ARM) also print fdt_blob in bdinfo cmd.
So I think this patch can be accepted.

Reviewed-by: Rick Chen <rick@andestech.com>

Rick


> > > Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
> > > ---
> > >
> > >  cmd/bdinfo.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> >
> > Regards,
> > Bin
Lukas Auer Oct. 26, 2018, 1:36 p.m. UTC | #3
Hi Rick and Bin,

On Wed, 2018-10-24 at 14:54 +0800, Rick Chen wrote:
> > > > Print the address of the u-boot device tree.
> > > > 
> > > 
> > > This is unnecessary as it is already done by 'fdt' command.
> > > 
> 
> Hi Bin & Lukas
> 
> At the beginning, I really don't understand the fdt Usage:
> Maybe I am not so familiar with fdt.
> I can't find any string about fdt_blob. It seem not describe so
> clearly
> After I trace fdt.c, I finally know to get it as below.
> 
> RISC-V # bdinfo
> boot_params = 0x00000400
> ...
> baudrate    = 38400 bps
> fdt_blob    = 0x3FF0F340
> RISC-V #
> 
> RISC-V # fdt addr -c
> The address of the fdt is 0x3ff0f340
> 
> Usage:
> fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location
> to <addr>
> fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make
> it active
> fdt resize [<extrasize>]            - Resize fdt to size + padding to
> 4k addr + some optional <extrasize> if needed
> fdt print  <path> [<prop>]          - Recursive print starting at
> <path>
> fdt list   <path> [<prop>]          - Print one level starting at
> <path>
> fdt get value <var> <path> <prop>   - Get <property> and store in
> <var>
> fdt get name <var> <path> <index>   - Get name of node <index> and
> store in <var>
> fdt get addr <var> <path> <prop>    - Get start address of <property>
> and store in <var>
> fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num
> nodes and store in <var>
> fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
> fdt mknode <path> <node>            - Create a new node after <path>
> fdt rm     <path> [<prop>]          - Delete the node or <property>
> fdt header                          - Display header info
> fdt bootcpu <id>                    - Set boot cpuid
> fdt memory <addr> <size>            - Add/Update memory node
> fdt rsvmem print                    - Show current mem reserves
> fdt rsvmem add <addr> <size>        - Add a mem reserve
> fdt rsvmem delete <index>           - Delete a mem reserves
> fdt chosen [<start> <end>]          - Add/update the /chosen branch
> in the tree
>                                         <start>/<end> - initrd
> start/end addr
> 
> It seem that other arch (MICROBLAZE, ARM) also print fdt_blob in
> bdinfo cmd.
> So I think this patch can be accepted.
> 
> Reviewed-by: Rick Chen <rick@andestech.com>
> 
> Rick
> 

I was not aware that the fdt command can print the location of
fdt_blob. I think this patch can be dropped, unless you want me to keep
it.

Thanks,
Lukas

> 
> > > > Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
> > > > ---
> > > > 
> > > >  cmd/bdinfo.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > > 
> > > 
> > > Regards,
> > > Bin
diff mbox series

Patch

diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 60b438766d..a9692f7662 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -430,6 +430,8 @@  int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	print_num("reloc off", gd->reloc_off);
 	print_eth_ip_addr();
 	print_baudrate();
+	if (gd->fdt_blob)
+		print_num("fdt_blob", (ulong)gd->fdt_blob);
 
 	return 0;
 }