device/resource: Modify some resource allocation instances

These changes made my crude pattern matching work with
coccinelle simpler.

Change-Id: I83f3ef38b8663640594b4d726838f7a6f96a58a2
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64698
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Kyösti Mälkki
2022-05-26 19:03:55 +03:00
committed by Felix Held
parent 2a167ffbbf
commit 4e4edf7d60
6 changed files with 14 additions and 21 deletions

View File

@@ -106,11 +106,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
continue;
resource = new_resource(dev, mc_fixed_resources[i].index);
resource->base = base;
resource->size = size;
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
resource->base = base;
resource->size = size;
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
__func__, mc_fixed_resources[i].description, index,
(unsigned long)base, (unsigned long)(base + size - 1));
@@ -298,7 +298,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
/* TSEG - DPR -> BGSM */
resource = new_resource(dev, index++);
resource->base = mc_values[TSEG_REG] - dpr.size * MiB;
resource->size = mc_values[BGSM_REG] - resource->base;
resource->size = mc_values[BGSM_REG] - (mc_values[TSEG_REG] - dpr.size * MiB);
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
@@ -306,7 +306,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
if (mc_values[BGSM_REG] != mc_values[TOLUD_REG]) {
resource = new_resource(dev, index++);
resource->base = mc_values[BGSM_REG];
resource->size = mc_values[TOLUD_REG] - resource->base;
resource->size = mc_values[TOLUD_REG] - mc_values[BGSM_REG];
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
}

View File

@@ -72,7 +72,7 @@ static void mch_domain_read_resources(struct device *dev)
/* cbmem_top can be shifted downwards due to alignment.
Mark the region between cbmem_top and tomk as unusable */
delta_cbmem = tomk - ((uint32_t)(uintptr_t)cbmem_top() >> 10);
delta_cbmem = tomk - ((uintptr_t)cbmem_top() >> 10);
tomk -= delta_cbmem;
uma_sizek += delta_cbmem;