Advertisement
Coproscefalo

toshiba_h.patch

Oct 22nd, 2015
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. --- a/usr/src/linux/include/uapi/linux/toshiba.h
  2. +++ b/usr/src/linux/include/uapi/linux/toshiba.h
  3. @@ -1,6 +1,7 @@
  4. /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops
  5. *
  6. * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk)
  7. + * Copyright (c) 2015 Azael Avalos <coproscefalo@gmail.com>
  8. *
  9. * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers
  10. * on making sure the structure is aligned and packed.
  11. @@ -20,9 +21,18 @@
  12. #ifndef _UAPI_LINUX_TOSHIBA_H
  13. #define _UAPI_LINUX_TOSHIBA_H
  14.  
  15. -#define TOSH_PROC "/proc/toshiba"
  16. -#define TOSH_DEVICE "/dev/toshiba"
  17. -#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */
  18. +/*
  19. + * Toshiba modules paths
  20. + */
  21. +
  22. +#define TOSH_PROC "/proc/toshiba"
  23. +#define TOSH_DEVICE "/dev/toshiba"
  24. +#define TOSHIBA_ACPI_PROC "/proc/acpi/toshiba"
  25. +#define TOSHIBA_ACPI_DEVICE "/dev/toshiba_acpi"
  26. +
  27. +/*
  28. + * Toshiba SMM structure
  29. + */
  30.  
  31. typedef struct {
  32. unsigned int eax;
  33. @@ -33,5 +43,21 @@
  34. unsigned int edi __attribute__ ((packed));
  35. } SMMRegisters;
  36.  
  37. +/*
  38. + * IOCTLs (0x90 - 0x91)
  39. + */
  40. +
  41. +#define TOSH_SMM _IOWR('t', 0x90, SMMRegisters)
  42. +/*
  43. + * Convenience toshiba_acpi command.
  44. + *
  45. + * The System Configuration Interface (SCI) is opened/closed internally
  46. + * to avoid userspace of buggy BIOSes.
  47. + *
  48. + * The toshiba_acpi module checks whether the eax register is set with
  49. + * SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not.
  50. + */
  51. +#define TOSHIBA_ACPI_SCI _IOWR('t', 0x91, SMMRegisters)
  52. +
  53.  
  54. #endif /* _UAPI_LINUX_TOSHIBA_H */
  55.  
  56. --- a/usr/include/linux/toshiba.h
  57. +++ b/usr/include/linux/toshiba.h
  58. @@ -1,6 +1,7 @@
  59. /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops
  60. *
  61. * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk)
  62. + * Copyright (c) 2015 Azael Avalos <coproscefalo@gmail.com>
  63. *
  64. * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers
  65. * on making sure the structure is aligned and packed.
  66. @@ -20,9 +21,18 @@
  67. #ifndef _UAPI_LINUX_TOSHIBA_H
  68. #define _UAPI_LINUX_TOSHIBA_H
  69.  
  70. -#define TOSH_PROC "/proc/toshiba"
  71. -#define TOSH_DEVICE "/dev/toshiba"
  72. -#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */
  73. +/*
  74. + * Toshiba modules paths
  75. + */
  76. +
  77. +#define TOSH_PROC "/proc/toshiba"
  78. +#define TOSH_DEVICE "/dev/toshiba"
  79. +#define TOSHIBA_ACPI_PROC "/proc/acpi/toshiba"
  80. +#define TOSHIBA_ACPI_DEVICE "/dev/toshiba_acpi"
  81. +
  82. +/*
  83. + * Toshiba SMM structure
  84. + */
  85.  
  86. typedef struct {
  87. unsigned int eax;
  88. @@ -33,5 +43,21 @@
  89. unsigned int edi __attribute__ ((packed));
  90. } SMMRegisters;
  91.  
  92. +/*
  93. + * IOCTLs (0x90 - 0x91)
  94. + */
  95. +
  96. +#define TOSH_SMM _IOWR('t', 0x90, SMMRegisters)
  97. +/*
  98. + * Convenience toshiba_acpi command.
  99. + *
  100. + * The System Configuration Interface (SCI) is opened/closed internally
  101. + * to avoid userspace of buggy BIOSes.
  102. + *
  103. + * The toshiba_acpi module checks whether the eax register is set with
  104. + * SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not.
  105. + */
  106. +#define TOSHIBA_ACPI_SCI _IOWR('t', 0x91, SMMRegisters)
  107. +
  108.  
  109. #endif /* _UAPI_LINUX_TOSHIBA_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement