From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 3 11:15:11 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EBA01065695 for ; Tue, 3 Aug 2010 11:15:11 +0000 (UTC) (envelope-from osharoiko@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id EDC3E8FC13 for ; Tue, 3 Aug 2010 11:15:08 +0000 (UTC) Received: by iwn35 with SMTP id 35so824063iwn.13 for ; Tue, 03 Aug 2010 04:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=rThOGlCZXt8xl/vmCncIfvNAXHDczqPNaQvLA7WTkyA=; b=u/DvEufLzPkNkxmfKsDl0rmdNXpdwwVPwDhdDmiOxv9hP/gEP31Svwpxop8lGehvA+ 5NeoVPMMQkzdSeSBTmVpy79CzZfSR3YBYW9e4R4BIcF2NCgEOsrWMMACfEq3y30/sO/f V146tm0ci0Lc4HUH6LejAqmFNDsMQptO+H4+U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=E4hr9QDP5my5IjMKdJ6dLQWhkp7aG92nukFacTkQ6Zo0lFQT3XryCz2rwLvRJJv1GD CG13mICrhSGLkYksHfJjZ+pE+pPg1qZGwi3G/U9oZirCuQWJ0aVRJYnjItICrh5eZiVy IWqL6fvJf9jjiJ3Oc+NCze1sXaOWyAUdPApfw= MIME-Version: 1.0 Received: by 10.231.39.137 with SMTP id g9mr8421553ibe.133.1280832548013; Tue, 03 Aug 2010 03:49:08 -0700 (PDT) Received: by 10.231.168.20 with HTTP; Tue, 3 Aug 2010 03:49:07 -0700 (PDT) Date: Tue, 3 Aug 2010 14:49:07 +0400 Message-ID: From: Oleg Sharoyko To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Subject: PCI config space is not restored upon resume (macbook pro) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 11:15:11 -0000 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: 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: 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