index.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .. SPDX-License-Identifier: GPL-2.0-only
  2. ==================================
  3. PLDM Firmware Flash Update Library
  4. ==================================
  5. ``pldmfw`` implements functionality for updating the flash on a device using
  6. the PLDM for Firmware Update standard
  7. <https://www.dmtf.org/documents/pmci/pldm-firmware-update-specification-100>.
  8. .. toctree::
  9. :maxdepth: 1
  10. file-format
  11. driver-ops
  12. ==================================
  13. Overview of the ``pldmfw`` library
  14. ==================================
  15. The ``pldmfw`` library is intended to be used by device drivers for
  16. implementing device flash update based on firmware files following the PLDM
  17. firwmare file format.
  18. It is implemented using an ops table that allows device drivers to provide
  19. the underlying device specific functionality.
  20. ``pldmfw`` implements logic to parse the packed binary format of the PLDM
  21. firmware file into data structures, and then uses the provided function
  22. operations to determine if the firmware file is a match for the device. If
  23. so, it sends the record and component data to the firmware using the device
  24. specific implementations provided by device drivers. Once the device
  25. firmware indicates that the update may be performed, the firmware data is
  26. sent to the device for programming.
  27. Parsing the PLDM file
  28. =====================
  29. The PLDM file format uses packed binary data, with most multi-byte fields
  30. stored in the Little Endian format. Several pieces of data are variable
  31. length, including version strings and the number of records and components.
  32. Due to this, it is not straight forward to index the record, record
  33. descriptors, or components.
  34. To avoid proliferating access to the packed binary data, the ``pldmfw``
  35. library parses and extracts this data into simpler structures for ease of
  36. access.
  37. In order to safely process the firmware file, care is taken to avoid
  38. unaligned access of multi-byte fields, and to properly convert from Little
  39. Endian to CPU host format. Additionally the records, descriptors, and
  40. components are stored in linked lists.
  41. Performing a flash update
  42. =========================
  43. To perform a flash update, the ``pldmfw`` module performs the following
  44. steps
  45. 1. Parse the firmware file for record and component information
  46. 2. Scan through the records and determine if the device matches any record
  47. in the file. The first matched record will be used.
  48. 3. If the matching record provides package data, send this package data to
  49. the device.
  50. 4. For each component that the record indicates, send the component data to
  51. the device. For each component, the firmware may respond with an
  52. indication of whether the update is suitable or not. If any component is
  53. not suitable, the update is canceled.
  54. 5. For each component, send the binary data to the device firmware for
  55. updating.
  56. 6. After all components are programmed, perform any final device-specific
  57. actions to finalize the update.