Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  * Copyright 2019 Google Inc
0004  *
0005  * This program is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU General Public License
0007  * as published by the Free Software Foundation; either version
0008  * 2 of the License, or (at your option) any later version.
0009  *
0010  * Provides a simple driver to control the ASPEED P2A interface which allows
0011  * the host to read and write to various regions of the BMC's memory.
0012  */
0013 
0014 #ifndef _UAPI_LINUX_ASPEED_P2A_CTRL_H
0015 #define _UAPI_LINUX_ASPEED_P2A_CTRL_H
0016 
0017 #include <linux/ioctl.h>
0018 #include <linux/types.h>
0019 
0020 #define ASPEED_P2A_CTRL_READ_ONLY 0
0021 #define ASPEED_P2A_CTRL_READWRITE 1
0022 
0023 /*
0024  * This driver provides a mechanism for enabling or disabling the read-write
0025  * property of specific windows into the ASPEED BMC's memory.
0026  *
0027  * A user can map a region of the BMC's memory as read-only or read-write, with
0028  * the caveat that once any region is mapped, all regions are unlocked for
0029  * reading.
0030  */
0031 
0032 /*
0033  * Unlock a region of BMC physical memory for access from the host.
0034  *
0035  * Also used to read back the optional memory-region configuration for the
0036  * driver.
0037  */
0038 struct aspeed_p2a_ctrl_mapping {
0039     __u64 addr;
0040     __u32 length;
0041     __u32 flags;
0042 };
0043 
0044 #define __ASPEED_P2A_CTRL_IOCTL_MAGIC 0xb3
0045 
0046 /*
0047  * This IOCTL is meant to configure a region or regions of memory given a
0048  * starting address and length to be readable by the host, or
0049  * readable-writeable.
0050  */
0051 #define ASPEED_P2A_CTRL_IOCTL_SET_WINDOW _IOW(__ASPEED_P2A_CTRL_IOCTL_MAGIC, \
0052         0x00, struct aspeed_p2a_ctrl_mapping)
0053 
0054 /*
0055  * This IOCTL is meant to read back to the user the base address and length of
0056  * the memory-region specified to the driver for use with mmap.
0057  */
0058 #define ASPEED_P2A_CTRL_IOCTL_GET_MEMORY_CONFIG \
0059     _IOWR(__ASPEED_P2A_CTRL_IOCTL_MAGIC, \
0060         0x01, struct aspeed_p2a_ctrl_mapping)
0061 
0062 #endif /* _UAPI_LINUX_ASPEED_P2A_CTRL_H */