From e25b5ef39fd10e48e87e0c4770a721a786e36a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 2 Dec 2016 08:56:05 +0200 Subject: MMCONF_SUPPORT: Consolidate resource registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id727270bff9e0288747d178c00f3d747fe223b0f Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/17695 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/device/device_util.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/device') diff --git a/src/device/device_util.c b/src/device/device_util.c index 56afefdc87..157f7b7443 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -888,6 +888,26 @@ void fixed_mem_resource(device_t dev, unsigned long index, resource->flags |= type; } +void mmconf_resource_init(struct resource *resource, resource_t base, + int buses) +{ + resource->base = base; + resource->size = buses * MiB; + resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE | + IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED; + + printk(BIOS_DEBUG, "Adding PCIe enhanced config space BAR " + "0x%08lx-0x%08lx.\n", (unsigned long)(resource->base), + (unsigned long)(resource->base + resource->size)); +} + +void mmconf_resource(struct device *dev, unsigned long index) +{ + struct resource *resource = new_resource(dev, index); + mmconf_resource_init(resource, CONFIG_MMCONF_BASE_ADDRESS, + CONFIG_MMCONF_BUS_NUMBER); +} + void tolm_test(void *gp, struct device *dev, struct resource *new) { struct resource **best_p = gp; -- cgit v1.2.3