wmi.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
  2. /*
  3. * User API methods for ACPI-WMI mapping driver
  4. *
  5. * Copyright (C) 2017 Dell, Inc.
  6. */
  7. #ifndef _LINUX_WMI_H
  8. #define _LINUX_WMI_H
  9. #include <linux/ioctl.h>
  10. #include <linux/types.h>
  11. /* WMI bus will filter all WMI vendor driver requests through this IOC */
  12. #define WMI_IOC 'W'
  13. /* All ioctl requests through WMI should declare their size followed by
  14. * relevant data objects
  15. */
  16. struct wmi_ioctl_buffer {
  17. __u64 length;
  18. __u8 data[];
  19. };
  20. /* This structure may be modified by the firmware when we enter
  21. * system management mode through SMM, hence the volatiles
  22. */
  23. struct calling_interface_buffer {
  24. __u16 cmd_class;
  25. __u16 cmd_select;
  26. __volatile__ __u32 input[4];
  27. __volatile__ __u32 output[4];
  28. } __attribute__((packed));
  29. struct dell_wmi_extensions {
  30. __u32 argattrib;
  31. __u32 blength;
  32. __u8 data[];
  33. } __attribute__((packed));
  34. struct dell_wmi_smbios_buffer {
  35. __u64 length;
  36. struct calling_interface_buffer std;
  37. struct dell_wmi_extensions ext;
  38. } __attribute__((packed));
  39. /* Whitelisted smbios class/select commands */
  40. #define CLASS_TOKEN_READ 0
  41. #define CLASS_TOKEN_WRITE 1
  42. #define SELECT_TOKEN_STD 0
  43. #define SELECT_TOKEN_BAT 1
  44. #define SELECT_TOKEN_AC 2
  45. #define CLASS_FLASH_INTERFACE 7
  46. #define SELECT_FLASH_INTERFACE 3
  47. #define CLASS_ADMIN_PROP 10
  48. #define SELECT_ADMIN_PROP 3
  49. #define CLASS_INFO 17
  50. #define SELECT_RFKILL 11
  51. #define SELECT_APP_REGISTRATION 3
  52. #define SELECT_DOCK 22
  53. /* whitelisted tokens */
  54. #define CAPSULE_EN_TOKEN 0x0461
  55. #define CAPSULE_DIS_TOKEN 0x0462
  56. #define WSMT_EN_TOKEN 0x04EC
  57. #define WSMT_DIS_TOKEN 0x04ED
  58. /* Dell SMBIOS calling IOCTL command used by dell-smbios-wmi */
  59. #define DELL_WMI_SMBIOS_CMD _IOWR(WMI_IOC, 0, struct dell_wmi_smbios_buffer)
  60. #endif