Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Aug 2010 14:59:55 -0400
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Oleg Sharoyko <osharoiko@gmail.com>
Cc:        freebsd-hackers@freebsd.org, Christian Zander <czander@nvidia.com>
Subject:   Re: PCI config space is not restored upon resume (macbook pro)
Message-ID:  <201008231500.51152.jkim@FreeBSD.org>
In-Reply-To: <AANLkTimOt9qGsoLrYah9ooDsnUaE8qFip%2BK5J8X_G-mw@mail.gmail.com>
References:  <AANLkTikMFhG1QLDf4raf%2BrxOKhobjoA-dRbUew2-8KeF@mail.gmail.com> <201008161422.01541.jkim@FreeBSD.org> <AANLkTimOt9qGsoLrYah9ooDsnUaE8qFip%2BK5J8X_G-mw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 19 August 2010 12:48 am, Oleg Sharoyko wrote:
> On 16 August 2010 22:21, Jung-uk Kim <jkim@freebsd.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008231500.51152.jkim>