libmsr
0.3.0
A friendlier interface to accessing MSRs on Intel platforms
|
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "csr_core.h"
#include "memhdlr.h"
#include "cpuid.h"
#include "libmsr_debug.h"
#include "libmsr_error.h"
Functions | |
int | init_csr (void) |
Open the module file descriptors exposed in the /dev filesystem. | |
int | finalize_csr (void) |
Close the module file descriptors exposed in the /dev filesystem. | |
int | csr_batch_storage (struct csr_batch_array **batchsel, const int batchnum, unsigned **opssize) |
Allocate space for uncore batch arrays. | |
int | allocate_csr_batch (const int batchnum, size_t bsize) |
Allocate space for new uncore batch operation. | |
int | free_csr_batch (const int batchnum) |
Deallocate memory for specific set of uncore batch operations. | |
int | create_csr_batch_op (off_t csr, uint8_t bus, uint8_t device, uint8_t function, uint8_t socket, uint8_t isread, size_t opsize, uint64_t **dest, const int batchnum) |
Create new uncore batch operation. | |
int | do_csr_batch_op (const int batchnum) |
Execute read/write batch operation on a specific set of batch uncore registers. | |
int allocate_csr_batch | ( | const int | batchnum, |
size_t | bsize | ||
) |
Allocate space for new uncore batch operation.
[in] | batchnum | csr_data_type_e data type of batch operation. |
[in] | bsize | Size of batch operation. |
int create_csr_batch_op | ( | off_t | csr, |
uint8_t | bus, | ||
uint8_t | device, | ||
uint8_t | function, | ||
uint8_t | socket, | ||
uint8_t | isread, | ||
size_t | opsize, | ||
uint64_t ** | dest, | ||
const int | batchnum | ||
) |
Create new uncore batch operation.
[in] | csr | Address of uncore register for which operation will take place. |
[in] | bus | Bus where batch operation will take place. |
[in] | device | Device where batch operation will take place. |
[in] | function | Function where batch operation will take place. |
[in] | socket | Socket where batch operation will take place. |
[in] | isread | Indicates read or write to uncore register. |
[in] | opsize | Size of operation. |
[in] | dest | Stores data resulting from read or necessary for write to uncore register. |
[in] | batchnum | csr_data_type_e data type of batch operation. |
int csr_batch_storage | ( | struct csr_batch_array ** | batchsel, |
const int | batchnum, | ||
unsigned ** | opssize | ||
) |
Allocate space for uncore batch arrays.
[out] | batchsel | Storage for uncore batch operations. |
[in] | batchnum | csr_data_type_e data type of batch operation. |
[out] | opssize | Size of specific set of batch operations. |
int do_csr_batch_op | ( | const int | batchnum | ) |
Execute read/write batch operation on a specific set of batch uncore registers.
[in] | batchnum | csr_data_type_e data type of batch operation. |
int finalize_csr | ( | void | ) |
Close the module file descriptors exposed in the /dev filesystem.
int free_csr_batch | ( | const int | batchnum | ) |
Deallocate memory for specific set of uncore batch operations.
[in] | batchnum | csr_data_type_e data type of batch operation. |
int init_csr | ( | void | ) |
Open the module file descriptors exposed in the /dev filesystem.