1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0-only 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun========================= 4*4882a593SmuzhiyunDriver-specific callbacks 5*4882a593Smuzhiyun========================= 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunThe ``pldmfw`` module relies on the device driver for implementing device 8*4882a593Smuzhiyunspecific behavior using the following operations. 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun``.match_record`` 11*4882a593Smuzhiyun----------------- 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunThe ``.match_record`` operation is used to determine whether a given PLDM 14*4882a593Smuzhiyunrecord matches the device being updated. This requires comparing the record 15*4882a593Smuzhiyundescriptors in the record with information from the device. Many record 16*4882a593Smuzhiyundescriptors are defined by the PLDM standard, but it is also allowed for 17*4882a593Smuzhiyundevices to implement their own descriptors. 18*4882a593Smuzhiyun 19*4882a593SmuzhiyunThe ``.match_record`` operation should return true if a given record matches 20*4882a593Smuzhiyunthe device. 21*4882a593Smuzhiyun 22*4882a593Smuzhiyun``.send_package_data`` 23*4882a593Smuzhiyun---------------------- 24*4882a593Smuzhiyun 25*4882a593SmuzhiyunThe ``.send_package_data`` operation is used to send the device-specific 26*4882a593Smuzhiyunpackage data in a record to the device firmware. If the matching record 27*4882a593Smuzhiyunprovides package data, ``pldmfw`` will call the ``.send_package_data`` 28*4882a593Smuzhiyunfunction with a pointer to the package data and with the package data 29*4882a593Smuzhiyunlength. The device driver should send this data to firmware. 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun``.send_component_table`` 32*4882a593Smuzhiyun------------------------- 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunThe ``.send_component_table`` operation is used to forward component 35*4882a593Smuzhiyuninformation to the device. It is called once for each applicable component, 36*4882a593Smuzhiyunthat is, for each component indicated by the matching record. The 37*4882a593Smuzhiyundevice driver should send the component information to the device firmware, 38*4882a593Smuzhiyunand wait for a response. The provided transfer flag indicates whether this 39*4882a593Smuzhiyunis the first, last, or a middle component, and is expected to be forwarded 40*4882a593Smuzhiyunto firmware as part of the component table information. The driver should an 41*4882a593Smuzhiyunerror in the case when the firmware indicates that the component cannot be 42*4882a593Smuzhiyunupdated, or return zero if the component can be updated. 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun``.flash_component`` 45*4882a593Smuzhiyun-------------------- 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunThe ``.flash_component`` operation is used to inform the device driver to 48*4882a593Smuzhiyunflash a given component. The driver must perform any steps necessary to send 49*4882a593Smuzhiyunthe component data to the device. 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun``.finalize_update`` 52*4882a593Smuzhiyun-------------------- 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunThe ``.finalize_update`` operation is used by the ``pldmfw`` library in 55*4882a593Smuzhiyunorder to allow the device driver to perform any remaining device specific 56*4882a593Smuzhiyunlogic needed to finish the update. 57