1. 21 Jul, 2021 1 commit
  2. 24 Jun, 2021 2 commits
  3. 12 May, 2021 1 commit
  4. 29 Apr, 2021 1 commit
  5. 18 Feb, 2021 1 commit
  6. 02 Feb, 2021 1 commit
    • Simon Glass's avatar
      common: Drop asm/global_data.h from common header · 401d1c4f
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      
      Move this out of the common header and include it only where needed.  In
      a number of cases this requires adding "struct udevice;" to avoid adding
      another large header or in other cases replacing / adding missing header
      files that had been pulled in, very indirectly.   Finally, we have a few
      cases where we did not need to include <asm/global_data.h> at all, so
      remove that include.
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Signed-off-by: Tom Rini's avatarTom Rini <trini@konsulko.com>
      401d1c4f
  7. 12 Jan, 2021 1 commit
    • Dario Binacchi's avatar
      fdt: translate address if #size-cells = <0> · d64b9cdc
      Dario Binacchi authored and Lokesh Vutla's avatar Lokesh Vutla committed
      
      
      The __of_translate_address routine translates an address from the
      device tree into a CPU physical address. A note in the description of
      the routine explains that the crossing of any level with
      since inherited from IBM. This does not happen for Texas Instruments, or
      at least for the beaglebone device tree. Without this patch, in fact,
      the translation into physical addresses of the registers contained in the
      am33xx-clocks.dtsi nodes would not be possible. They all have a parent
      with #size-cells = <0>.
      
      The CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS symbol makes translation
      possible even in the case of crossing levels with #size-cells = <0>.
      
      The patch acts conservatively on address translation, except for
      removing a check within the of_translate_one function in the
      drivers/core/of_addr.c file:
      
      +
              ranges = of_get_property(parent, rprop, &rlen);
      -       if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
      -               debug("no ranges; cannot translate\n");
      -               return 1;
      -       }
              if (ranges == NULL || rlen == 0) {
                      offset = of_read_number(addr, na);
                      memset(addr, 0, pna * 4);
      		debug("empty ranges; 1:1 translation\n");
      
      There are two reasons:
      1 The function of_empty_ranges_quirk always returns false, invalidating
        the following if statement in case of null ranges. Therefore one of
        the two checks is useless.
      
      2 The implementation of the of_translate_one function found in the
        common/fdt_support.c file has removed this check while keeping the one
        about the 1:1 translation.
      
      The patch adds a test and modifies a check for the correctness of an
      address in the case of enabling translation also for zero size cells.
      The added test checks translations of addresses generated by nodes of
      a device tree similar to those you can find in the files am33xx.dtsi
      and am33xx-clocks.dtsi for which the patch was created.
      
      The patch was also tested on a beaglebone black board. The addresses
      generated for the registers of the loaded drivers are those specified
      by the AM335x reference manual.
      Signed-off-by: default avatarDario Binacchi <dariobin@libero.it>
      Tested-by: default avatarDario Binacchi <dariobin@libero.it>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      d64b9cdc
  8. 23 Dec, 2020 1 commit
    • Simon Glass's avatar
      dm: core: Inline a few ofnode functions in SPL · ec1add1e
      Simon Glass authored
      A recent change to unify the flattree/livetree code introduced a small
      size increase in SPL on some boards. For example SPL code size for
      px30-core-ctouch2-px30 increased by 40 bytes.
      
      To address this we can take advantage of the fact that some of the ofnode
      functions are only called a few times in SPL, so it is worth inlining
      them.
      
      Add new Kconfig options to control this. These functions are not inlined
      for U-Boot proper, since this increases code size.
      
      Fixes: 2ebea5ea
      
       ("dm: core: Combine the flattree and livetree binding code")
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ec1add1e
  9. 13 Dec, 2020 1 commit
  10. 27 Oct, 2020 1 commit
  11. 06 Oct, 2020 1 commit
  12. 22 Sep, 2020 1 commit
  13. 22 Aug, 2020 1 commit
    • Heinrich Schuchardt's avatar
      dm: fix ofnode_read_addr/size_cells() · ae6b33dc
      Heinrich Schuchardt authored and Simon Glass's avatar Simon Glass committed
      
      
      In the case of the live tree ofnode_read_addr_cells() and
      ofnode_read_size_cells() return the #address-cells and #size-cells defined
      in the parent node. With the patch the same is done for a non-live tree.
      
      The only consumer of these functions is currently the CFI flash driver.
      
      This patch fixes the incorrect parsing of the device tree leading to
      'saveenv' failing on qemu_arm64_defconfig.
      
      For testing qemu-system-aarch64 has to be called with
      
          -drive if=pflash,format=raw,index=1,file=envstore.img
      
      to provide the flash memory. envstore.img must be 64 MiB large.
      Signed-off-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      Reviewed-by: Stefan Roese's avatarStefan Roese <sr@denx.de>
      ae6b33dc
  14. 19 May, 2020 1 commit
  15. 02 May, 2020 1 commit
  16. 17 Apr, 2020 1 commit
    • Patrick Delaunay's avatar
      dm: core: add ofnode and dev function to iterate on node property · ce891fca
      Patrick Delaunay authored and Tom Rini's avatar Tom Rini committed
      
      
      Add functions to iterate on all property with livetree
      - dev_read_first_prop
      - dev_read_next_prop
      - dev_read_prop_by_prop
      and
      - ofnode_get_first_property
      - ofnode_get_next_property
      - ofnode_get_property_by_prop
      
      And helper: dev_for_each_property
      
      For example:
      struct ofprop property;
      
      dev_for_each_property(property, config) {
      	value = dev_read_prop_by_prop(&property, &propname, &len);
      
      or:
      
      for (res = ofnode_get_first_property(node, &property);
           !res;
           res = ofnode_get_next_property(&property))
      {
           value = ofnode_get_property_by_prop(&property, &propname, &len);
      ....
      }
      Signed-off-by: Patrick Delaunay's avatarPatrick Delaunay <patrick.delaunay@st.com>
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      ce891fca
  17. 16 Apr, 2020 2 commits
  18. 06 Feb, 2020 5 commits
  19. 27 Oct, 2019 1 commit
  20. 03 Oct, 2019 2 commits
  21. 06 Sep, 2019 1 commit
  22. 19 Aug, 2019 1 commit
  23. 24 Jul, 2019 1 commit
  24. 22 Jul, 2019 1 commit
    • Fabien Dessenne's avatar
      dm: core: Introduce xxx_translate_dma_address() · 641067fb
      Fabien Dessenne authored and Patrick Delaunay's avatar Patrick Delaunay committed
      
      
      Add the following functions to translate DMA address to CPU address:
      - dev_translate_dma_address()
      - ofnode_translate_dma_address()
      - of_translate_dma_address()
      - fdt_translate_dma_address()
      These functions work the same way as xxx_translate_address(), with the
      difference that the translation relies on the "dma-ranges" property
      instead of the "ranges" property.
      
      Add related test. Test report:
      => ut dm fdt_translation
      Test: dm_test_fdt_translation: test-fdt.c
      Test: dm_test_fdt_translation: test-fdt.c (flat tree)
      Failures: 0
      Signed-off-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
      641067fb
  25. 21 May, 2019 2 commits
  26. 08 May, 2019 1 commit
  27. 12 Apr, 2019 2 commits
    • Eugeniu Rosca's avatar
      core: ofnode: Fix ASAN-reported stack-buffer-overflow in of_get_address · 9bfacf24
      Eugeniu Rosca authored and Simon Glass's avatar Simon Glass committed
      v2019.04-rc3 sandbox U-Boot fails to boot when compiled with
       -fsanitize=address and linked against -lasan, reporting [1].
      
      Git bisecting shows that the issue is contributed by v2019.01 commit
      1678754f
      
       ("core: ofnode: Fix ofnode_get_addr_index function").
      
      The root cause seems to be the mismatch between sizeof(u64) and
      sizeof(fdt_size_t) on sandbox. Luckily, thanks to the fact that the
      size argument of both of_get_address() and fdtdec_get_addr_size_fixed()
      is optional, we can pass NULL in its place, avoiding the problem.
      
      [1] Backtrace reported by ASAN (gcc 8.1.0):
      
      $> ./u-boot -d arch/sandbox/dts/sandbox.dtb
      [..]
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      
      =================================================================
      ==10998==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffcc2331140 at pc 0x0000004eeeb0 bp 0x7ffcc2330f80 sp 0x7ffcc2330f70
      WRITE of size 8 at 0x7ffcc2331140 thread T0
          #0 0x4eeeaf in of_get_address drivers/core/of_addr.c:154
          #1 0x4f7441 in ofnode_get_addr_index drivers/core/ofnode.c:263
          #2 0x5b2a78 in sb_eth_ofdata_to_platdata drivers/net/sandbox.c:422
          #3 0x4dccd8 in device_probe drivers/core/device.c:407
          #4 0x753170 in eth_initialize net/eth-uclass.c:428
          #5 0x47d9bf in initr_net common/board_r.c:557
          #6 0x6bcfa7 in initcall_run_list lib/initcall.c:30
          #7 0x47e1fe in board_init_r common/board_r.c:859
          #8 0x4060e5 in main arch/sandbox/cpu/start.c:356
          #9 0x7fb8d135482f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
          #10 0x40a3a8 in _start (/path/to/u-boot/u-boot+0x40a3a8)
      
      Address 0x7ffcc2331140 is located in stack of thread T0 at offset 32 in frame
          #0 0x4f72b8 in ofnode_get_addr_index drivers/core/ofnode.c:255
      
        This frame has 3 object(s):
          [32, 36) 'size' <== Memory access at offset 32 partially overflows this variable
          [96, 100) 'flags'
          [160, 168) 'node'
      HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
            (longjmp and C++ exceptions *are* supported)
      SUMMARY: AddressSanitizer: stack-buffer-overflow drivers/core/of_addr.c:154 in of_get_address
      Shadow bytes around the buggy address:
        0x10001845e1d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x10001845e1e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x10001845e1f0: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
        0x10001845e200: 04 f2 f2 f2 f2 f2 f2 f2 04 f2 f2 f2 f2 f2 f2 f2
        0x10001845e210: 04 f2 f2 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00
      =>0x10001845e220: 00 00 00 00 f1 f1 f1 f1[04]f2 f2 f2 f2 f2 f2 f2
        0x10001845e230: 04 f2 f2 f2 f2 f2 f2 f2 00 f2 f2 f2 f3 f3 f3 f3
        0x10001845e240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x10001845e250: 00 00 00 00 f1 f1 f1 f1 00 00 f2 f2 f3 f3 f3 f3
        0x10001845e260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1
        0x10001845e270: f1 f1 00 f2 f2 f2 f3 f3 f3 f3 00 00 00 00 00 00
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07
        Heap left redzone:       fa
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==10998==ABORTING
      
      'To' list:
       git log --since=1year drivers/core/ofnode.c | grep "\-by: .*@" | \
           sed 's/.*-by: //' | sort | uniq -c | sort -rn
           10 Simon Glass <sjg@chromium.org>
            3 Mario Six <mario.six@gdsys.cc>
            2 Martin Fuzzey <mfuzzey@parkeon.com>
            2 Marek Vasut <marek.vasut+renesas@gmail.com>
            1 Tom Rini <trini@konsulko.com>
            1 Masahiro Yamada <yamada.masahiro@socionext.com>
            1 Keerthy <j-keerthy@ti.com>
            1 Jens Wiklander <jens.wiklander@linaro.org>
            1 Bin Meng <bmeng.cn@gmail.com>
      
      Fixes: 1678754f
      
       ("core: ofnode: Fix ofnode_get_addr_index function")
      Signed-off-by: default avatarEugeniu Rosca <erosca@de.adit-jv.com>
      9bfacf24
    • Patrick Delaunay's avatar
      dm: remove pre reloc properties in SPL and TPL device tree · c7a88dae
      Patrick Delaunay authored and Simon Glass's avatar Simon Glass committed
      
      
      We can remove the pre reloc property in SPL and TPL device-tree:
      - u-boot,dm-pre-reloc
      - u-boot,dm-spl
      - u-boot,dm-tpl
      As only the needed node are kept by fdtgrep (1st pass).
      
      The associated function (XXX_pre_reloc) are simple for SPL/TPL:
      return always true.
      Signed-off-by: Patrick Delaunay's avatarPatrick Delaunay <patrick.delaunay@st.com>
      c7a88dae
  28. 29 Nov, 2018 1 commit
  29. 14 Nov, 2018 1 commit
  30. 09 Oct, 2018 1 commit
  31. 08 Oct, 2018 1 commit