devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] dtc: Add an option to generate __local_fixups__ and __fixups__
@ 2023-05-22  8:16 Uwe Kleine-König
       [not found] ` <20230522081629.385489-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-05-22  8:16 UTC (permalink / raw)
  To: David Gibson
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
	entwicklung-bIcnvbaLZ9MEGnE8C9+IrQ

This happens implicitly for dts files with a /plugin/ tag.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
---
 Documentation/manual.txt | 14 ++++++++++++++
 dtc.c                    |  8 +++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/manual.txt b/Documentation/manual.txt
index 15a7837d3cef..598c6e694c55 100644
--- a/Documentation/manual.txt
+++ b/Documentation/manual.txt
@@ -126,6 +126,20 @@ Options:
 	property for each label. The property's name is the label name and the
 	value is the path of the labeled node.
 
+    -L
+	Possibly generates a __local_fixups__ and a __fixups__ node at the root node.
+	For each property that contains a phandle reference using a locally
+	defined phandle, the __local_fixups__ node contains a property (at path
+	/__local_fixups__/$a if $a is the path of the node). Its value is a list
+	of offsets that are phandle values. If there are no such properties, no
+	__local_fixups__ node is generated.
+	For each undefined label used in at least one reference, the __fixups__
+	node contains a property. Its name is the label name, its value is a
+	list of locations where the label is used in a reference in the format
+	"path:property:offset". If there is no undefined label, no __fixups__
+	nodes is generated.
+	Enabled by default for compiling overlays (i.e. dts files with a
+	/plugin/ tag).
 
     -A
 	Generate automatically aliases for all node labels. This is similar to
diff --git a/dtc.c b/dtc.c
index bc786c543b7e..d2e4e2b55b5c 100644
--- a/dtc.c
+++ b/dtc.c
@@ -47,7 +47,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
 
 /* Usage related data. */
 static const char usage_synopsis[] = "dtc [options] <input file>";
-static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@AThv";
+static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@LAThv";
 static struct option const usage_long_opts[] = {
 	{"quiet",            no_argument, NULL, 'q'},
 	{"in-format",         a_argument, NULL, 'I'},
@@ -67,6 +67,7 @@ static struct option const usage_long_opts[] = {
 	{"warning",           a_argument, NULL, 'W'},
 	{"error",             a_argument, NULL, 'E'},
 	{"symbols",	     no_argument, NULL, '@'},
+	{"local-fixups",     no_argument, NULL, 'L'},
 	{"auto-alias",       no_argument, NULL, 'A'},
 	{"annotate",         no_argument, NULL, 'T'},
 	{"help",             no_argument, NULL, 'h'},
@@ -252,6 +253,11 @@ int main(int argc, char *argv[])
 		case '@':
 			generate_symbols = 1;
 			break;
+
+		case 'L':
+			generate_fixups = 1;
+			break;
+
 		case 'A':
 			auto_label_aliases = 1;
 			break;

base-commit: 3b02a94b486f998aa22d898b427820a805d0904f
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dtc: Add an option to generate __local_fixups__ and __fixups__
       [not found] ` <20230522081629.385489-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2023-05-22  9:06   ` David Gibson
  2023-05-22 14:20     ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: David Gibson @ 2023-05-22  9:06 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
	entwicklung-bIcnvbaLZ9MEGnE8C9+IrQ

[-- Attachment #1: Type: text/plain, Size: 3257 bytes --]

On Mon, May 22, 2023 at 10:16:29AM +0200, Uwe Kleine-König wrote:
> This happens implicitly for dts files with a /plugin/ tag.

Remind me what the use case for this is?

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  Documentation/manual.txt | 14 ++++++++++++++
>  dtc.c                    |  8 +++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/manual.txt b/Documentation/manual.txt
> index 15a7837d3cef..598c6e694c55 100644
> --- a/Documentation/manual.txt
> +++ b/Documentation/manual.txt
> @@ -126,6 +126,20 @@ Options:
>  	property for each label. The property's name is the label name and the
>  	value is the path of the labeled node.
>  
> +    -L
> +	Possibly generates a __local_fixups__ and a __fixups__ node at the root node.
> +	For each property that contains a phandle reference using a locally
> +	defined phandle, the __local_fixups__ node contains a property (at path
> +	/__local_fixups__/$a if $a is the path of the node). Its value is a list
> +	of offsets that are phandle values. If there are no such properties, no
> +	__local_fixups__ node is generated.
> +	For each undefined label used in at least one reference, the __fixups__
> +	node contains a property. Its name is the label name, its value is a
> +	list of locations where the label is used in a reference in the format
> +	"path:property:offset". If there is no undefined label, no __fixups__
> +	nodes is generated.
> +	Enabled by default for compiling overlays (i.e. dts files with a
> +	/plugin/ tag).
>  
>      -A
>  	Generate automatically aliases for all node labels. This is similar to
> diff --git a/dtc.c b/dtc.c
> index bc786c543b7e..d2e4e2b55b5c 100644
> --- a/dtc.c
> +++ b/dtc.c
> @@ -47,7 +47,7 @@ static void fill_fullpaths(struct node *tree, const char *prefix)
>  
>  /* Usage related data. */
>  static const char usage_synopsis[] = "dtc [options] <input file>";
> -static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@AThv";
> +static const char usage_short_opts[] = "qI:O:o:V:d:R:S:p:a:fb:i:H:sW:E:@LAThv";
>  static struct option const usage_long_opts[] = {
>  	{"quiet",            no_argument, NULL, 'q'},
>  	{"in-format",         a_argument, NULL, 'I'},
> @@ -67,6 +67,7 @@ static struct option const usage_long_opts[] = {
>  	{"warning",           a_argument, NULL, 'W'},
>  	{"error",             a_argument, NULL, 'E'},
>  	{"symbols",	     no_argument, NULL, '@'},
> +	{"local-fixups",     no_argument, NULL, 'L'},
>  	{"auto-alias",       no_argument, NULL, 'A'},
>  	{"annotate",         no_argument, NULL, 'T'},
>  	{"help",             no_argument, NULL, 'h'},
> @@ -252,6 +253,11 @@ int main(int argc, char *argv[])
>  		case '@':
>  			generate_symbols = 1;
>  			break;
> +
> +		case 'L':
> +			generate_fixups = 1;
> +			break;
> +
>  		case 'A':
>  			auto_label_aliases = 1;
>  			break;
> 
> base-commit: 3b02a94b486f998aa22d898b427820a805d0904f

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dtc: Add an option to generate __local_fixups__ and __fixups__
  2023-05-22  9:06   ` David Gibson
