Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Aug 2010 14:49:07 +0400
From:      Oleg Sharoyko <osharoiko@gmail.com>
To:        freebsd-hackers@freebsd.org
Subject:   PCI config space is not restored upon resume (macbook pro)
Message-ID:  <AANLkTikMFhG1QLDf4raf%2BrxOKhobjoA-dRbUew2-8KeF@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi!

I'm trying to make FreeBSD (9-Current, checkout on 2010-08-01) correctly
suspend/resume on macbook pro. As of now I have to issues with resume:

1. Display stays blank upon resume. Got 'vga0: failed to reload state'
 in dmesg, but I haven't looked into this  yet.

2. Some hardware is missing upon resume, specifically ath, msk and firewire.
This devices disappear because rather strange values are being
read from pci config space (such as vendor id, device id and others).

This is how it looks when system boots:

pci11: <ACPI PCI bus> on pcib4
pci11: domain=0, physical bus=11
pcib4: pci_read_device: before if
pcib4: pci_read_device: in if()
pcib4: pci_read_device subvendor: 106b, vendor: 168c, device: 0024
pcib4: pci_read_device: after if()
unknown: pci_cfg_save: subvendor: 106b, vendor: 168c, device: 0024
unknown: pci_cfg_restore: subvendor: 106b, vendor: 168c, device: 0024
found-> vendor=0x168c, dev=0x0024, revid=0x01
        domain=0, bus=11, slot=0, func=0
        class=02-80-00, hdrtype=0x00, mfdev=0
        cmdreg=0x0007, statreg=0x0010, cachelnsz=64 (dwords)
        lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
        intpin=a, irq=7
        powerspec 2  supports D0 D1 D3  current D0
        MSI supports 1 message
        MSI-X supports 1 message in map 0x10
        map[10]: type Memory, range 64, base 0x97300000, size 16, enabled
pcib4: requested memory range 0x97300000-0x9730ffff: good
pcib4: matched entry for 11.0.INTA
pcib4: slot 0 INTA hardwired to IRQ 16
ath0: <Atheros 5416> mem 0x97300000-0x9730ffff irq 16 at device 0.0 on pci11

everything as usual except for some debugging printfs I have added to
the kernel.

And here what I have upon resume:

pci_resume: before restore
pci0:11:0:0: Transition from D3 to D0
unknown: pci_cfg_restore: subvendor: 106b, vendor: 168c, device: 0024
pci_resume: before if
pci_resume: in if
unknown: pci_cfg_save: subvendor: ffff, vendor: ffff, device: ffff
pci_resume: after if

[some lines are skipped, please see [1] for a link to complete output of dmesg]

pci11: driver added
found-> vendor=0xffff, dev=0xffff, revid=0xff
        domain=0, bus=11, slot=0, func=0
        class=ff-ff-ff, hdrtype=0x00, mfdev=0
        cmdreg=0xffff, statreg=0x0010, cachelnsz=255 (dwords)
        lattimer=0xff (7650 ns), mingnt=0xff (63750 ns), maxlat=0xff (63750 ns)
        intpin=_, irq=255
        powerspec 2  supports D0 D1 D3  current D3
        MSI supports 1 message
        MSI-X supports 1 message in map 0x10
pci0:11:0:0: reprobing on driver added
pci0:11:0:0: Transition from D3 to D0
unknown: pci_cfg_restore: subvendor: ffff, vendor: ffff, device: ffff
unknown: pci_cfg_save: subvendor: ffff, vendor: ffff, device: ffff

As far as I can see pci_resume() (from dev/pci/pci.c) tries to write
saved values of
pci config space and calls pci_cfg_restore() to achieve this.
pci_cfg_restore() inded
writes correct values to pci config space. But the next attempt to
read these just written
value returns incorrect data.

What else can I do to understand and solve this issue? I would
appreciate any help. Thank you!

1. Complete output of dmesg
http://www.oleg-sharoyko.net/files/freebsd/pci_config.201008/dmesg.20100803.txt

-- 
Oleg Sharoyko



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikMFhG1QLDf4raf%2BrxOKhobjoA-dRbUew2-8KeF>