| From 67872c7f29e902445b2298f9f9173981a488b8ec Mon Sep 17 00:00:00 2001 |
| From: Nikhil Namjoshi <nikhilnamjoshi@google.com> |
| Date: Wed, 14 Feb 2024 23:31:06 +0000 |
| Subject: [PATCH] Add APIs to get Op Enumerate's encoded request and decoded |
| response |
| |
| Additionally also update the API the provide encoded Op Kill |
| and Op Complete requests, to accept resource and operation IDs, |
| instead of the context. |
| |
| Tested: |
| Verfied that the client is able to receive and use the |
| enocded requests for all the affected APIs. |
| |
| Patch Tracking Bug: b/325680381 |
| Upstream info / review: NA |
| Upstream-Status: Pending |
| Justification: |
| There is dependency on upstreaming rded first, followed |
| by other libpldm command support like OperationInit, |
| Operation,Status, OperationComplete and OperationKill |
| |
| Change-Id: Iac15c3364f04dc0be1391ea11eb76235935fc210 |
| Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com> |
| --- |
| .../libpldm/requester/pldm_rde_requester.h | 27 ++++++++++--- |
| src/requester/pldm_rde_requester.c | 39 +++++++++++++------ |
| 2 files changed, 49 insertions(+), 17 deletions(-) |
| |
| diff --git a/include/libpldm/requester/pldm_rde_requester.h b/include/libpldm/requester/pldm_rde_requester.h |
| index d96f6f4..92ced28 100644 |
| --- a/include/libpldm/requester/pldm_rde_requester.h |
| +++ b/include/libpldm/requester/pldm_rde_requester.h |
| @@ -227,7 +227,7 @@ pldm_rde_init_context(const char *device_id, int net_id, |
| bitfield16_t *mc_features, uint8_t number_of_resources, |
| uint32_t *resource_id_address, |
| struct pldm_rde_requester_context *(*alloc_requester_ctx)( |
| - uint8_t number_of_ctx), |
| + uint8_t number_of_ctx), |
| |
| // Callback function to clean any context memory |
| void (*free_requester_ctx)(void *ctx_memory)); |
| @@ -421,15 +421,32 @@ pldm_rde_requester_rc_t free_op_context_after_dictionary_extraction( |
| * @brief Provides the RDE Op complete request encoded |
| */ |
| pldm_rde_requester_rc_t get_pldm_rde_operation_complete_request( |
| - uint8_t instance_id, struct pldm_rde_requester_context *current_ctx, |
| + uint8_t instance_id, uint32_t resource_id, uint16_t operation_id, |
| struct pldm_msg *request); |
| |
| +/** |
| + * @brief Provides the encoded RDE Op Enumerate request |
| + */ |
| +pldm_rde_requester_rc_t |
| +get_pldm_rde_operation_enumerate_request(uint8_t instance_id, |
| + struct pldm_msg *request); |
| + |
| +/** |
| + * @brief Provides the decoded RDE Op Enumerate response |
| + */ |
| +pldm_rde_requester_rc_t get_pldm_rde_operation_enumerate_response( |
| + struct pldm_msg *response, uint8_t *completion_code, |
| + uint16_t *operation_count, |
| + struct pldm_rde_operation_enumerate_operation_data *operation_data, |
| + uint16_t operation_data_array_size); |
| + |
| /** |
| * @brief Provides the RDE Op Kill request encoded |
| */ |
| -pldm_rde_requester_rc_t get_pldm_rde_operation_kill_request( |
| - uint8_t instance_id, struct pldm_rde_requester_context *current_ctx, |
| - struct pldm_msg *request); |
| +pldm_rde_requester_rc_t |
| +get_pldm_rde_operation_kill_request(uint8_t instance_id, uint32_t resource_id, |
| + uint16_t operation_id, |
| + struct pldm_msg *request); |
| /** |
| * =============== Workaround ends for b/293742455 =================== |
| */ |
| diff --git a/src/requester/pldm_rde_requester.c b/src/requester/pldm_rde_requester.c |
| index 4f11b13..c7e1705 100644 |
| --- a/src/requester/pldm_rde_requester.c |
| +++ b/src/requester/pldm_rde_requester.c |
| @@ -675,27 +675,42 @@ free_rde_op_init_context(struct pldm_rde_requester_context *ctx) |
| */ |
| LIBPLDM_ABI_STABLE |
| pldm_rde_requester_rc_t get_pldm_rde_operation_complete_request( |
| - uint8_t instance_id, struct pldm_rde_requester_context *current_ctx, |
| - struct pldm_msg *request) |
| + uint8_t instance_id, uint32_t resource_id, |
| + uint16_t operation_id, struct pldm_msg *request) |
| { |
| - struct rde_operation *operation_ctx = |
| - (struct rde_operation *)current_ctx->operation_ctx; |
| return encode_rde_operation_complete_req( |
| - instance_id, operation_ctx->resource_id, |
| - operation_ctx->operation_id, request); |
| + instance_id, resource_id, |
| + operation_id, request); |
| +} |
| + |
| +LIBPLDM_ABI_STABLE |
| +pldm_rde_requester_rc_t get_pldm_rde_operation_enumerate_request( |
| + uint8_t instance_id, struct pldm_msg *request) |
| +{ |
| + return encode_rde_operation_enumerate_req( |
| + instance_id, request); |
| +} |
| + |
| +LIBPLDM_ABI_STABLE |
| +pldm_rde_requester_rc_t get_pldm_rde_operation_enumerate_response( |
| + struct pldm_msg *response, uint8_t *completion_code, |
| + uint16_t *operation_count, |
| + struct pldm_rde_operation_enumerate_operation_data *operation_data, |
| + uint16_t operation_data_array_size) |
| +{ |
| + return decode_rde_operation_enumerate_resp( |
| + response, completion_code, operation_count, |
| + operation_data, operation_data_array_size); |
| } |
| |
| LIBPLDM_ABI_STABLE |
| pldm_rde_requester_rc_t get_pldm_rde_operation_kill_request( |
| - uint8_t instance_id, struct pldm_rde_requester_context *current_ctx, |
| + uint8_t instance_id, uint32_t resource_id, uint16_t operation_id, |
| struct pldm_msg *request) |
| { |
| - struct rde_operation *operation_ctx = |
| - (struct rde_operation *)current_ctx->operation_ctx; |
| - |
| return encode_rde_operation_kill_req( |
| - instance_id, operation_ctx->resource_id, |
| - operation_ctx->operation_id, request); |
| + instance_id, resource_id, |
| + operation_id, request); |
| } |
| /** |
| * =============== Workaround ends =================== |
| -- |
| 2.44.0.rc0.258.g7320e95886-goog |
| |