Re: [PATCH 2/2] libfdt: Add address translation functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Mon, May 12, 2014 at 02:01:14PM -0500, Rob Herring wrote:
> On Mon, May 12, 2014 at 1:06 AM, David Gibson
> <david@xxxxxxxxxxxxxxxxxxxxx> wrote:
> > Add the fdt_address_translate() function to process 'ranges' properties
> > to translate addresses from one bus to another.
> 
> Some trailing whitespace errors:
> 
> Applying: libfdt: Add address translation functions
> dtc/.git/rebase-apply/patch:87: trailing whitespace.
> 
> dtc/.git/rebase-apply/patch:208: trailing whitespace.
>  * @inbusoffset: offset of node which defines the address space of the input
> dtc/.git/rebase-apply/patch:342: trailing whitespace.
> 
> warning: 3 lines add whitespace errors.

Oops.  Not sure how I missed those.

> [...]
> 
> 
> > +int fdt_address_translate(const void *fdt,
> > +                         int inbusoffset, const fdt32_t *inaddr,
> > +                         int outbusoffset, fdt32_t *outaddr)
> 
> The translated address in native endian would be more useful, but more
> importantly how does one determine the translated address size needed
> to convert it? I don't see any reason for the caller to have the
> outaddr in be32. While in theory you could need something larger than
> a uint64_t, the reality is any >2 cell case is broken anyway.

The output isn't necessarily representable in any simple type
(e.g. translating from an ISA bus to a parent PCI bus - output is 3
cells).

I'm certainly thinking helper functions to translate simple 1 and 2
cell addresses to native integers, but this function is intended to
strictly translate between one device tree address representation and
another device tree address representation.

-- 
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: pgp7nyFkQoOLP.pgp
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux