commit | 4e5e8a2159c190d4f3940656c060c65a28f83d86 | [log] [tgz] |
---|---|---|
author | Andrew Jeffery <andrew@aj.id.au> | Tue Apr 04 11:58:45 2023 +0930 |
committer | Andrew Jeffery <andrew@aj.id.au> | Fri Apr 21 04:59:04 2023 +0000 |
tree | 97eabe697bf87d835a52f8d424cce2a4785cee3b | |
parent | 5c651b80615bee3cc706c7f006ce2fa1865f3bbd [diff] |
platform: pldm_msgbuf for decode_get_pdr_resp() The rework in this patch is the first use pldm_msgbuf on a message type with variable-length data. The length of the data is embedded in the message and is one of the elements that we must extract. As we need to use the extracted length value we must first ensure that the value has been successfully extracted. This requires we test against the return value of `pldm_msgbuf_extract()` and _not_ batch the evaluation of success like we have elsewhere. Another side-effect is the rework affects mechanics of the "bad" test. To accommodate that, the change to `recordDataLength` sets the message up such that the length of the variable data embedded in the message is 1 byte longer than the supplied buffer into which the data should be extracted. This arrangement upholds the test expectation that decode_get_pdr_resp() returns PLDM_ERROR_INVALID_LENGTH for the provided message buffer. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Change-Id: I6916d28cdd1e27f180fb52725a836a365299ee9a
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.
Need meson
and ninja
. Alternatively, source an OpenBMC ARM/x86 SDK.
meson setup builddir && ninja -C builddir
The simplest way of running the tests is as described by the meson man page:
meson setup builddir && meson test -C builddir
This will support OEM or vendor-specific functions and semantic information. Following directory structure has to be used:
libpldm |---- include/libpldm | |---- oem/<oem_name>/libpldm | |----<oem based .h files> |---- src | |---- oem/<oem_name> | |----<oem based .c files> |---- tests | |---- oem/<oem_name> | |----<oem based test files>
<oem_name> - This folder must be created with the name of the OEM/vendor in lower case.
Header files & source files having the oem functionality for the libpldm library should be placed under the respective folder hierarchy as mentioned in the above figure. They must be adhering to the rules mentioned under the libpldm section above.
Once the above is done a meson option has to be created in libpldm/meson_options.txt
with its mapped compiler flag to enable conditional compilation.
For consistency would recommend using "oem-<oem_name>".
The libpldm/meson.build
and the corresponding source file(s) will need to incorporate the logic of adding its mapped compiler flag to allow conditional compilation of the code.
The pldm requester API's are present in src/requester
folder and they are intended to provide API's to interact with the desired underlying transport layer to send/receive pldm messages.
NOTE : In the current state, the requester API's in the repository only works with specific transport mechanism & these are going to change in future & probably aren't appropriate to be writing code against.