Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase master #40

Open
wants to merge 71 commits into
base: main
Choose a base branch
from
Open

Conversation

ArchanaKakani
Copy link
Contributor

libpldm rebase with master

Pavithrab7 and others added 30 commits June 28, 2024 19:55
The commit adds a new API get_terminus_handle and modifies the
existing remove_by_terminus_handle API.

Signed-off-by: Pavithra Barithaya <[email protected]>
This commit adds OEM entity type for chassis power controller
to perform ReIPL, PowerDown and ArmAPR when the respective state
set IDs are set.

Signed-off-by: Varsha Kaverappa <[email protected]>
API to find if parent of a contained entity is present in
the entity association tree.

Signed-off-by: Varsha Kaverappa <[email protected]>
This commit adds API used to fetch the enabled/disabled
trigger functions from the host and pass that bitmap value
to the D-Bus API introduced by the PanelApp.

Signed-off-by: Sagar Srinivas <[email protected]>
While creating the Entity association PDRs, same record handle
is used multiple time to create PDR. Because of which 2 PDRs
with same record handle are added to the repo causing loop.
Adding the fix to resolve the duplicate record handle issue.

Tested:
Power on/off and reset reload on mex and non mex systems.

Signed-off-by: Archana Kakani <[email protected]>
This commit adds APIs that subscribe, process, remove
and build FRUs for hotplu and CM operations in PLDM.

Signed-off-by: Varsha Kaverappa <[email protected]>
After receiving RECORDS DELETED event from Host,
PLDM needs to update the Dbus properties "Availability",
"Operation Status". Entity is the key to find the object path
for the corresponding PDR. So adding a function to get the entity
details using record handle.

Signed-off-by: Archana Kakani <[email protected]>
This commit introduces two new api for finding and updating the
container Id of Effecter Id after receiving updates container Id value
from remote terminus/endpoint.

pldm_find_container_id - Finds the updated container id of an effecter
from Entity Association PDR.

pldm_change_container_id_of_effecter - Updates the container id of the
corresponding effecter in Numeric Effecter PDR

Tested: Verified the containers id getting updated in Numeric Effecter
PDRs.

Signed-off-by: Riya Dixit <[email protected]>
This commit adds the new and generic user password error status
codes for the following scenarios:

1. Password authentication status
2. Password change status
3. Admin operation status

Example use case:
If host passes the username and password credentials to the BMC, it
could support below requirements through any password validation
mechanism (Ex: PAM module)
1. Password authentication
2. Password change if the password has been expired

Change-Id: Ie52c256e6e5b3011435b5453f4d4691cc4677884

Signed-off-by: Jayashankar Padath <[email protected]>
These symlinks have been in-place long enough for people to migrate.
Provide a coccinelle semantic patch to help anyone who hasn't.

