| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2005, 2006 IBM Corporation |
|---|
| 3 | 4 | * Copyright (C) 2014, 2015 Intel Corporation |
|---|
| .. | .. |
|---|
| 13 | 14 | * |
|---|
| 14 | 15 | * This device driver implements the TPM interface as defined in |
|---|
| 15 | 16 | * the TCG TPM Interface Spec version 1.2, revision 1.0. |
|---|
| 16 | | - * |
|---|
| 17 | | - * This program is free software; you can redistribute it and/or |
|---|
| 18 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 19 | | - * published by the Free Software Foundation, version 2 of the |
|---|
| 20 | | - * License. |
|---|
| 21 | 17 | */ |
|---|
| 22 | 18 | |
|---|
| 23 | 19 | #ifndef __TPM_TIS_CORE_H__ |
|---|
| .. | .. |
|---|
| 38 | 34 | TPM_STS_GO = 0x20, |
|---|
| 39 | 35 | TPM_STS_DATA_AVAIL = 0x10, |
|---|
| 40 | 36 | TPM_STS_DATA_EXPECT = 0x08, |
|---|
| 37 | + TPM_STS_READ_ZERO = 0x23, /* bits that must be zero on read */ |
|---|
| 41 | 38 | }; |
|---|
| 42 | 39 | |
|---|
| 43 | 40 | enum tis_int_flags { |
|---|
| .. | .. |
|---|
| 57 | 54 | TIS_MEM_LEN = 0x5000, |
|---|
| 58 | 55 | TIS_SHORT_TIMEOUT = 750, /* ms */ |
|---|
| 59 | 56 | TIS_LONG_TIMEOUT = 2000, /* 2 sec */ |
|---|
| 57 | + TIS_TIMEOUT_MIN_ATML = 14700, /* usecs */ |
|---|
| 58 | + TIS_TIMEOUT_MAX_ATML = 15000, /* usecs */ |
|---|
| 60 | 59 | }; |
|---|
| 61 | 60 | |
|---|
| 62 | 61 | /* Some timeout values are needed before it is known whether the chip is |
|---|
| .. | .. |
|---|
| 86 | 85 | |
|---|
| 87 | 86 | enum tpm_tis_flags { |
|---|
| 88 | 87 | TPM_TIS_ITPM_WORKAROUND = BIT(0), |
|---|
| 88 | + TPM_TIS_INVALID_STATUS = BIT(1), |
|---|
| 89 | 89 | }; |
|---|
| 90 | 90 | |
|---|
| 91 | 91 | struct tpm_tis_data { |
|---|
| 92 | 92 | u16 manufacturer_id; |
|---|
| 93 | + struct mutex locality_count_mutex; |
|---|
| 94 | + unsigned int locality_count; |
|---|
| 93 | 95 | int locality; |
|---|
| 94 | 96 | int irq; |
|---|
| 95 | 97 | bool irq_tested; |
|---|
| 96 | | - unsigned int flags; |
|---|
| 98 | + unsigned long flags; |
|---|
| 97 | 99 | void __iomem *ilb_base_addr; |
|---|
| 98 | 100 | u16 clkrun_enabled; |
|---|
| 99 | 101 | wait_queue_head_t int_queue; |
|---|
| 100 | 102 | wait_queue_head_t read_queue; |
|---|
| 101 | 103 | const struct tpm_tis_phy_ops *phy_ops; |
|---|
| 102 | 104 | unsigned short rng_quality; |
|---|
| 105 | + unsigned int timeout_min; /* usecs */ |
|---|
| 106 | + unsigned int timeout_max; /* usecs */ |
|---|
| 103 | 107 | }; |
|---|
| 104 | 108 | |
|---|
| 105 | 109 | struct tpm_tis_phy_ops { |
|---|