papr-sysparm.h 2.0 KB

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