1e3596384SManojkiran Eda# PLDM - Platform Level Data Model 23618064eSPatrick Williams 3e3596384SManojkiran Eda[](LICENSE) 43618064eSPatrick Williams 5e3596384SManojkiran Eda## Overview 6e3596384SManojkiran Eda 7e3596384SManojkiran EdaPLDM (Platform Level Data Model) is a key component of the OpenBMC project, 8e3596384SManojkiran Edaproviding a standardized data model and message formats for various platform 9e3596384SManojkiran Edamanagement functionalities. It defines a method to manage, monitor, and control 10e3596384SManojkiran Edathe firmware and hardware of a system. 11e3596384SManojkiran Eda 12e3596384SManojkiran EdaThe OpenBMC PLDM project aims to implement the specifications defined by the 13e3596384SManojkiran EdaDistributed Management Task Force (DMTF), allowing for interoperable management 14e3596384SManojkiran Edainterfaces across different hardware and firmware components. 15e3596384SManojkiran Eda 16e3596384SManojkiran Eda## Features 17e3596384SManojkiran Eda 18e3596384SManojkiran Eda- **Standardized Messaging:** Adheres to the DMTF's PLDM specifications, 19e3596384SManojkiran Eda enabling consistent and interoperable communication between different 20e3596384SManojkiran Eda components. 21e3596384SManojkiran Eda- **Modularity:** Supports multiple PLDM types, including base, FRU,Firmware 22e3596384SManojkiran Eda update, Platform Monitoring and Control, and BIOS Control and Configuration. 23e3596384SManojkiran Eda- **Extensibility:** Easily extendable to support new PLDM types and custom OEM 24e3596384SManojkiran Eda commands. 25e3596384SManojkiran Eda- **Integration:** Seamlessly integrates with other OpenBMC components for 26e3596384SManojkiran Eda comprehensive system management. 27e3596384SManojkiran Eda 28e3596384SManojkiran Eda## Getting Started 29e3596384SManojkiran Eda 30e3596384SManojkiran Eda### Prerequisites 31e3596384SManojkiran Eda 32e3596384SManojkiran EdaTo build and run PLDM, you need the following dependencies: 33e3596384SManojkiran Eda 34e3596384SManojkiran Eda- `Meson` 35e3596384SManojkiran Eda- `Ninja` 36e3596384SManojkiran Eda 37e3596384SManojkiran EdaAlternatively, source an OpenBMC ARM/x86 SDK. 38e3596384SManojkiran Eda 39e3596384SManojkiran Eda### Building 40e3596384SManojkiran Eda 41e3596384SManojkiran EdaTo build the PLDM project, follow these steps: 42e3596384SManojkiran Eda 43e3596384SManojkiran Eda```bash 443586d360SPavithra Barithayameson setup build && ninja -C build 453c275e1cSDeepak Kodihalli``` 464913998aSManojkiran Eda 47e3596384SManojkiran Eda### To run unit tests 483618064eSPatrick Williams 496db5532dSBrad BishopThe simplest way of running the tests is as described by the meson man page: 503618064eSPatrick Williams 51e3596384SManojkiran Eda```bash 523586d360SPavithra Barithayameson setup builddir && meson setup test -C builddir 536db5532dSBrad Bishop``` 543618064eSPatrick Williams 55ace4e14dSManojkiran EdaAlternatively, tests can be run in the OpenBMC CI docker container using 56ace4e14dSManojkiran Eda[these](https://github.com/openbmc/docs/blob/master/testing/local-ci-build.md) 57ace4e14dSManojkiran Edasteps. 584913998aSManojkiran Eda 59e3596384SManojkiran Eda### To enable pldm verbosity 603618064eSPatrick Williams 613618064eSPatrick Williamspldm daemon accepts a command line argument `--verbose` or `--v` or `-v` to 623618064eSPatrick Williamsenable the daemon to run in verbose mode. It can be done via adding this option 633618064eSPatrick Williamsto the environment file that pldm service consumes. 643618064eSPatrick Williams 65e3596384SManojkiran Eda```bash 66f25145fbSManojkiran Edaecho 'PLDMD_ARGS="--verbose"' > /etc/default/pldmd 67f25145fbSManojkiran Edasystemctl restart pldmd 68f25145fbSManojkiran Eda``` 693618064eSPatrick Williams 70e3596384SManojkiran Eda### To disable pldm verbosity 713618064eSPatrick Williams 72e3596384SManojkiran Eda```bash 73f25145fbSManojkiran Edarm /etc/default/pldmd 74f25145fbSManojkiran Edasystemctl restart pldmd 75f25145fbSManojkiran Eda``` 766db5532dSBrad Bishop 77e3596384SManojkiran Eda### Code Organization 783618064eSPatrick Williams 79e090e3ddSDeepak KodihalliAt a high-level, code in this repository belongs to one of the following three 80e090e3ddSDeepak Kodihallicomponents. 81e090e3ddSDeepak Kodihalli 82e3596384SManojkiran Eda#### libpldmresponder 833618064eSPatrick Williams 84e090e3ddSDeepak KodihalliThis library provides handlers for incoming PLDM request messages. It provides 85e090e3ddSDeepak Kodihallifor a registration as well as a plug-in mechanism. The library is implemented in 86e090e3ddSDeepak Kodihallimodern C++, and handles OpenBMC's platform specifics. 87e090e3ddSDeepak Kodihalli 88e090e3ddSDeepak KodihalliThe handlers are of the form 893618064eSPatrick Williams 90e3596384SManojkiran Eda```c 91e090e3ddSDeepak KodihalliResponse handler(Request payload, size_t payloadLen) 92e090e3ddSDeepak Kodihalli``` 93e090e3ddSDeepak Kodihalli 94e090e3ddSDeepak KodihalliSource files are named according to the PLDM Type, for eg base.[hpp/cpp], 95e090e3ddSDeepak Kodihallifru.[hpp/cpp], etc. 96e090e3ddSDeepak Kodihalli 97e3596384SManojkiran Eda#### OEM/vendor-specific functions 983618064eSPatrick Williams 997f57f441SJinu Joy ThomasThis will support OEM or vendor-specific functions and semantic information. 1007f57f441SJinu Joy ThomasFollowing directory structure has to be used: 1013618064eSPatrick Williams 102e3596384SManojkiran Eda```txt 1037f57f441SJinu Joy Thomas pldm repo 1047f57f441SJinu Joy Thomas |---- oem 1057f57f441SJinu Joy Thomas |----<oem_name> 1067f57f441SJinu Joy Thomas |----libpldmresponder 1077f57f441SJinu Joy Thomas |---<oem based handler files> 1087f57f441SJinu Joy Thomas 1097f57f441SJinu Joy Thomas``` 1103618064eSPatrick Williams 1113618064eSPatrick Williams<oem_name> - This folder must be created with the name of the OEM/vendor in 1123618064eSPatrick Williamslower case. Folders named libpldm and libpldmresponder must be created under the 1133618064eSPatrick Williamsfolder <oem_name> 1147f57f441SJinu Joy Thomas 1157f57f441SJinu Joy ThomasFiles having the oem functionality for the libpldmresponder library should be 1167f57f441SJinu Joy Thomasplaced under the folder oem/<oem_name>/libpldmresponder. They must be adhering 1177f57f441SJinu Joy Thomasto the rules mentioned under the libpldmresponder section above. 1187f57f441SJinu Joy Thomas 119d8da2089SManojkiran EdaOnce the above is done a meson option has to be created in 120d8da2089SManojkiran Eda`pldm/meson_options.txt` with its mapped compiler flag to enable conditional 121d8da2089SManojkiran Edacompilation. 1227f57f441SJinu Joy Thomas 123d8da2089SManojkiran EdaFor consistency would recommend using "oem-<oem_name>". 1247f57f441SJinu Joy Thomas 125d8da2089SManojkiran EdaThe `pldm/meson.build` and the corresponding source file(s) will need to 126d8da2089SManojkiran Edaincorporate the logic of adding its mapped compiler flag to allow conditional 127d8da2089SManojkiran Edacompilation of the code. 1287f57f441SJinu Joy Thomas 129e3596384SManojkiran Eda##### libpldm 1303618064eSPatrick Williams 1314913998aSManojkiran Edapldm daemon links against the libpldm library during compilation, For more 1323618064eSPatrick Williamsinformation on libpldm please refer to 1333618064eSPatrick Williams[libpldm](https://github.com/openbmc/libpldm) 1344913998aSManojkiran Eda 135e3596384SManojkiran Eda##### pldmtool 1363618064eSPatrick Williams 13712c8a661SSridevi RameshFor more information on pldmtool please refer to plmdtool/README.md. 13812c8a661SSridevi Ramesh 139e3596384SManojkiran Eda##### Flows 1403618064eSPatrick Williams 141b4fedab8SDeepak KodihalliThis section documents important code flow paths. 142b4fedab8SDeepak Kodihalli 143e3596384SManojkiran Eda###### BMC as PLDM responder 1443618064eSPatrick Williams 145b4fedab8SDeepak Kodihallia) PLDM daemon receives PLDM request message from underlying transport (MCTP). 1461a68b45cSDeepak Kodihalli 147b4fedab8SDeepak Kodihallib) PLDM daemon routes message to message handler, based on the PLDM command. 1481a68b45cSDeepak Kodihalli 149b4fedab8SDeepak Kodihallic) Message handler decodes request payload into various field(s) of the request 1503618064eSPatrick Williamsmessage. It can make use of a decode_foo_req() API, and doesn't have to perform 1513618064eSPatrick Williamsdeserialization of the request payload by itself. 1521a68b45cSDeepak Kodihalli 153b4fedab8SDeepak Kodihallid) Message handler works with the request field(s) and generates response 154b4fedab8SDeepak Kodihallifield(s). 1551a68b45cSDeepak Kodihalli 156b4fedab8SDeepak Kodihallie) Message handler prepares a response message. It can make use of an 157b4fedab8SDeepak Kodihalliencode_foo_resp() API, and doesn't have to perform the serialization of the 158b4fedab8SDeepak Kodihalliresponse field(s) by itself. 1591a68b45cSDeepak Kodihalli 160b4fedab8SDeepak Kodihallif) The PLDM daemon sends the response message prepared at step e) to the remote 161b4fedab8SDeepak KodihalliPLDM device. 162b4fedab8SDeepak Kodihalli 163e3596384SManojkiran Eda##### BMC as PLDM requester 1643618064eSPatrick Williams 165b4fedab8SDeepak Kodihallia) A BMC PLDM requester app prepares a PLDM request message. There would be 1663618064eSPatrick Williamsseveral requester apps (based on functionality/PLDM remote device). Each of them 1673618064eSPatrick Williamsneedn't bother with the serialization of request field(s), and can instead make 1683618064eSPatrick Williamsuse of an encode_foo_req() API. 1691a68b45cSDeepak Kodihalli 170b4fedab8SDeepak Kodihallib) BMC requester app requests PLDM daemon to send the request message to remote 171b4fedab8SDeepak KodihalliPLDM device. 1721a68b45cSDeepak Kodihalli 173b4fedab8SDeepak Kodihallic) Once the PLDM daemon receives a corresponding response message, it notifies 174b4fedab8SDeepak Kodihallithe requester app. 1751a68b45cSDeepak Kodihalli 176b4fedab8SDeepak Kodihallid) The requester app has to work with the response field(s). It can make use of 177b4fedab8SDeepak Kodihallia decode_foo_resp() API to deserialize the response message. 178c6e8fb50SDeepak Kodihalli 179e3596384SManojkiran Eda###### PDR Implementation 1803618064eSPatrick Williams 181c6e8fb50SDeepak KodihalliWhile PLDM Platform Descriptor Records (PDRs) are mostly static information, 182c6e8fb50SDeepak Kodihallithey can vary across platforms and systems. For this reason, platform specific 183c6e8fb50SDeepak KodihalliPDR information is encoded in platform specific JSON files. JSON files must be 184c6e8fb50SDeepak Kodihallinamed based on the PDR type number. For example a state effecter PDR JSON file 185c6e8fb50SDeepak Kodihalliwill be named 11.json. The JSON files may also include information to enable 186c6e8fb50SDeepak Kodihalliadditional processing (apart from PDR creation) for specific PDR types, for eg 187c6e8fb50SDeepak Kodihallimapping an effecter id to a D-Bus object. 188c6e8fb50SDeepak Kodihalli 189c6e8fb50SDeepak KodihalliThe PLDM responder implementation finds and parses PDR JSON files to create the 190c6e8fb50SDeepak KodihalliPDR repository. Platform specific PDR modifications would likely just result in 191c6e8fb50SDeepak KodihalliJSON updates. New PDR type support would require JSON updates as well as PDR 192c6e8fb50SDeepak Kodihalligeneration code. The PDR generator is a map of PDR Type -> C++ lambda to create 193c6e8fb50SDeepak KodihalliPDR entries for that type based on the JSON, and to update the central PDR repo. 194*aa1efa49SArchana Kakani 195*aa1efa49SArchana Kakani###### BIOS Support 196*aa1efa49SArchana Kakani 197*aa1efa49SArchana KakaniRedfish supports the BIOS Attribute Registry, which provides users with a list 198*aa1efa49SArchana Kakaniof BIOS attributes supported in the BIOS configuration. To incorporate BIOS 199*aa1efa49SArchana Kakaniattribute registry support in openBMC, BmcWeb is designed to read data from the 200*aa1efa49SArchana KakaniBase BIOS Table. PLDM populates the Base BIOS Table for the BIOS Config Manager 201*aa1efa49SArchana Kakanibased on BIOS JSON files. BIOS functionality is integrated into PLDM according 202*aa1efa49SArchana Kakanito the guidelines in the 203*aa1efa49SArchana Kakani[PLDM BIOS Specification](https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf). 204*aa1efa49SArchana KakaniBIOS attributes, also referred to as BIOS parameters or configuration settings, 205*aa1efa49SArchana Kakaniare structured within JSON files. Each attribute is defined by its name, type, 206*aa1efa49SArchana Kakaniand type-specific metadata. PLDM parses 207*aa1efa49SArchana Kakani[BIOS JSON file](https://github.com/openbmc/pldm/tree/master/oem/ibm/configurations/bios/com.ibm.Hardware.Chassis.Model.Rainier2U) 208*aa1efa49SArchana Kakaniand creates the 209*aa1efa49SArchana Kakani[Base BIOS Table](https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml#L62) 210*aa1efa49SArchana Kakanihosted by [BIOS Config Manager](https://github.com/openbmc/bios-settings-mgr). 211*aa1efa49SArchana KakaniThe design is documented in 212*aa1efa49SArchana Kakani[DesignDoc](https://github.com/openbmc/docs/blob/master/designs/remote-bios-configuration.md). 213*aa1efa49SArchana KakaniRedfish supports 214*aa1efa49SArchana Kakani[BIOS Attribute registry](https://redfish.dmtf.org/schemas/v1/AttributeRegistry.v1_3_8.json), 215*aa1efa49SArchana Kakaniwhich provides users with the list of BIOS attributes supported in the BIOS 216*aa1efa49SArchana Kakaniconfiguration. The BIOS Attribute registry data is supposed to be derived from 217*aa1efa49SArchana Kakani[Base BIOS Table](https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/BIOSConfig/Manager.interface.yaml#L62). 218*aa1efa49SArchana KakaniPLDM populates the Base BIOS Table for BIOS Config Manager based on BIOS Json 219*aa1efa49SArchana Kakanifiles. 220*aa1efa49SArchana Kakani 221*aa1efa49SArchana KakaniAfter the JSON files are parsed, pldm would also create the string table, 222*aa1efa49SArchana Kakaniattribute table, and attribute value table as per Section7 in 223*aa1efa49SArchana Kakani[PLDM BIOS Specification](https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf). 224*aa1efa49SArchana KakaniThose BIOS tables are exchanged with remote PLDM terminus using the 225*aa1efa49SArchana Kakani`GetBiosTable` command as defined in DSP0247_1.0.0.pdf Section 8.1. All the 226*aa1efa49SArchana Kakani`bios attribute json files are kept under OEM` 227*aa1efa49SArchana Kakani[Path](https://github.com/openbmc/pldm/tree/master/oem). BIOS json configuration 228*aa1efa49SArchana Kakaniis provided in bios_attr.json file which contains attributes of type enum, 229*aa1efa49SArchana Kakaniinteger and string. 230*aa1efa49SArchana Kakani 231*aa1efa49SArchana KakaniInteger Attribute details as documented at Table9 of 232*aa1efa49SArchana Kakani[PLDM BIOS Specification](https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf): 233*aa1efa49SArchana Kakani 234*aa1efa49SArchana Kakani```json 235*aa1efa49SArchana Kakani{ 236*aa1efa49SArchana Kakani "entries": [ 237*aa1efa49SArchana Kakani { 238*aa1efa49SArchana Kakani "attribute_type": "integer", 239*aa1efa49SArchana Kakani "attribute_name": "Attribute Name", 240*aa1efa49SArchana Kakani "lower_bound": "The lower bound on the integer value", 241*aa1efa49SArchana Kakani "upper_bound": "The upper bound on the integer value", 242*aa1efa49SArchana Kakani "scalar_increment": "The scalar value that is used for the increments to this integer ", 243*aa1efa49SArchana Kakani "default_value": "The default value of the integer", 244*aa1efa49SArchana Kakani "help_text": "Help text about attribute usage", 245*aa1efa49SArchana Kakani "display_name": "Attribute Display Name", 246*aa1efa49SArchana Kakani "read_only": "Read only Attribute" 247*aa1efa49SArchana Kakani } 248*aa1efa49SArchana Kakani ] 249*aa1efa49SArchana Kakani} 250*aa1efa49SArchana Kakani``` 251*aa1efa49SArchana Kakani 252*aa1efa49SArchana KakaniEnum Attribute details as documented at Table6 of 253*aa1efa49SArchana Kakani[PLDM BIOS Specification](https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf): 254*aa1efa49SArchana Kakani 255*aa1efa49SArchana Kakani```json 256*aa1efa49SArchana Kakani{ 257*aa1efa49SArchana Kakani "entries": [ 258*aa1efa49SArchana Kakani { 259*aa1efa49SArchana Kakani "attribute_type": "enum", 260*aa1efa49SArchana Kakani "attribute_name": "Attribute Name", 261*aa1efa49SArchana Kakani "possible_values": [ 262*aa1efa49SArchana Kakani "An array of character strings of variable to indicate the possible values of the BIOS attribute" 263*aa1efa49SArchana Kakani ], 264*aa1efa49SArchana Kakani "default_values": "Default value", 265*aa1efa49SArchana Kakani "help_text": "Help text about attribute usage", 266*aa1efa49SArchana Kakani "display_name": "Display Name", 267*aa1efa49SArchana Kakani "read_only": "Read only Attribute" 268*aa1efa49SArchana Kakani } 269*aa1efa49SArchana Kakani ] 270*aa1efa49SArchana Kakani} 271*aa1efa49SArchana Kakani``` 272*aa1efa49SArchana Kakani 273*aa1efa49SArchana KakaniString Attribute details as documented at Table7 of 274*aa1efa49SArchana Kakani[PLDM BIOS Specification](https://www.dmtf.org/sites/default/files/standards/documents/DSP0247_1.0.0.pdf): 275*aa1efa49SArchana Kakani 276*aa1efa49SArchana Kakani```json 277*aa1efa49SArchana Kakani{ 278*aa1efa49SArchana Kakani "entries": [ 279*aa1efa49SArchana Kakani { 280*aa1efa49SArchana Kakani "attribute_type": "string", 281*aa1efa49SArchana Kakani "attribute_name": "Attribute Name", 282*aa1efa49SArchana Kakani "string_type": "It specifies the character encoding format, which can be ASCII, Hex, UTF-8, UTF-16LE, or UTF-16BE. Currently, only ASCII is supported", 283*aa1efa49SArchana Kakani "minimum_string_length": "The minimum length of the string in bytes", 284*aa1efa49SArchana Kakani "maximum_string_length": "The maximum length of the string in bytes", 285*aa1efa49SArchana Kakani "default_string": "The default string itself", 286*aa1efa49SArchana Kakani "help_text": "Help text about attribute usage", 287*aa1efa49SArchana Kakani "display_name": "Attribute Display Name", 288*aa1efa49SArchana Kakani "read_only": "Read only Attribute" 289*aa1efa49SArchana Kakani } 290*aa1efa49SArchana Kakani ] 291*aa1efa49SArchana Kakani} 292*aa1efa49SArchana Kakani``` 293*aa1efa49SArchana Kakani 294*aa1efa49SArchana KakaniAs PLDM BIOS Attributes may differ across platforms and systems, supporting 295*aa1efa49SArchana Kakanisystem-specific BIOS attributes is crucial. To achieve this, BIOS JSON files are 296*aa1efa49SArchana Kakaniorganized under folders named after the system type. System type information is 297*aa1efa49SArchana Kakaniretrieved from the Entity Manager service, which hosts the 298*aa1efa49SArchana Kakani[Compatible Interface](https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Inventory/Decorator/Compatible.interface.yaml). 299*aa1efa49SArchana Kakani 300*aa1efa49SArchana KakaniThis interface dynamically populates the Names property with system type 301*aa1efa49SArchana Kakaniinformation. However, determining the system type in the application space may 302*aa1efa49SArchana Kakanitake some time since the compatible interface and the Names property are 303*aa1efa49SArchana Kakanidynamically created by the Entity Manager. Consequently, BIOS tables are lazily 304*aa1efa49SArchana Kakaniconstructed upon receiving the system type. 305*aa1efa49SArchana Kakani 306*aa1efa49SArchana KakaniTo enable system-specific BIOS attribute support within PLDM, the meson option 307*aa1efa49SArchana Kakani`system-specific-bios-json` can be utilized. With `system-specific-bios-json` 308*aa1efa49SArchana Kakanioption `enabled` BIOS JSON files specific to the system type are fetched during 309*aa1efa49SArchana Kakaniruntime. 310