Skip to content
Snippets Groups Projects
  1. Nov 20, 2021
  2. Oct 08, 2021
    • Simon Glass's avatar
      Add support for an owned buffer · 67bc59df
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      When passing a data buffer back from a function, it is not always clear
      who owns the buffer, i.e. who is responsible for freeing the memory used.
      An example of this is where multiple files are decompressed from the
      firmware image, using a temporary buffer for reading (since the
      compressed data has to live somewhere) and producing a temporary or
      permanent buffer with the resuilts.
      
      Where the firmware image can be memory-mapped, as on x86, the compressed
      data does not need to be buffered, but the complexity of having a buffer
      which is either allocated or not, makes the code hard to understand.
      
      Introduce a new 'abuf' which supports simple buffer operations:
      
      - encapsulating a buffer and its size
      - either allocated with malloc() or not
      - able to be reliably freed if necessary
      - able to be converted to an allocated buffer if needed
      
      This simple API makes it easier to deal with allocated and memory-mapped
      buffers.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      67bc59df
    • Simon Glass's avatar
      lib: Add memdup() · 930c887e
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Add a function to duplicate a memory region, a little like strdup().
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      930c887e
  3. Jul 27, 2021
  4. Jul 23, 2021
  5. Jun 07, 2021
  6. Apr 22, 2021
  7. Apr 12, 2021
  8. Apr 08, 2021
  9. Mar 27, 2021
  10. Mar 12, 2021
  11. Feb 02, 2021
    • 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: default avatarTom Rini <trini@konsulko.com>
      401d1c4f
  12. Jan 16, 2021
  13. Oct 30, 2020
  14. Oct 23, 2020
  15. Aug 27, 2020
  16. Aug 24, 2020
  17. Aug 14, 2020
  18. Aug 08, 2020
  19. Aug 04, 2020
  20. Jul 03, 2020
  21. May 19, 2020
  22. May 18, 2020
    • Simon Glass's avatar
      command: Remove the cmd_tbl_t typedef · 09140113
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      We should not use typedefs in U-Boot. They cannot be used as forward
      declarations which means that header files must include the full header to
      access them.
      
      Drop the typedef and rename the struct to remove the _s suffix which is
      now not useful.
      
      This requires quite a few header-file additions.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      09140113
    • Simon Glass's avatar
      common: Drop net.h from common header · 90526e9f
      Simon Glass authored and Tom Rini's avatar Tom Rini committed
      
      Move this header out of the common header. Network support is used in
      quite a few places but it still does not warrant blanket inclusion.
      
      Note that this net.h header itself has quite a lot in it. It could be
      split into the driver-mode support, functions, structures, checksumming,
      etc.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      90526e9f
  23. May 04, 2020
  24. Mar 12, 2020
  25. Feb 13, 2020
    • Philippe Reynes's avatar
      test: aes: fix memleak · 58b209cf
      Philippe Reynes authored and Tom Rini's avatar Tom Rini committed
      
      In the first version, the result of malloc is checked
      with ut_assertnonnull. But on a fail, this macro exit
      the function, so previously malloc are not freed.
      
      So to avoid a memleak, we don't use ut_assertnonnull,
      but simply check the return of malloc. If one has failed,
      we freed all the allocated memory and quit the function.
      
      Reported-by: Coverity (CID: 284403)
      Reported-by: Coverity (CID: 284404)
      Reported-by: Coverity (CID: 284405)
      Reported-by: Coverity (CID: 284406)
      Reported-by: Coverity (CID: 284407)
      Signed-off-by: default avatarPhilippe Reynes <philippe.reynes@softathome.com>
      58b209cf
  26. Feb 06, 2020
    • Simon Glass's avatar
      dm: core: Create a new header file for 'compat' features · 336d4615
      Simon Glass authored
      
      At present dm/device.h includes the linux-compatible features. This
      requires including linux/compat.h which in turn includes a lot of headers.
      One of these is malloc.h which we thus end up including in every file in
      U-Boot. Apart from the inefficiency of this, it is problematic for sandbox
      which needs to use the system malloc() in some files.
      
      Move the compatibility features into a separate header file.
      
      Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      336d4615
  27. Jan 17, 2020
  28. Jan 07, 2020
    • Philippe Reynes's avatar
      cmd_ut: add a parameter prefix to the function cmd_ut_category · 4ad4edfe
      Philippe Reynes authored and Tom Rini's avatar Tom Rini committed
      
      There is black magic in the file conftest.py that list
      all the test unit. Then, all those test unit are called
      in pytest. This call is done with the end of the name
      (for example checksum if the full name is bloblist_test_checksum).
      
      The result is that only test for dm are really executed.
      by pytest, all others tests are listed but never executed.
      
      This behaviour happens because the dm test unit only check
      the end of the name and others tests checks the full name.
      
      To fix this issue, I've added a prefix to the function
      cmd_ut_category, and this prefix is removed when looking
      for the unit test.
      
      Signed-off-by: default avatarPhilippe Reynes <philippe.reynes@softathome.com>
      Tested-by: Heinrich Schuchardt's avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
      4ad4edfe
  29. Dec 06, 2019
  30. Oct 31, 2019
  31. Apr 22, 2019
  32. Feb 09, 2019
  33. Feb 02, 2019
  34. Jan 26, 2019
  35. Jan 16, 2019
    • Simon Goldschmidt's avatar
      lib: lmb: extend lmb for checks at load time · 4cc8af80
      Simon Goldschmidt authored and Tom Rini's avatar Tom Rini committed
      
      This adds two new functions, lmb_alloc_addr and
      lmb_get_unreserved_size.
      
      lmb_alloc_addr behaves like lmb_alloc, but it tries to allocate a
      pre-specified address range. Unlike lmb_reserve, this address range
      must be inside one of the memory ranges that has been set up with
      lmb_add.
      
      lmb_get_unreserved_size returns the number of bytes that can be
      used up to the next reserved region or the end of valid ram. This
      can be 0 if the address passed is reserved.
      
      Added test for these new functions.
      
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Signed-off-by: default avatarSimon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
      4cc8af80
    • Simon Goldschmidt's avatar
      lib: lmb: reserving overlapping regions should fail · 0f7c51a6
      Simon Goldschmidt authored and Tom Rini's avatar Tom Rini committed
      
      lmb_add_region handles overlapping regions wrong: instead of merging
      or rejecting to add a new reserved region that overlaps an existing
      one, it just adds the new region.
      
      Since internally the same function is used for lmb_alloc, change
      lmb_add_region to reject overlapping regions.
      
      Also, to keep reserved memory correct after 'free', reserved entries
      created by allocating memory must not set their size to a multiple
      of alignment but to the original size. This ensures the reserved
      region is completely removed when the caller calls 'lmb_free', as
      this one takes the same size as passed to 'lmb_alloc' etc.
      
      Add test to assert this.
      
      Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
      Signed-off-by: default avatarSimon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
      0f7c51a6
Loading