aboutsummaryrefslogtreecommitdiffstats
path: root/addpsci.pl
blob: 06270ca504f2908c3f7fdf0f1bb84e1104ead2b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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());
}