git: f0c97033018b - main - sys/dev/ichsmb: Silence unhandled SMBALERT device_printfs

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Mon, 26 Jun 2023 09:35:48 UTC
The branch main has been updated by kp:

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

commit f0c97033018b0741aa832bf1b79430ed73ceb0da
Author:     Reid Linnemann <rlinnemann@netgate.com>
AuthorDate: 2023-06-26 08:25:26 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-06-26 08:29:34 +0000

    sys/dev/ichsmb: Silence unhandled SMBALERT device_printfs
    
    The ichsmb driver does not actually handle SMBALERT, other than by logging the
    first 16 occurences of the ICH_HST_STA_SMBALERT_STS_SMBALERT status
    flag. Because the SMBALERT is not acknowledged by the host, clearing it in the
    host status register does not appear to work as long as some slave device is
    pulling the SMBALERT line low, at least for C2000 chips. As a result, if a slave
    device does pull SMBALERT low the interrupt handler will always loop its maximum
    of 16 times attempting to clear all status register flags and device_printf the
    status register. The result is the kernel message buffer is littered with these
    device_printfs at every interrupt.
    
    To remedy the problem, the ICH_HST_STA_SMBALERT_STS flag is zeroed in the read
    host status register value, just as with ICH_HST_STA_INUSE_STS and
    ICH_HST_STA_HOST_BUSY. This allows the loop to break when no other flags that
    must be handled are set in the host status register. Additionally, because the
    SMBALERT is not actually handled the SMBALERT logging is omitted as it has no
    actual function at this time.
    
    Reviewed by:    imp
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D39966
---
 sys/dev/ichsmb/ichsmb.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c
index ba2d993ffe5a..d5950f056c0d 100644
--- a/sys/dev/ichsmb/ichsmb.c
+++ b/sys/dev/ichsmb/ichsmb.c
@@ -510,7 +510,8 @@ ichsmb_device_intr(void *cookie)
 			DBG("%d stat=0x%02x\n", count, status);
 		}
 #endif
-		status &= ~(ICH_HST_STA_INUSE_STS | ICH_HST_STA_HOST_BUSY);
+		status &= ~(ICH_HST_STA_INUSE_STS | ICH_HST_STA_HOST_BUSY |
+		    ICH_HST_STA_SMBALERT_STS);
 		if (status == 0)
 			break;
 
@@ -531,18 +532,6 @@ ichsmb_device_intr(void *cookie)
 			continue;
 		}
 
-		/* Handle SMBALERT interrupt */
-		if (status & ICH_HST_STA_SMBALERT_STS) {
-			static int smbalert_count = 16;
-			if (smbalert_count > 0) {
-				device_printf(dev, "SMBALERT# rec'd\n");
-				if (--smbalert_count == 0) {
-					device_printf(dev,
-					    "not logging anymore\n");
-				}
-			}
-		}
-
 		/* Check for bus error */
 		if (status & ICH_HST_STA_BUS_ERR) {
 			sc->smb_error = SMB_ECOLLI;	/* XXX SMB_EBUSERR? */