summaryrefslogtreecommitdiff
path: root/fdtget.c
diff options
context:
space:
mode:
author David Gibson <david@gibson.dropbear.id.au> 2018-06-21 15:32:40 +1000
committer David Gibson <david@gibson.dropbear.id.au> 2018-06-26 15:09:46 +1000
commit6dcb8ba408ec18009083acaa9f85429afa39e453 (patch)
treef3c2bcf3ea65422c3c19c287ebfb1e5cf45f85d2 /fdtget.c
parent42607f21d43e44aafc7ac7d9ca4f0ea1e3bda904 (diff)
libfdt: Add helpers for accessing unaligned words
This adds some helpers to load (32 or 64 bit) words from an fdt blob, even if they're unaligned and we're on a platform that doesn't like plain unaligned loads and stores. We then use the helpers in a number of places. There are two purposes for this: 1) This makes libfdt more robust against a blob loaded at an unaligned address. It's usually good practice to load a blob at a 64-bit alignment, but it's nice to work even then. 2) Users can use these helpers to load integer values from within property values. These can often be unaligned, even if the blob as a whole is aligned, since some property encodings have integers and strings mixed together without any alignment gaps. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'fdtget.c')
-rw-r--r--fdtget.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fdtget.c b/fdtget.c
index ee7139f..a79c3b2 100644
--- a/fdtget.c
+++ b/fdtget.c
@@ -76,7 +76,7 @@ static int show_cell_list(struct display_info *disp, const char *data, int len,
for (i = 0; i < len; i += size, p += size) {
if (i)
printf(" ");
- value = size == 4 ? fdt32_to_cpu(*(const fdt32_t *)p) :
+ value = size == 4 ? fdt32_ld((const fdt32_t *)p) :
size == 2 ? (*p << 8) | p[1] : *p;
printf(fmt, value);
}