From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 23 19:01:06 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id B8ECD1065695; Mon, 23 Aug 2010 19:01:06 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: Oleg Sharoyko Date: Mon, 23 Aug 2010 14:59:55 -0400 User-Agent: KMail/1.6.2 References: <201008161422.01541.jkim@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Message-Id: <201008231500.51152.jkim@FreeBSD.org> Cc: freebsd-hackers@freebsd.org, Christian Zander Subject: Re: 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: Mon, 23 Aug 2010 19:01:06 -0000 On Thursday 19 August 2010 12:48 am, Oleg Sharoyko wrote: > On 16 August 2010 22:21, Jung-uk Kim wrote: > > In theory, we can shadow video ROM and execute it in emulation > > *iff* it actually contains x86 real mode code.  It won't be too > > hard but I am not sure whether it is worth trying.  Are you sure > > the option ROM is actually real mode code but not shadowed again > > after resume? [Sorry for the late reply] > Sorry, I guess I wasn't clear enough. There is no VGA ROM at > 0xc0000 after resume. Yes, it was perfectly clear to me. > In patches for linux loader (which I've mentioned in previous > message) they search for ROM, then copy it into memory, execute and > install at proper address. This is possible during boot, but I don't > think this can be done after resume. That's exactly what I meant by "shadowing video ROM". And, it isn't too hard to implement in suspend/resume path. :-) > And, moreover, I tend to agree that this isn't worth trying as this > is very specific to macboocs only (AFAIK). Let's see if I can find some free time later. > By the way, do you think it could be possible to dump option ROM > contents into a file before suspending the system and then load it > back on resume from userland? I've seen a userland tool in ports > (sysutils/vbetool) which can execute VESA BIOS functions. So, I > guess, it could be possible to try to call POST using saved ROM > dump, but I don't know if it's possible to stick this ROM image > into memory "forever" and for all processes. Yes, that's one way to do it. In fact, I am the sysutils/vbetool maintainer, too. :-) hammer# dd if=/dev/mem of=video.rom bs=64k skip=0xc count=1 1+0 records in 1+0 records out 65536 bytes transferred in 0.000872 secs (75164864 bytes/sec) hammer# hexdump -C video.rom | head 00000000 55 aa 75 e9 fd 01 00 00 00 00 00 00 00 00 00 00 |U.u.............| 00000010 00 00 00 00 00 00 00 00 b0 01 00 00 00 00 49 42 |..............IB| 00000020 4d fb 00 00 00 00 00 00 00 00 00 00 00 00 00 04 |M...............| 00000030 20 37 36 31 32 39 35 35 32 30 00 00 00 00 00 00 | 761295520......| 00000040 f5 01 00 00 00 00 00 00 8c 01 00 00 00 00 00 00 |................| 00000050 30 34 2f 30 39 2f 30 38 2c 30 32 3a 33 39 3a 33 |04/09/08,02:39:3| 00000060 38 00 00 00 e9 92 03 00 e9 a5 03 00 00 00 94 00 |8...............| 00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000090 00 00 00 00 00 52 53 37 38 30 00 50 43 49 5f 45 |.....RS780.PCI_E| Please send me the dump privately, I'd like to see. Thanks, Jung-uk Kim