aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/pc80
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2020-09-21 09:48:53 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-11-22 22:27:29 +0000
commitd8d8be1a6a008d061727ddd07bd39bd435c4aaf0 (patch)
tree8f6c766dc31217d3d7a468fe671fefb61fed2811 /src/drivers/pc80
parentac7f461d8d592cc3cbad0be491f15fe4238e1348 (diff)
drivers/tpm: Move PPI stub
As preparation to a full PPI implementation move the acpi code out of the pc80/tpm/tis driver into the generic tpm driver folder. This doesn't change any functionality. Change-Id: I7818d0344d4a08926195bd4804565502717c48fa Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/45567 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/drivers/pc80')
-rw-r--r--src/drivers/pc80/tpm/tis.c128
1 files changed, 6 insertions, 122 deletions
diff --git a/src/drivers/pc80/tpm/tis.c b/src/drivers/pc80/tpm/tis.c
index 27d238ce75..48e529ad9f 100644
--- a/src/drivers/pc80/tpm/tis.c
+++ b/src/drivers/pc80/tpm/tis.c
@@ -21,13 +21,11 @@
#include <console/console.h>
#include <security/tpm/tis.h>
#include <device/pnp.h>
+#include <drivers/tpm/tpm_ppi.h>
#include "chip.h"
#define PREFIX "lpc_tpm: "
-/* TCG Physical Presence Interface */
-#define TPM_PPI_UUID "3dddfaa6-361b-4eb4-a424-8d10089d1653"
-/* TCG Memory Clear Interface */
-#define TPM_MCI_UUID "376054ed-cc13-4675-901c-4756d7f2d45d"
+
/* coreboot wrapper for TPM driver (start) */
#define TPM_DEBUG(fmt, args...) \
if (CONFIG(DEBUG_TPM)) { \
@@ -777,104 +775,9 @@ static void lpc_tpm_set_resources(struct device *dev)
}
#if CONFIG(HAVE_ACPI_TABLES)
-
-static void tpm_ppi_func0_cb(void *arg)
-{
- /* Functions 1-8. */
- u8 buf[] = {0xff, 0x01};
- acpigen_write_return_byte_buffer(buf, 2);
-}
-
-static void tpm_ppi_func1_cb(void *arg)
-{
- if (CONFIG(TPM2))
- /* Interface version: 2.0 */
- acpigen_write_return_string("2.0");
- else
- /* Interface version: 1.2 */
- acpigen_write_return_string("1.2");
-}
-
-static void tpm_ppi_func2_cb(void *arg)
-{
- /* Submit operations: drop on the floor and return success. */
- acpigen_write_return_byte(0);
-}
-
-static void tpm_ppi_func3_cb(void *arg)
-{
- /* Pending operation: none. */
- acpigen_emit_byte(RETURN_OP);
- acpigen_write_package(2);
- acpigen_write_byte(0);
- acpigen_write_byte(0);
- acpigen_pop_len();
-}
-static void tpm_ppi_func4_cb(void *arg)
-{
- /* Pre-OS transition method: reboot. */
- acpigen_write_return_byte(2);
-}
-static void tpm_ppi_func5_cb(void *arg)
-{
- /* Operation response: no operation executed. */
- acpigen_emit_byte(RETURN_OP);
- acpigen_write_package(3);
- acpigen_write_byte(0);
- acpigen_write_byte(0);
- acpigen_write_byte(0);
- acpigen_pop_len();
-}
-static void tpm_ppi_func6_cb(void *arg)
-{
- /*
- * Set preferred user language: deprecated and must return 3 aka
- * "not implemented".
- */
- acpigen_write_return_byte(3);
-}
-static void tpm_ppi_func7_cb(void *arg)
-{
- /* Submit operations: deny. */
- acpigen_write_return_byte(3);
-}
-static void tpm_ppi_func8_cb(void *arg)
-{
- /* All actions are forbidden. */
- acpigen_write_return_byte(1);
-}
-static void (*tpm_ppi_callbacks[])(void *) = {
- tpm_ppi_func0_cb,
- tpm_ppi_func1_cb,
- tpm_ppi_func2_cb,
- tpm_ppi_func3_cb,
- tpm_ppi_func4_cb,
- tpm_ppi_func5_cb,
- tpm_ppi_func6_cb,
- tpm_ppi_func7_cb,
- tpm_ppi_func8_cb,
-};
-
-static void tpm_mci_func0_cb(void *arg)
-{
- /* Function 1. */
- acpigen_write_return_singleton_buffer(0x3);
-}
-static void tpm_mci_func1_cb(void *arg)
-{
- /* Just return success. */
- acpigen_write_return_byte(0);
-}
-
-static void (*tpm_mci_callbacks[])(void *) = {
- tpm_mci_func0_cb,
- tpm_mci_func1_cb,
-};
-
static void lpc_tpm_fill_ssdt(const struct device *dev)
{
const char *path = acpi_device_path(dev->bus->dev);
- u32 arg;
if (!path) {
path = "\\_SB_.PCI0.LPCB";
@@ -938,31 +841,12 @@ static void lpc_tpm_fill_ssdt(const struct device *dev)
acpi_device_write_interrupt(&tpm_irq);
}
+
acpigen_write_resourcetemplate_footer();
- if (!CONFIG(CHROMEOS)) {
- /*
- * _DSM method
- */
- struct dsm_uuid ids[] = {
- /* Physical presence interface.
- * This is used to submit commands like "Clear TPM" to
- * be run at next reboot provided that user confirms
- * them. Spec allows user to cancel all commands and/or
- * configure BIOS to reject commands. So we pretend that
- * user did just this: cancelled everything. If user
- * really wants to clear TPM the only option now is to
- * do it manually in payload.
- */
- DSM_UUID(TPM_PPI_UUID, &tpm_ppi_callbacks[0],
- ARRAY_SIZE(tpm_ppi_callbacks), (void *) &arg),
- /* Memory clearing on boot: just a dummy. */
- DSM_UUID(TPM_MCI_UUID, &tpm_mci_callbacks[0],
- ARRAY_SIZE(tpm_mci_callbacks), (void *) &arg),
- };
-
- acpigen_write_dsm_uuid_arr(ids, ARRAY_SIZE(ids));
- }
+ if (!CONFIG(CHROMEOS))
+ tpm_ppi_acpi_fill_ssdt(dev);
+
acpigen_pop_len(); /* Device */
acpigen_pop_len(); /* Scope */