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

Bug#615110: tpm_tis prevents suspend working more than once



On 20/01/12 08:46, Jonathan Nieder wrote:
Thanks.  Do you know the commit id of this 3.2-rc2+ kernel?
It's one I've been working on to fix Sony Vaio keyboard problems.  I'll try an "official" kernel today.
There have been some tpm fixes upstream recently, so results from
testing v3.3-rc1 or later would be interesting.

Ok, will try.

I've tried the workaround and it works perfectly.

root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
Manufacturer: 0x49465800
TCG version: 1.2
Firmware version: 1.0

did a suspend there - worked

root@carbon:~# cat  /sys/devices/pnp0/00:07/caps

tried a suspend - didnt work

root@carbon:~# dmesg | grep -i failed
[    0.076215]  pci0000:00: ACPI _OSC request failed (AE_NOT_FOUND), returned control mask: 0x1d
[ 1176.136093] PM: Device 00:07 failed to suspend: error 38
[ 1176.136109] PM: Some devices failed to suspend
root@carbon:~# ~john/tpm_startup 
Success!
root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
Manufacturer: 0x49465800
TCG version: 1.2
Firmware version: 1.0

did a suspend there - worked

root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
root@carbon:~# ~john/tpm_startup 
Success!
root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
Manufacturer: 0x49465800
TCG version: 1.2
Firmware version: 1.0

Did a suspend there - worked

root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
root@carbon:~# ~john/tpm_startup 
Success!
root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
Manufacturer: 0x49465800
TCG version: 1.2
Firmware version: 1.0

Try running  tpm_startup twice:

root@carbon:~# ~john/tpm_startup 
Got an error code in response: 38
root@carbon:~# cat  /sys/devices/pnp0/00:07/caps
Manufacturer: 0x49465800
TCG version: 1.2
Firmware version: 1.0
 
Suspend still works
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>

int main(void) {
     const uint8_t startup_st_state[] = {
         0x00, 0xc1,
         0x00, 0x00, 0x00, 0x0c,
         0x00, 0x00, 0x00, 0x99,
         0x00, 0x02
     };
     uint8_t buf[10];
     int fd = open("/dev/tpm0", O_RDWR);
     int len;
     uint32_t err;

     if (fd < 0) {
         printf("Could not open /dev/tpm0\n");
         return 1;
     }

     len = write(fd, startup_st_state, sizeof(startup_st_state));

     if (len != sizeof(startup_st_state)) {
         printf("Write failed.\n");
         goto err_exit;
     }

     len = read(fd, buf, sizeof(buf));

     if (len != sizeof(buf)) {
         printf("Expected %d bytes bot got %d\n", (int)sizeof(buf), len);
         goto err_exit;
     }

     if (buf[1] != 0xc4) {
         printf("Response tag is bad.\n");
         goto err_exit;
     }

     if (buf[5] != sizeof(buf)) {
         printf("Response length is bad: %d\n", buf[5]);
         goto err_exit;
     }

     err = buf[6] << 24 | buf[7] << 16 | buf[8] << 8 | buf[9];
     if (err) {
         printf("Got an error code in response: %u\n", err);
     } else {
         printf("Success!\n");
     }

err_exit:
     close(fd);
     return 0;
}


Reply to: