From 6e039076ab106a11ec9f82ef2f8250b20f1a885e Mon Sep 17 00:00:00 2001 From: Felix Held Date: Wed, 9 Aug 2023 19:20:15 +0200 Subject: soc/amd/common/lpc: use fixed_io_range_flags instead of open coding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of open coding the same functionality, use fixed_io_range_flags to tell the resource allocator about the FCH subtractively decoding the first 0x1000 bytes of I/O space. Also update the comment to match the code. TEST=On Mandolin the flags of this resource stay the same (0xc0040100). Signed-off-by: Felix Held Change-Id: Ia30a87a4e37c98248568476b74af2730a3c0e88d Reviewed-on: https://review.coreboot.org/c/coreboot/+/77170 Reviewed-by: Kyösti Mälkki Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/lpc/lpc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/soc/amd/common') diff --git a/src/soc/amd/common/block/lpc/lpc.c b/src/soc/amd/common/block/lpc/lpc.c index 3d5775fe35..96b9a2c4e7 100644 --- a/src/soc/amd/common/block/lpc/lpc.c +++ b/src/soc/amd/common/block/lpc/lpc.c @@ -105,18 +105,14 @@ static void lpc_init(struct device *dev) static void lpc_read_resources(struct device *dev) { - struct resource *res; unsigned long idx = 0; /* Get the normal pci resources of this device */ pci_dev_read_resources(dev); - /* Add an extra subtractive resource for both memory and I/O. */ - res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0)); - res->base = 0; - res->size = 0x1000; - res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE | - IORESOURCE_ASSIGNED | IORESOURCE_FIXED; + /* Add an extra subtractive resource for I/O. */ + fixed_io_range_flags(dev, IOINDEX_SUBTRACTIVE(0, 0), 0, 0x1000, + IORESOURCE_SUBTRACTIVE); /* Only up to 16 MByte of the SPI flash can be mapped right below 4 GB */ mmio_range(dev, idx++, FLASH_BELOW_4GB_MAPPING_REGION_BASE, -- cgit v1.2.3