On Sun, Feb 10, 2019 at 04:33:42PM -0800, Frank Rowand wrote: > Hi David, > > On 2/5/19 8:39 PM, David Gibson wrote: > > On Thu, Jan 24, 2019 at 07:20:48PM +0900, AKASHI Takahiro wrote: > >> This function will append an address range property using parent node's > >> "#address-cells" and "#size-cells" properties. > >> > >> It will be used in implementing kdump with kexec_file_load system call > >> at linux kernel for arm64 once it is merged into kernel tree. > >> > >> Signed-off-by: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx> > > > > Sorry I've taken so long to look at this. > > > >> --- > >> libfdt/fdt_addresses.c | 43 ++++++++++++++++++++++++++++++++++++++++++ > >> libfdt/libfdt.h | 37 ++++++++++++++++++++++++++++++++++++ > >> 2 files changed, 80 insertions(+) > >> > >> diff --git a/libfdt/fdt_addresses.c b/libfdt/fdt_addresses.c > >> index f13a87dfa068..6f13a7bbb6a3 100644 > >> --- a/libfdt/fdt_addresses.c > >> +++ b/libfdt/fdt_addresses.c > >> @@ -95,3 +95,46 @@ int fdt_size_cells(const void *fdt, int nodeoffset) > >> return 1; > >> return val; > >> } > >> + > >> +static void cpu64_to_fdt_cells(uint8_t *prop, uint64_t val, int cells) > >> +{ > >> + fdt32_t val32; > >> + > >> + while (cells) { > >> + val32 = cpu_to_fdt32(val >> (32 * (--cells))); > > < snip > > > The line of code above led me to look at the libfdt version of cpu_to_fdt32(). > If I am looking in the correct place, libfdt/libfdt_env.h, then I only see > a version for little endian systems. Am I missing something, or does libfdt > assume little endian system and not support running on a big endian > system? No, despite not using an #ifdef the versions there work for both little and big endian systems. The trick is that on one side we access bytes by index a pointer and on the other side we access bytes using integer shifts. Those relate to each other differently on big vs. little endian systems. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature