Implement the code related to the GetMixedComponentVersion()

Change-Id: I98aad97b4cb6498b7f2fc03a2d5ee7c9e949d5f1
Signed-off-by: Chen Gong <curry.gong@amd.com>
This commit is contained in:
Chen Gong
2024-08-25 00:18:48 +08:00
committed by Galantsev, Dmitrii
parent 8db404f84f
commit 1edd04d84e
9 changed files with 153 additions and 1 deletions
+66
View File
@@ -0,0 +1,66 @@
#ifndef INCLUDE_RDC_RDC_PRIVATE_H_
#define INCLUDE_RDC_RDC_PRIVATE_H_
#include "rdc/rdc.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#ifdef __cplusplus
// cstddef include causes issues on older GCC
// use stddef.h instead
#if __GNUC__ < 9
#include <stddef.h>
#else
#include <cstddef>
#endif // __GNUC__
#include <cstdint>
#else
#include <stddef.h>
#include <stdint.h>
#endif // __cplusplus
/**
* @brief The maximum string length occupied by version information.
*/
#define USR_MAX_VERSION_STR_LENGTH 60
/**
* @brief Version information of mixed components
*/
typedef struct {
char version[USR_MAX_VERSION_STR_LENGTH];
} mixed_component_version_t;
/**
* @brief Type of Components
*/
typedef enum {
RDCD_COMPONENT
//If needed later, add them one by one
} mixed_component_t;
/**
* @brief Get ersion information of mixed components.
*
* @details Given a component type, return its version information.
*
* @param[in] p_rdc_handle The RDC handler.
*
* @param[in] component Component type.
*
* @param[out] p_mixed_compv Version information of the corresponding component.
*
* @retval ::RDC_ST_OK is returned upon successful call.
*/
rdc_status_t get_mixed_component_version(rdc_handle_t p_rdc_handle, mixed_component_t component, mixed_component_version_t* p_mixed_compv);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // INCLUDE_RDC_RDC_PRIVATE_H_
+5
View File
@@ -23,6 +23,7 @@ THE SOFTWARE.
#define INCLUDE_RDC_LIB_RDCHANDLER_H_
#include "rdc/rdc.h"
#include "rdc/rdc_private.h"
#include "rdc_lib/rdc_common.h"
namespace amd {
@@ -88,6 +89,10 @@ class RdcHandler {
// Control API
virtual rdc_status_t rdc_field_update_all(uint32_t wait_for_update) = 0;
// It is just a client interface under the GRPC framework and is not used as an RDC API.
// The reason is that RdcEmbeddedHandler::get_mixed_component_version does not need to be called.
virtual rdc_status_t get_mixed_component_version(mixed_component_t component, mixed_component_version_t* p_mixed_compv) = 0;
virtual ~RdcHandler() {}
};
@@ -91,6 +91,10 @@ class RdcEmbeddedHandler final : public RdcHandler {
// Control API
rdc_status_t rdc_field_update_all(uint32_t wait_for_update) override;
// It is just a client interface under the GRPC framework and is not used as an RDC API.
// Pure virtual functions need to be overridden.
rdc_status_t get_mixed_component_version(mixed_component_t component, mixed_component_version_t* p_mixed_compv) override;
explicit RdcEmbeddedHandler(rdc_operation_mode_t op_mode);
~RdcEmbeddedHandler() final;
@@ -86,6 +86,10 @@ class RdcStandaloneHandler : public RdcHandler {
// Control RdcAPI
rdc_status_t rdc_field_update_all(uint32_t wait_for_update) override;
// It is just a client interface under the GRPC framework and is not used as an RDC API.
// Pure virtual functions need to be overridden
rdc_status_t get_mixed_component_version(mixed_component_t component, mixed_component_version_t* p_mixed_compv) override;
explicit RdcStandaloneHandler(const char* ip_and_port, const char* root_ca,
const char* client_cert, const char* client_key);