aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2017-01-19 14:12:59 +0000
committerMark Rutland <mark.rutland@arm.com>2017-01-19 14:41:48 +0000
commit1a0163135df878114e520beab207abde36eb2502 (patch)
treec921ff7d41656445fdecf94a78f40451e487956f
parenta184c6afdf8989b3baea864e65cf9260c24d1cfc (diff)
downloadboot-wrapper-aarch64-1a0163135df878114e520beab207abde36eb2502.tar.gz
FDT.pm: add helper to get untranslated reg
In some cases, we'll want to parse a reg property that cannot be translated, e.g. for cpu nodes. Add a helper to extract the reg without attempting translation, factoring this logic out of Node::get_translated_reg(). Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rwxr-xr-xFDT.pm15
1 files changed, 13 insertions, 2 deletions
diff --git a/FDT.pm b/FDT.pm
index b814ef8..f498f09 100755
--- a/FDT.pm
+++ b/FDT.pm
@@ -348,7 +348,7 @@ sub translate_address
return undef;
}
-sub get_translated_reg
+sub get_untranslated_reg
{
my $self = shift;
my $idx = shift;
@@ -361,7 +361,18 @@ sub get_translated_reg
return undef if ($off + $ac + $sc > $reg->num_cells());
- my ($addr, $size) = $reg->read_cell_list($off, [$ac, $sc]);
+ return $reg->read_cell_list($off, [$ac, $sc]);
+}
+
+sub get_translated_reg
+{
+ my $self = shift;
+ my $idx = shift;
+ my $parent = $self->{parent};
+
+ my ($addr, $size) = $self->get_untranslated_reg($idx);
+
+ return undef if (not defined($addr) && defined($size));
for (my $parent = $self->{parent}; $parent; $parent = $parent->{parent}) {
last if (not defined($addr));