[LinuxBIOS] [PATCH] fix resource end in K8 amdk8/northbridge.c

Marc Jones marc.jones at amd.com
Fri Oct 12 23:36:36 CEST 2007



Rudolf Marek wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Hello
> 
> Sorry for the delay.
> 
> Uwe Hermann wrote:
>> On Sat, Sep 29, 2007 at 02:02:48AM +0200, Rudolf Marek wrote:
>>> Index: src/northbridge/amd/amdk8/northbridge.c
>>> ===================================================================
>>> --- src/northbridge/amd/amdk8/northbridge.c	(revision 2776)
>>> +++ src/northbridge/amd/amdk8/northbridge.c	(working copy)
>>> @@ -562,7 +562,7 @@
>>>  	base  |= (resource->base >> 8) & 0xffffff00;
>>>  	base  |= 3;
>>>  	limit &= 0x00000048;
>>> -	limit |= ((resource->base + resource->size) >> 8) & 0xffffff00;
>>> +	limit |= (resource_end(resource) >> 8) & 0xffffff00;
>>>  	limit |= (resource->index & 3) << 4;
>>>  	limit |= (nodeid & 7);
>>>  	f1_write_config32(reg + 0x4, limit);
>> What exactly is broken in the current code and how does it show? How can
>> we test the effect of the fix?
> 
> 
> Well I reverted the patch and have forgotten :/ Without the patch my machine
> suffers random lockup, when DMA from SATA/IDE hit the 0xC0000-0xCFFFF RAM memory.
...

> MMIO map: #5 0x00000a0000 - 0x00000cffff Access: R/W     Dstnode:0 DstLink 0
> 
> 
> Mote the region size! it is 64kb larger than it should be...
...
> So with the patch applied, it gets correct again:
> 
> MMIO map: #5 0x00000a0000 - 0x00000bffff Access: R/W     Dstnode:0 DstLink 0
> 
> 
> Btw maybe you can take the util and put it to some SVN repo, it has proven useful ;)
> 
> Thanks,
> 
> Rudolf

I have looked this over and agree with Rudolf. The VGA area can't go 
into the 0xC0000 ROM shadow area.

	resource->base = 0xa0000;
	resource->size = 0x20000;
...
	limit |= ((resource->base + resource->size) >> 8) & 0xffffff00;

The problem is that the size is not base 0 aligned. The following would 
also fix the bug and makes it more clear why it failed.

limit |= ((resource->base + (resource->size - 1)) >> 8) & 0xffffff00;

I think Rudolf's use of resource_end() is better than the inline math.

Marc

-- 
Marc Jones
Senior Firmware Engineer
(970) 226-9684 Office
mailto:Marc.Jones at amd.com
http://www.amd.com/embeddedprocessors






More information about the coreboot mailing list