soc/amd/common: fix SPI bar resource usage

The ACPI code was not masking off the correct bits for publishing
the SPI bar to the OS.

It resulted in a dmesg messagelike:
	system 00:00: [mem 0xfec10002-0xfec11001] has been reserved
And /proc/iomem entry
	fec10002-fec11001 : pnp 00:00

These addresses are wrong because they are including bits of a
register that are not a part of the address.

Moreover, the code does not publish the eSPI register area either.
The eSPI registers live at 0x10000 added to the SPI bar. Lastly,
both regions are less than a page so only report a page of usage
for each.

Stoney Ridge's SPI bar register defines the address as 31:6 while
Picasso's SPI bar register defines the address as 31:8. Use Picasso's
valid mask for both cases because no one is assigning addresses
that are aligned to less than 256 bytes.

With the fixes, dmesg reports:
	system 00:00: [mem 0xfec10000-0xfec10fff] has been reserved
	system 00:00: [mem 0xfec20000-0xfec20fff] has been reserved
And /proc/iomem indicates:
	fec10000-fec10fff : pnp 00:00
	fec20000-fec20fff : pnp 00:00

BUG=b:160290629

Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Change-Id: I130b5ad26d9e13b44c25fbb35a05389f9e8841ab
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42959
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Aaron Durbin 2020-07-01 00:01:33 -06:00
parent 57285820a3
commit c5bb02f2ec
1 changed files with 12 additions and 4 deletions

View File

@ -26,17 +26,25 @@ Device(LPCB) {
{
Memory32Fixed(ReadWrite, // Setup for fixed resource location for SPI base address
0x00000000, // Address Base
0x00000000, // Address Length
0x00001000, // Address Length
BAR0 // Descriptor Name
)
Memory32Fixed(ReadWrite, // Setup for fixed resource location for eSPI base address
0x00000000, // Address Base
0x00001000, // Address Length
BAR1 // Descriptor Name
)
})
Method(_CRS,0,Serialized)
{
CreateDwordField(^CRS,^BAR0._BAS,SPIB) // Field to hold SPI base address
CreateDwordField(^CRS,^BAR0._LEN,SPIL) // Field to hold SPI address length
Store(BAR,SPIB) // SPI base address mapped
Store(0x1000,SPIL) // 4k space mapped
CreateDwordField(^CRS,^BAR1._BAS,ESPB) // Field to hold eSPI base address
And(BAR, 0xffffff00, Local0)
Store(Local0, SPIB) // SPI base address mapped
Add(Local0, 0x10000, Local1)
Store(Local1, ESPB) // eSPI base address mapped
Return(CRS)
}
}