[Crosstoolchain-logs] [device-tree-compiler] 41/357: dtc: add setting of physical boot cpu

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:05:46 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit 38e8f8fd88dae07ef8ada9d6baa41b06a4d9ac9f
Author: Michael Neuling <mikey at neuling.org>
Date:   Wed May 31 08:31:51 2006 +1000

    dtc: add setting of physical boot cpu
    
    dtc always sets the physical boot CPU to 0xfeedbeef.  Add a -b option to
    set this.    Also add warnings when using the wrong property with the
    wrong blob version.
    
    Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 dtc.c      | 14 ++++++++++----
 dtc.h      |  8 +++++---
 flattree.c | 16 ++++++++++------
 livetree.c | 17 ++++++++++++-----
 4 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/dtc.c b/dtc.c
index f26b1ec..646b814 100644
--- a/dtc.c
+++ b/dtc.c
@@ -95,6 +95,8 @@ static void usage(void)
 	fprintf(stderr, "\t\tBlob version to produce, defaults to 3 (relevant for dtb\n\t\tand asm output only)\n");
 	fprintf(stderr, "\t-R <number>\n");
 	fprintf(stderr, "\t\tMake space for <number> reserve map entries (relevant for \n\t\tdtb and asm output only)\n");
+	fprintf(stderr, "\t-b <number>\n");
+	fprintf(stderr, "\t\tSet the physical boot cpu\n");
 	fprintf(stderr, "\t-f\n");
 	fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n");
 	exit(2);
@@ -113,8 +115,9 @@ int main(int argc, char *argv[])
 	FILE *outf = NULL;
 	int outversion = 3;
 	int reservenum = 1;
+	int boot_cpuid_phys = 0xfeedbeef;
 
