Commit 9f9ce3c369b7fbcc47496331ff28fad80302a42c

Authored by Miquel Raynal
Committed by Tom Rini
1 parent 06425aa087

tpm: prepare introduction of TPMv2.x support in Kconfig

Because both major revisions are not compatible at all, let's make them
mutually exclusive in Kconfig. This way we will be sure, when using a
command or a library function that it is supported by the right
revision.

Current drivers are currently prefixed by "tpm_", we will prefix TPMv2.x
files by "tpm2_" to make the distinction without moving everything.

The Kconfig menu about TPM drivers is now divided into two sections, one
for each specification. Compliant drivers with one specification will
only show up if this specification _only_ has been selected, otherwise a
comment is displayed.

Once a driver is selected by the user, it selects automatically a
boolean value, that is needed in order to activate the TPM commands.
Selecting the TPM commands will automatically select the right
command/library files.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
[trini: Rework deps as TPM_V1 and TPM_V2 depend on TPM,
        drop TPM_DRIVER_SELECTED]
Signed-off-by: Tom Rini <trini@konsulko.com>

Showing 4 changed files with 58 additions and 19 deletions Side-by-side Diff

... ... @@ -1491,24 +1491,36 @@
1491 1491 help
1492 1492 Add -v option to verify data against a hash.
1493 1493  
  1494 +config CMD_TPM_V1
  1495 + bool
  1496 +
  1497 +config CMD_TPM_V2
  1498 + bool
  1499 +
1494 1500 config CMD_TPM
1495 1501 bool "Enable the 'tpm' command"
1496   - depends on TPM
  1502 + depends on TPM_V1 || TPM_V2
  1503 + select CMD_TPM_V1 if TPM_V1
  1504 + select CMD_TPM_V2 if TPM_V2
1497 1505 help
1498 1506 This provides a means to talk to a TPM from the command line. A wide
1499 1507 range of commands if provided - see 'tpm help' for details. The
1500 1508 command requires a suitable TPM on your board and the correct driver
1501 1509 must be enabled.
1502 1510  
  1511 +if CMD_TPM
  1512 +
1503 1513 config CMD_TPM_TEST
1504 1514 bool "Enable the 'tpm test' command"
1505   - depends on CMD_TPM
  1515 + depends on TPM_V1
1506 1516 help
1507   - This provides a a series of tests to confirm that the TPM is working
1508   - correctly. The tests cover initialisation, non-volatile RAM, extend,
1509   - global lock and checking that timing is within expectations. The
1510   - tests pass correctly on Infineon TPMs but may need to be adjusted
  1517 + This provides a a series of tests to confirm that the TPMv1.x is
  1518 + working correctly. The tests cover initialisation, non-volatile RAM,
  1519 + extend, global lock and checking that timing is within expectations.
  1520 + The tests pass correctly on Infineon TPMs but may need to be adjusted
1511 1521 for other devices.
  1522 +
  1523 +endif
1512 1524  
1513 1525 endmenu
1514 1526  
... ... @@ -120,7 +120,7 @@
120 120 obj-$(CONFIG_CMD_TIME) += time.o
121 121 obj-$(CONFIG_CMD_TRACE) += trace.o
122 122 obj-$(CONFIG_HUSH_PARSER) += test.o
123   -obj-$(CONFIG_CMD_TPM) += tpm.o
  123 +obj-$(CONFIG_CMD_TPM_V1) += tpm.o
124 124 obj-$(CONFIG_CMD_TPM_TEST) += tpm_test.o
125 125 obj-$(CONFIG_CMD_CROS_EC) += cros_ec.o
126 126 obj-$(CONFIG_CMD_TSI148) += tsi148.o
... ... @@ -4,9 +4,22 @@
4 4  
5 5 menu "TPM support"
6 6  
  7 +comment "Please select only one TPM revision"
  8 + depends on TPM_V1 && TPM_V2
  9 +
  10 +config TPM_V1
  11 + bool "TPMv1.x support"
  12 + depends on TPM
  13 + default y
  14 + help
  15 + Major TPM versions are not compatible at all, choose either
  16 + one or the other. This option enables TPMv1.x drivers/commands.
  17 +
  18 +if TPM_V1 && !TPM_V2
  19 +
7 20 config TPM_TIS_SANDBOX
8 21 bool "Enable sandbox TPM driver"
9   - depends on SANDBOX
  22 + depends on TPM_V1 && SANDBOX
10 23 help
11 24 This driver emulates a TPM, providing access to base functions
12 25 such as reading and writing TPM private data. This is enough to
... ... @@ -15,7 +28,7 @@
15 28  
16 29 config TPM_ATMEL_TWI
17 30 bool "Enable Atmel TWI TPM device driver"
18   - depends on TPM
  31 + depends on TPM_V1
