commit | 62d12ecba038c64e1d965c643558a22579eb18e3 | [log] [tgz] |
---|---|---|
author | George Liu <liuxiwei@inspur.com> | Wed Feb 05 16:27:08 2020 +0800 |
committer | Deepak Kodihalli <dkodihal@in.ibm.com> | Mon May 11 02:58:08 2020 +0000 |
tree | a229e8c937f7b74d0a72d260c9b0c23cb57c5567 | |
parent | 64d26bed8a272f7edd38b8de01e893d0370e6b8c [diff] |
pldmtool: Add print message for the NumericEffectPDR Refer to DSP0248_1.2.0 28.11 Table 76 and print the message for the NumericEffecterPDR. Tested with JSON file: https://gist.github.com/lxwinspur/db1e6e37a14bdd626591b222e96f9d7e pldmtool platform GetPDR -d 3 Encode request successfully Request Message: 08 01 80 02 51 03 00 00 00 00 00 00 00 01 80 00 00 00 Success in creating the socket : RC = 3 Success in connecting to socket : RC = 0 Success in sending message type as pldm to mctp : RC = 0 Write to socket successful : RC = 18 Total length:18 Loopback response message: 08 01 80 02 51 03 00 00 00 00 00 00 00 01 80 00 00 00 On first recv(),response == request : RC = 0 Total length: 101 Shutdown Socket successful : RC = 0 Response Message: 08 01 00 02 51 00 00 00 00 00 00 00 00 00 01 54 00 03 00 00 00 01 09 00 00 4a 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 15 00 03 00 00 00 00 00 01 04 00 00 80 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Parsed Response Msg: nextRecordHandle: 0 responseCount: 84 recordHandle: 3 PDRHeaderVersion: 1 PDRType: 9 recordChangeNumber: 0 dataLength: 74 PLDMTerminusHandle: 0 effecterID: 3 entityType: 0 entityInstanceNumber: 0 containerID: 0 effecterSemanticID: 0 effecterInit: 0 effecterAuxiliaryNames: false baseUnit: 21 unitModifier: 0 rateUnit: 3 baseOEMUnitHandle: 0 auxUnit: 0 auxUnitModifier: 0 auxrateUnit: 0 auxOEMUnitHandle: 0 isLinear: true effecterDataSize: 4 resolution: 1 offset: 0 accuracy: 0 plusTolerance: 0 minusTolerance: 0 stateTransitionInterval: 0 TransitionInterval: 0 maxSettable: 0 minSettable: 0 rangeFieldFormat: 4 rangeFieldSupport: 0 nominalValue: 0 normalMax: 0 normalMin: 0 ratedMax: 0 ratedMin: 0 Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I68c974d5fb993853b7f40e0eb078f47f30c80bce
Need meson
and ninja
. Alternatively, source an OpenBMC ARM/x86 SDK.
meson build && ninja -C build
Tests can be run in the CI docker container, or with an OpenBMC x86 sdk(see below for x86 steps).
meson -Doe-sdk=enabled -Dtests=enabled build ninja -C build test
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.