Change-Id: Iab456ebba8d87c57eb2d573b7a8bffb394e0bb00
Signed-off-by: Andrew Jeffery <[email protected]>
36af84c ("requester: Add new APIs for instance ID allocation and
freeing") introduced the new instance ID allocation APIs, and some
unbalanced locking along with it. When a conflict arose on an instance
ID, the read lock was not released by the non-owning caller.

Release the lock on conflict and on error, and add a test case to
prevent regression.

gitlint-ignore: UC1, B1
Fixes: 36af84c ("requester: Add new APIs for instance ID allocation and freeing")
Reported-by: Jerry Chen <[email protected]>
Change-Id: Iecd1583c6b8863b458cc4fbf1ac42b20ca2a3433
Signed-off-by: Andrew Jeffery <[email protected]>
Introduce "weird machines" for those who aren't aware of them. The blog
also links to Dullien's paper that provides fairly tight definition
for them.

The SEI CERT C Coding Standard is maintained by members of the C
standards committee as a more approachable resource for C programmers
than the standard itself (which is written for implementers of C more so
than users).

Change-Id: I6df09feacd47c0eea42b840784ab2c90a913fcff
Signed-off-by: Andrew Jeffery <[email protected]>
Log entry for new APIs introduced to add a contained entity
into an entity association PDR as a new change.

Change-Id: I2f8510ecaab97ae68de53c54d295f55c43cef952
Signed-off-by: Varsha Kaverappa <[email protected]>
`Table 16: PollForPlatformEventMessage command format` and `Table 68:
GetPDR command format` in DSP0248 v1.2.2 define the values of the
responded `transferflag` for PLDM platform and control commands.
Add the definition for further using.

Change-Id: Ibd97918a7a5add10dbb5db7c044c71daa5bbaa4e
Signed-off-by: Thu Nguyen <[email protected]>
Adds a new libpldm API to get the terminus handle of the
particular record given as input from the PDR repo.

Change-Id: I3694cc3974a564296f4584b70de7d6d1dad2a866
Signed-off-by: Pavithra Barithaya <[email protected]>
Build the type-safe and generic behavior on top of memcpy() via a
"private" helper that takes a void pointer.

Change-Id: Iedb8e9237c780735d4cac41fe0a723c3751c64ce
Signed-off-by: Chris Wang <[email protected]>
Signed-off-by: Andrew Jeffery <[email protected]>
Add pldm_msgbuf_span_string_ascii() API to find the start of the ascii
string in the message buffer.

```
pldm_msgbuf_span_string_ascii(struct pldm_msgbuf *ctx, void **cursor,
			      size_t *length)
```

The API returns the start pointer of ascii string in the message buffer
and length of that ascii string includes Terminator.
The `cursor` and `length` are optional. Input NULL to `cursor` and
`length` will cause the message buffer cursor points to remaining data.
The caller can ignore `length` option by input NULL if they don't care
about the size of ascii string.

Change-Id: I4a73b7425ee1e4e5621eb16de6e16189efdf202b
Signed-off-by: Thu Nguyen <[email protected]>
Signed-off-by: Andrew Jeffery <[email protected]>
Safely copy a NUL-terminated string between msgbuf instances.

Change-Id: I224dc3f5bbd55fd9d4727ab0de065d5253ee0bea
Signed-off-by: Andrew Jeffery <[email protected]>
Add pldm_msgbuf_span_string_utf16 API to return the start pointer of the
utf16 string in message buffer. The API also returns the UTF16 string
length in terms of bytes, including the NUL terminator.

```
__attribute__((always_inline)) static inline int
pldm_msgbuf_span_string_utf16(struct pldm_msgbuf *ctx, void **cursor,
			      size_t *length)
```

The `cursor` and `length` are optional. Input NULL to `cursor` and
`length` will cause the message buffer cursor points to remaining data.
The caller can ignore `length` option by input NULL if they don't care
about the size of utf16 string.

Change-Id: I1fc2865a21d9925e49416531b85212b3b07dc37a
Signed-off-by: Thu Nguyen <[email protected]>
Signed-off-by: Andrew Jeffery <[email protected]>
Safely copy a NUL-terminated UTF16-{BE,LE} string between msgbuf
instances.

Change-Id: If96df9598f17ac771d75f0831be270c5e0139578
Signed-off-by: Andrew Jeffery <[email protected]>
Add `decode_entity_auxiliary_names_pdr()` to decode the entity auxiliary
names PDR raw data to the data fields as table 95 in DSP0248_1.2.2.
The API will not decode the entity auxiliary names directly - to
expose the language tags and names fields the caller has to
subsequently call `decode_pldm_entity_auxiliary_names_pdr_index()`.
Between the API calls the caller must allocate memory for the
`names` field as an array of `struct pldm_entity_auxiliary_name` with
`name_string_count` elements.

Change-Id: I5fc3989c4c4595546a70c01eb2b6dadcf8c14303
Signed-off-by: Thu Nguyen <[email protected]>
Signed-off-by: Andrew Jeffery <[email protected]>
Add support for Get Downstream Firmware Parameters to ask all
downstream devices' Firmware Parameters.

The code is developed based on the definition of
'GetDownstreamFirmwareParameters' in DSP0267_1.1.0. Section 10.5

Change-Id: I291ca3b623be6119434b70494bb9a12b22f600b9
Signed-off-by: Chris Wang <[email protected]>
Signed-off-by: Andrew Jeffery <[email protected]>
This was not addressed in the change renaming the function. I've updated
the changes checklist to reflect the need.

Change-Id: Iea55421e9b3dd6f060ebd9f615093ec2a8a8a432
Signed-off-by: Andrew Jeffery <[email protected]>
See usage example at:
https://gerrit.openbmc.org/c/openbmc/pldm/+/72610

Change-Id: I16c6d42ad11afa59b04676fa187f5ea0764d1880
Signed-off-by: Thu Nguyen <[email protected]>
Change-Id: I65374a30814210cb7eb2ff16d334553ec529c473
Signed-off-by: Andrew Jeffery <[email protected]>
To ensure memmem() is visible _GNU_SOURCE needs to be defined early,
at least before any system headers are included. Define it in the build
flags as clang-tidy will re-order includes based on vibes rather than
dependencies. Finally, clean up the remaining compiler warnings by
dropping the unnecessary casts.

Note that _GNU_SOURCE implies _DEFAULT_SOURCE, so we drop the latter:

> Since glibc 2.19, defining _GNU_SOURCE also has the effect of
> implicitly defining _DEFAULT_SOURCE.  Before glibc 2.20, defining
> _GNU_SOURCE also had the effect of implicitly defining _BSD_SOURCE
> and _SVID_SOURCE.

https://www.man7.org/linux/man-pages/man7/feature_test_macros.7.html

Fixes: ibm-openbmc#12
Fixes: 1523778 ("msgbuf: Add pldm_msgbuf_span_string_utf16()")
Change-Id: I9206f7616740790a89366762cce11d3045471b97
Signed-off-by: Andrew Jeffery <[email protected]>
Change-Id: If49d6f4d3d0a46c5181d17dbc1fb16e8cc1b946b
Signed-off-by: Andrew Jeffery <[email protected]>
Adds `struct pldm_message_poll_event` which includes `format_version`,
`event_id` and `data_transfer_handle` in `pldmMessagePollEvent` data.
Rework decode/encode_pldm_message_poll_event_data() APIs to use `struct
pldm_message_poll_event poll_event` as parameter.

Change-Id: I01c643ed320b17141d89068cb3e00b1a99162d77
Signed-off-by: Thu Nguyen <[email protected]>
amboar and others added 30 commits September 5, 2024 23:48
Introduce pldm_entity_association_pdr_add(), deprecate
pldm_entity_association_pdr_add_check(), add the rename configuration
and then apply it.

One quirk this time around is that we had forgotten to remove the
declaration of pldm_entity_association_pdr_add() from the header when we
removed its implementation. Clean this issue up as well, as it's
necessary to avoid the type conflict.

Change-Id: Id8e61c817017dd7caefa9fd7b2bc59ee0f1f6721
Signed-off-by: Andrew Jeffery <[email protected]>
Introduce pldm_entity_association_pdr_add_from_node(), deprecate
pldm_entity_association_pdr_add_from_node_check(), add the rename
configuration and apply it.

Change-Id: Id4f20365115977810491e8feb465042e51e3a267
Signed-off-by: Andrew Jeffery <[email protected]>
Introduce pldm_bios_table_string_entry_encode(), deprecate
pldm_bios_table_string_entry_encode_check(), add the rename
configuration and apply it.

Change-Id: I3a75320fde4be6bf913b3eb9b56ccacc11abf511
Signed-off-by: Andrew Jeffery <[email protected]>
…eck()

Introduce pldm_bios_table_string_entry_decode_string(), deprecate
pldm_bios_table_string_entry_decode_string_check(), add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: Ia204acd95d9e1d9bc80d91dd0ff6ffea3a1fe243
Signed-off-by: Andrew Jeffery <[email protected]>
Introduce pldm_bios_table_attr_entry_enum_encode(), deprecate
pldm_bios_table_attr_entry_enum_encode_check(), add the rename
configuration and apply it.

Change-Id: I52586f960c5bda2a8c839d27c95bd65ca90c831f
Signed-off-by: Andrew Jeffery <[email protected]>
…_check()

Introduce `pldm_bios_table_attr_entry_enum_decode_pv_num()`, deprecate
`pldm_bios_table_attr_entry_enum_decode_pv_num_check()`, add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: Ifb34736e9c1a31ad15649e556dcb6e3c98890f07
Signed-off-by: Andrew Jeffery <[email protected]>
…m_check()

Introduce pldm_bios_table_attr_entry_enum_decode_def_num(), deprecate
pldm_bios_table_attr_entry_enum_decode_def_num_check(), add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: Ia0eec8050e39f2ee45c350386af32bd5c37135c5
Signed-off-by: Andrew Jeffery <[email protected]>
…s_check()

Introduce pldm_bios_table_attr_entry_enum_decode_pv_hdls(), deprecate
pldm_bios_table_attr_entry_enum_decode_pv_hdls_check(), add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I29b4d24ce0bbb92ff0491c2abae4b512d4374e74
Signed-off-by: Andrew Jeffery <[email protected]>
Introduce pldm_bios_table_attr_entry_string_encode(), deprecate
pldm_bios_table_attr_entry_string_encode_check(), add the rename
configuration and apply it.

Change-Id: I7c2b70784dd91757723857ca9544d9462937a8a7
Signed-off-by: Andrew Jeffery <[email protected]>
…string_length_check()

Introduce
pldm_bios_table_attr_entry_string_decode_def_string_length(), deprecate
pldm_bios_table_attr_entry_string_decode_def_string_length_check(), add
the rename configuration and apply it.

As a consequence clang-tidy detected the following, though it's unclear
why it was not detected previously:

```
clang-tidy-17 -export-fixes /tmp/tmpf4lalo2j/tmpkiyu1sgy.yaml -p=/home/andrew/src/openbmc.org/openbmc/libpldm/origin/build1qcxy8ww -quiet /home/andrew/src/openbmc.org/openbmc/libpldm/origin/src/dsp/bios_table.c
../src/dsp/bios_table.c:460:2: error: Null pointer passed to 2nd parameter expecting 'nonnull' [clang-analyzer-core.NonNullParamChecker,-warnings-as-errors]
  460 |         memcpy(buffer, fields->def_string, length);
      |         ^              ~~~~~~~~~~~~~~~~~~
../src/dsp/bios_table.c:457:11: note: Assuming the condition is true
  457 |         length = length < (size - 1) ? length : (size - 1);
      |                  ^~~~~~~~~~~~~~~~~~~
../src/dsp/bios_table.c:457:11: note: '?' condition is true
../src/dsp/bios_table.c:460:2: note: Null pointer passed to 2nd parameter expecting 'nonnull'
  460 |         memcpy(buffer, fields->def_string, length);
      |         ^              ~~~~~~~~~~~~~~~~~~
```

gitlint-ignore: T1, B1
Change-Id: Ic390e00f520cb3d5e479604b34939cefd09e9448
Signed-off-by: Andrew Jeffery <[email protected]>
…ck()

Introduce pldm_bios_table_attr_entry_integer_encode(), deprecate
pldm_bios_table_attr_entry_integer_encode_check(), add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I4ad074babfa33e661cb5b0791cc539453dbd27c7
Signed-off-by: Andrew Jeffery <[email protected]>
…check()

Introduce pldm_bios_table_attr_value_entry_encode_enum(), deprecate
pldm_bios_table_attr_value_entry_encode_enum_check(), add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I8fe0da169b9acc919d01ba024503e72fd2792d4e
Signed-off-by: Andrew Jeffery <[email protected]>
…g_check()

Introduce pldm_bios_table_attr_value_entry_encode_string(), deprecate
pldm_bios_table_attr_value_entry_encode_string_check, add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I7f785aca80a8115bc5e6c60be40ac23ac3e322f1
Signed-off-by: Andrew Jeffery <[email protected]>
…er_check()

Introduce pldm_bios_table_attr_value_entry_encode_integer(), deprecate
pldm_bios_table_attr_value_entry_encode_integer_check(), add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I7832752518592e69f8d64ac57d2724345b096729
Signed-off-by: Andrew Jeffery <[email protected]>
Introduce pldm_bios_table_append_pad_checksum(), deprecate
pldm_bios_table_append_pad_checksum_check(), add rename configuration
and apply it.

Change-Id: I77e79f4be6cecbac87b47d2140e1714b519c4e8d
Signed-off-by: Andrew Jeffery <[email protected]>
The macro wraps __attribute__((counted_by(x))) if compiler support
is available. The `counted_by(...)` attribute gives the compiler the
necessary information to track invalid accesses for flexible array
members.

See the related GCC documentation at [1].

[1]: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-counted_005fby-variable-attribute

Change-Id: If87e022d27df03b7e882df95f8c2452a4d4b828f
Signed-off-by: Andrew Jeffery <[email protected]>
Support decoder for `cperEvent` event class as table `Table 27 -
CPEREvent class eventData format` in DSP0248 V1.3.0.

Change-Id: I6165980e0570bbb21158af9e6adee15894b3bf3a
Signed-off-by: Thu Nguyen <[email protected]>
Some reasoning is provided as well.

Change-Id: Ic0fc7ff16b58ceff3a1ab8c08923b16de4353e33
Signed-off-by: Andrew Jeffery <[email protected]>
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version.  The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: I0af2024502c08b1060bb6beb0895108459f00d48
Signed-off-by: Patrick Williams <[email protected]>
Ensure that we have __has_attribute available, and then further
ensure that the unused attribute is provided. Once satisfied, define
LIBPDLM_CC_UNUSED and replace raw use of __attribute__((unused)).

Change-Id: I2433039297d5fdedb8b8d99b30e73e4542d9069f
Signed-off-by: Andrew Jeffery <[email protected]>
Meson 1.1.1 and GCC-13 both support C++23 and a sufficient portion of
the standard has been implemented.  Upgrade the build to leverage it.

Change-Id: Ifa6971bf40e5bfddc76935308027472806c48c4b
Signed-off-by: Patrick Williams <[email protected]>
Rename `decode_pldm_platform_cper_event_data` to
`decode_pldm_platform_cper_event` as the API does not decode the CPER
data, it decodes the event message.

Change-Id: I0937f043e4d3836f20733f78ea3f5970da6585d5
Signed-off-by: Thu Nguyen <[email protected]>
Unused structs become an API headache - dependent applications can come
to rely on them despite them having no use by the library.

Provide advice to avoid them altogether.

Change-Id: Ic68d725e5f7b569e77f429e858a69085cde1fb2e
Signed-off-by: Andrew Jeffery <[email protected]>
Using it through the code-base reduces some of the source noise, and
gives us a way to control the definition going forward.

Change-Id: I27e76cbae5c45f0efd64b01fb9a8b243a6c8e65d
Signed-off-by: Andrew Jeffery <[email protected]>
Review of some proposed APIs suggested that correct use of the
pldm_msgbuf_{insert,extract}_array() helpers was more difficult that it
should be. In the three-parameter form, it was too tempting to provide
the length to extract as parsed out of a PLDM message. The intended
use was that the length parameter represented the length of the
user-provided data buffer.

Instead, move to a four-parameter form, provide reasonable documentation
for how these APIs should be used, fix all the call-sites, and deprecate
some existing unsafe APIs.

Change-Id: If58e5574600e80b354f383554283c4eda5d7234c
Signed-off-by: Andrew Jeffery <[email protected]>
This allows us to elide checks where they're not necessary, and warn
people at compile-time when they're doing things they shouldn't.

Note that this comes with an apparent ABI break. abi-compliance-checker
reports:

```
platform.h, libpldm.so.0.8.0
[−] decode_sensor_op_data ( uint8_t const* sensor_data, size_t sensor_data_length, uint8_t* present_op_state, uint8_t* previous_op_state )
Change: The parameter previous_op_state became passed in r8 register instead of rcx.
Effect Applications will read the wrong memory block instead of the parameter value.
```

It's unclear to me why. The signature hasn't changed, but how the
implementation tests the parameter values has.

Change-Id: Ie8d8bc1641280522532d9b4764bf07c64b1921c8
Signed-off-by: Andrew Jeffery <[email protected]>
See usage example at:
[1] https://gerrit.openbmc.org/c/openbmc/pldm/+/63028/86/platform-mc/event_manager.cpp#77

Change-Id: I43c5c807f10ac38ee893e65a9d75fca76312d188
Signed-off-by: Thu Nguyen <[email protected]>
The commit adds a new API get_terminus_handle and modifies the
existing remove_by_terminus_handle API.

Signed-off-by: Pavithra Barithaya <[email protected]>
API to find if parent of a contained entity is present in
the entity association tree.

Signed-off-by: Varsha Kaverappa <[email protected]>
While creating the Entity association PDRs, same record handle
is used multiple time to create PDR. Because of which 2 PDRs
with same record handle are added to the repo causing loop.
Adding the fix to resolve the duplicate record handle issue.

Tested:
Power on/off and reset reload on mex and non mex systems.

Signed-off-by: Archana Kakani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.