psp-dev.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * AMD Platform Security Processor (PSP) interface driver
  4. *
  5. * Copyright (C) 2017-2018 Advanced Micro Devices, Inc.
  6. *
  7. * Author: Brijesh Singh <brijesh.singh@amd.com>
  8. */
  9. #ifndef __PSP_DEV_H__
  10. #define __PSP_DEV_H__
  11. #include <linux/device.h>
  12. #include <linux/spinlock.h>
  13. #include <linux/mutex.h>
  14. #include <linux/list.h>
  15. #include <linux/wait.h>
  16. #include <linux/dmapool.h>
  17. #include <linux/hw_random.h>
  18. #include <linux/bitops.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/irqreturn.h>
  21. #include <linux/dmaengine.h>
  22. #include <linux/psp-sev.h>
  23. #include <linux/miscdevice.h>
  24. #include "sp-dev.h"
  25. #define PSP_CMD_COMPLETE BIT(1)
  26. #define PSP_CMDRESP_CMD_SHIFT 16
  27. #define PSP_CMDRESP_IOC BIT(0)
  28. #define PSP_CMDRESP_RESP BIT(31)
  29. #define PSP_CMDRESP_ERR_MASK 0xffff
  30. #define MAX_PSP_NAME_LEN 16
  31. struct sev_misc_dev {
  32. struct kref refcount;
  33. struct miscdevice misc;
  34. };
  35. struct psp_device {
  36. struct list_head entry;
  37. struct psp_vdata *vdata;
  38. char name[MAX_PSP_NAME_LEN];
  39. struct device *dev;
  40. struct sp_device *sp;
  41. void __iomem *io_regs;
  42. int sev_state;
  43. unsigned int sev_int_rcvd;
  44. wait_queue_head_t sev_int_queue;
  45. struct sev_misc_dev *sev_misc;
  46. struct sev_user_data_status status_cmd_buf;
  47. struct sev_data_init init_cmd_buf;
  48. u8 api_major;
  49. u8 api_minor;
  50. u8 build;
  51. };
  52. #endif /* __PSP_DEV_H */