2017-12-04 23:57:28 +07:00
|
|
|
/*
|
|
|
|
* AMD Platform Security Processor (PSP) interface driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Advanced Micro Devices, Inc.
|
|
|
|
*
|
|
|
|
* Author: Brijesh Singh <brijesh.singh@amd.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __PSP_DEV_H__
|
|
|
|
#define __PSP_DEV_H__
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/wait.h>
|
|
|
|
#include <linux/dmapool.h>
|
|
|
|
#include <linux/hw_random.h>
|
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/irqreturn.h>
|
|
|
|
#include <linux/dmaengine.h>
|
2017-12-04 23:57:28 +07:00
|
|
|
#include <linux/psp-sev.h>
|
|
|
|
#include <linux/miscdevice.h>
|
2017-12-04 23:57:28 +07:00
|
|
|
|
|
|
|
#include "sp-dev.h"
|
|
|
|
|
2018-07-04 00:11:52 +07:00
|
|
|
#define PSP_CMD_COMPLETE BIT(1)
|
2017-12-04 23:57:28 +07:00
|
|
|
|
2017-12-04 23:57:28 +07:00
|
|
|
#define PSP_CMDRESP_CMD_SHIFT 16
|
|
|
|
#define PSP_CMDRESP_IOC BIT(0)
|
|
|
|
#define PSP_CMDRESP_RESP BIT(31)
|
|
|
|
#define PSP_CMDRESP_ERR_MASK 0xffff
|
|
|
|
|
|
|
|
#define MAX_PSP_NAME_LEN 16
|
|
|
|
|
2017-12-04 23:57:28 +07:00
|
|
|
struct sev_misc_dev {
|
|
|
|
struct kref refcount;
|
|
|
|
struct miscdevice misc;
|
|
|
|
};
|
|
|
|
|
2017-12-04 23:57:28 +07:00
|
|
|
struct psp_device {
|
|
|
|
struct list_head entry;
|
|
|
|
|
|
|
|
struct psp_vdata *vdata;
|
|
|
|
char name[MAX_PSP_NAME_LEN];
|
|
|
|
|
|
|
|
struct device *dev;
|
|
|
|
struct sp_device *sp;
|
|
|
|
|
|
|
|
void __iomem *io_regs;
|
2017-12-04 23:57:28 +07:00
|
|
|
|
|
|
|
int sev_state;
|
|
|
|
unsigned int sev_int_rcvd;
|
|
|
|
wait_queue_head_t sev_int_queue;
|
|
|
|
struct sev_misc_dev *sev_misc;
|
|
|
|
struct sev_user_data_status status_cmd_buf;
|
|
|
|
struct sev_data_init init_cmd_buf;
|
2018-05-26 03:23:29 +07:00
|
|
|
|
|
|
|
u8 api_major;
|
|
|
|
u8 api_minor;
|
|
|
|
u8 build;
|
2017-12-04 23:57:28 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __PSP_DEV_H */
|