NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/45932: The tpm(4) driver prevents suspending

>Number:         45932
>Category:       kern
>Synopsis:       It is impossible to suspend with tpm(4) attached
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 06 00:35:00 +0000 2012
>Originator:     Pierre Pronchery <>
>Release:        NetBSD 5.99.60
System: NetBSD syn.defora.rom 5.99.60 NetBSD 5.99.60 (GENERIC) #0: Sat Jan 28 
14:38:06 CET 2012 
Architecture: x86_64
Machine: amd64
The tpm(4) driver was introduced recently to the kernel (thanks!). It is
found on some laptop computers, like on my Lenovo ThinkPad T60 2007:

/netbsd: tpm0 at isa0 iomem 0xfed40000-0xfed44fff irq 7: ATML 97SC3203 rev 0x5

Unfortunately, with this driver attached, the laptop fails to suspend:

/netbsd: acpi0: entering state S3
/netbsd: Devices without power management support: tpm0
/netbsd: Devices withoug suspend

This error message is a bit confusing, since the actual issue is not
with tpm(4) not supporting power management; it supports it, but the
callback functions do not return the proper value, indicating instead
(and apparently, wrongly so) that the attempt at suspending the device

I wonder therefore if it would make sense to warn about devices not
supporting power management as soon as they are done attaching. Then I
suppose it would be easier to report about failures when actually trying
to suspend.

1. Run netbsd-current on a computer featuring a device matched by tpm(4)
2. # sysctl -w machdep.sleep_state=3
3. Suspending is aborted:
Fixing the tpm(4) driver itself is trivial once this figured out (found

I haven't looked at how to let the error message be more clear.

Index: sys/dev/ic/tpm.c
RCS file: /cvsroot/src/sys/dev/ic/tpm.c,v
retrieving revision 1.6
diff -p -u -r1.6 tpm.c
--- sys/dev/ic/tpm.c    3 Feb 2012 15:42:46 -0000       1.6
+++ sys/dev/ic/tpm.c    6 Feb 2012 00:26:23 -0000
@@ -333,7 +333,7 @@ tpm_suspend(device_t dev, const pmf_qual
 #ifdef TPM_DEBUG
        aprint_debug_dev(sc->sc_dev, "%s: power down\n", __func__);
-       return 0;
+       return true;
@@ -347,7 +347,7 @@ tpm_resume(device_t dev, const pmf_qual_
        struct tpm_softc *sc = device_private(dev);
        aprint_debug_dev(sc->sc_dev, "%s: resume\n", __func__);
-       return 0;
+       return true;
 /* Wait for given status bits using polling. */

Home | Main Index | Thread Index | Old Index