18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2017 IBM Corp.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or
68c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License
78c2ecf20Sopenharmony_ci * as published by the Free Software Foundation; either version
88c2ecf20Sopenharmony_ci * 2 of the License, or (at your option) any later version.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _UAPI_LINUX_ASPEED_LPC_CTRL_H
128c2ecf20Sopenharmony_ci#define _UAPI_LINUX_ASPEED_LPC_CTRL_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/ioctl.h>
158c2ecf20Sopenharmony_ci#include <linux/types.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* Window types */
188c2ecf20Sopenharmony_ci#define ASPEED_LPC_CTRL_WINDOW_FLASH	1
198c2ecf20Sopenharmony_ci#define ASPEED_LPC_CTRL_WINDOW_MEMORY	2
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * This driver provides a window for the host to access a BMC resource
238c2ecf20Sopenharmony_ci * across the BMC <-> Host LPC bus.
248c2ecf20Sopenharmony_ci *
258c2ecf20Sopenharmony_ci * window_type: The BMC resource that the host will access through the
268c2ecf20Sopenharmony_ci * window. BMC flash and BMC RAM.
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * window_id: For each window type there may be multiple windows,
298c2ecf20Sopenharmony_ci * these are referenced by ID.
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * flags: Reserved for future use, this field is expected to be
328c2ecf20Sopenharmony_ci * zeroed.
338c2ecf20Sopenharmony_ci *
348c2ecf20Sopenharmony_ci * addr: Address on the host LPC bus that the specified window should
358c2ecf20Sopenharmony_ci * be mapped. This address must be power of two aligned.
368c2ecf20Sopenharmony_ci *
378c2ecf20Sopenharmony_ci * offset: Offset into the BMC window that should be mapped to the
388c2ecf20Sopenharmony_ci * host (at addr). This must be a multiple of size.
398c2ecf20Sopenharmony_ci *
408c2ecf20Sopenharmony_ci * size: The size of the mapping. The smallest possible size is 64K.
418c2ecf20Sopenharmony_ci * This must be power of two aligned.
428c2ecf20Sopenharmony_ci *
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistruct aspeed_lpc_ctrl_mapping {
468c2ecf20Sopenharmony_ci	__u8	window_type;
478c2ecf20Sopenharmony_ci	__u8	window_id;
488c2ecf20Sopenharmony_ci	__u16	flags;
498c2ecf20Sopenharmony_ci	__u32	addr;
508c2ecf20Sopenharmony_ci	__u32	offset;
518c2ecf20Sopenharmony_ci	__u32	size;
528c2ecf20Sopenharmony_ci};
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define __ASPEED_LPC_CTRL_IOCTL_MAGIC	0xb2
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define ASPEED_LPC_CTRL_IOCTL_GET_SIZE	_IOWR(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
578c2ecf20Sopenharmony_ci		0x00, struct aspeed_lpc_ctrl_mapping)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#define ASPEED_LPC_CTRL_IOCTL_MAP	_IOW(__ASPEED_LPC_CTRL_IOCTL_MAGIC, \
608c2ecf20Sopenharmony_ci		0x01, struct aspeed_lpc_ctrl_mapping)
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#endif /* _UAPI_LINUX_ASPEED_LPC_CTRL_H */
63