README.bloblist 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # SPDX-License-Identifier: GPL-2.0+
  2. Blob Lists - bloblist
  3. =====================
  4. Introduction
  5. ------------
  6. A bloblist provides a way to store collections of binary information (blobs) in
  7. a central structure. Each record of information is assigned a tag so that its
  8. owner can find it and update it. Each record is generally described by a C
  9. structure defined by the code that owns it.
  10. Passing state through the boot process
  11. --------------------------------------
  12. The bloblist is created when the first U-Boot component runs (often SPL,
  13. sometimes TPL). It is passed through to each successive part of the boot and
  14. can be accessed as needed. This provides a way to transfer state from one part
  15. to the next. For example, TPL may determine that a watchdog reset occurred by
  16. reading an SoC register. Reading the register may reset the value, so that it
  17. cannot be read a second time. So TPL can store that in a bloblist record which
  18. can be passed through to SPL and U-Boot proper, which can print a message
  19. indicating that something went wrong and the watchdog fired.
  20. Blobs
  21. -----
  22. While each blob in the bloblist can be of any length, bloblists are designed to
  23. hold small amounts of data, typically a few KB at most. It is not possible to
  24. change the length of a blob once it has been written. Each blob is normally
  25. created from a C structure which can beused to access its fields.
  26. Blob tags
  27. ---------
  28. Each blob has a tag which is a 32-bit number. This uniquely identifies the
  29. owner of the blob. Blob tags are listed in enum blob_tag_t and are named
  30. with a BLOBT_ prefix.
  31. Single structure
  32. ----------------
  33. There is normally only one bloblist in U-Boot. Since a bloblist can store
  34. multiple blobs it does not seem useful to allow multiple bloblists. Of course
  35. there could be reasons for this, such as needing to spread the blobs around in
  36. different memory areas due to fragmented memory, but it is simpler to just have
  37. a single bloblist.
  38. API
  39. ---
  40. Bloblist provides a fairly simple API which allows blobs to be created and
  41. found. All access is via the blob's tag.
  42. Finishing the bloblist
  43. ----------------------
  44. When a part of U-Boot is about to jump to the next part, it can 'finish' the
  45. bloblist in preparation for the next stage. This involves adding a checksum so
  46. that the next stage can make sure that the data arrived safely. While the
  47. bloblist is in use, changes can be made which will affect the checksum, so it
  48. is easier to calculate the checksum at the end after all changes are made.
  49. Future work
  50. -----------
  51. Bootstage has a mechanism to 'stash' its records for passing to the next part.
  52. This should move to using bloblist, to avoid having its own mechanism for
  53. passing information between U-Boot parts.
  54. Simon Glass
  55. sjg@chromium.org
  56. 12-Aug-2018