summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2021-11-18 14:12:46 -0700
committerKarthik Ramasubramanian <kramasub@google.com>2021-11-22 16:31:34 +0000
commit5e3c454fbb7524715186ef7ad32e65fa9279aa4b (patch)
tree7d8f107fa3e375a0e380ff776ba3fade1fa3dee6 /src/drivers
parentb35acf9210ffdd458a806ddbbf7deef7aac20fcd (diff)
downloadcoreboot-5e3c454fbb7524715186ef7ad32e65fa9279aa4b.tar.gz
coreboot-5e3c454fbb7524715186ef7ad32e65fa9279aa4b.tar.bz2
coreboot-5e3c454fbb7524715186ef7ad32e65fa9279aa4b.zip
drivers/tpm: Add firmware-power-managed DSD property
Introduce firmware-power-managed DSD ACPI property for TPM devices. This property can be checked by the kernel TPM driver to override how the TPM power states are managed. This is a tri-state flag, true, false, or unset. So an enum used to keep the flag is unset by default. When firmware-power-managed is true, the kernel driver will not send a shutdown during s2idle/s0i3 suspend. BUG=b:200578885 BRANCH=None TEST=TPM shutdown is triggered on s0ix suspend on guybrush with patched kernel Change-Id: Ia48ead856fc0c6e637a2e07a5ecc58423f599c5b Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/59479 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Raul Rangel <rrangel@chromium.org>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/i2c/tpm/chip.c16
-rw-r--r--src/drivers/i2c/tpm/chip.h7
2 files changed, 23 insertions, 0 deletions
diff --git a/src/drivers/i2c/tpm/chip.c b/src/drivers/i2c/tpm/chip.c
index 07791c33a488..3a2f8aa544fe 100644
--- a/src/drivers/i2c/tpm/chip.c
+++ b/src/drivers/i2c/tpm/chip.c
@@ -11,6 +11,7 @@
static void i2c_tpm_fill_ssdt(const struct device *dev)
{
+ struct acpi_dp *dsd;
struct drivers_i2c_tpm_config *config = dev->chip_info;
const char *scope = acpi_device_scope(dev);
struct acpi_i2c i2c = {
@@ -47,6 +48,21 @@ static void i2c_tpm_fill_ssdt(const struct device *dev)
acpigen_write_resourcetemplate_footer();
+ /* _DSD, Device-Specific Data */
+ dsd = acpi_dp_new_table("_DSD");
+ switch (config->power_managed_mode) {
+ case TPM_FIRMWARE_POWER_MANAGED:
+ acpi_dp_add_integer(dsd, "firmware-power-managed", 1);
+ break;
+ case TPM_KERNEL_POWER_MANAGED:
+ acpi_dp_add_integer(dsd, "firmware-power-managed", 0);
+ break;
+ case TPM_DEFAULT_POWER_MANAGED:
+ default:
+ /* Leave firmware-power-managed unset */
+ }
+ acpi_dp_write(dsd);
+
acpigen_pop_len(); /* Device */
acpigen_pop_len(); /* Scope */
diff --git a/src/drivers/i2c/tpm/chip.h b/src/drivers/i2c/tpm/chip.h
index 0ab10d7560f7..4eac7e16f477 100644
--- a/src/drivers/i2c/tpm/chip.h
+++ b/src/drivers/i2c/tpm/chip.h
@@ -3,6 +3,12 @@
#include <acpi/acpi_device.h>
#include <device/i2c_simple.h>
+enum tpm_power_managed_mode {
+ TPM_DEFAULT_POWER_MANAGED = 0,
+ TPM_FIRMWARE_POWER_MANAGED,
+ TPM_KERNEL_POWER_MANAGED,
+};
+
struct drivers_i2c_tpm_config {
const char *hid; /* ACPI _HID (required) */
const char *desc; /* Device Description */
@@ -10,4 +16,5 @@ struct drivers_i2c_tpm_config {
enum i2c_speed speed; /* Bus speed in Hz, default is I2C_SPEED_FAST */
struct acpi_irq irq; /* Interrupt */
struct acpi_gpio irq_gpio; /* GPIO interrupt */
+ enum tpm_power_managed_mode power_managed_mode; /* TPM power managed mode */
};