aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/dtc-src/dtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/boot/dtc-src/dtc.c')
-rw-r--r--arch/powerpc/boot/dtc-src/dtc.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/arch/powerpc/boot/dtc-src/dtc.c b/arch/powerpc/boot/dtc-src/dtc.c
index 01131d7c2d5e..d8fd43b4ac1a 100644
--- a/arch/powerpc/boot/dtc-src/dtc.c
+++ b/arch/powerpc/boot/dtc-src/dtc.c
@@ -55,7 +55,7 @@ char *join_path(const char *path, const char *name)
55 return str; 55 return str;
56} 56}
57 57
58void fill_fullpaths(struct node *tree, const char *prefix) 58static void fill_fullpaths(struct node *tree, const char *prefix)
59{ 59{
60 struct node *child; 60 struct node *child;
61 const char *unit; 61 const char *unit;
@@ -106,7 +106,7 @@ static void __attribute__ ((noreturn)) usage(void)
106 fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n"); 106 fprintf(stderr, "\t\tForce - try to produce output even if the input tree has errors\n");
107 fprintf(stderr, "\t-v\n"); 107 fprintf(stderr, "\t-v\n");
108 fprintf(stderr, "\t\tPrint DTC version and exit\n"); 108 fprintf(stderr, "\t\tPrint DTC version and exit\n");
109 exit(2); 109 exit(3);
110} 110}
111 111
112int main(int argc, char *argv[]) 112int main(int argc, char *argv[])
@@ -118,10 +118,9 @@ int main(int argc, char *argv[])
118 int force = 0, check = 0; 118 int force = 0, check = 0;
119 const char *arg; 119 const char *arg;
120 int opt; 120 int opt;
121 FILE *inf = NULL;
122 FILE *outf = NULL; 121 FILE *outf = NULL;
123 int outversion = DEFAULT_FDT_VERSION; 122 int outversion = DEFAULT_FDT_VERSION;
124 int boot_cpuid_phys = 0xfeedbeef; 123 long long cmdline_boot_cpuid = -1;
125 124
126 quiet = 0; 125 quiet = 0;
127 reservenum = 0; 126 reservenum = 0;
@@ -161,11 +160,11 @@ int main(int argc, char *argv[])
161 quiet++; 160 quiet++;
162 break; 161 break;
163 case 'b': 162 case 'b':
164 boot_cpuid_phys = strtol(optarg, NULL, 0); 163 cmdline_boot_cpuid = strtoll(optarg, NULL, 0);
165 break; 164 break;
166 case 'v': 165 case 'v':
167 printf("Version: %s\n", DTC_VERSION); 166 printf("Version: %s\n", DTC_VERSION);
168 exit(0); 167 exit(0);
169 case 'h': 168 case 'h':
170 default: 169 default:
171 usage(); 170 usage();
@@ -180,31 +179,27 @@ int main(int argc, char *argv[])
180 arg = argv[optind]; 179 arg = argv[optind];
181 180
182 /* minsize and padsize are mutually exclusive */ 181 /* minsize and padsize are mutually exclusive */
183 if ((minsize) && (padsize)) { 182 if (minsize && padsize)
184 die("Can't set both -p and -S\n"); 183 die("Can't set both -p and -S\n");
185 }
186 184
187 fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", 185 fprintf(stderr, "DTC: %s->%s on file \"%s\"\n",
188 inform, outform, arg); 186 inform, outform, arg);
189 187
190 if (streq(inform, "dts")) { 188 if (streq(inform, "dts"))
191 bi = dt_from_source(arg); 189 bi = dt_from_source(arg);
192 } else if (streq(inform, "fs")) { 190 else if (streq(inform, "fs"))
193 bi = dt_from_fs(arg); 191 bi = dt_from_fs(arg);
194 } else if(streq(inform, "dtb")) { 192 else if(streq(inform, "dtb"))
195 inf = dtc_open_file(arg); 193 bi = dt_from_blob(arg);
196 bi = dt_from_blob(inf); 194 else
197 } else {
198 die("Unknown input format \"%s\"\n", inform); 195 die("Unknown input format \"%s\"\n", inform);
199 }
200 196
201 if (inf && (inf != stdin)) 197 if (cmdline_boot_cpuid != -1)
202 fclose(inf); 198 bi->boot_cpuid_phys = cmdline_boot_cpuid;
203 199
204 if (! bi || ! bi->dt) 200 fill_fullpaths(bi->dt, "");
205 die("Couldn't read input tree\n"); 201 process_checks(force, bi);
206 202
207 process_checks(force, bi, check, outversion, boot_cpuid_phys);
208 203
209 if (streq(outname, "-")) { 204 if (streq(outname, "-")) {
210 outf = stdout; 205 outf = stdout;
@@ -218,9 +213,9 @@ int main(int argc, char *argv[])
218 if (streq(outform, "dts")) { 213 if (streq(outform, "dts")) {
219 dt_to_source(outf, bi); 214 dt_to_source(outf, bi);
220 } else if (streq(outform, "dtb")) { 215 } else if (streq(outform, "dtb")) {
221 dt_to_blob(outf, bi, outversion, boot_cpuid_phys); 216 dt_to_blob(outf, bi, outversion);
222 } else if (streq(outform, "asm")) { 217 } else if (streq(outform, "asm")) {
223 dt_to_asm(outf, bi, outversion, boot_cpuid_phys); 218 dt_to_asm(outf, bi, outversion);
224 } else if (streq(outform, "null")) { 219 } else if (streq(outform, "null")) {
225 /* do nothing */ 220 /* do nothing */
226 } else { 221 } else {