git: 2764bc54d5d3 - main - asmc: do not enable the sudden motion sensor on the MMIO backend

From: Abdelkader Boudih <seuros_at_FreeBSD.org>
Date: Tue, 10 Nov 2026 16:12:31 UTC
The branch main has been updated by seuros:

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

commit 2764bc54d5d35838c2aeccbfd2632625067283a5
Author:     Abdelkader Boudih <seuros@FreeBSD.org>
AuthorDate: 2026-11-10 16:12:06 +0000
Commit:     Abdelkader Boudih <seuros@FreeBSD.org>
CommitDate: 2026-11-10 16:12:06 +0000

    asmc: do not enable the sudden motion sensor on the MMIO backend
    
    The interrupt filter reads the PIO interrupt port, but sc_ioport is NULL
    under MMIO; the capability test only probed for keys, which says nothing
    about the backend.
    
    No MMIO-capable machine has a sudden motion sensor anyway. It existed to
    park the heads of spinning disks.
    
    Reviewed by:    adrian
    Differential Revision:  https://reviews.freebsd.org/D61383
---
 sys/dev/asmc/asmc.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 3f43ff6d45d2..5714e2e58c49 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -557,13 +557,17 @@ asmc_detect_capabilities(device_t dev)
 	uint8_t len;
 	char type[ASMC_TYPELEN + 1];
 
-	/* SMS: require all keys used by asmc_sms_init() */
-	sc->sc_has_sms = 1;
-	for (unsigned int k = 0; k < nitems(asmc_sms_required_keys); k++) {
-		if (asmc_key_getinfo(dev, asmc_sms_required_keys[k],
-		    &len, type) != 0) {
-			sc->sc_has_sms = 0;
-			break;
+	/* SMS: PIO only, the filter reads the PIO interrupt port. */
+	sc->sc_has_sms = 0;
+	if (!sc->sc_is_mmio) {
+		sc->sc_has_sms = 1;
+		for (unsigned int k = 0;
+		    k < nitems(asmc_sms_required_keys); k++) {
+			if (asmc_key_getinfo(dev, asmc_sms_required_keys[k],
+			    &len, type) != 0) {
+				sc->sc_has_sms = 0;
+				break;
+			}
 		}
 	}
 
@@ -1001,7 +1005,8 @@ asmc_sms_intrfast(void *arg)
 	uint8_t type;
 	device_t dev = (device_t)arg;
 	struct asmc_softc *sc = device_get_softc(dev);
-	if (!sc->sc_sms_intr_works)
+
+	if (sc->sc_is_mmio || !sc->sc_sms_intr_works)
 		return (FILTER_HANDLED);
 
 	mtx_lock_spin(&sc->sc_mtx);