xref: /OK3568_Linux_fs/kernel/include/uapi/linux/aspeed-lpc-ctrl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright 2017 IBM Corp.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This program is free software; you can redistribute it and/or
6*4882a593Smuzhiyun  * modify it under the terms of the GNU General Public License
7*4882a593Smuzhiyun  * as published by the Free Software Foundation; either version
8*4882a593Smuzhiyun  * 2 of the License, or (at your option) any later version.
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef _UAPI_LINUX_ASPEED_LPC_CTRL_H
12*4882a593Smuzhiyun #define _UAPI_LINUX_ASPEED_LPC_CTRL_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <linux/ioctl.h>
15*4882a593Smuzhiyun #include <linux/types.h>
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun /* Window types */
18*4882a593Smuzhiyun #define ASPEED_LPC_CTRL_WINDOW_FLASH	1
19*4882a593Smuzhiyun #define ASPEED_LPC_CTRL_WINDOW_MEMORY	2
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun  * This driver provides a window for the host to access a BMC resource
23*4882a593Smuzhiyun  * across the BMC <-> Host LPC bus.
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  * window_type: The BMC resource that the host will access through the
26*4882a593Smuzhiyun  * window. BMC flash and BMC RAM.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * window_id: For each window type there may be multiple windows,
29*4882a593Smuzhiyun  * these are referenced by ID.
30*4882a593Smuzhiyun  *
31*4882a593Smuzhiyun  * flags: Reserved for future use, this field is expected to be
32*4882a593Smuzhiyun  * zeroed.
33*4882a593Smuzhiyun  *
34*4882a593Smuzhiyun  * addr: Address on the host LPC bus that the specified window should
35*4882a593Smuzhiyun  * be mapped. This address must be power of two aligned.
36*4882a593Smuzhiyun  *
37*4882a593Smuzhiyun  * offset: Offset into the BMC window that should be mapped to the
38*4882a593Smuzhiyun  * host (at addr). This must be a multiple of size.
39*4882a593Smuzhiyun  *
40*4882a593Smuzhiyun  * size: The size of the mapping. The smallest possible size is 64K.
41*4882a593Smuzhiyun  * This must be power of two aligned.
42*4882a593Smuzhiyun  *
43*4882a593Smuzhiyun  */
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun struct aspeed_lpc_ctrl_mapping {
46*4882a593Smuzhiyun 	__u8	window_type;
47*4882a593Smuzhiyun 	__u8	window_id;
48*4882a593Smuzhiyun 	__u16	flags;
49*4882a593Smuzhiyun 	__u32	addr;
50*4882a593Smuzhiyun 	__u32	offset;
51*4882a593Smuzhiyun 	__u32	size;
52*4882a593Smuzhiyun };
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun #define __ASPEED_LPC_CTRL_IOCTL_MAGIC	0xb2
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun #define ASPEED_LPC_CTRL_IOCTL_GET_SIZE	_IOWR(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
57*4882a593Smuzhiyun 		0x00, struct aspeed_lpc_ctrl_mapping)
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun #define ASPEED_LPC_CTRL_IOCTL_MAP	_IOW(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
60*4882a593Smuzhiyun 		0x01, struct aspeed_lpc_ctrl_mapping)
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun #endif /* _UAPI_LINUX_ASPEED_LPC_CTRL_H */
63