psp-dev.h 1.5 KB

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