aboutsummaryrefslogtreecommitdiff
path: root/addpsci.pl
diff options
context:
space:
mode:
Diffstat (limited to 'addpsci.pl')
-rwxr-xr-xaddpsci.pl29
1 files changed, 29 insertions, 0 deletions
diff --git a/addpsci.pl b/addpsci.pl
new file mode 100755
index 0000000..06270ca
--- /dev/null
+++ b/addpsci.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+# Generate additions to add a PSCI enable-method to cpu nodes.
+#
+# Usage: ./$0 <DTB>
+#
+# Copyright (C) 2014 ARM Limited. All rights reserved.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE.txt file.
+
+use warnings;
+use strict;
+
+use FDT;
+
+my $filename = shift;
+die("No filename provided") unless defined($filename);
+
+open (my $fh, "<:raw", $filename) or die("Unable to open file '$filename'");
+
+my $fdt = FDT->parse($fh) or die("Unable to parse DTB");
+
+my $root = $fdt->get_root();
+
+my @cpus = $root->find_by_device_type('cpu');
+
+foreach my $cpu (@cpus) {
+ printf("&{%s} { enable-method = \\\"psci\\\"; };\n", $cpu->get_full_path());
+}