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 #include <linux/types.h>
15 
16 /* Window types */
17 #define ASPEED_LPC_CTRL_WINDOW_FLASH	1
18 #define ASPEED_LPC_CTRL_WINDOW_MEMORY	2
19 
20 /*
21  * This driver provides a window for the host to access a BMC resource
22  * across the BMC <-> Host LPC bus.
23  *
24  * window_type: The BMC resource that the host will access through the
25  * window. BMC flash and BMC RAM.
26  *
27  * window_id: For each window type there may be multiple windows,
28  * these are referenced by ID.
29  *
30  * flags: Reserved for future use, this field is expected to be
31  * zeroed.
32  *
33  * addr: Address on the host LPC bus that the specified window should
34  * be mapped. This address must be power of two aligned.
35  *
36  * offset: Offset into the BMC window that should be mapped to the
37  * host (at addr). This must be a multiple of size.
38  *
39  * size: The size of the mapping. The smallest possible size is 64K.
40  * This must be power of two aligned.
41  *
42  */
43 
44 struct aspeed_lpc_ctrl_mapping {
45 	__u8	window_type;
46 	__u8	window_id;
47 	__u16	flags;
48 	__u32	addr;
49 	__u32	offset;
50 	__u32	size;
51 };
52 
53 #define __ASPEED_LPC_CTRL_IOCTL_MAGIC	0xb2
54 
55 #define ASPEED_LPC_CTRL_IOCTL_GET_SIZE	_IOWR(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
56 		0x00, struct aspeed_lpc_ctrl_mapping)
57 
58 #define ASPEED_LPC_CTRL_IOCTL_MAP	_IOW(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
59 		0x01, struct aspeed_lpc_ctrl_mapping)
60 
61 #endif /* _UAPI_LINUX_ASPEED_LPC_CTRL_H */
62