xref: /OK3568_Linux_fs/kernel/include/uapi/linux/toshiba.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2*4882a593Smuzhiyun /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (c) 1996-2000  Jonathan A. Buzzard (jonathan@buzzard.org.uk)
5*4882a593Smuzhiyun  * Copyright (c) 2015  Azael Avalos <coproscefalo@gmail.com>
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers
8*4882a593Smuzhiyun  * on making sure the structure is aligned and packed.
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or modify it
11*4882a593Smuzhiyun  * under the terms of the GNU General Public License as published by the
12*4882a593Smuzhiyun  * Free Software Foundation; either version 2, or (at your option) any
13*4882a593Smuzhiyun  * later version.
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * This program is distributed in the hope that it will be useful, but
16*4882a593Smuzhiyun  * WITHOUT ANY WARRANTY; without even the implied warranty of
17*4882a593Smuzhiyun  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18*4882a593Smuzhiyun  * General Public License for more details.
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun #ifndef _UAPI_LINUX_TOSHIBA_H
23*4882a593Smuzhiyun #define _UAPI_LINUX_TOSHIBA_H
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun /*
26*4882a593Smuzhiyun  * Toshiba modules paths
27*4882a593Smuzhiyun  */
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #define TOSH_PROC		"/proc/toshiba"
30*4882a593Smuzhiyun #define TOSH_DEVICE		"/dev/toshiba"
31*4882a593Smuzhiyun #define TOSHIBA_ACPI_PROC	"/proc/acpi/toshiba"
32*4882a593Smuzhiyun #define TOSHIBA_ACPI_DEVICE	"/dev/toshiba_acpi"
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun /*
35*4882a593Smuzhiyun  * Toshiba SMM structure
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun typedef struct {
39*4882a593Smuzhiyun 	unsigned int eax;
40*4882a593Smuzhiyun 	unsigned int ebx __attribute__ ((packed));
41*4882a593Smuzhiyun 	unsigned int ecx __attribute__ ((packed));
42*4882a593Smuzhiyun 	unsigned int edx __attribute__ ((packed));
43*4882a593Smuzhiyun 	unsigned int esi __attribute__ ((packed));
44*4882a593Smuzhiyun 	unsigned int edi __attribute__ ((packed));
45*4882a593Smuzhiyun } SMMRegisters;
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /*
48*4882a593Smuzhiyun  * IOCTLs (0x90 - 0x91)
49*4882a593Smuzhiyun  */
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun #define TOSH_SMM		_IOWR('t', 0x90, SMMRegisters)
52*4882a593Smuzhiyun /*
53*4882a593Smuzhiyun  * Convenience toshiba_acpi command.
54*4882a593Smuzhiyun  *
55*4882a593Smuzhiyun  * The System Configuration Interface (SCI) is opened/closed internally
56*4882a593Smuzhiyun  * to avoid userspace of buggy BIOSes.
57*4882a593Smuzhiyun  *
58*4882a593Smuzhiyun  * The toshiba_acpi module checks whether the eax register is set with
59*4882a593Smuzhiyun  * SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not.
60*4882a593Smuzhiyun  */
61*4882a593Smuzhiyun #define TOSHIBA_ACPI_SCI	_IOWR('t', 0x91, SMMRegisters)
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #endif /* _UAPI_LINUX_TOSHIBA_H */
65