PCI config space is not restored upon resume (macbook pro)

Jung-uk Kim jkim at FreeBSD.org
Mon Aug 23 19:01:06 UTC 2010


On Thursday 19 August 2010 12:48 am, Oleg Sharoyko wrote:
> On 16 August 2010 22:21, Jung-uk Kim <jkim at 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


More information about the freebsd-hackers mailing list