19 32 help
20 33 This driver supports an Atmel TPM device connected on the I2C bus.
21 34 The usual tpm operations and the 'tpm' command can be used to talk
... ... @@ -24,7 +37,7 @@
24 37  
25 38 config TPM_TIS_INFINEON
26 39 bool "Enable support for Infineon SLB9635/45 TPMs on I2C"
27   - depends on TPM && DM_I2C
  40 + depends on TPM_V1 && DM_I2C
28 41 help
29 42 This driver supports Infineon TPM devices connected on the I2C bus.
30 43 The usual tpm operations and the 'tpm' command can be used to talk
... ... @@ -33,7 +46,7 @@
33 46  
34 47 config TPM_TIS_I2C_BURST_LIMITATION
35 48 bool "Enable I2C burst length limitation"
36   - depends on TPM_TIS_INFINEON
  49 + depends on TPM_V1 && TPM_TIS_INFINEON
37 50 help
38 51 Some broken TPMs have a limitation on the number of bytes they can
39 52 receive in one message. Enable this option to allow you to set this
... ... @@ -48,7 +61,7 @@
48 61  
49 62 config TPM_TIS_LPC
50 63 bool "Enable support for Infineon SLB9635/45 TPMs on LPC"
51   - depends on TPM && X86
  64 + depends on TPM_V1 && X86
52 65 help
53 66 This driver supports Infineon TPM devices connected on the LPC bus.
54 67 The usual tpm operations and the 'tpm' command can be used to talk
... ... @@ -57,7 +70,7 @@
57 70  
58 71 config TPM_AUTH_SESSIONS
59 72 bool "Enable TPM authentication session support"
60   - depends on TPM
  73 + depends on TPM_V1
61 74 help
62 75 Enable support for authorised (AUTH1) commands as specified in the
63 76 TCG Main Specification 1.2. OIAP-authorised versions of the commands
... ... @@ -66,7 +79,7 @@
66 79  
67 80 config TPM_ST33ZP24_I2C
68 81 bool "STMicroelectronics ST33ZP24 I2C TPM"
69   - depends on TPM && DM_I2C
  82 + depends on TPM_V1 && DM_I2C
70 83 ---help---
71 84 This driver supports STMicroelectronics TPM devices connected on the I2C bus.
72 85 The usual tpm operations and the 'tpm' command can be used to talk
... ... @@ -75,7 +88,7 @@
75 88  
76 89 config TPM_ST33ZP24_SPI
77 90 bool "STMicroelectronics ST33ZP24 SPI TPM"
78   - depends on TPM && DM_SPI
  91 + depends on TPM_V1 && DM_SPI
79 92 ---help---
80 93 This driver supports STMicroelectronics TPM devices connected on the SPI bus.
81 94 The usual tpm operations and the 'tpm' command can be used to talk
82 95  
... ... @@ -84,14 +97,14 @@
84 97  
85 98 config TPM_FLUSH_RESOURCES
86 99 bool "Enable TPM resource flushing support"
87   - depends on TPM
  100 + depends on TPM_V1
88 101 help
89 102 Enable support to flush specific resources (e.g. keys) from the TPM.
90 103 The functionality is available via the 'tpm' command as well.
91 104  
92 105 config TPM_LOAD_KEY_BY_SHA1
93 106 bool "Enable TPM key loading by SHA1 support"
94   - depends on TPM
  107 + depends on TPM_V1
95 108 help
96 109 Enable support to load keys into the TPM by identifying
97 110 their parent via the public key's SHA1 hash.
98 111  
... ... @@ -99,9 +112,23 @@
99 112  
100 113 config TPM_LIST_RESOURCES
101 114 bool "Enable TPM resource listing support"
102   - depends on TPM
  115 + depends on TPM_V1
103 116 help
104 117 Enable support to list specific resources (e.g. keys) within the TPM.
105 118 The functionality is available via the 'tpm' command as well.
  119 +
  120 +endif # TPM_V1
  121 +
  122 +config TPM_V2
  123 + bool "TPMv2.x support"
  124 + depends on TPM
  125 + help
  126 + Major TPM versions are not compatible at all, choose either
  127 + one or the other. This option enables TPMv2.x drivers/commands.
  128 +
  129 +if TPM_V2 && !TPM_V1
  130 +
  131 +endif # TPM_V2
  132 +
106 133 endmenu
... ... @@ -39,7 +39,7 @@
39 39 obj-y += qsort.o
40 40 obj-y += rc4.o
41 41 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += sha256.o
42   -obj-$(CONFIG_TPM) += tpm.o
  42 +obj-$(CONFIG_TPM_V1) += tpm.o
43 43 obj-$(CONFIG_RBTREE) += rbtree.o
44 44 obj-$(CONFIG_BITREVERSE) += bitrev.o
45 45 obj-y += list_sort.o