mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-21 20:34:38 +00:00
fdtdec: Remove fdt_{addr,size}_unpack()
U-Boot already defines the {upper,lower}_32_bits() macros that have the same purpose. Use the existing macros instead of defining new APIs. Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
parent
089ff8eb66
commit
3bf2f15351
3 changed files with 12 additions and 28 deletions
|
@ -24,30 +24,6 @@
|
||||||
typedef phys_addr_t fdt_addr_t;
|
typedef phys_addr_t fdt_addr_t;
|
||||||
typedef phys_size_t fdt_size_t;
|
typedef phys_size_t fdt_size_t;
|
||||||
|
|
||||||
static inline fdt32_t fdt_addr_unpack(fdt_addr_t addr, fdt32_t *upper)
|
|
||||||
{
|
|
||||||
if (upper)
|
|
||||||
#ifdef CONFIG_PHYS_64BIT
|
|
||||||
*upper = addr >> 32;
|
|
||||||
#else
|
|
||||||
*upper = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline fdt32_t fdt_size_unpack(fdt_size_t size, fdt32_t *upper)
|
|
||||||
{
|
|
||||||
if (upper)
|
|
||||||
#ifdef CONFIG_PHYS_64BIT
|
|
||||||
*upper = size >> 32;
|
|
||||||
#else
|
|
||||||
*upper = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PHYS_64BIT
|
#ifdef CONFIG_PHYS_64BIT
|
||||||
#define FDT_ADDR_T_NONE (-1U)
|
#define FDT_ADDR_T_NONE (-1U)
|
||||||
#define fdt_addr_to_cpu(reg) be64_to_cpu(reg)
|
#define fdt_addr_to_cpu(reg) be64_to_cpu(reg)
|
||||||
|
|
|
@ -1300,6 +1300,7 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
|
||||||
fdt32_t cells[4] = {}, *ptr = cells;
|
fdt32_t cells[4] = {}, *ptr = cells;
|
||||||
uint32_t upper, lower, phandle;
|
uint32_t upper, lower, phandle;
|
||||||
int parent, node, na, ns, err;
|
int parent, node, na, ns, err;
|
||||||
|
fdt_size_t size;
|
||||||
char name[64];
|
char name[64];
|
||||||
|
|
||||||
/* create an empty /reserved-memory node if one doesn't exist */
|
/* create an empty /reserved-memory node if one doesn't exist */
|
||||||
|
@ -1340,7 +1341,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
|
||||||
* Unpack the start address and generate the name of the new node
|
* Unpack the start address and generate the name of the new node
|
||||||
* base on the basename and the unit-address.
|
* base on the basename and the unit-address.
|
||||||
*/
|
*/
|
||||||
lower = fdt_addr_unpack(carveout->start, &upper);
|
upper = upper_32_bits(carveout->start);
|
||||||
|
lower = lower_32_bits(carveout->start);
|
||||||
|
|
||||||
if (na > 1 && upper > 0)
|
if (na > 1 && upper > 0)
|
||||||
snprintf(name, sizeof(name), "%s@%x,%x", basename, upper,
|
snprintf(name, sizeof(name), "%s@%x,%x", basename, upper,
|
||||||
|
@ -1374,7 +1376,9 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
|
||||||
*ptr++ = cpu_to_fdt32(lower);
|
*ptr++ = cpu_to_fdt32(lower);
|
||||||
|
|
||||||
/* store one or two size cells */
|
/* store one or two size cells */
|
||||||
lower = fdt_size_unpack(carveout->end - carveout->start + 1, &upper);
|
size = carveout->end - carveout->start + 1;
|
||||||
|
upper = upper_32_bits(size);
|
||||||
|
lower = lower_32_bits(size);
|
||||||
|
|
||||||
if (ns > 1)
|
if (ns > 1)
|
||||||
*ptr++ = cpu_to_fdt32(upper);
|
*ptr++ = cpu_to_fdt32(upper);
|
||||||
|
|
|
@ -155,11 +155,13 @@ static int make_fdt_carveout_device(void *fdt, uint32_t na, uint32_t ns)
|
||||||
};
|
};
|
||||||
fdt32_t cells[4], *ptr = cells;
|
fdt32_t cells[4], *ptr = cells;
|
||||||
uint32_t upper, lower;
|
uint32_t upper, lower;
|
||||||
|
fdt_size_t size;
|
||||||
char name[32];
|
char name[32];
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
/* store one or two address cells */
|
/* store one or two address cells */
|
||||||
lower = fdt_addr_unpack(carveout.start, &upper);
|
upper = upper_32_bits(carveout.start);
|
||||||
|
lower = lower_32_bits(carveout.start);
|
||||||
|
|
||||||
if (na > 1 && upper > 0)
|
if (na > 1 && upper > 0)
|
||||||
snprintf(name, sizeof(name), "%s@%x,%x", basename, upper,
|
snprintf(name, sizeof(name), "%s@%x,%x", basename, upper,
|
||||||
|
@ -173,7 +175,9 @@ static int make_fdt_carveout_device(void *fdt, uint32_t na, uint32_t ns)
|
||||||
*ptr++ = cpu_to_fdt32(lower);
|
*ptr++ = cpu_to_fdt32(lower);
|
||||||
|
|
||||||
/* store one or two size cells */
|
/* store one or two size cells */
|
||||||
lower = fdt_size_unpack(carveout.end - carveout.start + 1, &upper);
|
size = carveout.end - carveout.start + 1;
|
||||||
|
upper = upper_32_bits(size);
|
||||||
|
lower = lower_32_bits(size);
|
||||||
|
|
||||||
if (ns > 1)
|
if (ns > 1)
|
||||||
*ptr++ = cpu_to_fdt32(upper);
|
*ptr++ = cpu_to_fdt32(upper);
|
||||||
|
|
Loading…
Add table
Reference in a new issue