From nobody Sat May 10 07:35:38 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1518538145323110.55840873125203; Tue, 13 Feb 2018 08:09:05 -0800 (PST) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1eldAU-0002jc-7l; Tue, 13 Feb 2018 17:10:54 +0100 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1eldA4-0002ej-Gf for seabios@seabios.org; Tue, 13 Feb 2018 17:10:52 +0100 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1DG23A2139070 for ; Tue, 13 Feb 2018 11:08:22 -0500 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g41skmerf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 13 Feb 2018 11:08:22 -0500 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Feb 2018 11:08:19 -0500 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 13 Feb 2018 11:08:17 -0500 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1DG8Gsb44171456; Tue, 13 Feb 2018 16:08:16 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A46DDB2054; Tue, 13 Feb 2018 11:05:10 -0500 (EST) Received: from sbct-3.watson.ibm.com (unknown [9.47.158.153]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 98B4CB204D; Tue, 13 Feb 2018 11:05:10 -0500 (EST) From: Stefan Berger To: seabios@seabios.org, kevin@koconnor.net Date: Tue, 13 Feb 2018 11:08:05 -0500 X-Mailer: git-send-email 2.5.5 In-Reply-To: <1518538087-28888-1-git-send-email-stefanb@linux.vnet.ibm.com> References: <1518538087-28888-1-git-send-email-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18021316-0008-0000-0000-000002D0DFB6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008527; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000253; SDB=6.00989182; UDB=6.00502256; IPR=6.00768536; BA=6.00005827; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019534; XFM=3.00000015; UTC=2018-02-13 16:08:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021316-0009-0000-0000-0000383E6037 Message-Id: <1518538087-28888-3-git-send-email-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-13_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802130191 X-Spam-Score: -6.0 (------) Subject: [SeaBIOS] [PATCH v2 2/4] tpm: generalize init_timeout() X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau It seems both TIS & CRB devices share the same timeout. Make initialization function generic now. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Stefan Berger Tested-by: Stefan Berger --- 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; } =20 -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 =3D=3D NULL) { + if (tpm_drivers[driver].durations =3D=3D NULL) { u32 *durations =3D tpm_default_dur; memcpy(durations, tpm_default_durations, sizeof(tpm_default_durations)); - tpm_drivers[TIS_DRIVER_IDX].durations =3D durations; + tpm_drivers[driver].durations =3D durations; } =20 - if (tpm_drivers[TIS_DRIVER_IDX].timeouts =3D=3D NULL) { + if (tpm_drivers[driver].timeouts =3D=3D NULL) { u32 *timeouts =3D tpm_default_to; memcpy(timeouts, tis_default_timeouts, sizeof(tis_default_timeouts)); - tpm_drivers[TIS_DRIVER_IDX].timeouts =3D timeouts; + tpm_drivers[driver].timeouts =3D 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); =20 return 1; } --=20 2.5.5 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios