Skip to content

Commit

Permalink
Merge commit 'd6909a9a8d188952fa2a340d1384421053a1ac76' into aravuri/…
Browse files Browse the repository at this point in the history
…pull_libs
  • Loading branch information
anandaravuri committed Sep 18, 2020
2 parents af7313c + d6909a9 commit 0dfb115
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
8 changes: 4 additions & 4 deletions opae-libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
cmake_minimum_required(VERSION 2.8.12)
project(opae-libs)

set(OPAE_VERSION_MAJOR 1 CACHE STRING "OPAE major version" FORCE)
set(OPAE_VERSION_MINOR 4 CACHE STRING "OPAE minor version" FORCE)
set(OPAE_VERSION_MAJOR 2 CACHE STRING "OPAE major version" FORCE)
set(OPAE_VERSION_MINOR 0 CACHE STRING "OPAE minor version" FORCE)
set(OPAE_VERSION_REVISION 0 CACHE STRING "OPAE revision version" FORCE)
set(OPAE_VERSION ${OPAE_VERSION_MAJOR}.${OPAE_VERSION_MINOR}.${OPAE_VERSION_REVISION}
CACHE STRING "OPAE version" FORCE)
Expand Down Expand Up @@ -102,12 +102,12 @@ option(OPAE_PRESERVE_REPOS "Disable refresh of external repos" OFF)
mark_as_advanced(OPAE_PRESERVE_REPOS)

if(OPAE_BUILD_TESTS)
option(OPAE_TEST_TAG "Desired branch for opae-test" master)
option(OPAE_TEST_TAG "Desired branch for opae-test" release/2.0.0)
mark_as_advanced(OPAE_TEST_TAG)
endif(OPAE_BUILD_TESTS)

if(OPAE_BUILD_SIM)
option(OPAE_SIM_TAG "Desired branch for opae-sim" master)
option(OPAE_SIM_TAG "Desired branch for opae-sim" release/2.0.0)
mark_as_advanced(OPAE_SIM_TAG)
endif(OPAE_BUILD_SIM)

Expand Down
11 changes: 5 additions & 6 deletions opae-libs/include/opae/cxx/core/pvalue.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright(c) 2018, Intel Corporation
// Copyright(c) 2018-2020, Intel Corporation
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -93,9 +93,8 @@ struct guid_t {
* @param[in] str The guid string.
*/
void parse(const char *str) {
int u;
is_set_ = false;
if (0 != (u = uuid_parse(str, data_.data()))) {
if (0 != uuid_parse(str, data_.data())) {
throw except(OPAECXX_HERE);
}
ASSERT_FPGA_OK(fpgaPropertiesSetGUID(*props_, data_.data()));
Expand Down Expand Up @@ -165,7 +164,7 @@ struct pvalue {
typedef typename std::conditional<std::is_same<T, char *>::value,
typename std::string, T>::type copy_t;

pvalue() : props_(0), is_set_(false), get_(nullptr), set_(nullptr) {}
pvalue() : props_(0), is_set_(false), get_(nullptr), set_(nullptr), copy_() {}

/**
* @brief pvalue contructor that takes in a reference to fpga_properties
Expand All @@ -176,7 +175,7 @@ struct pvalue {
* @param s The setter function
*/
pvalue(fpga_properties *p, getter_t g, setter_t s)
: props_(p), is_set_(false), get_(g), set_(s) {}
: props_(p), is_set_(false), get_(g), set_(s), copy_() {}

/**
* @brief Overload of `=` operator that calls the wrapped setter
Expand Down Expand Up @@ -255,9 +254,9 @@ struct pvalue {
private:
fpga_properties *props_;
bool is_set_;
copy_t copy_;
getter_t get_;
setter_t set_;
copy_t copy_;
};

/**
Expand Down
9 changes: 5 additions & 4 deletions opae-libs/plugins/xfpga/metrics/afu_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ fpga_result get_afu_metric_value(fpga_handle handle,
if (metric_num == _fpga_enum_metric->metric_num) {

result = xfpga_fpgaReadMMIO64(handle, 0, _fpga_enum_metric->mmio_offset, &metric_csr.csr);

fpga_metric->value.ivalue = metric_csr.value;
result = FPGA_OK;

if (result != FPGA_OK) {
OPAE_ERR("Failed to get metric");
break;
}
fpga_metric->value.ivalue = metric_csr.value;
}

}
Expand Down
5 changes: 4 additions & 1 deletion opae-libs/plugins/xfpga/metrics/metrics_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,10 @@ fpga_result enum_bmc_metrics_info(struct _fpga_handle *_handle,

for (x = 0; x < num_sensors; x++) {
result = xfpga_bmcGetSDRDetails(_handle, values, x, &details);

if (result != FPGA_OK) {
OPAE_ERR("Failed to get sensor details.");
return result;
}

if (details.sensor_type == BMC_THERMAL) {

Expand Down
10 changes: 10 additions & 0 deletions opae-libs/plugins/xfpga/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,17 @@ xfpga_fpgaOpen(fpga_token token, fpga_handle *handle, int flags)

// Init MMIO table
_handle->mmio_root = wsid_tracker_init(4);
if (NULL == _handle->mmio_root) {
result = FPGA_NO_MEMORY;
goto out_free1;
}

// Init workspace table
_handle->wsid_root = wsid_tracker_init(16384);
if (NULL == _handle->wsid_root) {
result = FPGA_NO_MEMORY;
goto out_free2;
}

// Init metric enum
_handle->metric_enum_status = false;
Expand Down Expand Up @@ -151,7 +159,9 @@ xfpga_fpgaOpen(fpga_token token, fpga_handle *handle, int flags)

out_free:
wsid_tracker_cleanup(_handle->wsid_root, NULL);
out_free2:
wsid_tracker_cleanup(_handle->mmio_root, NULL);
out_free1:
free(_handle);

if (-1 != fddev) {
Expand Down

0 comments on commit 0dfb115

Please sign in to comment.