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