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

@ -161,9 +161,9 @@ static void wilco_ec_resource(struct device *dev, int index,
size_t base, size_t size) size_t base, size_t size)
{ {
struct resource *res = new_resource(dev, index); struct resource *res = new_resource(dev, index);
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
res->base = base; res->base = base;
res->size = size; res->size = size;
res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
} }
static void wilco_ec_read_resources(struct device *dev) static void wilco_ec_read_resources(struct device *dev)

View File

@ -106,11 +106,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
continue; continue;
resource = new_resource(dev, mc_fixed_resources[i].index); resource = new_resource(dev, mc_fixed_resources[i].index);
resource->base = base;
resource->size = size;
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED; IORESOURCE_RESERVE | IORESOURCE_ASSIGNED;
resource->base = base;
resource->size = size;
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n", printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
__func__, mc_fixed_resources[i].description, index, __func__, mc_fixed_resources[i].description, index,
(unsigned long)base, (unsigned long)(base + size - 1)); (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 */ /* TSEG - DPR -> BGSM */
resource = new_resource(dev, index++); resource = new_resource(dev, index++);
resource->base = mc_values[TSEG_REG] - dpr.size * MiB; 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 | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE; 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]) { if (mc_values[BGSM_REG] != mc_values[TOLUD_REG]) {
resource = new_resource(dev, index++); resource = new_resource(dev, index++);
resource->base = mc_values[BGSM_REG]; 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 | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_RESERVE | IORESOURCE_ASSIGNED; 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. /* cbmem_top can be shifted downwards due to alignment.
Mark the region between cbmem_top and tomk as unusable */ 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; tomk -= delta_cbmem;
uma_sizek += delta_cbmem; uma_sizek += delta_cbmem;

View File

@ -129,11 +129,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
continue; continue;
resource = new_resource(dev, mc_fixed_resources[i].index); resource = new_resource(dev, mc_fixed_resources[i].index);
resource->base = base;
resource->size = size;
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_RESERVE | IORESOURCE_STORED | IORESOURCE_RESERVE |
IORESOURCE_ASSIGNED; IORESOURCE_ASSIGNED;
resource->base = base;
resource->size = size;
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n", printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
__func__, mc_fixed_resources[i].description, index, __func__, mc_fixed_resources[i].description, index,
(unsigned long)base, (unsigned long)(base + size - 1)); (unsigned long)base, (unsigned long)(base + size - 1));
@ -328,7 +328,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
/* TSEG - DPR -> BGSM */ /* TSEG - DPR -> BGSM */
resource = new_resource(dev, index++); resource = new_resource(dev, index++);
resource->base = mc_values[TSEG_REG] - dpr_size; resource->base = mc_values[TSEG_REG] - dpr_size;
resource->size = mc_values[BGSM_REG] - resource->base; resource->size = mc_values[BGSM_REG] - (mc_values[TSEG_REG] - dpr_size);
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_RESERVE | IORESOURCE_STORED | IORESOURCE_RESERVE |
IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE; IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
@ -336,7 +336,7 @@ static void mc_add_dram_resources(struct device *dev, int *resource_cnt)
/* BGSM -> TOLUD */ /* BGSM -> TOLUD */
resource = new_resource(dev, index++); resource = new_resource(dev, index++);
resource->base = mc_values[BGSM_REG]; 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 | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_RESERVE | IORESOURCE_STORED | IORESOURCE_RESERVE |
IORESOURCE_ASSIGNED; IORESOURCE_ASSIGNED;

View File

@ -405,10 +405,6 @@ static void pci_p2sb_read_resources(struct device *dev)
res->size = 16 * 1024 * 1024; /* 16MB PCR config space */ res->size = 16 * 1024 * 1024; /* 16MB PCR config space */
res->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED | res->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED |
IORESOURCE_ASSIGNED; IORESOURCE_ASSIGNED;
printk(BIOS_DEBUG,
"Adding P2SB PCR config space BAR 0x%08lx-0x%08lx.\n",
(unsigned long)(res->base),
(unsigned long)(res->base + res->size));
/* Add MMIO resource /* Add MMIO resource
* Use 0xdb as an unused index for IOAPIC. * Use 0xdb as an unused index for IOAPIC.

View File

@ -104,11 +104,11 @@ static void mc_add_fixed_mmio_resources(struct device *dev)
continue; continue;
resource = new_resource(dev, mc_fixed_resources[i].index); resource = new_resource(dev, mc_fixed_resources[i].index);
resource->base = base;
resource->size = size;
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_RESERVE | IORESOURCE_STORED | IORESOURCE_RESERVE |
IORESOURCE_ASSIGNED; IORESOURCE_ASSIGNED;
resource->base = base;
resource->size = size;
printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n", printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n",
__func__, mc_fixed_resources[i].description, index, __func__, mc_fixed_resources[i].description, index,
(unsigned long)base, (unsigned long)(base + size - 1)); (unsigned long)base, (unsigned long)(base + size - 1));
@ -248,7 +248,7 @@ static void mc_add_dram_resources(struct device *dev)
/* top_of_ram -> TSEG */ /* top_of_ram -> TSEG */
resource = new_resource(dev, index++); resource = new_resource(dev, index++);
resource->base = top_of_ram; resource->base = top_of_ram;
resource->size = mc_values[TSEG_REG] - resource->base; resource->size = mc_values[TSEG_REG] - top_of_ram;
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_RESERVE | IORESOURCE_STORED | IORESOURCE_RESERVE |
IORESOURCE_ASSIGNED; IORESOURCE_ASSIGNED;
@ -256,13 +256,10 @@ static void mc_add_dram_resources(struct device *dev)
/* TSEG -> TOLUD */ /* TSEG -> TOLUD */
resource = new_resource(dev, index++); resource = new_resource(dev, index++);
resource->base = mc_values[TSEG_REG]; resource->base = mc_values[TSEG_REG];
resource->size = mc_values[TOLUD_REG] - resource->base; resource->size = mc_values[TOLUD_REG] - mc_values[TSEG_REG];
resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_RESERVE | IORESOURCE_STORED | IORESOURCE_RESERVE |
IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE; IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE;
printk(BIOS_DEBUG,
"SMM memory location: 0x%llx SMM memory size: 0x%llx\n",
resource->base, resource->size);
/* 4GiB -> TOUUD */ /* 4GiB -> TOUUD */
base_k = 4096 * 1024; /* 4GiB */ base_k = 4096 * 1024; /* 4GiB */