@ 2023-05-22 14:20     ` Uwe Kleine-König
       [not found]       ` <20230522142032.5e4rqg7iokta5vkp-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2023-05-22 14:20 UTC (permalink / raw)
  To: David Gibson
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
	entwicklung-bIcnvbaLZ9MEGnE8C9+IrQ

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

On Mon, May 22, 2023 at 07:06:16PM +1000, David Gibson wrote:
> On Mon, May 22, 2023 at 10:16:29AM +0200, Uwe Kleine-König wrote:
> > This happens implicitly for dts files with a /plugin/ tag.
> 
> Remind me what the use case for this is?

The idea is to have enough information in a dtb file to restore the tags
and phandle-refs. Look for "[PATCH] dtc: When compiling to dts interpret
/__symbols__ and /__local_fixups__" in your inbox.

Is this a request to improve the commit log? If so, maybe:

	dtc: Add an option to generate __local_fixups__ and __fixups__

	This records detailed usage of labels in a dtb that can
	later be used to restore labels when compiling back to dts
	format.

Best regards
Uwe


-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dtc: Add an option to generate __local_fixups__ and __fixups__
       [not found]       ` <20230522142032.5e4rqg7iokta5vkp-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2023-05-23  3:09         ` David Gibson
  0 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2023-05-23  3:09 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA,
	entwicklung-bIcnvbaLZ9MEGnE8C9+IrQ

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

On Mon, May 22, 2023 at 04:20:32PM +0200, Uwe Kleine-König wrote:
> On Mon, May 22, 2023 at 07:06:16PM +1000, David Gibson wrote:
> > On Mon, May 22, 2023 at 10:16:29AM +0200, Uwe Kleine-König wrote:
> > > This happens implicitly for dts files with a /plugin/ tag.
> > 
> > Remind me what the use case for this is?
> 
> The idea is to have enough information in a dtb file to restore the tags
> and phandle-refs. Look for "[PATCH] dtc: When compiling to dts interpret
> /__symbols__ and /__local_fixups__" in your inbox.
> 
> Is this a request to improve the commit log? If so, maybe:
> 
> 	dtc: Add an option to generate __local_fixups__ and __fixups__
> 
> 	This records detailed usage of labels in a dtb that can
> 	later be used to restore labels when compiling back to dts
> 	format.

Yes, having that extra context in the commit message would be good,
thanks.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-23  3:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-22  8:16 [PATCH v2] dtc: Add an option to generate __local_fixups__ and __fixups__ Uwe Kleine-König
     [not found] ` <20230522081629.385489-1-u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2023-05-22  9:06   ` David Gibson
2023-05-22 14:20     ` Uwe Kleine-König
     [not found]       ` <20230522142032.5e4rqg7iokta5vkp-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2023-05-23  3:09         ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).