commit | f666db132c8d7d6861cc3f8df8e084673f922b29 | [log] [tgz] |
---|---|---|
author | Jinu Joy Thomas <jinu.joy.thomas@in.ibm.com> | Wed May 29 05:22:31 2019 -0500 |
committer | Deepak Kodihalli <dkodihal@in.ibm.com> | Wed Jun 26 08:35:16 2019 +0000 |
tree | 3d9157f7e988bf4a80d65067c33719df7e9613a5 | |
parent | d07829652ceb4110c2aae620f23ac3c5f4c5cf6e [diff] |
Implement the PLDM Daemon. The pldm daemon is a PLDM responder. PLDM messages received by the PLDM daemon from the MCTP daemon are routed to the respective command handler to create a response. This response will be sent back by the PLDM daemon to the requester. PLDM daemon and MCTP daemon interact with each other using UNIX domain sockets, as documented in https://github.com/openbmc/docs/blob/master/designs/mctp.md Implemented a way for the PLDM responder library to register handlers for specific PLDM commands. This is as per the registration scheme documented in README.md. Support for enabling verbosity in the PLDM Daemon (tracing the receive and response message packets) are conditionally compiled.You would need to provide the --enable-verbose flag to configure to enable it. We discard response messages received currently. Fixed Handler function signature for bios and file_io types. Tested : Updated system with the Daemon and did a 'obmcutil poweron' The Daemon was build with the verbose enabled configuration Could boot a hypervisor that sends PLDM commands. Below is the transactions recorded in the journal Jun 25 13:35:27 witherspoon-128 pldmd[1980]: Received Msg Jun 25 13:35:27 witherspoon-128 pldmd[1980]: Buffer Data: 09 01 81 3f 06 00 00 00 00 00 00 00 00 00 00 08 00 00 00 01 00 00 00 00 00 Jun 25 13:35:27 witherspoon-128 pldmd[1980]: Sending Msg Jun 25 13:35:27 witherspoon-128 pldmd[1980]: Buffer Data: 09 01 00 3f 06 80 00 00 00 00 Change-Id: I22cfd85103bce167239219fbcc59c25b09528211 Signed-off-by: Jinu Joy Thomas <jinu.joy.thomas@in.ibm.com>
At a high-level, code in this repository belongs to one of the following three components.
This is a library which deals with the encoding and decoding of PLDM messages. It should be possible to use this library by projects other than OpenBMC, and hence certain constraints apply to it:
Source files are named according to the PLDM Type, for eg base.[h/c], fru.[h/c], etc.
Given a PLDM command "foo", the library will provide the following API: For the Requester function:
encode_foo_req() - encode a foo request decode_foo_resp() - decode a response to foo
For the Responder function:
decode_foo_req() - decode a foo request encode_foo_resp() - encode a response to foo
The library also provides API to pack and unpack PLDM headers.
This library provides handlers for incoming PLDM request messages. It provides for a registration as well as a plug-in mechanism. The library is implemented in modern C++, and handles OpenBMC's platform specifics.
The handlers are of the form
Response handler(Request payload, size_t payloadLen)
Source files are named according to the PLDM Type, for eg base.[hpp/cpp], fru.[hpp/cpp], etc.
This will support OEM or vendor-specific functions and semantic information. Following directory structure has to be used:
pldm repo |---- oem |----<oem_name> |----libpldm |----<oem based encoding and decoding files> |----libpldmresponder |---<oem based handler files>
<oem_name> - This folder must be created with the name of the OEM/vendor in lower case. Folders named libpldm and libpldmresponder must be created under the folder <oem_name>
Files having the oem functionality for the libpldm library should be placed under the folder oem/<oem_name>/libpldm. They must be adhering to the rules mentioned under the libpldm section above.
Files having the oem functionality for the libpldmresponder library should be placed under the folder oem/<oem_name>/libpldmresponder. They must be adhering to the rules mentioned under the libpldmresponder section above.
Once the above is done a conditional flag has to be created in the configure.ac to enable conditional compilation.
For consistency would recommend using "--enable-oem-<oem_name>".
The Makefile.am files in libpldm and libpldmresponder will need to be changed to allow conditional compilation of the code.
Consider hosting libpldm above in a repo of its own, probably even outside the OpenBMC project? A separate repo would enable something like git submodule.
This section documents important code flow paths.
a) PLDM daemon receives PLDM request message from underlying transport (MCTP).
b) PLDM daemon routes message to message handler, based on the PLDM command.
c) Message handler decodes request payload into various field(s) of the request message. It can make use of a decode_foo_req() API, and doesn't have to perform deserialization of the request payload by itself.
d) Message handler works with the request field(s) and generates response field(s).
e) Message handler prepares a response message. It can make use of an encode_foo_resp() API, and doesn't have to perform the serialization of the response field(s) by itself.
f) The PLDM daemon sends the response message prepared at step e) to the remote PLDM device.
a) A BMC PLDM requester app prepares a PLDM request message. There would be several requester apps (based on functionality/PLDM remote device). Each of them needn't bother with the serialization of request field(s), and can instead make use of an encode_foo_req() API.
b) BMC requester app requests PLDM daemon to send the request message to remote PLDM device.
c) Once the PLDM daemon receives a corresponding response message, it notifies the requester app.
d) The requester app has to work with the response field(s). It can make use of a decode_foo_resp() API to deserialize the response message.
While PLDM Platform Descriptor Records (PDRs) are mostly static information, they can vary across platforms and systems. For this reason, platform specific PDR information is encoded in platform specific JSON files. JSON files must be named based on the PDR type number. For example a state effecter PDR JSON file will be named 11.json. The JSON files may also include information to enable additional processing (apart from PDR creation) for specific PDR types, for eg mapping an effecter id to a D-Bus object.
The PLDM responder implementation finds and parses PDR JSON files to create the PDR repository. Platform specific PDR modifications would likely just result in JSON updates. New PDR type support would require JSON updates as well as PDR generation code. The PDR generator is a map of PDR Type -> C++ lambda to create PDR entries for that type based on the JSON, and to update the central PDR repo.