Path: blob/master/arch/powerpc/platforms/pseries/papr-rtas-common.h
26481 views
/* SPDX-License-Identifier: GPL-2.0-only */1#ifndef _ASM_POWERPC_PAPR_RTAS_COMMON_H2#define _ASM_POWERPC_PAPR_RTAS_COMMON_H34#include <linux/types.h>56/*7* Return codes for sequence based RTAS calls.8* Not listed under PAPR+ v2.13 7.2.8: "Return Codes".9* But defined in the specific section of each RTAS call.10*/11#define RTAS_SEQ_COMPLETE 0 /* All data has been retrieved. */12#define RTAS_SEQ_MORE_DATA 1 /* More data is available */13#define RTAS_SEQ_START_OVER -4 /* Data changed, restart call sequence. */1415/*16* Internal "blob" APIs for accumulating RTAS call results into17* an immutable buffer to be attached to a file descriptor.18*/19struct papr_rtas_blob {20const char *data;21size_t len;22};2324/**25* struct papr_sequence - State for managing a sequence of RTAS calls.26* @error: Shall be zero as long as the sequence has not encountered an error,27* -ve errno otherwise. Use papr_rtas_sequence_set_err() to update.28* @params: Parameter block to pass to rtas_*() calls.29* @begin: Work area allocation and initialize the needed parameter30* values passed to RTAS call31* @end: Free the allocated work area32* @work: Obtain data with RTAS call and invoke it until the sequence is33* completed.34*35*/36struct papr_rtas_sequence {37int error;38void *params;39void (*begin)(struct papr_rtas_sequence *seq);40void (*end)(struct papr_rtas_sequence *seq);41const char *(*work)(struct papr_rtas_sequence *seq, size_t *len);42};4344extern bool papr_rtas_blob_has_data(const struct papr_rtas_blob *blob);45extern void papr_rtas_blob_free(const struct papr_rtas_blob *blob);46extern int papr_rtas_sequence_set_err(struct papr_rtas_sequence *seq,47int err);48extern const struct papr_rtas_blob *papr_rtas_retrieve(struct papr_rtas_sequence *seq);49extern long papr_rtas_setup_file_interface(struct papr_rtas_sequence *seq,50const struct file_operations *fops, char *name);51extern bool papr_rtas_sequence_should_stop(const struct papr_rtas_sequence *seq,52s32 status, bool init_state);53extern ssize_t papr_rtas_common_handle_read(struct file *file,54char __user *buf, size_t size, loff_t *off);55extern int papr_rtas_common_handle_release(struct inode *inode,56struct file *file);57extern loff_t papr_rtas_common_handle_seek(struct file *file, loff_t off,58int whence);59#endif /* _ASM_POWERPC_PAPR_RTAS_COMMON_H */60616263