xref: /linux/include/uapi/linux/toshiba.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2607ca46eSDavid Howells /* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops
3607ca46eSDavid Howells  *
4607ca46eSDavid Howells  * Copyright (c) 1996-2000  Jonathan A. Buzzard (jonathan@buzzard.org.uk)
5fc5462f8SAzael Avalos  * Copyright (c) 2015  Azael Avalos <coproscefalo@gmail.com>
6607ca46eSDavid Howells  *
7607ca46eSDavid Howells  * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers
8607ca46eSDavid Howells  * on making sure the structure is aligned and packed.
9607ca46eSDavid Howells  *
10607ca46eSDavid Howells  * This program is free software; you can redistribute it and/or modify it
11607ca46eSDavid Howells  * under the terms of the GNU General Public License as published by the
12607ca46eSDavid Howells  * Free Software Foundation; either version 2, or (at your option) any
13607ca46eSDavid Howells  * later version.
14607ca46eSDavid Howells  *
15607ca46eSDavid Howells  * This program is distributed in the hope that it will be useful, but
16607ca46eSDavid Howells  * WITHOUT ANY WARRANTY; without even the implied warranty of
17607ca46eSDavid Howells  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18607ca46eSDavid Howells  * General Public License for more details.
19607ca46eSDavid Howells  *
20607ca46eSDavid Howells  */
21607ca46eSDavid Howells 
22607ca46eSDavid Howells #ifndef _UAPI_LINUX_TOSHIBA_H
23607ca46eSDavid Howells #define _UAPI_LINUX_TOSHIBA_H
24607ca46eSDavid Howells 
25fc5462f8SAzael Avalos /*
26fc5462f8SAzael Avalos  * Toshiba modules paths
27fc5462f8SAzael Avalos  */
28fc5462f8SAzael Avalos 
29607ca46eSDavid Howells #define TOSH_PROC		"/proc/toshiba"
30607ca46eSDavid Howells #define TOSH_DEVICE		"/dev/toshiba"
31fc5462f8SAzael Avalos #define TOSHIBA_ACPI_PROC	"/proc/acpi/toshiba"
32fc5462f8SAzael Avalos #define TOSHIBA_ACPI_DEVICE	"/dev/toshiba_acpi"
33fc5462f8SAzael Avalos 
34fc5462f8SAzael Avalos /*
35fc5462f8SAzael Avalos  * Toshiba SMM structure
36fc5462f8SAzael Avalos  */
37607ca46eSDavid Howells 
38607ca46eSDavid Howells typedef struct {
39607ca46eSDavid Howells 	unsigned int eax;
40607ca46eSDavid Howells 	unsigned int ebx __attribute__ ((packed));
41607ca46eSDavid Howells 	unsigned int ecx __attribute__ ((packed));
42607ca46eSDavid Howells 	unsigned int edx __attribute__ ((packed));
43607ca46eSDavid Howells 	unsigned int esi __attribute__ ((packed));
44607ca46eSDavid Howells 	unsigned int edi __attribute__ ((packed));
45607ca46eSDavid Howells } SMMRegisters;
46607ca46eSDavid Howells 
47fc5462f8SAzael Avalos /*
48fc5462f8SAzael Avalos  * IOCTLs (0x90 - 0x91)
49fc5462f8SAzael Avalos  */
50fc5462f8SAzael Avalos 
51fc5462f8SAzael Avalos #define TOSH_SMM		_IOWR('t', 0x90, SMMRegisters)
52fc5462f8SAzael Avalos /*
53fc5462f8SAzael Avalos  * Convenience toshiba_acpi command.
54fc5462f8SAzael Avalos  *
55fc5462f8SAzael Avalos  * The System Configuration Interface (SCI) is opened/closed internally
56fc5462f8SAzael Avalos  * to avoid userspace of buggy BIOSes.
57fc5462f8SAzael Avalos  *
58fc5462f8SAzael Avalos  * The toshiba_acpi module checks whether the eax register is set with
59fc5462f8SAzael Avalos  * SCI_GET (0xf300) or SCI_SET (0xf400), returning -EINVAL if not.
60fc5462f8SAzael Avalos  */
61fc5462f8SAzael Avalos #define TOSHIBA_ACPI_SCI	_IOWR('t', 0x91, SMMRegisters)
62fc5462f8SAzael Avalos 
63607ca46eSDavid Howells 
64607ca46eSDavid Howells #endif /* _UAPI_LINUX_TOSHIBA_H */
65