aspeed-p2a-ctrl.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. /*
  3. * Copyright 2019 Google Inc
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. *
  10. * Provides a simple driver to control the ASPEED P2A interface which allows
  11. * the host to read and write to various regions of the BMC's memory.
  12. */
  13. #ifndef _UAPI_LINUX_ASPEED_P2A_CTRL_H
  14. #define _UAPI_LINUX_ASPEED_P2A_CTRL_H
  15. #include <linux/ioctl.h>
  16. #include <linux/types.h>
  17. #define ASPEED_P2A_CTRL_READ_ONLY 0
  18. #define ASPEED_P2A_CTRL_READWRITE 1
  19. /*
  20. * This driver provides a mechanism for enabling or disabling the read-write
  21. * property of specific windows into the ASPEED BMC's memory.
  22. *
  23. * A user can map a region of the BMC's memory as read-only or read-write, with
  24. * the caveat that once any region is mapped, all regions are unlocked for
  25. * reading.
  26. */
  27. /*
  28. * Unlock a region of BMC physical memory for access from the host.
  29. *
  30. * Also used to read back the optional memory-region configuration for the
  31. * driver.
  32. */
  33. struct aspeed_p2a_ctrl_mapping {
  34. __u64 addr;
  35. __u32 length;
  36. __u32 flags;
  37. };
  38. #define __ASPEED_P2A_CTRL_IOCTL_MAGIC 0xb3
  39. /*
  40. * This IOCTL is meant to configure a region or regions of memory given a
  41. * starting address and length to be readable by the host, or
  42. * readable-writeable.
  43. */
  44. #define ASPEED_P2A_CTRL_IOCTL_SET_WINDOW _IOW(__ASPEED_P2A_CTRL_IOCTL_MAGIC, \
  45. 0x00, struct aspeed_p2a_ctrl_mapping)
  46. /*
  47. * This IOCTL is meant to read back to the user the base address and length of
  48. * the memory-region specified to the driver for use with mmap.
  49. */
  50. #define ASPEED_P2A_CTRL_IOCTL_GET_MEMORY_CONFIG \
  51. _IOWR(__ASPEED_P2A_CTRL_IOCTL_MAGIC, \
  52. 0x01, struct aspeed_p2a_ctrl_mapping)
  53. #endif /* _UAPI_LINUX_ASPEED_P2A_CTRL_H */