git: e2f492a9ac65 - main - TPM: Add hint check to skip TPM IRQ configuration

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Fri, 29 Aug 2025 17:56:25 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=e2f492a9ac651a27e447acfd681a128a66292309

commit e2f492a9ac651a27e447acfd681a128a66292309
Author:     Amit Kumar Gupta <amitgu@juniper.net>
AuthorDate: 2025-08-29 17:55:11 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2025-08-29 17:56:25 +0000

    TPM: Add hint check to skip TPM IRQ configuration
    
    Added use_polling hint check in tpm tis driver attach routine
    to skip TPM IRQ configuration and to use TPM poll method
    to get TPM operation status
    
    Reviewed by:    imp
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52048
---
 sys/dev/tpm/tpm_tis_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/dev/tpm/tpm_tis_core.c b/sys/dev/tpm/tpm_tis_core.c
index d8421f8156c9..4159de4daf3b 100644
--- a/sys/dev/tpm/tpm_tis_core.c
+++ b/sys/dev/tpm/tpm_tis_core.c
@@ -97,6 +97,7 @@ tpmtis_attach(device_t dev)
 {
 	struct tpm_sc *sc;
 	int result;
+	int poll = 0;
 
 	sc = device_get_softc(dev);
 	sc->dev = dev;
@@ -105,6 +106,12 @@ tpmtis_attach(device_t dev)
 	sx_init(&sc->dev_lock, "TPM driver lock");
 	sc->buf = malloc(TPM_BUFSIZE, M_TPM20, M_WAITOK);
 
+	resource_int_value("tpm", device_get_unit(dev), "use_polling", &poll);
+	if (poll != 0) {
+	    device_printf(dev, "Using poll method to get TPM operation status \n");
+	    goto skip_irq;
+	}
+
 	sc->irq_rid = 0;
 	sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid,
 		    RF_ACTIVE | RF_SHAREABLE);