-	while ((opt = getopt(argc, argv, "I:O:o:V:R:f")) != EOF) {
+	while ((opt = getopt(argc, argv, "I:O:o:V:R:fb:")) != EOF) {
 		switch (opt) {
 		case 'I':
 			inform = optarg;
@@ -134,6 +137,9 @@ int main(int argc, char *argv[])
 		case 'f':
 			force = 1;
 			break;
+		case 'b':
+			boot_cpuid_phys = strtol(optarg, NULL, 0);
+			break;
 		default:
 			usage();
 		}
@@ -167,7 +173,7 @@ int main(int argc, char *argv[])
 	if (! bi || ! bi->dt)
 		die("Couldn't read input tree\n");
 
-	if (! check_device_tree(bi->dt)) {
+	if (! check_device_tree(bi->dt, outversion, boot_cpuid_phys)) {
 		fprintf(stderr, "Input tree has errors\n");
 		if (! force)
 			exit(1);
@@ -185,9 +191,9 @@ int main(int argc, char *argv[])
 	if (streq(outform, "dts")) {
 		dt_to_source(outf, bi);
 	} else if (streq(outform, "dtb")) {
-		dt_to_blob(outf, bi, outversion);
+		dt_to_blob(outf, bi, outversion, boot_cpuid_phys);
 	} else if (streq(outform, "asm")) {
-		dt_to_asm(outf, bi, outversion);
+		dt_to_asm(outf, bi, outversion, boot_cpuid_phys);
 	} else if (streq(outform, "null")) {
 		/* do nothing */
 	} else {
diff --git a/dtc.h b/dtc.h
index 3d32b61..42e9de0 100644
--- a/dtc.h
+++ b/dtc.h
@@ -178,7 +178,7 @@ struct node *chain_node(struct node *first, struct node *list);
 void add_property(struct node *node, struct property *prop);
 void add_child(struct node *parent, struct node *child);
 
-int check_device_tree(struct node *dt);
+int check_device_tree(struct node *dt, int outversion, int boot_cpuid_phys);
 
 /* Boot info (tree plus memreserve information */
 
@@ -207,8 +207,10 @@ struct boot_info *build_boot_info(struct reserve_info *reservelist,
 
 /* Flattened trees */
 
-void dt_to_blob(FILE *f, struct boot_info *bi, int version);
-void dt_to_asm(FILE *f, struct boot_info *bi, int version);
+void dt_to_blob(FILE *f, struct boot_info *bi, int version,
+		int boot_cpuid_phys);
+void dt_to_asm(FILE *f, struct boot_info *bi, int version,
+	       int boot_cpuid_phys);
 
 struct boot_info *dt_from_blob(FILE *f);
 
diff --git a/flattree.c b/flattree.c
index 439fbbb..56c1b38 100644
--- a/flattree.c
+++ b/flattree.c
@@ -301,7 +301,8 @@ static struct data flatten_reserve_list(struct reserve_info *reservelist,
 }
 static void make_bph(struct boot_param_header *bph,
 		     struct version_info *vi,
-		     int reservesize, int dtsize, int strsize)
+		     int reservesize, int dtsize, int strsize,
+		     int boot_cpuid_phys)
 {
 	int reserve_off;
 
@@ -324,12 +325,13 @@ static void make_bph(struct boot_param_header *bph,
 				     + dtsize + strsize);
 		
 	if (vi->flags & FTF_BOOTCPUID)
-		bph->boot_cpuid_phys = 0xfeedbeef;
+		bph->boot_cpuid_phys = cpu_to_be32(boot_cpuid_phys);
 	if (vi->flags & FTF_STRTABSIZE)
 		bph->size_dt_strings = cpu_to_be32(strsize);
 }
 
-void dt_to_blob(FILE *f, struct boot_info *bi, int version)
+void dt_to_blob(FILE *f, struct boot_info *bi, int version,
+		int boot_cpuid_phys)
 {
 	struct version_info *vi = NULL;
 	int i;
@@ -355,7 +357,8 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version)
 	reservebuf = flatten_reserve_list(bi->reservelist, vi);
 
 	/* Make header */
-	make_bph(&bph, vi, reservebuf.len, dtbuf.len, strbuf.len);
+	make_bph(&bph, vi, reservebuf.len, dtbuf.len, strbuf.len,
+		 boot_cpuid_phys);
 
 	fwrite(&bph, vi->hdr_size, 1, f);
 
@@ -395,7 +398,7 @@ static void dump_stringtable_asm(FILE *f, struct data strbuf)
 	}
 }
 
-void dt_to_asm(FILE *f, struct boot_info *bi, int version)
+void dt_to_asm(FILE *f, struct boot_info *bi, int version, int boot_cpuid_phys)
 {
 	struct version_info *vi = NULL;
 	int i;
@@ -434,7 +437,8 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version)
 		vi->last_comp_version);
 
 	if (vi->flags & FTF_BOOTCPUID)
-		fprintf(f, "\t.long\t0xdeadbeef\t/*boot_cpuid_phys*/\n");
+		fprintf(f, "\t.long\t%i\t/*boot_cpuid_phys*/\n",
+			boot_cpuid_phys);
 
 	if (vi->flags & FTF_STRTABSIZE)
 		fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n",
diff --git a/livetree.c b/livetree.c
index ef54174..f64de01 100644
--- a/livetree.c
+++ b/livetree.c
@@ -456,7 +456,7 @@ static int check_root(struct node *root)
 	return ok;
 }
 
-static int check_cpus(struct node *root)
+static int check_cpus(struct node *root, int outversion, int boot_cpuid_phys)
 {
 	struct node *cpus, *cpu;
 	struct property *prop;
@@ -518,8 +518,15 @@ static int check_cpus(struct node *root)
 		}
 	}
 
-	if (! bootcpu)
-		WARNMSG("No cpu has \"linux,boot-cpu\" property\n");
+	if (outversion < 2) {
+		if (! bootcpu)
+			WARNMSG("No cpu has \"linux,boot-cpu\" property\n");
+	} else {
+		if (bootcpu)
+			WARNMSG("\"linux,boot-cpu\" property is deprecated in blob version 2 or higher\n");
+		if (boot_cpuid_phys == 0xfeedbeef)
+			WARNMSG("physical boot CPU not set.  Use -b option to set\n");
+	}
 
 	return ok;	
 }
@@ -697,7 +704,7 @@ static void fixup_phandles(struct node *root, struct node *node)
 		fixup_phandles(root, child);
 }
 
-int check_device_tree(struct node *dt)
+int check_device_tree(struct node *dt, int outversion, int boot_cpuid_phys)
 {
 	int ok = 1;
 
@@ -713,7 +720,7 @@ int check_device_tree(struct node *dt)
 		return 0;
 
 	ok = ok && check_root(dt);
-	ok = ok && check_cpus(dt);
+	ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
 	ok = ok && check_memory(dt);
 	ok = ok && check_chosen(dt);
 	if (! ok)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list