Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * Copyright (C) 2012 IBM Corporation
 4 *
 5 * Author: Ashley Lai <ashleydlai@gmail.com>
 6 *
 7 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
 8 *
 9 * Device driver for TCG/TCPA TPM (trusted platform module).
10 * Specifications at www.trustedcomputinggroup.org
 
 
 
 
 
 
11 */
12
13#ifndef __TPM_IBMVTPM_H__
14#define __TPM_IBMVTPM_H__
15
16/* vTPM Message Format 1 */
17struct ibmvtpm_crq {
18	u8 valid;
19	u8 msg;
20	__be16 len;
21	__be32 data;
22	__be64 reserved;
23} __attribute__((packed, aligned(8)));
24
25struct ibmvtpm_crq_queue {
26	struct ibmvtpm_crq *crq_addr;
27	u32 index;
28	u32 num_entry;
29	wait_queue_head_t wq;
30};
31
32struct ibmvtpm_dev {
33	struct device *dev;
34	struct vio_dev *vdev;
35	struct ibmvtpm_crq_queue crq_queue;
36	dma_addr_t crq_dma_handle;
37	u32 rtce_size;
38	void __iomem *rtce_buf;
39	dma_addr_t rtce_dma_handle;
40	spinlock_t rtce_lock;
41	wait_queue_head_t wq;
42	u16 res_len;
43	u32 vtpm_version;
44	u8 tpm_processing_cmd;
45};
46
47#define CRQ_RES_BUF_SIZE	PAGE_SIZE
48
49/* Initialize CRQ */
50#define INIT_CRQ_CMD		0xC001000000000000LL /* Init cmd */
51#define INIT_CRQ_COMP_CMD	0xC002000000000000LL /* Init complete cmd */
52#define INIT_CRQ_RES		0x01	/* Init respond */
53#define INIT_CRQ_COMP_RES	0x02	/* Init complete respond */
54#define VALID_INIT_CRQ		0xC0	/* Valid command for init crq */
55
56/* vTPM CRQ response is the message type | 0x80 */
57#define VTPM_MSG_RES		0x80
58#define IBMVTPM_VALID_CMD	0x80
59
60/* vTPM CRQ message types */
61#define VTPM_GET_VERSION			0x01
62#define VTPM_GET_VERSION_RES			(0x01 | VTPM_MSG_RES)
63
64#define VTPM_TPM_COMMAND			0x02
65#define VTPM_TPM_COMMAND_RES			(0x02 | VTPM_MSG_RES)
66
67#define VTPM_GET_RTCE_BUFFER_SIZE		0x03
68#define VTPM_GET_RTCE_BUFFER_SIZE_RES		(0x03 | VTPM_MSG_RES)
69
70#define VTPM_PREPARE_TO_SUSPEND			0x04
71#define VTPM_PREPARE_TO_SUSPEND_RES		(0x04 | VTPM_MSG_RES)
72
73#endif
v3.15
 
 1/*
 2 * Copyright (C) 2012 IBM Corporation
 3 *
 4 * Author: Ashley Lai <adlai@us.ibm.com>
 5 *
 6 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
 7 *
 8 * Device driver for TCG/TCPA TPM (trusted platform module).
 9 * Specifications at www.trustedcomputinggroup.org
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation, version 2 of the
14 * License.
15 *
16 */
17
18#ifndef __TPM_IBMVTPM_H__
19#define __TPM_IBMVTPM_H__
20
21/* vTPM Message Format 1 */
22struct ibmvtpm_crq {
23	u8 valid;
24	u8 msg;
25	u16 len;
26	u32 data;
27	u64 reserved;
28} __attribute__((packed, aligned(8)));
29
30struct ibmvtpm_crq_queue {
31	struct ibmvtpm_crq *crq_addr;
32	u32 index;
33	u32 num_entry;
 
34};
35
36struct ibmvtpm_dev {
37	struct device *dev;
38	struct vio_dev *vdev;
39	struct ibmvtpm_crq_queue crq_queue;
40	dma_addr_t crq_dma_handle;
41	u32 rtce_size;
42	void __iomem *rtce_buf;
43	dma_addr_t rtce_dma_handle;
44	spinlock_t rtce_lock;
45	wait_queue_head_t wq;
46	u16 res_len;
47	u32 vtpm_version;
 
48};
49
50#define CRQ_RES_BUF_SIZE	PAGE_SIZE
51
52/* Initialize CRQ */
53#define INIT_CRQ_CMD		0xC001000000000000LL /* Init cmd */
54#define INIT_CRQ_COMP_CMD	0xC002000000000000LL /* Init complete cmd */
55#define INIT_CRQ_RES		0x01	/* Init respond */
56#define INIT_CRQ_COMP_RES	0x02	/* Init complete respond */
57#define VALID_INIT_CRQ		0xC0	/* Valid command for init crq */
58
59/* vTPM CRQ response is the message type | 0x80 */
60#define VTPM_MSG_RES		0x80
61#define IBMVTPM_VALID_CMD	0x80
62
63/* vTPM CRQ message types */
64#define VTPM_GET_VERSION			0x01
65#define VTPM_GET_VERSION_RES			(0x01 | VTPM_MSG_RES)
66
67#define VTPM_TPM_COMMAND			0x02
68#define VTPM_TPM_COMMAND_RES			(0x02 | VTPM_MSG_RES)
69
70#define VTPM_GET_RTCE_BUFFER_SIZE		0x03
71#define VTPM_GET_RTCE_BUFFER_SIZE_RES		(0x03 | VTPM_MSG_RES)
72
73#define VTPM_PREPARE_TO_SUSPEND			0x04
74#define VTPM_PREPARE_TO_SUSPEND_RES		(0x04 | VTPM_MSG_RES)
75
76#endif