commit | 184f60263a0e4c3dda934d94ecb2a904ef835299 | [log] [tgz] |
---|---|---|
author | Chicago Duan <duanzhijia01@inspur.com> | Fri Apr 17 11:30:49 2020 +0800 |
committer | Deepak Kodihalli <dkodihal@in.ibm.com> | Fri Aug 21 10:54:42 2020 +0000 |
tree | 7d982743ccb66346b3e731b2dcaa66d9edc2d69b | |
parent | 1b180d8a6d3fa1be6a67e83bafb0cbdfa97ce4d8 [diff] |
soft-off: Send soft off request to the host and wait the host soft off responds The pldm-softpoweroff application will send a set state effecter states request to host, then the host will soft off. The pldm-softpoweroff need two timers. One of the timer is used to wait the response of the pldm soft off request message(default 30s). Another timer is used to wait the host graceful shutdown complete(default 7200s).If the host response is not received within the timeout then log an error and exit the application. The pldm-softpowerroff application need Subscribe to the xyz.openbmc_project.PLDM.Event StateSensorEvent signal,When the host soft off is complete, it sends a pldm event Msg to BMC.After pldmd receive this event Msg ,it will emit the StateSensorEvent signal.When the pldm-softpowerroff receive the signal,it will stop the timer and exit. Tested in fp5280g2 system: 1、If the host state is not "Running", this application will exit with success(0). 2、If no ACK of the soft off request is received within 30 seconds, this application will exit with error(-1). 3、If no pldm event Msg(host gracefully shutdown complete) is received within 7200 seconds, this application will record an error log and exit with error(-1). 4、If the pldm event Msg(host gracefully shutdown complete) is received within 7200 seconds, this application will exit with success(0). Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: I486d8068d013766329f78685acc0508fc3cb6c95
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.