xref: /linux/include/uapi/linux/aspeed-lpc-ctrl.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
26c4e9767SCyril Bur /*
36c4e9767SCyril Bur  * Copyright 2017 IBM Corp.
46c4e9767SCyril Bur  *
56c4e9767SCyril Bur  * This program is free software; you can redistribute it and/or
66c4e9767SCyril Bur  * modify it under the terms of the GNU General Public License
76c4e9767SCyril Bur  * as published by the Free Software Foundation; either version
86c4e9767SCyril Bur  * 2 of the License, or (at your option) any later version.
96c4e9767SCyril Bur  */
106c4e9767SCyril Bur 
116c4e9767SCyril Bur #ifndef _UAPI_LINUX_ASPEED_LPC_CTRL_H
126c4e9767SCyril Bur #define _UAPI_LINUX_ASPEED_LPC_CTRL_H
136c4e9767SCyril Bur 
146c4e9767SCyril Bur #include <linux/ioctl.h>
15f580ff0eSArnd Bergmann #include <linux/types.h>
166c4e9767SCyril Bur 
176c4e9767SCyril Bur /* Window types */
186c4e9767SCyril Bur #define ASPEED_LPC_CTRL_WINDOW_FLASH	1
196c4e9767SCyril Bur #define ASPEED_LPC_CTRL_WINDOW_MEMORY	2
206c4e9767SCyril Bur 
216c4e9767SCyril Bur /*
226c4e9767SCyril Bur  * This driver provides a window for the host to access a BMC resource
236c4e9767SCyril Bur  * across the BMC <-> Host LPC bus.
246c4e9767SCyril Bur  *
256c4e9767SCyril Bur  * window_type: The BMC resource that the host will access through the
266c4e9767SCyril Bur  * window. BMC flash and BMC RAM.
276c4e9767SCyril Bur  *
286c4e9767SCyril Bur  * window_id: For each window type there may be multiple windows,
296c4e9767SCyril Bur  * these are referenced by ID.
306c4e9767SCyril Bur  *
316c4e9767SCyril Bur  * flags: Reserved for future use, this field is expected to be
326c4e9767SCyril Bur  * zeroed.
336c4e9767SCyril Bur  *
346c4e9767SCyril Bur  * addr: Address on the host LPC bus that the specified window should
356c4e9767SCyril Bur  * be mapped. This address must be power of two aligned.
366c4e9767SCyril Bur  *
376c4e9767SCyril Bur  * offset: Offset into the BMC window that should be mapped to the
386c4e9767SCyril Bur  * host (at addr). This must be a multiple of size.
396c4e9767SCyril Bur  *
406c4e9767SCyril Bur  * size: The size of the mapping. The smallest possible size is 64K.
416c4e9767SCyril Bur  * This must be power of two aligned.
426c4e9767SCyril Bur  *
436c4e9767SCyril Bur  */
446c4e9767SCyril Bur 
456c4e9767SCyril Bur struct aspeed_lpc_ctrl_mapping {
466c4e9767SCyril Bur 	__u8	window_type;
476c4e9767SCyril Bur 	__u8	window_id;
486c4e9767SCyril Bur 	__u16	flags;
496c4e9767SCyril Bur 	__u32	addr;
506c4e9767SCyril Bur 	__u32	offset;
516c4e9767SCyril Bur 	__u32	size;
526c4e9767SCyril Bur };
536c4e9767SCyril Bur 
546c4e9767SCyril Bur #define __ASPEED_LPC_CTRL_IOCTL_MAGIC	0xb2
556c4e9767SCyril Bur 
566c4e9767SCyril Bur #define ASPEED_LPC_CTRL_IOCTL_GET_SIZE	_IOWR(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
576c4e9767SCyril Bur 		0x00, struct aspeed_lpc_ctrl_mapping)
586c4e9767SCyril Bur 
596c4e9767SCyril Bur #define ASPEED_LPC_CTRL_IOCTL_MAP	_IOW(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
606c4e9767SCyril Bur 		0x01, struct aspeed_lpc_ctrl_mapping)
616c4e9767SCyril Bur 
626c4e9767SCyril Bur #endif /* _UAPI_LINUX_ASPEED_LPC_CTRL_H */
63