From: Marc-André Lureau <marcandre.lureau@redhat.com>
It seems both TIS & CRB devices share the same timeout. Make
initialization function generic for now.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/hw/tpm_drivers.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c
index a137e62..0daaef2 100644
--- a/src/hw/tpm_drivers.c
+++ b/src/hw/tpm_drivers.c
@@ -102,26 +102,31 @@ static TPMVersion tis_get_tpm_version(void)
return TPM_VERSION_1_2;
}
-static u32 tis_init(void)
+static void init_timeout(int driver)
{
- if (!CONFIG_TCGBIOS)
- return 1;
-
- writeb(TIS_REG(0, TIS_REG_INT_ENABLE), 0);
-
- if (tpm_drivers[TIS_DRIVER_IDX].durations == NULL) {
+ if (tpm_drivers[driver].durations == NULL) {
u32 *durations = tpm_default_dur;
memcpy(durations, tpm_default_durations,
sizeof(tpm_default_durations));
- tpm_drivers[TIS_DRIVER_IDX].durations = durations;
+ tpm_drivers[driver].durations = durations;
}
- if (tpm_drivers[TIS_DRIVER_IDX].timeouts == NULL) {
+ if (tpm_drivers[driver].timeouts == NULL) {
u32 *timeouts = tpm_default_to;
memcpy(timeouts, tis_default_timeouts,
sizeof(tis_default_timeouts));
- tpm_drivers[TIS_DRIVER_IDX].timeouts = timeouts;
+ tpm_drivers[driver].timeouts = timeouts;
}
+}
+
+static u32 tis_init(void)
+{
+ if (!CONFIG_TCGBIOS)
+ return 1;
+
+ writeb(TIS_REG(0, TIS_REG_INT_ENABLE), 0);
+
+ init_timeout(TIS_DRIVER_IDX);
return 1;
}
--
2.14.1.146.gd35faa819
_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
On 10/06/2017 11:33 AM, marcandre.lureau@redhat.com wrote: > From: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > > It seems both TIS & CRB devices share the same timeout. Make > initialization function generic for now. > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > --- > src/hw/tpm_drivers.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > > diff --git a/src/hw/tpm_drivers.c b/src/hw/tpm_drivers.c > index a137e62..0daaef2 100644 > --- a/src/hw/tpm_drivers.c > +++ b/src/hw/tpm_drivers.c > @@ -102,26 +102,31 @@ static TPMVersion tis_get_tpm_version(void) > return TPM_VERSION_1_2; > } > > -static u32 tis_init(void) > +static void init_timeout(int driver) > { > - if (!CONFIG_TCGBIOS) > - return 1; > - > - writeb(TIS_REG(0, TIS_REG_INT_ENABLE), 0); > - > - if (tpm_drivers[TIS_DRIVER_IDX].durations == NULL) { > + if (tpm_drivers[driver].durations == NULL) { > u32 *durations = tpm_default_dur; > memcpy(durations, tpm_default_durations, > sizeof(tpm_default_durations)); > - tpm_drivers[TIS_DRIVER_IDX].durations = durations; > + tpm_drivers[driver].durations = durations; > } > > - if (tpm_drivers[TIS_DRIVER_IDX].timeouts == NULL) { > + if (tpm_drivers[driver].timeouts == NULL) { > u32 *timeouts = tpm_default_to; > memcpy(timeouts, tis_default_timeouts, > sizeof(tis_default_timeouts)); > - tpm_drivers[TIS_DRIVER_IDX].timeouts = timeouts; > + tpm_drivers[driver].timeouts = timeouts; > } > +} > + > +static u32 tis_init(void) > +{ > + if (!CONFIG_TCGBIOS) > + return 1; > + > + writeb(TIS_REG(0, TIS_REG_INT_ENABLE), 0); > + > + init_timeout(TIS_DRIVER_IDX); > > return 1; > } > _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios
© 2016 - 2025 Red Hat, Inc.