driver-ops.rst 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .. SPDX-License-Identifier: GPL-2.0-only
  2. =========================
  3. Driver-specific callbacks
  4. =========================
  5. The ``pldmfw`` module relies on the device driver for implementing device
  6. specific behavior using the following operations.
  7. ``.match_record``
  8. -----------------
  9. The ``.match_record`` operation is used to determine whether a given PLDM
  10. record matches the device being updated. This requires comparing the record
  11. descriptors in the record with information from the device. Many record
  12. descriptors are defined by the PLDM standard, but it is also allowed for
  13. devices to implement their own descriptors.
  14. The ``.match_record`` operation should return true if a given record matches
  15. the device.
  16. ``.send_package_data``
  17. ----------------------
  18. The ``.send_package_data`` operation is used to send the device-specific
  19. package data in a record to the device firmware. If the matching record
  20. provides package data, ``pldmfw`` will call the ``.send_package_data``
  21. function with a pointer to the package data and with the package data
  22. length. The device driver should send this data to firmware.
  23. ``.send_component_table``
  24. -------------------------
  25. The ``.send_component_table`` operation is used to forward component
  26. information to the device. It is called once for each applicable component,
  27. that is, for each component indicated by the matching record. The
  28. device driver should send the component information to the device firmware,
  29. and wait for a response. The provided transfer flag indicates whether this
  30. is the first, last, or a middle component, and is expected to be forwarded
  31. to firmware as part of the component table information. The driver should an
  32. error in the case when the firmware indicates that the component cannot be
  33. updated, or return zero if the component can be updated.
  34. ``.flash_component``
  35. --------------------
  36. The ``.flash_component`` operation is used to inform the device driver to
  37. flash a given component. The driver must perform any steps necessary to send
  38. the component data to the device.
  39. ``.finalize_update``
  40. --------------------
  41. The ``.finalize_update`` operation is used by the ``pldmfw`` library in
  42. order to allow the device driver to perform any remaining device specific
  43. logic needed to finish the update.