/* * Opaque handle for client code to refer to RTAS functions. All valid * function handles are build-time constants prefixed with RTAS_FN_.
*/ typedefstruct { constenum rtas_function_index index;
} rtas_fn_handle_t;
#define RTAS_UNKNOWN_SERVICE (-1) #define RTAS_INSTANTIATE_MAX (1ULL<<30) /* Don't instantiate rtas at/above this value */
/* Memory set aside for sys_rtas to use with calls that need a work area. */ #define RTAS_USER_REGION_SIZE (64 * 1024)
/* * Common RTAS function return values, derived from the table "RTAS * Status Word Values" in PAPR+ v2.13 7.2.8: "Return Codes". If a * function can return a value in this table then generally it has the * meaning listed here. More extended commentary in the documentation * for rtas_call(). * * RTAS functions may use negative and positive numbers not in this * set for function-specific error and success conditions, * respectively.
*/ #define RTAS_SUCCESS 0 /* Success. */ #define RTAS_HARDWARE_ERROR -1 /* Hardware or other unspecified error. */ #define RTAS_BUSY -2 /* Retry immediately. */ #define RTAS_INVALID_PARAMETER -3 /* Invalid indicator/domain/sensor etc. */ #define RTAS_UNEXPECTED_STATE_CHANGE -7 /* Seems limited to EEH and slot reset. */ #define RTAS_EXTENDED_DELAY_MIN 9900 /* Retry after delaying for ~1ms. */ #define RTAS_EXTENDED_DELAY_MAX 9905 /* Retry after delaying for ~100s. */ #define RTAS_ML_ISOLATION_ERROR -9000 /* Multi-level isolation error. */
/* statuses specific to ibm,suspend-me */ #define RTAS_SUSPEND_ABORTED 9000 /* Suspension aborted */ #define RTAS_NOT_SUSPENDABLE -9004 /* Partition not suspendable */ #define RTAS_THREADS_ACTIVE -9005 /* Multiple processor threads active */ #define RTAS_OUTSTANDING_COPROC -9006 /* Outstanding coprocessor operations */
/* RTAS event classes */ #define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */ #define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */ #define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */ #define RTAS_IO_EVENTS 0x08000000 /* set bit 4 */ #define RTAS_EVENT_SCAN_ALL_EVENTS 0xffffffff
/* * This can be set by the rtas_flash module so that it can get called * as the absolutely last thing before the kernel terminates.
*/ externvoid (*rtas_flash_term_hook)(int);
externstruct rtas_t rtas;
s32 rtas_function_token(const rtas_fn_handle_t handle); staticinlinebool rtas_function_implemented(const rtas_fn_handle_t handle)
{ return rtas_function_token(handle) != RTAS_UNKNOWN_SERVICE;
} int rtas_token(constchar *service); int rtas_call(int token, int nargs, int nret, int *outputs, ...); void rtas_call_unlocked(struct rtas_args *args, int token, int nargs, int nret, ...); void __noreturn rtas_restart(char *cmd); void rtas_power_off(void); void __noreturn rtas_halt(void); void rtas_os_term(char *str); void rtas_activate_firmware(void); int rtas_get_sensor(int sensor, int index, int *state); int rtas_get_sensor_fast(int sensor, int index, int *state); int rtas_get_power_level(int powerdomain, int *level); int rtas_set_power_level(int powerdomain, int level, int *setlevel); bool rtas_indicator_present(int token, int *maxindex); int rtas_set_indicator(int indicator, int index, int new_value); int rtas_set_indicator_fast(int indicator, int index, int new_value); void rtas_progress(char *s, unsignedshort hex); int rtas_ibm_suspend_me(int *fw_status); int rtas_error_rc(int rtas_rc);
/* Error types logged. */ #define ERR_FLAG_ALREADY_LOGGED 0x0 #define ERR_FLAG_BOOT 0x1 /* log was pulled from NVRAM on boot */ #define ERR_TYPE_RTAS_LOG 0x2 /* from rtas event-scan */ #define ERR_TYPE_KERNEL_PANIC 0x4 /* from die()/panic() */ #define ERR_TYPE_KERNEL_PANIC_GZ 0x8 /* ditto, compressed */
/* All the types and not flags */ #define ERR_TYPE_MASK \
(ERR_TYPE_RTAS_LOG | ERR_TYPE_KERNEL_PANIC | ERR_TYPE_KERNEL_PANIC_GZ)
#define RTAS_DEBUG KERN_DEBUG "RTAS: "
#define RTAS_ERROR_LOG_MAX 2048
/* * Return the firmware-specified size of the error log buffer * for all rtas calls that require an error buffer argument. * This includes 'check-exception' and 'rtas-last-error'.
*/ int rtas_get_error_log_max(void);
/* Event Scan Parameters */ #define EVENT_SCAN_ALL_EVENTS 0xf0000000 #define SURVEILLANCE_TOKEN 9000 #define LOG_NUMBER 64 /* must be a power of two */ #define LOG_NUMBER_MASK (LOG_NUMBER-1)
/* Some RTAS ops require a data buffer and that buffer must be < 4G. * Rather than having a memory allocator, just use this buffer * (get the lock first), make the RTAS call. Copy the data instead * of holding the buffer for long.
*/
/** * rtas_config_addr - Format a busno, devfn and reg for RTAS. * @busno: The bus number. * @devfn: The device and function number as encoded by PCI_DEVFN(). * @reg: The register number. * * This function encodes the given busno, devfn and register number as * required for RTAS calls that take a "config_addr" parameter. * See PAPR requirement 7.3.4-1 for more info.
*/ staticinline u32 rtas_config_addr(int busno, int devfn, int reg)
{ return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) |
(devfn << 8) | (reg & 0xff);
}
/* Not the best place to put pSeries_coalesce_init, will be fixed when we
* move some of the rtas suspend-me stuff to pseries */ void pSeries_coalesce_init(void); void rtas_initialize(void); #else staticinlineint page_is_rtas_user_buf(unsignedlong pfn) { return 0;} staticinlinevoid pSeries_coalesce_init(void) { } staticinlinevoid rtas_initialize(void) { } #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.