1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef _UAPI_PAPR_SYSPARM_H_ 3 #define _UAPI_PAPR_SYSPARM_H_ 4 5 #include <linux/types.h> 6 #include <asm/ioctl.h> 7 #include <asm/papr-miscdev.h> 8 9 enum { 10 PAPR_SYSPARM_MAX_INPUT = 1024, 11 PAPR_SYSPARM_MAX_OUTPUT = 4000, 12 }; 13 14 struct papr_sysparm_io_block { 15 __u32 parameter; 16 __u16 length; 17 __u8 data[PAPR_SYSPARM_MAX_OUTPUT]; 18 }; 19 20 /** 21 * PAPR_SYSPARM_IOC_GET - Retrieve the value of a PAPR system parameter. 22 * 23 * Uses _IOWR because of one corner case: Retrieving the value of the 24 * "OS Service Entitlement Status" parameter (60) requires the caller 25 * to supply input data (a date string) in the buffer passed to 26 * firmware. So the @length and @data of the incoming 27 * papr_sysparm_io_block are always used to initialize the work area 28 * supplied to ibm,get-system-parameter. No other parameters are known 29 * to parameterize the result this way, and callers are encouraged 30 * (but not required) to zero-initialize @length and @data in the 31 * common case. 32 * 33 * On error the contents of the ioblock are indeterminate. 34 * 35 * Return: 36 * 0: Success; @length is the length of valid data in @data, not to exceed @PAPR_SYSPARM_MAX_OUTPUT. 37 * -EIO: Platform error. (-1) 38 * -EINVAL: Incorrect data length or format. (-9999) 39 * -EPERM: The calling partition is not allowed to access this parameter. (-9002) 40 * -EOPNOTSUPP: Parameter not supported on this platform (-3) 41 */ 42 #define PAPR_SYSPARM_IOC_GET _IOWR(PAPR_MISCDEV_IOC_ID, 1, struct papr_sysparm_io_block) 43 44 /** 45 * PAPR_SYSPARM_IOC_SET - Update the value of a PAPR system parameter. 46 * 47 * The contents of the ioblock are unchanged regardless of success. 48 * 49 * Return: 50 * 0: Success; the parameter has been updated. 51 * -EIO: Platform error. (-1) 52 * -EINVAL: Incorrect data length or format. (-9999) 53 * -EPERM: The calling partition is not allowed to access this parameter. (-9002) 54 * -EOPNOTSUPP: Parameter not supported on this platform (-3) 55 */ 56 #define PAPR_SYSPARM_IOC_SET _IOW(PAPR_MISCDEV_IOC_ID, 2, struct papr_sysparm_io_block) 57 58 #endif /* _UAPI_PAPR_SYSPARM_H_ */ 59