#include <fcntl.h>#include <unistd.h>#include "librtas.h"#include "common.h"Defines | |
| #define | SANITY_CHECKS(_name) |
| #define | CALL_RTAS_METHOD(_name, _token, _args...) |
| #define | CALL_HELPER_METHOD(_name, _args...) |
| #define | MAX_PATH_LEN 80 |
Functions | |
| int | open_proc_rtas_file (const char *name, int mode) |
| Open the proc rtas file. | |
| static int | init_interface () |
| Initialize the librtas interface to use. | |
| int | rtas_activate_firmware () |
| Interface for ibm,activate-firmware rtas call. | |
| int | rtas_cfg_connector (char *workarea) |
| Interface for ibm,configure-connector rtas call. | |
| int | rtas_delay_timeout (uint64_t timeout_ms) |
| Interface to retrieve the rtas timeout delay. | |
| int | rtas_display_char (char c) |
| Interface for display-character rtas call. | |
| int | rtas_display_msg (char *buf) |
| Interface for ibm,display-message rtas call. | |
| int | rtas_errinjct (int etoken, int otoken, char *workarea) |
| Interface to the ibm,errinjct rtas call. | |
| int | rtas_errinjct_close (int otoken) |
| Inerface to close the ibm,errinjct facility. | |
| int | rtas_errinjct_open (int *otoken) |
| Interface to open the ibm,errinjct facility. | |
| int | rtas_free_rmo_buffer (void *buf, uint32_t phys_addr, size_t size) |
| free the rmo buffer used by librtas | |
| int | rtas_get_dynamic_sensor (int sensor, void *loc_code, int *state) |
| Interface to ibm,get-dynamic-sensor-state rtas call. | |
| int | rtas_get_indices (int is_sensor, int type, char *workarea, size_t size, int start, int *next) |
| Interface to the ibm,get-indices rtas call. | |
| int | rtas_get_power_level (int powerdomain, int *level) |
| Interface to the get-power-level rtas call. | |
| int | rtas_get_rmo_buffer (size_t size, void **buf, uint32_t *phys_addr) |
| Retrive the RMO buffer used by librtas. | |
| int | rtas_get_sensor (int sensor, int index, int *state) |
| Interface to the get-sensor-state rtas call. | |
| int | rtas_get_sysparm (unsigned int parameter, unsigned int length, char *data) |
| Interface to the ibm,get-system-parameter rtas call. | |
| int | rtas_get_time (uint32_t *year, uint32_t *month, uint32_t *day, uint32_t *hour, uint32_t *min, uint32_t *sec, uint32_t *nsec) |
| Interface to get-time-of-day rtas call. | |
| int | rtas_get_vpd (char *loc_code, char *workarea, size_t size, unsigned int sequence, unsigned int *seq_next, unsigned int *bytes_ret) |
| Interface to the ibm,get-vpd rtas call. | |
| int | rtas_lpar_perftools (int subfunc, char *workarea, unsigned int length, unsigned int sequence, unsigned int *seq_next) |
| Interface to the ibm,lpa-perftools rtas call. | |
| int | rtas_platform_dump (uint64_t dump_tag, uint64_t sequence, void *buffer, size_t length, uint64_t *next_seq, uint64_t *bytes_ret) |
| int | rtas_read_slot_reset (uint32_t cfg_addr, uint64_t phbid, int *state, int *eeh) |
| Interface to the ibm,read-slot-reset-state rtas call. | |
| int | rtas_scan_log_dump (void *buffer, size_t length) |
| Interface to the ibm,scan-log-dump rtas call. | |
| int | rtas_set_debug (int level) |
| Interface to set librtas debug level. | |
| int | rtas_set_dynamic_indicator (int indicator, int new_value, void *loc_code) |
| Interface to the ibm,set-dynamic-indicator rtas call. | |
| int | rtas_set_eeh_option (uint32_t cfg_addr, uint64_t phbid, int function) |
| Inerface to the ibm,set-eeh-option rtas call. | |
| int | rtas_set_indicator (int indicator, int index, int new_value) |
| Interface to the set-indicator rtas call. | |
| int | rtas_set_power_level (int powerdomain, int level, int *setlevel) |
| Interface to the set-power-level rtas call. | |
| int | rtas_set_poweron_time (uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec, uint32_t nsec) |
| interface to the set-time-for-power-on rtas call | |
| int | rtas_set_sysparm (unsigned int parameter, char *data) |
| Interface to the ibm,set-system-parameter rtas call. | |
| int | rtas_set_time (uint32_t year, uint32_t month, uint32_t day, uint32_t hour, uint32_t min, uint32_t sec, uint32_t nsec) |
| Interface to the set-time-of-day rtas call. | |
Variables | |
| struct rtas_operations | syscall_rtas_ops |
| struct rtas_operations | procfs_rtas_ops |
| struct librtas_config | config = { NULL, 0ll, 0 } |
| #define CALL_HELPER_METHOD | ( | _name, | |||
| _args... | ) |
Value:
SANITY_CHECKS(_name); \ \ /* Call interface-specific helper routine */ \ return config.rtas_ops->_name(_args) \
| #define CALL_RTAS_METHOD | ( | _name, | |||
| _token, | |||||
| _args... | ) |
Value:
SANITY_CHECKS(_name); \ \ /* Call interface-specific RTAS routine, \ * passing in token */ \ return config.rtas_ops->_name(_token, ##_args)
| #define MAX_PATH_LEN 80 |
| #define SANITY_CHECKS | ( | _name | ) |
Value:
/* Check credentials */ \ if (geteuid() != (uid_t) 0) \ return RTAS_PERM; \ \ /* Check for any kernel RTAS interface */ \ if (config.rtas_ops == NULL) \ if (init_interface()) \ return RTAS_KERNEL_INT; \ \ /* Check for kernel implementation of function */ \ if (config.rtas_ops->_name == NULL) \ return RTAS_KERNEL_IMP
| static int init_interface | ( | ) | [static] |
init_interface
| int open_proc_rtas_file | ( | const char * | name, | |
| int | mode | |||
| ) |
open_proc_rtas_file
| name | filename to open | |
| mode | mode to open file in |
| int rtas_activate_firmware | ( | ) |
rtas_activate_firmware
| int rtas_cfg_connector | ( | char * | workarea | ) |
| workarea | buffer containg args to ibm,configure-connector |
| int rtas_delay_timeout | ( | uint64_t | timeout_ms | ) |
rtas_delay_timeout
| timeout_ms | timeout in milli-seconds |
| int rtas_display_char | ( | char | c | ) |
rtas_diaply_char
| c | character to display |
| int rtas_display_msg | ( | char * | buf | ) |
rtas_diaplay_msg
| buf | message to display |
| int rtas_errinjct | ( | int | etoken, | |
| int | otoken, | |||
| char * | workarea | |||
| ) |
rtas_errinjct
| etoken | errinjct token | |
| otoken | errinjct open token | |
| workarea | additional args to ibm,errinjct |
| int rtas_errinjct_close | ( | int | otoken | ) |
rtas_errinjct_close
| otoken | errinjct open token |
| int rtas_errinjct_open | ( | int * | otoken | ) |
rtas_errinjct_open
This call will set the value refrenced by otoken to the open token for the ibm,errinjct facility
| otoken | pointer to open token |
| int rtas_free_rmo_buffer | ( | void * | buf, | |
| uint32_t | phys_addr, | |||
| size_t | size | |||
| ) |
rtas_free_rmp_buffer
| buf | rmo buffer to free | |
| phys_addr | physical address of the buffer | |
| size | buf size |
| int rtas_get_dynamic_sensor | ( | int | sensor, | |
| void * | loc_code, | |||
| int * | state | |||
| ) |
rtas_get_dynamic_sensor
On success the variable referenced by the state parameter will contain the state of the sensor
| sensor | sensor to retrieve | |
| loc_code | location code of the sensor | |
| state | reference to state variable |
| int rtas_get_indices | ( | int | is_sensor, | |
| int | type, | |||
| char * | workarea, | |||
| size_t | size, | |||
| int | start, | |||
| int * | next | |||
| ) |
rtas_get_indices
| is_sensor | is this index a sensor? | |
| type | ||
| workarea | additional args to the rtas call | |
| size | ||
| start | ||
| next |
| int rtas_get_power_level | ( | int | powerdomain, | |
| int * | level | |||
| ) |
On success this routine will set the variable referenced by the level parameter to the power level
| powerdomain | ||
| level | reference to the power level variable |
| int rtas_get_rmo_buffer | ( | size_t | size, | |
| void ** | buf, | |||
| uint32_t * | phys_addr | |||
| ) |
rtas_get_rmo_buffer
On successful completion the buf parameter will reference an allocated area of RMO memory and the phys_addr parameter will refernce the physical address of the RMO buffer.
| size | buffer size to retrieve | |
| buf | reference to buffer pointer | |
| phys_addr | reference to the phys_addr variable |
| int rtas_get_sensor | ( | int | sensor, | |
| int | index, | |||
| int * | state | |||
| ) |
On successful completion the state parameter will reference the current state of the sensor
| sensor | ||
| index | sensor index | |
| state | reference to state variable |
| int rtas_get_sysparm | ( | unsigned int | parameter, | |
| unsigned int | length, | |||
| char * | data | |||
| ) |
On successful completion the data parameter will contain the system parameter results
| parameter | system parameter to retrieve | |
| length | data buffer length | |
| data | reference to buffer to return parameter in |
| int rtas_get_time | ( | uint32_t * | year, | |
| uint32_t * | month, | |||
| uint32_t * | day, | |||
| uint32_t * | hour, | |||
| uint32_t * | min, | |||
| uint32_t * | sec, | |||
| uint32_t * | nsec | |||
| ) |
rtas_get_time
On successful completion all of the parameters will be filled with their respective values for the current time of day.
| year | ||
| month | ||
| day | ||
| hour | ||
| min | ||
| sec | ||
| nsec |
| int rtas_get_vpd | ( | char * | loc_code, | |
| char * | workarea, | |||
| size_t | size, | |||
| unsigned int | sequence, | |||
| unsigned int * | seq_next, | |||
| unsigned int * | bytes_ret | |||
| ) |
rtas_get_vpd
| loc_code | location code | |
| workarea | additional args to rtas call | |
| size | ||
| sequence | ||
| seq_next | ||
| bytes_ret |
| int rtas_lpar_perftools | ( | int | subfunc, | |
| char * | workarea, | |||
| unsigned int | length, | |||
| unsigned int | sequence, | |||
| unsigned int * | seq_next | |||
| ) |
rtas_lpar_perftools
| subfunc | ||
| workarea | additional args to the rtas call | |
| length | ||
| sequence | ||
| seq_next |
| int rtas_platform_dump | ( | uint64_t | dump_tag, | |
| uint64_t | sequence, | |||
| void * | buffer, | |||
| size_t | length, | |||
| uint64_t * | next_seq, | |||
| uint64_t * | bytes_ret | |||
| ) |
rtas_platform_dump Interface to the ibm,platform-dump rtas call
| dump_tag | ||
| sequence | ||
| buffer | buffer to write dump to | |
| length | buffer length | |
| next_seq | ||
| bytes_ret |
| int rtas_read_slot_reset | ( | uint32_t | cfg_addr, | |
| uint64_t | phbid, | |||
| int * | state, | |||
| int * | eeh | |||
| ) |
rtas_read_slot_reset
| cfg_addr | configuration address of slot to read | |
| phbid | PHB ID of the slot to read | |
| state | reference to variable to return slot state in | |
| eeh |
| int rtas_scan_log_dump | ( | void * | buffer, | |
| size_t | length | |||
| ) |
rtas_scan_log_dump
| buffer | buffer to return scan log dump in | |
| length | size of buffer |
| int rtas_set_debug | ( | int | level | ) |
rtas_set_debug
| level | debug level to set to |
| int rtas_set_dynamic_indicator | ( | int | indicator, | |
| int | new_value, | |||
| void * | loc_code | |||
| ) |
rtas_set_dynamic_indicator
| indicator | indicator to set | |
| new_value | value to set the indicator to | |
| loc_code |
| int rtas_set_eeh_option | ( | uint32_t | cfg_addr, | |
| uint64_t | phbid, | |||
| int | function | |||
| ) |
rtas_set_eeh_option
| cfg_addr | configuration address for slot to set eeh option on | |
| phbid | PHB ID for slot to set option on | |
| function |
| int rtas_set_indicator | ( | int | indicator, | |
| int | index, | |||
| int | new_value | |||
| ) |
| indicator | indicator to set | |
| index | indicator index | |
| new_value | value to set the indicator to |
| int rtas_set_power_level | ( | int | powerdomain, | |
| int | level, | |||
| int * | setlevel | |||
| ) |
| powerdomain | ||
| level | power level to set to | |
| setlevel |
| int rtas_set_poweron_time | ( | uint32_t | year, | |
| uint32_t | month, | |||
| uint32_t | day, | |||
| uint32_t | hour, | |||
| uint32_t | min, | |||
| uint32_t | sec, | |||
| uint32_t | nsec | |||
| ) |
rtas_set_poweron_time
| year | year to power on | |
| month | month to power on | |
| day | day to power on | |
| hour | hour to power on | |
| min | minute to power on | |
| sec | second to power on | |
| nsec | nano-second top power on |
| int rtas_set_sysparm | ( | unsigned int | parameter, | |
| char * | data | |||
| ) |
rtas_set_sysparm
| parameter | ||
| data |
| int rtas_set_time | ( | uint32_t | year, | |
| uint32_t | month, | |||
| uint32_t | day, | |||
| uint32_t | hour, | |||
| uint32_t | min, | |||
| uint32_t | sec, | |||
| uint32_t | nsec | |||
| ) |
rtas_set_time
| year | year to set time to | |
| month | month to set time to | |
| day | day to set time to | |
| hour | hour to set time to | |
| min | minute to set time to | |
| sec | second to set time to | |
| nsec | nan-second to set time to |
| struct librtas_config config = { NULL, 0ll, 0 } |
| struct rtas_operations procfs_rtas_ops |
| struct rtas_operations syscall_rtas_ops |
1.5.3