Changeset 220cde8 in rtems for cpukit/dtc


Ignore:
Timestamp:
Jul 27, 2016, 12:55:55 PM (3 years ago)
Author:
Maxime Ripard <maxime.ripard@…>
Branches:
master
Children:
2086bbc8
Parents:
eda76d4
git-author:
Maxime Ripard <maxime.ripard@…> (07/27/16 12:55:55)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/19/18 05:01:09)
Message:

libfdt: Add max phandle retrieval function

Add a function to retrieve the highest phandle in a given device tree.

Acked-by: Simon Glass <sjg@…>
Reviewed-by: Stefan Agner <stefan@…>
Reviewed-by: David Gibson <david@…>
Signed-off-by: Maxime Ripard <maxime.ripard@…>
Signed-off-by: David Gibson <david@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/dtc/libfdt/fdt_ro.c

    reda76d4 r220cde8  
    8989}
    9090
     91uint32_t fdt_get_max_phandle(const void *fdt)
     92{
     93        uint32_t max_phandle = 0;
     94        int offset;
     95
     96        for (offset = fdt_next_node(fdt, -1, NULL);;
     97             offset = fdt_next_node(fdt, offset, NULL)) {
     98                uint32_t phandle;
     99
     100                if (offset == -FDT_ERR_NOTFOUND)
     101                        return max_phandle;
     102
     103                if (offset < 0)
     104                        return (uint32_t)-1;
     105
     106                phandle = fdt_get_phandle(fdt, offset);
     107                if (phandle == (uint32_t)-1)
     108                        continue;
     109
     110                if (phandle > max_phandle)
     111                        max_phandle = phandle;
     112        }
     113
     114        return 0;
     115}
     116
    91117int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size)
    92118{
Note: See TracChangeset for help on using the changeset viewer.