|
Packit |
534379 |
// Copyright(c) 2018, Intel Corporation
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
534379 |
// modification, are permitted provided that the following conditions are met:
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
534379 |
// this list of conditions and the following disclaimer.
|
|
Packit |
534379 |
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
534379 |
// this list of conditions and the following disclaimer in the documentation
|
|
Packit |
534379 |
// and/or other materials provided with the distribution.
|
|
Packit |
534379 |
// * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
534379 |
// may be used to endorse or promote products derived from this software
|
|
Packit |
534379 |
// without specific prior written permission.
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
534379 |
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
534379 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
534379 |
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
Packit |
534379 |
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
Packit |
534379 |
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
Packit |
534379 |
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
534379 |
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
Packit |
534379 |
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit |
534379 |
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
Packit |
534379 |
// POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#include "pyproperties.h"
|
|
Packit |
534379 |
#include <sstream>
|
|
Packit |
534379 |
|
|
Packit |
534379 |
namespace py = pybind11;
|
|
Packit |
534379 |
using opae::fpga::types::properties;
|
|
Packit |
534379 |
using opae::fpga::types::token;
|
|
Packit |
534379 |
|
|
Packit |
534379 |
static inline fpga_version pytuple_to_fpga_version(py::tuple tpl) {
|
|
Packit |
534379 |
fpga_version version{
|
|
Packit |
534379 |
.major = tpl[0].cast<uint8_t>(),
|
|
Packit |
534379 |
.minor = tpl[1].cast<uint8_t>(),
|
|
Packit |
534379 |
.patch = tpl[2].cast<uint16_t>(),
|
|
Packit |
534379 |
};
|
|
Packit |
534379 |
return version;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
const char *properties_doc() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
properties class is a container class for OPAE resource properties.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
const char *properties_doc_get() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Create a new properties object. If kwargs is not included then the
|
|
Packit |
534379 |
properties object is created with no property values set.
|
|
Packit |
534379 |
If one of the kwargs keys is an OPAE property name then the kwargs
|
|
Packit |
534379 |
value is used to initialize the corresponding value in the
|
|
Packit |
534379 |
properties object.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
Kwargs:
|
|
Packit |
534379 |
|
|
Packit |
534379 |
parent (token): Token object representing parent resource.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
guid (str): GUID (as a string) of the resource.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
type (fpga_objtype): The object type - DEVICE or ACCELERATOR.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
segment (uint16_t) : The PCIe segment (or domain) number.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
bus (uint8_t) : The PCIe bus number.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
device (uint8_t) : The PCIe device number.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
function (uint8_t) : The PCIe function number.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
socket_id (uint8_t): The socket ID encoded in the FIM.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
num_slots (uint32_t): Number of slots available in the FPGA.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
num_errors (uint32_t): Number of error registers in the resource.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
bbs_id (uint64_t): The BBS ID encoded in the FIM.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
bbs_version (tuple): The version of the BBS.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
vendor_id (uint16_t): The vendor ID in PCI config space.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
device_id (uint16_t): The device ID in PCI config space.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
model (str): The model of the FPGA.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
local_memory_size (uint64_t): The size (in bytes) of the FPGA local memory.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
num_mmio (uint32_t): The number of mmio spaces.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
num_interrupts (uint32_t): The number of interrupts supported by an accelerator.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
accelerator_state (fpga_accelerator_state): The state of the accelerator - ASSIGNED or UNASSIGNED.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
object_id (uint64_t): The 64-bit number unique within a single node or system.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
properties::ptr_t properties_get(py::kwargs kwargs) {
|
|
Packit |
534379 |
auto props = properties::get();
|
|
Packit |
534379 |
// if kwargs is empty, return a new (empty) properties object
|
|
Packit |
534379 |
if (!kwargs) {
|
|
Packit |
534379 |
return props;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
if (kwargs.contains("parent")) {
|
|
Packit |
534379 |
props->parent = *kwargs["parent"].cast<token::ptr_t>();
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
if (kwargs.contains("guid")) {
|
|
Packit |
534379 |
props->guid.parse(kwargs["guid"].cast<std::string>().c_str());
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
kwargs_to_props<fpga_objtype>(props->type, kwargs, "type");
|
|
Packit |
534379 |
kwargs_to_props<uint16_t>(props->segment, kwargs, "segment");
|
|
Packit |
534379 |
kwargs_to_props<uint8_t>(props->bus, kwargs, "bus");
|
|
Packit |
534379 |
kwargs_to_props<uint8_t>(props->device, kwargs, "device");
|
|
Packit |
534379 |
kwargs_to_props<uint8_t>(props->function, kwargs, "function");
|
|
Packit |
534379 |
kwargs_to_props<uint8_t>(props->socket_id, kwargs, "socket_id");
|
|
Packit |
534379 |
kwargs_to_props<uint32_t>(props->num_errors, kwargs, "num_errors");
|
|
Packit |
534379 |
kwargs_to_props<uint32_t>(props->num_slots, kwargs, "num_slots");
|
|
Packit |
534379 |
kwargs_to_props<uint64_t>(props->bbs_id, kwargs, "bbs_id");
|
|
Packit |
534379 |
|
|
Packit |
534379 |
if (kwargs.contains("bbs_version")) {
|
|
Packit |
534379 |
py::tuple version_tuple = kwargs["bbs_version"].cast<py::tuple>();
|
|
Packit |
534379 |
props->bbs_version = pytuple_to_fpga_version(version_tuple);
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
kwargs_to_props<uint16_t>(props->vendor_id, kwargs, "vendor_id");
|
|
Packit |
534379 |
kwargs_to_props<uint16_t>(props->device_id, kwargs, "device_id");
|
|
Packit |
534379 |
|
|
Packit |
534379 |
if (kwargs.contains("model")) {
|
|
Packit |
534379 |
props->model =
|
|
Packit |
534379 |
const_cast<char *>(kwargs["model"].cast<std::string>().c_str());
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
kwargs_to_props<uint64_t>(props->local_memory_size, kwargs,
|
|
Packit |
534379 |
"local_memory_size");
|
|
Packit |
534379 |
kwargs_to_props<uint64_t>(props->capabilities, kwargs, "capabilities");
|
|
Packit |
534379 |
kwargs_to_props<uint32_t>(props->num_mmio, kwargs, "num_mmio");
|
|
Packit |
534379 |
kwargs_to_props<uint32_t>(props->num_interrupts, kwargs, "num_interrupts");
|
|
Packit |
534379 |
kwargs_to_props<fpga_accelerator_state>(props->accelerator_state, kwargs,
|
|
Packit |
534379 |
"accelerator_state");
|
|
Packit |
534379 |
kwargs_to_props<uint64_t>(props->object_id, kwargs, "object_id");
|
|
Packit |
534379 |
|
|
Packit |
534379 |
return props;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
const char *properties_doc_get_token() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get properties from a token object.
|
|
Packit |
534379 |
Args:
|
|
Packit |
534379 |
tok (token): The token to read properties from.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
opae::fpga::types::properties::ptr_t properties_get_token(
|
|
Packit |
534379 |
opae::fpga::types::token::ptr_t tok) {
|
|
Packit |
534379 |
return properties::get(tok);
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
const char *properties_doc_get_handle() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get properties from a handle object.
|
|
Packit |
534379 |
Args:
|
|
Packit |
534379 |
h (handle): The handle to read properties from.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
opae::fpga::types::properties::ptr_t properties_get_handle(
|
|
Packit |
534379 |
opae::fpga::types::handle::ptr_t h) {
|
|
Packit |
534379 |
return properties::get(h);
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
const char *properties_doc_parent() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the token representing a parent object of a resource.
|
|
Packit |
534379 |
The resource must be of type ACCELERATOR
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
token::ptr_t properties_get_parent(properties::ptr_t props) {
|
|
Packit |
534379 |
auto token_struct = props->parent;
|
|
Packit |
534379 |
auto parent_props = properties::get(token_struct);
|
|
Packit |
534379 |
auto tokens = token::enumerate({parent_props});
|
|
Packit |
534379 |
return tokens[0];
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_parent(properties::ptr_t props, token::ptr_t parent) {
|
|
Packit |
534379 |
props->parent = *parent;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// guid
|
|
Packit |
534379 |
const char *properties_doc_guid() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the guid property of a resource as a string.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
std::string properties_get_guid(properties::ptr_t props) {
|
|
Packit |
534379 |
std::stringstream ss;
|
|
Packit |
534379 |
ss << props->guid;
|
|
Packit |
534379 |
return ss.str();
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_guid(properties::ptr_t props, const std::string &guid_str) {
|
|
Packit |
534379 |
props->guid.parse(guid_str.c_str());
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// object type
|
|
Packit |
534379 |
const char *properties_doc_type() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the type property of a resource. The type must be
|
|
Packit |
534379 |
either DEVICE or ACCELERATOR
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_objtype properties_get_type(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->type;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_type(properties::ptr_t props, fpga_objtype type) {
|
|
Packit |
534379 |
props->type = type;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
// pcie segment
|
|
Packit |
534379 |
const char *properties_doc_segment() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the PCIe segment property of a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint16_t properties_get_segment(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->segment;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_segment(properties::ptr_t props, uint16_t segment) {
|
|
Packit |
534379 |
props->segment = segment;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// pcie bus
|
|
Packit |
534379 |
const char *properties_doc_bus() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the PCIe bus property of a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint8_t properties_get_bus(properties::ptr_t props) { return props->bus; }
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_bus(properties::ptr_t props, uint8_t bus) {
|
|
Packit |
534379 |
props->bus = bus;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// pcie device
|
|
Packit |
534379 |
const char *properties_doc_device() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the PCIe device property of a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint8_t properties_get_device(properties::ptr_t props) { return props->device; }
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_device(properties::ptr_t props, uint8_t device) {
|
|
Packit |
534379 |
props->device = device;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// pcie function
|
|
Packit |
534379 |
const char *properties_doc_function() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the PCIe function property of a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint8_t properties_get_function(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->function;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_function(properties::ptr_t props, uint8_t function) {
|
|
Packit |
534379 |
props->function = function;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// socket id
|
|
Packit |
534379 |
const char *properties_doc_socket_id() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the Socket ID property of a resource. The socket id is
|
|
Packit |
534379 |
encoded in of the FIM CSRs
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint8_t properties_get_socket_id(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->socket_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_socket_id(properties::ptr_t props, uint8_t socket_id) {
|
|
Packit |
534379 |
props->socket_id = socket_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// object id
|
|
Packit |
534379 |
const char *properties_doc_object_id() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the Object ID property of a resource. The object id is
|
|
Packit |
534379 |
a 64-bit identifier that is unique within a single node or system.
|
|
Packit |
534379 |
I represents a similar concept as the token but can be serialized
|
|
Packit |
534379 |
for use across processes
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint64_t properties_get_object_id(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->object_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_object_id(properties::ptr_t props, uint64_t object_id) {
|
|
Packit |
534379 |
props->object_id = object_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// num errors
|
|
Packit |
534379 |
const char *properties_doc_num_errors() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the number of error registers in the resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint32_t properties_get_num_errors(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->num_errors;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_num_errors(properties::ptr_t props, uint32_t num_errors) {
|
|
Packit |
534379 |
props->num_errors = num_errors;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// num slots
|
|
Packit |
534379 |
const char *properties_doc_num_slots() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the number of slots property of a resource.
|
|
Packit |
534379 |
The resource must be of type DEVICE
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint32_t properties_get_num_slots(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->num_slots;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_num_slots(properties::ptr_t props, uint32_t num_slots) {
|
|
Packit |
534379 |
props->num_slots = num_slots;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// bbs id
|
|
Packit |
534379 |
const char *properties_doc_bbs_id() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the BBS ID property of a resource.
|
|
Packit |
534379 |
The resource must be of type DEVICE
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint64_t properties_get_bbs_id(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->bbs_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_bbs_id(properties::ptr_t props, uint64_t bbs_id) {
|
|
Packit |
534379 |
props->bbs_id = bbs_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// bbs version
|
|
Packit |
534379 |
const char *properties_doc_bbs_version() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the BBS version property of a resource.
|
|
Packit |
534379 |
The resource must be of type DEVICE
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
std::tuple<uint8_t, uint8_t, uint16_t> properties_get_bbs_version(
|
|
Packit |
534379 |
properties::ptr_t props) {
|
|
Packit |
534379 |
fpga_version version = props->bbs_version;
|
|
Packit |
534379 |
return std::make_tuple(version.major, version.minor, version.patch);
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_bbs_version(properties::ptr_t props,
|
|
Packit |
534379 |
py::tuple bbs_version) {
|
|
Packit |
534379 |
props->bbs_version = pytuple_to_fpga_version(bbs_version);
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// vendor id
|
|
Packit |
534379 |
const char *properties_doc_vendor_id() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the vendor ID property of a resource.
|
|
Packit |
534379 |
The vendor ID is part of the PCI ID and is assigned by the
|
|
Packit |
534379 |
PCI SIG consortium.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint32_t properties_get_vendor_id(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->vendor_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_vendor_id(properties::ptr_t props, uint32_t vendor_id) {
|
|
Packit |
534379 |
props->vendor_id = vendor_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// device id
|
|
Packit |
534379 |
const char *properties_doc_device_id() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the device ID property of a resource.
|
|
Packit |
534379 |
The device ID is part of the PCI ID and is assigned by the
|
|
Packit |
534379 |
vendor.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint32_t properties_get_device_id(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->device_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_device_id(properties::ptr_t props, uint32_t device_id) {
|
|
Packit |
534379 |
props->device_id = device_id;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// model
|
|
Packit |
534379 |
const char *properties_doc_model() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the model property of a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
std::string properties_get_model(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->model;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_model(properties::ptr_t props, char *model) {
|
|
Packit |
534379 |
props->model = model;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// local memory size
|
|
Packit |
534379 |
const char *properties_doc_local_memory_size() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the local memory size property of a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint64_t properties_get_local_memory_size(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->local_memory_size;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_local_memory_size(properties::ptr_t props, uint64_t size) {
|
|
Packit |
534379 |
props->local_memory_size = size;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// capabilities
|
|
Packit |
534379 |
const char *properties_doc_capabilities() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the capabilities property of a resource.
|
|
Packit |
534379 |
This is taken directly from the capabilities CSR in the FIM.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint64_t properties_get_capabilities(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->capabilities;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_capabilities(properties::ptr_t props, uint64_t caps) {
|
|
Packit |
534379 |
props->capabilities = caps;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// num mmio
|
|
Packit |
534379 |
const char *properties_doc_num_mmio() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the number of mmio spaces in a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
uint32_t properties_get_num_mmio(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->num_mmio;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_num_mmio(properties::ptr_t props, uint32_t num_mmio) {
|
|
Packit |
534379 |
props->num_mmio = num_mmio;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// num interrupts
|
|
Packit |
534379 |
const char *properties_doc_num_interrupts() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the number of interrupt vectors supported by a resource.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
uint32_t properties_get_num_interrupts(properties::ptr_t props) {
|
|
Packit |
534379 |
return props->num_interrupts;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
void properties_set_num_interrupts(properties::ptr_t props,
|
|
Packit |
534379 |
uint32_t num_interrupts) {
|
|
Packit |
534379 |
props->num_interrupts = num_interrupts;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// accelerator state
|
|
Packit |
534379 |
const char *properties_doc_accelerator_state() {
|
|
Packit |
534379 |
return R"opaedoc(
|
|
Packit |
534379 |
Get or set the state of an accelerator.
|
|
Packit |
534379 |
The accelerator state is of type fpga_accelerator_state.
|
|
Packit |
534379 |
)opaedoc";
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_accelerator_state properties_get_accelerator_state(
|
|
Packit |
534379 |
properties::ptr_t props) {
|
|
Packit |
534379 |
return props->accelerator_state;
|
|
Packit |
534379 |
}
|
|
Packit |
534379 |
|
|
Packit |
534379 |
void properties_set_accelerator_state(properties::ptr_t props,
|
|
Packit |
534379 |
fpga_accelerator_state state) {
|
|
Packit |
534379 |
props->accelerator_state = state;
|
|
Packit |
534379 |
}
|